Merge pull request #207 from dean0x7d/udl-api

Update Sphinx with C++11 literals fix and add fmt::literals API docs
This commit is contained in:
Victor Zverovich 2015-10-13 07:26:25 -07:00
commit 9575e77e40
4 changed files with 29 additions and 3 deletions

View File

@ -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

View File

@ -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:

View File

@ -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.

View File

@ -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<char>
operator"" _format(const char *s, std::size_t) { return {s}; }
inline internal::UdlFormat<wchar_t>
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<char>
operator"" _a(const char *s, std::size_t) { return {s}; }
inline internal::UdlArg<wchar_t>