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
11addaa1
Commit
11addaa1
authored
Jun 03, 2021
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs
parent
760ca5cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
32 deletions
+29
-32
doc/api.rst
doc/api.rst
+27
-30
include/fmt/core.h
include/fmt/core.h
+2
-2
No files found.
doc/api.rst
View file @
11addaa1
...
@@ -6,13 +6,11 @@ API Reference
...
@@ -6,13 +6,11 @@ API Reference
The {fmt} library API consists of the following parts:
The {fmt} library API consists of the following parts:
* :ref:`fmt/core.h <core-api>`: the core API providing argument handling
* :ref:`fmt/core.h <core-api>`: the core API providing main formatting functions
facilities and a lightweight subset of formatting functions
for ``char``/UTF-8 with compile-time checks and minimal dependencies
* :ref:`fmt/format.h <format-api>`: the full format API providing compile-time
* :ref:`fmt/format.h <format-api>`: the full format API providing additional
format string checks, wide string, output iterator and user-defined type
formatting functions and locale support
support
* :ref:`fmt/ranges.h <ranges-api>`: formatting of ranges and tuples
* :ref:`fmt/ranges.h <ranges-api>`: additional formatting support for ranges
and tuples
* :ref:`fmt/chrono.h <chrono-api>`: date and time formatting
* :ref:`fmt/chrono.h <chrono-api>`: date and time formatting
* :ref:`fmt/compile.h <compile-api>`: format string compilation
* :ref:`fmt/compile.h <compile-api>`: format string compilation
* :ref:`fmt/color.h <color-api>`: terminal color and text style
* :ref:`fmt/color.h <color-api>`: terminal color and text style
...
@@ -29,9 +27,10 @@ macros have prefix ``FMT_``.
...
@@ -29,9 +27,10 @@ macros have prefix ``FMT_``.
Core API
Core API
========
========
``fmt/core.h`` defines the core API which provides argument handling facilities
``fmt/core.h`` defines the core API which provides main formatting functions for
and a lightweight subset of formatting functions. It is only beneficial when
``char``/UTF-8 with compile-time checks. It has minimal include dependencies for
using {fmt} as a library and not in the header-only mode.
better compile times. This header is only beneficial when using {fmt} as a
library and not in the header-only mode.
The following functions use :ref:`format string syntax <syntax>`
The following functions use :ref:`format string syntax <syntax>`
similar to that of Python's `str.format
similar to that of Python's `str.format
...
@@ -60,10 +59,24 @@ participate in an overload resolution if the latter is not a string.
...
@@ -60,10 +59,24 @@ participate in an overload resolution if the latter is not a string.
.. _print:
.. _print:
.. doxygenfunction:: fmt::print(format_string<T...> fmt, T&&... args)
.. doxygenfunction:: fmt::print(format_string<T...> fmt, T&&... args)
.. doxygenfunction:: vprint(string_view
, format_
args)
.. doxygenfunction:: vprint(string_view
fmt, format_args
args)
.. doxygenfunction:: print(std::FILE *f, format_string<T...> fmt, T&&... args)
.. doxygenfunction:: print(std::FILE *f, format_string<T...> fmt, T&&... args)
.. doxygenfunction:: vprint(std::FILE*, string_view, format_args)
.. doxygenfunction:: vprint(std::FILE* f, string_view fmt, format_args args)
Compile-time Format String Checks
---------------------------------
Compile-time checks are enabled when using ``FMT_STRING``. They support built-in
and string types as well as user-defined types with ``constexpr`` ``parse``
functions in their ``formatter`` specializations.
.. doxygendefine:: FMT_STRING
To force the use of compile-time checks, define the preprocessor variable
``FMT_ENFORCE_COMPILE_STRING``. When set, functions accepting ``FMT_STRING``
will fail to compile with regular strings. Runtime-checked
formatting is still possible using ``fmt::vformat``, ``fmt::vprint``, etc.
Named Arguments
Named Arguments
---------------
---------------
...
@@ -151,22 +164,8 @@ locale::
...
@@ -151,22 +164,8 @@ locale::
Format API
Format API
==========
==========
``fmt/format.h`` defines the full format API providing compile-time format
``fmt/format.h`` defines the full format API providing additional formatting
string checks, wide string, output iterator and user-defined type support.
functions and locale support.
Compile-time Format String Checks
---------------------------------
Compile-time checks are enabled when using ``FMT_STRING``. They support built-in
and string types as well as user-defined types with ``constexpr`` ``parse``
functions in their ``formatter`` specializations.
.. doxygendefine:: FMT_STRING
To force the use of compile-time checks, define the preprocessor variable
``FMT_ENFORCE_COMPILE_STRING``. When set, functions accepting ``FMT_STRING``
will fail to compile with regular strings. Runtime-checked
formatting is still possible using ``fmt::vformat``, ``fmt::vprint``, etc.
.. _udt:
.. _udt:
...
@@ -303,8 +302,6 @@ The following user-defined literals are defined in ``fmt/format.h``.
...
@@ -303,8 +302,6 @@ The following user-defined literals are defined in ``fmt/format.h``.
Utilities
Utilities
---------
---------
.. doxygentypedef:: fmt::char_t
.. doxygenfunction:: fmt::ptr(T p) -> const void*
.. doxygenfunction:: fmt::ptr(T p) -> const void*
.. doxygenfunction:: fmt::ptr(const std::unique_ptr<T> &p) -> const void*
.. doxygenfunction:: fmt::ptr(const std::unique_ptr<T> &p) -> const void*
.. doxygenfunction:: fmt::ptr(const std::shared_ptr<T> &p) -> const void*
.. doxygenfunction:: fmt::ptr(const std::shared_ptr<T> &p) -> const void*
...
...
include/fmt/core.h
View file @
11addaa1
...
@@ -2912,8 +2912,8 @@ FMT_INLINE auto formatted_size(format_string<T...> fmt, T&&... args) -> size_t {
...
@@ -2912,8 +2912,8 @@ FMT_INLINE auto formatted_size(format_string<T...> fmt, T&&... args) -> size_t {
return
buf
.
count
();
return
buf
.
count
();
}
}
FMT_API
void
vprint
(
string_view
,
format_
args
);
FMT_API
void
vprint
(
string_view
fmt
,
format_args
args
);
FMT_API
void
vprint
(
std
::
FILE
*
,
string_view
,
format_
args
);
FMT_API
void
vprint
(
std
::
FILE
*
f
,
string_view
fmt
,
format_args
args
);
/**
/**
\rst
\rst
...
...
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