diff --git a/doc/api.rst b/doc/api.rst index 7e1855a7..ecd442a1 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -26,6 +26,8 @@ arguments in the resulting string. .. doxygenfunction:: format(CStringRef, ArgList) +.. doxygenfunction:: operator""_format(const char *, std::size_t) + .. _print: .. doxygenfunction:: print(CStringRef, ArgList) @@ -74,6 +76,8 @@ Utilities .. doxygenfunction:: fmt::arg(StringRef, const T&) +.. doxygenfunction:: operator""_a(const char *, std::size_t) + .. doxygendefine:: FMT_CAPTURE .. doxygendefine:: FMT_VARIADIC diff --git a/doc/build.py b/doc/build.py index e2cea6a3..e4c66533 100755 --- a/doc/build.py +++ b/doc/build.py @@ -30,7 +30,8 @@ def build_docs(): activate_this_file = os.path.join(virtualenv_dir, 'bin', 'activate_this.py') execfile(activate_this_file, dict(__file__=activate_this_file)) # Install Sphinx and Breathe. - pip_install('sphinx==1.3.1') + pip_install('sphinx-doc/sphinx', + '4d2c17e043d9e8197fa5cd0db34212af3bb17069') pip_install('michaeljones/breathe', '511b0887293e7c6b12310bb61b3659068f48f0f4') # Build docs. @@ -53,7 +54,8 @@ def build_docs(): ALIASES += "endrst=\endverbatim" PREDEFINED = _WIN32=1 \ FMT_USE_VARIADIC_TEMPLATES=1 \ - FMT_USE_RVALUE_REFERENCES=1 + FMT_USE_RVALUE_REFERENCES=1 \ + FMT_USE_USER_DEFINED_LITERALS=1 EXCLUDE_SYMBOLS = fmt::internal::* StringValue write_str '''.format(os.path.dirname(doc_dir))) if p.returncode != 0: diff --git a/doc/index.rst b/doc/index.rst index a890776b..35c56f04 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -165,7 +165,7 @@ Although the library uses C++11 features when available, it also works with olde compilers and standard library implementations. The only thing to keep in mind for C++98 portability: -* Variadic templates: minimum GCC 4.4, Clang 2.9 or VS2013. This feature allow +* Variadic templates: minimum GCC 4.4, Clang 2.9 or VS2013. This feature allows the Format API to accept an unlimited number of arguments. With older compilers the maximum is 15. diff --git a/format.h b/format.h index e5e91537..d25eab34 100644 --- a/format.h +++ b/format.h @@ -3044,11 +3044,31 @@ struct UdlArg { inline namespace literals { +/** + \rst + C++11 literal equivalent of :func:`fmt::format`. + + **Example**:: + + using namespace fmt::literals; + std::string message = "The answer is {}"_format(42); + \endrst + */ inline internal::UdlFormat operator"" _format(const char *s, std::size_t) { return {s}; } inline internal::UdlFormat operator"" _format(const wchar_t *s, std::size_t) { return {s}; } +/** + \rst + C++11 literal equivalent of :func:`fmt::arg`. + + **Example**:: + + using namespace fmt::literals; + print("Elapsed time: {s:.2f} seconds", "s"_a=1.23); + \endrst + */ inline internal::UdlArg operator"" _a(const char *s, std::size_t) { return {s}; } inline internal::UdlArg