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
5281ea6a
Commit
5281ea6a
authored
Mar 04, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do_vformat_to -> vformat_to and update docs
parent
d07ba498
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
17 deletions
+18
-17
doc/api.rst
doc/api.rst
+4
-4
include/fmt/core.h
include/fmt/core.h
+4
-3
include/fmt/format.h
include/fmt/format.h
+8
-8
test/custom-formatter-test.cc
test/custom-formatter-test.cc
+1
-1
test/format-test.cc
test/format-test.cc
+1
-1
No files found.
doc/api.rst
View file @
5281ea6a
...
...
@@ -22,7 +22,7 @@ arguments in the resulting string.
*args* is an argument list representing objects to be formatted.
The `performance of the format
API
The `performance of the format
ing functions
<https://github.com/fmtlib/fmt/blob/master/README.rst#speed-tests>`_ is close
to that of glibc's ``printf`` and better than the performance of IOStreams.
...
...
@@ -127,7 +127,7 @@ custom argument formatter class::
// with the ``x`` format specifier.
class custom_arg_formatter : public arg_formatter {
public:
custom_arg_formatter(
context_type
&ctx, fmt::format_specs &spec)
custom_arg_formatter(
fmt::context
&ctx, fmt::format_specs &spec)
: arg_formatter(ctx, spec) {}
using arg_formatter::operator();
...
...
@@ -142,8 +142,8 @@ custom argument formatter class::
std::string custom_vformat(fmt::string_view format_str, fmt::format_args args) {
fmt::memory_buffer buffer;
// Pass custom argument formatter as a template arg to
do_vformat
.
fmt::
do_
vformat_to<custom_arg_formatter>(buffer, format_str, args);
// Pass custom argument formatter as a template arg to
vformat_to
.
fmt::vformat_to<custom_arg_formatter>(buffer, format_str, args);
return fmt::to_string(buffer);
}
...
...
include/fmt/core.h
View file @
5281ea6a
...
...
@@ -183,9 +183,10 @@ typename std::add_rvalue_reference<T>::type declval() FMT_NOEXCEPT;
/**
\rst
An implementation of ``std::basic_string_view`` for pre-C++17. It provides a
subset of the API. fmt::basic_string_view is used for format strings even if
std::string_view is available to prevent issues when a library is compiled
with different -std option than the client code (which is not recommended).
subset of the API. ``fmt::basic_string_view`` is used for format strings even
if ``std::string_view`` is available to prevent issues when a library is
compiled with a different ``-std`` option than the client code (which is not
recommended).
\endrst
*/
template
<
typename
Char
>
...
...
include/fmt/format.h
View file @
5281ea6a
...
...
@@ -3197,7 +3197,7 @@ struct format_handler : internal::error_handler {
/** Formats arguments and writes the output to the buffer. */
template
<
typename
ArgFormatter
,
typename
Char
,
typename
Context
>
typename
Context
::
iterator
do_
vformat_to
(
typename
ArgFormatter
::
range
out
,
typename
Context
::
iterator
vformat_to
(
typename
ArgFormatter
::
range
out
,
basic_string_view
<
Char
>
format_str
,
basic_format_args
<
Context
>
args
)
{
typedef
internal
::
null_terminating_iterator
<
Char
>
iterator
;
...
...
@@ -3327,13 +3327,13 @@ std::basic_string<Char> to_string(const basic_memory_buffer<Char> &buffer) {
inline
void
vformat_to
(
internal
::
buffer
&
buf
,
string_view
format_str
,
format_args
args
)
{
typedef
back_insert_range
<
internal
::
buffer
>
range
;
do_
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
}
inline
void
vformat_to
(
internal
::
wbuffer
&
buf
,
wstring_view
format_str
,
wformat_args
args
)
{
typedef
back_insert_range
<
internal
::
wbuffer
>
range
;
do_
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
}
template
<
typename
...
Args
>
...
...
@@ -3362,7 +3362,7 @@ 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
do_
vformat_to
<
arg_formatter
<
range
>>
(
range
(
out
),
format_str
,
args
);
return
vformat_to
<
arg_formatter
<
range
>>
(
range
(
out
),
format_str
,
args
);
}
template
<
typename
OutputIt
,
typename
...
Args
>
...
...
@@ -3465,7 +3465,7 @@ FMT_CONSTEXPR internal::udl_formatter<Char, CHARS...> operator""_format() {
# else
/**
\rst
C++11
literal equivalent of :func:`fmt::format`.
User-defined
literal equivalent of :func:`fmt::format`.
**Example**::
...
...
@@ -3481,7 +3481,7 @@ operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
/**
\rst
C++11
literal equivalent of :func:`fmt::arg`.
User-defined
literal equivalent of :func:`fmt::arg`.
**Example**::
...
...
test/custom-formatter-test.cc
View file @
5281ea6a
...
...
@@ -37,7 +37,7 @@ class CustomArgFormatter :
std
::
string
custom_vformat
(
fmt
::
string_view
format_str
,
fmt
::
format_args
args
)
{
fmt
::
memory_buffer
buffer
;
// Pass custom argument formatter as a template arg to vwrite.
fmt
::
do_
vformat_to
<
CustomArgFormatter
>
(
buffer
,
format_str
,
args
);
fmt
::
vformat_to
<
CustomArgFormatter
>
(
buffer
,
format_str
,
args
);
return
std
::
string
(
buffer
.
data
(),
buffer
.
size
());
}
...
...
test/format-test.cc
View file @
5281ea6a
...
...
@@ -1577,7 +1577,7 @@ class mock_arg_formatter:
void
custom_vformat
(
fmt
::
string_view
format_str
,
fmt
::
format_args
args
)
{
fmt
::
memory_buffer
buffer
;
fmt
::
do_
vformat_to
<
mock_arg_formatter
>
(
buffer
,
format_str
,
args
);
fmt
::
vformat_to
<
mock_arg_formatter
>
(
buffer
,
format_str
,
args
);
}
template
<
typename
...
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