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
5bced124
Commit
5bced124
authored
Sep 30, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parameterize more functions on string type
parent
674999c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
27 deletions
+24
-27
include/fmt/core.h
include/fmt/core.h
+5
-5
include/fmt/format-inl.h
include/fmt/format-inl.h
+1
-1
include/fmt/format.h
include/fmt/format.h
+17
-20
test/format-test.cc
test/format-test.cc
+1
-1
No files found.
include/fmt/core.h
View file @
5bced124
...
...
@@ -1306,10 +1306,12 @@ std::basic_string<Char> vformat(
basic_format_args
<
typename
buffer_context
<
Char
>::
type
>
args
);
}
// namespace internal
#define FMT_CHAR(Str) typename internal::format_string_traits<Str>::char_type
template
<
typename
String
>
format_context
::
iterator
vformat_to
(
internal
::
buffer
&
buf
,
string_view
format_str
,
format_args
args
);
wformat_context
::
iterator
vformat_to
(
internal
::
wbuffer
&
buf
,
wstring_view
format_str
,
wformat_args
args
);
internal
::
basic_buffer
<
FMT_CHAR
(
String
)
>
&
buf
,
const
String
&
format_str
,
basic_format_args
<
buffer_context
<
FMT_CHAR
(
String
)
>
>
args
);
template
<
typename
Container
>
struct
is_contiguous
:
std
::
false_type
{};
...
...
@@ -1359,8 +1361,6 @@ inline typename std::enable_if<
make_format_args
<
wformat_context
>
(
args
...));
}
#define FMT_CHAR(Str) typename internal::format_string_traits<Str>::char_type
template
<
typename
String
,
typename
Char
=
FMT_CHAR
(
String
)
>
inline
std
::
basic_string
<
Char
>
vformat
(
const
String
&
format_str
,
...
...
include/fmt/format-inl.h
View file @
5bced124
...
...
@@ -840,7 +840,7 @@ FMT_FUNC void report_windows_error(
FMT_FUNC
void
vprint
(
std
::
FILE
*
f
,
string_view
format_str
,
format_args
args
)
{
memory_buffer
buffer
;
vformat_to
(
buffer
,
format_str
,
args
);
vformat_to
(
buffer
,
format_str
,
basic_format_args
<
buffer_context
<
char
>::
type
>
(
args
)
);
std
::
fwrite
(
buffer
.
data
(),
1
,
buffer
.
size
(),
f
);
}
...
...
include/fmt/format.h
View file @
5bced124
...
...
@@ -3441,10 +3441,13 @@ std::basic_string<Char> to_string(const basic_memory_buffer<Char, SIZE> &buf) {
return
std
::
basic_string
<
Char
>
(
buf
.
data
(),
buf
.
size
());
}
inline
format_context
::
iterator
vformat_to
(
internal
::
buffer
&
buf
,
string_view
format_str
,
format_args
args
)
{
typedef
back_insert_range
<
internal
::
buffer
>
range
;
return
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
template
<
typename
String
,
typename
Char
=
FMT_CHAR
(
String
)>
inline
typename
buffer_context
<
FMT_CHAR
(
String
)
>::
type
::
iterator
vformat_to
(
internal
::
basic_buffer
<
Char
>
&
buf
,
const
String
&
format_str
,
basic_format_args
<
typename
buffer_context
<
Char
>::
type
>
args
)
{
typedef
back_insert_range
<
internal
::
basic_buffer
<
FMT_CHAR
(
String
)
>
>
range
;
return
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
basic_string_view
<
Char
>
(
format_str
),
args
);
}
inline
wformat_context
::
iterator
vformat_to
(
...
...
@@ -3477,17 +3480,11 @@ struct format_args_t {
typename
format_context_t
<
OutputIt
,
Char
>::
type
>
type
;
};
template
<
typename
OutputIt
,
typename
...
Args
>
inline
OutputIt
vformat_to
(
OutputIt
out
,
string_view
format_str
,
typename
format_args_t
<
OutputIt
>::
type
args
)
{
typedef
output_range
<
OutputIt
,
char
>
range
;
return
vformat_to
<
arg_formatter
<
range
>>
(
range
(
out
),
format_str
,
args
);
}
template
<
typename
OutputIt
,
typename
...
Args
>
template
<
typename
String
,
typename
OutputIt
,
typename
...
Args
>
inline
OutputIt
vformat_to
(
OutputIt
out
,
wstring_view
format_str
,
typename
format_args_t
<
OutputIt
,
wchar_t
>::
type
args
)
{
typedef
output_range
<
OutputIt
,
wchar_t
>
range
;
OutputIt
out
,
const
String
&
format_str
,
typename
format_args_t
<
OutputIt
,
FMT_CHAR
(
String
)
>::
type
args
)
{
typedef
output_range
<
OutputIt
,
FMT_CHAR
(
String
)
>
range
;
return
vformat_to
<
arg_formatter
<
range
>>
(
range
(
out
),
format_str
,
args
);
}
...
...
@@ -3503,14 +3500,14 @@ inline OutputIt vformat_to(
\endrst
*/
template
<
typename
OutputIt
,
typename
String
,
typename
...
Args
>
inline
typename
std
::
enable_if
<
internal
::
is_format_string
<
String
>::
value
,
OutputIt
>::
type
format_to
(
OutputIt
out
,
const
String
&
format_str
,
const
Args
&
...
args
)
{
inline
typename
std
::
enable_if
<
internal
::
is_format_string
<
String
>::
value
,
OutputIt
>::
type
format_to
(
OutputIt
out
,
const
String
&
format_str
,
const
Args
&
...
args
)
{
internal
::
check_format_string
<
Args
...
>
(
format_str
);
typedef
typename
format_context_t
<
OutputIt
,
FMT_CHAR
(
String
)
>::
type
context
_t
;
format_arg_store
<
context
_t
,
Args
...
>
as
{
args
...};
typedef
typename
format_context_t
<
OutputIt
,
FMT_CHAR
(
String
)
>::
type
context
;
format_arg_store
<
context
,
Args
...
>
as
{
args
...};
return
vformat_to
(
out
,
basic_string_view
<
FMT_CHAR
(
String
)
>
(
format_str
),
basic_format_args
<
context
_t
>
(
as
));
basic_format_args
<
context
>
(
as
));
}
template
<
typename
OutputIt
>
...
...
test/format-test.cc
View file @
5bced124
...
...
@@ -1836,7 +1836,7 @@ TEST(StrTest, Convert) {
EXPECT_EQ
(
"2012-12-9"
,
s
);
}
st
atic
st
d
::
string
vformat_message
(
int
id
,
const
char
*
format
,
fmt
::
format_args
args
)
{
std
::
string
vformat_message
(
int
id
,
const
char
*
format
,
fmt
::
format_args
args
)
{
fmt
::
memory_buffer
buffer
;
format_to
(
buffer
,
"[{}] "
,
id
);
vformat_to
(
buffer
,
format
,
args
);
...
...
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