Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
47c84d79
Commit
47c84d79
authored
Aug 27, 2017
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move part of write API (spec factories) to a separate header
parent
20168147
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
36 deletions
+63
-36
fmt/CMakeLists.txt
fmt/CMakeLists.txt
+1
-1
fmt/format.h
fmt/format.h
+0
-35
fmt/write.h
fmt/write.h
+61
-0
test/format-test.cc
test/format-test.cc
+1
-0
No files found.
fmt/CMakeLists.txt
View file @
47c84d79
# Define the fmt library, its includes and the needed defines.
# format.cc is added to FMT_HEADERS for the header-only configuration.
set
(
FMT_HEADERS format.h format.cc ostream.h ostream.cc printf.h printf.cc
string.h time.h
)
string.h time.h
write.h
)
if
(
HAVE_OPEN
)
set
(
FMT_HEADERS
${
FMT_HEADERS
}
posix.h
)
set
(
FMT_SOURCES
${
FMT_SOURCES
}
posix.cc
)
...
...
fmt/format.h
View file @
47c84d79
...
...
@@ -1747,30 +1747,6 @@ class fill_spec : public format_spec<Char, fill_tag> {
typedef
format_spec
<
unsigned
,
width_tag
>
width_spec
;
typedef
format_spec
<
char
,
type_tag
>
type_spec
;
class
fill_spec_factory
{
public:
constexpr
fill_spec_factory
()
{}
template
<
typename
Char
>
fill_spec
<
Char
>
operator
=
(
Char
value
)
const
{
return
fill_spec
<
Char
>
(
value
);
}
};
template
<
typename
FormatSpec
>
class
format_spec_factory
{
public:
constexpr
format_spec_factory
()
{}
FormatSpec
operator
=
(
typename
FormatSpec
::
value_type
value
)
const
{
return
FormatSpec
(
value
);
}
};
constexpr
fill_spec_factory
fill
;
constexpr
format_spec_factory
<
width_spec
>
width
;
constexpr
format_spec_factory
<
type_spec
>
type
;
// An empty format specifier.
struct
empty_spec
{};
...
...
@@ -2225,17 +2201,6 @@ class system_error : public std::runtime_error {
FMT_API
void
format_system_error
(
fmt
::
buffer
&
out
,
int
error_code
,
fmt
::
string_view
message
)
FMT_NOEXCEPT
;
namespace
internal
{
// Named format specifier.
template
<
typename
T
>
class
named_format_spec
{
public:
constexpr
named_format_spec
()
{}
};
constexpr
named_format_spec
<
unsigned
>
width
;
}
/**
\rst
This template provides operations for formatting and writing data into a
...
...
fmt/write.h
0 → 100644
View file @
47c84d79
/*
Formatting library for C++
Copyright (c) 2012 - 2016, Victor Zverovich
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FMT_WRITE_H_
#define FMT_WRITE_H_
#include "fmt/format.h"
namespace
fmt
{
class
fill_spec_factory
{
public:
constexpr
fill_spec_factory
()
{}
template
<
typename
Char
>
fill_spec
<
Char
>
operator
=
(
Char
value
)
const
{
return
fill_spec
<
Char
>
(
value
);
}
};
template
<
typename
FormatSpec
>
class
format_spec_factory
{
public:
constexpr
format_spec_factory
()
{}
FormatSpec
operator
=
(
typename
FormatSpec
::
value_type
value
)
const
{
return
FormatSpec
(
value
);
}
};
constexpr
fill_spec_factory
fill
;
constexpr
format_spec_factory
<
width_spec
>
width
;
constexpr
format_spec_factory
<
type_spec
>
type
;
}
// namespace fmt
#endif // FMT_WRITE_H_
test/format-test.cc
View file @
47c84d79
...
...
@@ -43,6 +43,7 @@
#define None 0
#include "fmt/format.h"
#include "fmt/write.h"
#include "util.h"
#include "mock-allocator.h"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment