Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sphinx with C++11 literals fix and add fmt::literals API docs #207

Merged
merged 1 commit into from
Oct 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions doc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
20 changes: 20 additions & 0 deletions format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down