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
40232917
Commit
40232917
authored
Mar 04, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs
parent
86a9bc82
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
22 deletions
+27
-22
doc/api.rst
doc/api.rst
+21
-16
include/fmt/core.h
include/fmt/core.h
+2
-2
include/fmt/format.h
include/fmt/format.h
+3
-3
include/fmt/printf.h
include/fmt/printf.h
+1
-1
No files found.
doc/api.rst
View file @
40232917
...
@@ -187,14 +187,14 @@ Write API
...
@@ -187,14 +187,14 @@ Write API
The write API provides classes for writing formatted data into character
The write API provides classes for writing formatted data into character
streams. It is usually faster than the `format API`_ but, as IOStreams,
streams. It is usually faster than the `format API`_ but, as IOStreams,
may result in larger compiled code size. The main writer class is
may result in larger compiled code size. The main writer class is
`~fmt::
BasicMemoryW
riter` which stores its output in a memory buffer and
`~fmt::
basic_memory_w
riter` which stores its output in a memory buffer and
provides direct access to it. It is possible to create custom writers that
provides direct access to it. It is possible to create custom writers that
store output elsewhere by subclassing `~fmt::BasicWriter`.
store output elsewhere by subclassing `~fmt::BasicWriter`.
.. doxygenclass:: fmt::BasicWriter
.. doxygenclass:: fmt::BasicWriter
:members:
:members:
.. doxygenclass:: fmt::
BasicMemoryW
riter
.. doxygenclass:: fmt::
basic_memory_w
riter
:members:
:members:
.. doxygenclass:: fmt::BasicArrayWriter
.. doxygenclass:: fmt::BasicArrayWriter
...
@@ -220,8 +220,6 @@ Utilities
...
@@ -220,8 +220,6 @@ Utilities
.. doxygenfunction:: operator""_a(const char *, std::size_t)
.. doxygenfunction:: operator""_a(const char *, std::size_t)
.. doxygendefine:: FMT_CAPTURE
.. doxygenclass:: fmt::basic_format_args
.. doxygenclass:: fmt::basic_format_args
:members:
:members:
...
@@ -230,7 +228,7 @@ Utilities
...
@@ -230,7 +228,7 @@ Utilities
.. doxygenclass:: fmt::basic_string_view
.. doxygenclass:: fmt::basic_string_view
:members:
:members:
.. doxygenclass:: fmt::
B
uffer
.. doxygenclass:: fmt::
basic_memory_b
uffer
:protected-members:
:protected-members:
:members:
:members:
...
@@ -250,22 +248,29 @@ System errors
...
@@ -250,22 +248,29 @@ System errors
Custom allocators
Custom allocators
=================
=================
The
fmt
library supports custom dynamic memory allocators.
The
{fmt}
library supports custom dynamic memory allocators.
A custom allocator class can be specified as a template argument to
A custom allocator class can be specified as a template argument to
:class:`fmt::
BasicMemoryWrit
er`::
:class:`fmt::
basic_memory_buff
er`::
typedef fmt::BasicMemoryWriter<char, CustomAllocator> CustomMemoryWriter;
using custom_memory_buffer =
fmt::basic_memory_buffer<char, custom_allocator>;
It is also possible to write a formatting function that uses a custom
It is also possible to write a formatting function that uses a custom
allocator::
allocator::
typedef std::basic_string<char, std::char_traits<char>, CustomAllocator>
using custom_string =
CustomString;
std::basic_string<char, std::char_traits<char>, custom_allocator>;
custom_string format(custom_allocator alloc, fmt::string_view format_str,
fmt::format_args args) {
custom_memory_buffer buf(alloc);
fmt::vformat_to(buf, format_str, args);
return custom_string(buf.data(), buf.size(), alloc);
}
CustomString format(CustomAllocator alloc, fmt::CStringRef format_str,
template <typename ...Args>
fmt::ArgList args) {
inline custom_string format(custom_allocator alloc,
CustomMemoryWriter writer(alloc);
fmt::string_view format_str,
writer.write(format_str, args);
const Args & ... args) {
return
CustomString(writer.data(), writer.size(), alloc
);
return
vformat(alloc, format_str, fmt::make_args(args...)
);
}
}
FMT_VARIADIC(CustomString, format, CustomAllocator, fmt::CStringRef)
include/fmt/core.h
View file @
40232917
...
@@ -1114,11 +1114,11 @@ struct named_arg : named_arg_base<Char> {
...
@@ -1114,11 +1114,11 @@ struct named_arg : named_arg_base<Char> {
/**
/**
\rst
\rst
Returns a named argument
for formatting functions
.
Returns a named argument
to be used in a formatting function
.
**Example**::
**Example**::
fmt::print("Elapsed time: {s:.2f} seconds", arg("s", 1.23));
fmt::print("Elapsed time: {s:.2f} seconds",
fmt::
arg("s", 1.23));
\endrst
\endrst
*/
*/
template
<
typename
T
>
template
<
typename
T
>
...
...
include/fmt/format.h
View file @
40232917
...
@@ -374,7 +374,7 @@ class locale_provider {
...
@@ -374,7 +374,7 @@ class locale_provider {
/**
/**
\rst
\rst
A dynamically growing memory buffer for trivially copyable/constructible types
A dynamically growing memory buffer for trivially copyable/constructible types
with the first
SIZE
elements stored in the object itself.
with the first
``SIZE``
elements stored in the object itself.
You can use one of the following typedefs for common character types:
You can use one of the following typedefs for common character types:
...
@@ -388,7 +388,7 @@ class locale_provider {
...
@@ -388,7 +388,7 @@ class locale_provider {
**Example**::
**Example**::
memory_buffer out;
fmt::
memory_buffer out;
format_to(out, "The answer is {}.", 42);
format_to(out, "The answer is {}.", 42);
This will write the following output to the ``out`` object:
This will write the following output to the ``out`` object:
...
@@ -3487,7 +3487,7 @@ operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
...
@@ -3487,7 +3487,7 @@ operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
**Example**::
**Example**::
using namespace fmt::literals;
using namespace fmt::literals;
print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
fmt::
print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
\endrst
\endrst
*/
*/
inline
internal
::
udl_arg
<
char
>
inline
internal
::
udl_arg
<
char
>
...
...
include/fmt/printf.h
View file @
40232917
...
@@ -635,7 +635,7 @@ inline int vfprintf(std::ostream &os, string_view format_str,
...
@@ -635,7 +635,7 @@ inline int vfprintf(std::ostream &os, string_view format_str,
**Example**::
**Example**::
fprintf(cerr, "Don't %s!", "panic");
f
mt::f
printf(cerr, "Don't %s!", "panic");
\endrst
\endrst
*/
*/
template
<
typename
...
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