diff --git a/README.rst b/README.rst index 0b802058..861286cf 100644 --- a/README.rst +++ b/README.rst @@ -42,8 +42,8 @@ Features performance of IOStreams. See `Speed tests`_ and `Fast integer to string conversion in C++ `_. -* Small code size both in terms of source code (the core library consists of a - single header file and a single source file) and compiled code. +* Small code size both in terms of source code (the core library consists of two + header files and a single source file) and compiled code. See `Compile time and code bloat`_. * Reliability: the library has an extensive set of `unit tests `_. @@ -101,7 +101,7 @@ Format strings can be checked at compile time: on_error("argument index out of range"); ^ -fmt can be used as a safe portable replacement for ``itoa``: +{fmt} can be used as a safe portable replacement for ``itoa``: .. code:: c++ diff --git a/doc/api.rst b/doc/api.rst index c1a8bbdc..45408d38 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -11,7 +11,7 @@ namespace is usually omitted in examples. Format API ========== -The following functions defined in ``fmt/format.h`` use :ref:`format string +The following functions defined in ``fmt/core.h`` use :ref:`format string syntax ` similar to the one used by Python's `str.format `_ function. They take *format_str* and *args* as arguments. @@ -71,7 +71,7 @@ template and implement ``parse`` and ``format`` methods:: template auto format(const MyStruct &s, FormatContext &ctx) { - fmt::format_to(ctx.begin(), "[MyStruct: x={:.1f}, y={:.2f}]", s.x, s.y); + return format_to(ctx.begin(), "[MyStruct: x={:.1f}, y={:.2f}]", s.x, s.y); } }; } @@ -84,7 +84,7 @@ Then you can pass objects of type ``MyStruct`` to any formatting function:: In the example above the ``formatter::parse`` function ignores the contents of the format string referred to by ``ctx.begin()`` so the object will -always be formatted as specified. See ``formatter::parse`` in +always be formatted in the same way. See ``formatter::parse`` in :file:`fmt/time.h` for an advanced example of how to parse the format string and customize the formatted output. @@ -113,7 +113,7 @@ formatting of user-defined types that have overloaded ``operator<<``:: std::string s = fmt::format("The date is {}", Date(2012, 12, 9)); // s == "The date is 2012-12-9" -.. doxygenfunction:: print(std::ostream&, string_view, ArgList) +.. doxygenfunction:: print(std::ostream&, string_view, const Args&...) Argument formatters ------------------- @@ -168,13 +168,13 @@ the POSIX extension for positional arguments. Unlike their standard counterparts, the ``fmt`` functions are type-safe and throw an exception if an argument type doesn't match its format specification. -.. doxygenfunction:: printf(string_view, ArgList) +.. doxygenfunction:: printf(string_view, const Args&...) -.. doxygenfunction:: fprintf(std::FILE *, string_view, ArgList) +.. doxygenfunction:: fprintf(std::FILE *, string_view, const Args&...) -.. doxygenfunction:: fprintf(std::ostream&, string_view, ArgList) +.. doxygenfunction:: fprintf(std::ostream&, string_view, const Args&...) -.. doxygenfunction:: sprintf(string_view, ArgList) +.. doxygenfunction:: sprintf(string_view, const Args&...) .. doxygenclass:: fmt::PrintfFormatter :members: @@ -246,12 +246,12 @@ Utilities System errors ============= -.. doxygenclass:: fmt::SystemError +.. doxygenclass:: fmt::system_error :members: .. doxygenfunction:: fmt::format_system_error -.. doxygenclass:: fmt::WindowsError +.. doxygenclass:: fmt::windows_error :members: .. _formatstrings: diff --git a/include/fmt/format.h b/include/fmt/format.h index 91cf5ab1..ccd12f03 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3233,7 +3233,7 @@ auto join(const Range &range, wstring_view sep) **Example**:: - #include "fmt/string.h" + #include "fmt/format.h" std::string answer = fmt::to_string(42); \endrst