mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-10 21:20:07 +00:00
Fix markup
This commit is contained in:
parent
3453df6d65
commit
91d9497911
@ -3,38 +3,44 @@
|
|||||||
|
|
||||||
* More efficient implementation of variadic formatting functions.
|
* More efficient implementation of variadic formatting functions.
|
||||||
|
|
||||||
* `Writer::Format` now has a variadic overload::
|
* ``Writer::Format`` now has a variadic overload:
|
||||||
|
|
||||||
|
.. code:: c++
|
||||||
|
|
||||||
Writer out;
|
Writer out;
|
||||||
out.Format("Look, I'm {}!", "variadic");
|
out.Format("Look, I'm {}!", "variadic");
|
||||||
|
|
||||||
* For efficiency and consistency with other overloads, variadic overload of
|
* For efficiency and consistency with other overloads, variadic overload of
|
||||||
the `Format` function now returns `Writer` instead of `std::string`.
|
the ``Format`` function now returns ``Writer`` instead of ``std::string``.
|
||||||
Use the `str` function to convert it to `std::string`::
|
Use the ``str`` function to convert it to ``std::string``:
|
||||||
|
|
||||||
|
.. code:: c++
|
||||||
|
|
||||||
std::string s = str(Format("Look, I'm {}!", "variadic"));
|
std::string s = str(Format("Look, I'm {}!", "variadic"));
|
||||||
|
|
||||||
* Replaced formatter actions with output sinks: `NoAction` -> `NullSink`,
|
* Replaced formatter actions with output sinks: ``NoAction`` -> ``NullSink``,
|
||||||
`Write` -> `FileSink`, `ColorWriter` -> `ANSITerminalSink`. This improves
|
``Write`` -> ``FileSink``, ``ColorWriter`` -> ``ANSITerminalSink``.
|
||||||
naming consistency and shouldn't affect client code unless these classes
|
This improves naming consistency and shouldn't affect client code unless
|
||||||
are used directly which should be rarely needed.
|
these classes are used directly which should be rarely needed.
|
||||||
|
|
||||||
* Added `ThrowSystemError` function that formats a message and throws
|
* Added ``ThrowSystemError`` function that formats a message and throws
|
||||||
`SystemError` containing the formatted message and system-specific error
|
``SystemError`` containing the formatted message and system-specific error
|
||||||
description. For example, the following code::
|
description. For example, the following code
|
||||||
|
|
||||||
|
.. code:: c++
|
||||||
|
|
||||||
FILE *f = fopen(filename, "r");
|
FILE *f = fopen(filename, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
ThrowSystemError(errno, "Failed to open file '{}'") << filename;
|
ThrowSystemError(errno, "Failed to open file '{}'") << filename;
|
||||||
|
|
||||||
will throw `SystemError` exception with description
|
will throw ``SystemError`` exception with description
|
||||||
"Failed to open file '<filename>': No such file or directory" if file
|
"Failed to open file '<filename>': No such file or directory" if file
|
||||||
doesn't exist.
|
doesn't exist.
|
||||||
|
|
||||||
* Support for `AppVeyor <https://ci.appveyor.com/project/vitaut/cppformat>`_
|
* Support for `AppVeyor <https://ci.appveyor.com/project/vitaut/cppformat>`_
|
||||||
continuous integration platform.
|
continuous integration platform.
|
||||||
|
|
||||||
* `Format` now throws `SystemError` in case of I/O errors.
|
* ``Format`` now throws ``SystemError`` in case of I/O errors.
|
||||||
|
|
||||||
* Improve test infrastructure. Print functions are now tested by redirecting
|
* Improve test infrastructure. Print functions are now tested by redirecting
|
||||||
the output to a pipe.
|
the output to a pipe.
|
||||||
|
Loading…
Reference in New Issue
Block a user