diff --git a/doc/api.rst b/doc/api.rst index 26ce03e2..24347e8e 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -45,21 +45,24 @@ participate in an overload resolution if the latter is not a string. .. _format: -.. doxygenfunction:: format(const S&, Args&&...) -.. doxygenfunction:: vformat(const S&, basic_format_args>>) +.. doxygenfunction:: format(const S &format_str, Args&&... args) +.. doxygenfunction:: vformat(const S &format_str, basic_format_args>> args) -.. doxygenfunction:: fmt::format_to(OutputIt, const S&, Args&&...) -.. doxygenfunction:: fmt::format_to_n(OutputIt, size_t, const S&, const Args&...) -.. doxygenfunction:: fmt::formatted_size(string_view, Args&&...) +.. doxygenfunction:: format_to(OutputIt out, const S &, Args&&... args) +.. doxygenfunction:: format_to_n(OutputIt out, size_t n, const S&, const Args&... args) +.. doxygenfunction:: formatted_size(string_view format_str, Args&&... args) .. _print: -.. doxygenfunction:: print(const S&, Args&&...) +.. doxygenfunction:: print(string_view format_str, const Args&... args) .. doxygenfunction:: vprint(string_view, format_args) -.. doxygenfunction:: print(std::FILE *, const S&, Args&&...) +.. doxygenfunction:: print(std::FILE*, string_view, format_args) .. doxygenfunction:: vprint(std::FILE *, string_view, format_args) +.. doxygenstruct:: fmt::format_to_n_result + :members: + Named Arguments --------------- @@ -286,14 +289,6 @@ conversion. .. doxygenclass:: fmt::basic_format_parse_context :members: -Output Iterator Support ------------------------ - -.. doxygenfunction:: fmt::format_to(OutputIt, const S&, Args&&...) -.. doxygenfunction:: fmt::format_to_n(OutputIt, size_t, const S&, const Args&...) -.. doxygenstruct:: fmt::format_to_n_result - :members: - Literal-based API ----------------- @@ -310,19 +305,19 @@ Utilities .. doxygentypedef:: fmt::char_t -.. doxygenfunction:: fmt::ptr(const T *) -.. doxygenfunction:: fmt::ptr(const std::unique_ptr&) -.. doxygenfunction:: fmt::ptr(const std::shared_ptr&) +.. doxygenfunction:: fmt::ptr(const T *p) +.. doxygenfunction:: fmt::ptr(const std::unique_ptr &p) +.. doxygenfunction:: fmt::ptr(const std::shared_ptr &p) -.. doxygenfunction:: fmt::to_string(const T&) +.. doxygenfunction:: fmt::to_string(const T &value) -.. doxygenfunction:: fmt::to_wstring(const T&) +.. doxygenfunction:: fmt::to_wstring(const T &value) .. doxygenfunction:: fmt::to_string_view(const Char *) -.. doxygenfunction:: fmt::join(Range&&, string_view) +.. doxygenfunction:: fmt::join(Range &&range, string_view sep) -.. doxygenfunction:: fmt::join(It, Sentinel, string_view) +.. doxygenfunction:: fmt::join(It begin, Sentinel end, string_view sep) .. doxygenclass:: fmt::detail::buffer :members: diff --git a/doc/build.py b/doc/build.py index 6a17abce..e488232f 100755 --- a/doc/build.py +++ b/doc/build.py @@ -1,53 +1,31 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Build the documentation. -from __future__ import print_function -import errno, os, re, shutil, sys, tempfile -from subprocess import check_call, check_output, CalledProcessError, Popen -from subprocess import PIPE, STDOUT -from distutils.version import LooseVersion +import errno, os, re, sys +from subprocess import check_call, CalledProcessError, Popen, PIPE, STDOUT versions = ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0', '4.1.0', '5.0.0', '5.1.0', '5.2.0', '5.2.1', '5.3.0', '6.0.0', '6.1.0', '6.1.1', '6.1.2', '6.2.0', '6.2.1', '7.0.0', '7.0.1', '7.0.2', '7.0.3', '7.1.0', '7.1.1', '7.1.2'] -def pip_install(package, commit=None, **kwargs): - "Install package using pip." - if commit: - package = 'git+https://github.com/{0}.git@{1}'.format(package, commit) - print('Installing {0}'.format(package)) - check_call(['pip', 'install', package]) +class Pip: + def __init__(self, venv_dir): + self.path = os.path.join(venv_dir, 'bin', 'pip') -def create_build_env(dirname='virtualenv'): + def install(self, package, commit=None): + "Install package using pip." + if commit: + package = 'git+https://github.com/{0}.git@{1}'.format(package, commit) + print('Installing {0}'.format(package)) + check_call([self.path, 'install', package]) + +def create_build_env(venv_dir='virtualenv'): # Create virtualenv. - if not os.path.exists(dirname): - check_call(['virtualenv', dirname]) - import sysconfig - scripts_dir = os.path.basename(sysconfig.get_path('scripts')) - activate_this_file = os.path.join(dirname, scripts_dir, 'activate_this.py') - with open(activate_this_file) as f: - exec(f.read(), dict(__file__=activate_this_file)) - # Import get_distribution after activating virtualenv to get info about - # the correct packages. - from pkg_resources import get_distribution, DistributionNotFound - # Upgrade pip because installation of sphinx with pip 1.1 available on Travis - # is broken (see #207) and it doesn't support the show command. - pip_version = get_distribution('pip').version - if LooseVersion(pip_version) < LooseVersion('1.5.4'): - print("Updating pip") - check_call(['pip', 'install', '--upgrade', 'pip']) - # Upgrade distribute because installation of sphinx with distribute 0.6.24 - # available on Travis is broken (see #207). - try: - distribute_version = get_distribution('distribute').version - if LooseVersion(distribute_version) <= LooseVersion('0.6.24'): - print("Updating distribute") - check_call(['pip', 'install', '--upgrade', 'distribute']) - except DistributionNotFound: - pass + if not os.path.exists(venv_dir): + check_call(['python3', '-m', 'venv', venv_dir]) # Install Sphinx and Breathe. Require the exact version of Sphinx which is # compatible with Breathe. - pip_install('sphinx-doc/sphinx', '12b83372ac9316e8cbe86e7fed889296a4cc29ee') - pip_install('michaeljones/breathe', - '129222318f7c8f865d2631e7da7b033567e7f56a') + pip = Pip(venv_dir) + pip.install('sphinx-doc/sphinx', 'v3.3.0') + pip.install('michaeljones/breathe', 'v4.23.0') def build_docs(version='dev', **kwargs): doc_dir = kwargs.get('doc_dir', os.path.dirname(os.path.realpath(__file__))) @@ -84,7 +62,7 @@ def build_docs(version='dev', **kwargs): "FMT_BEGIN_NAMESPACE=namespace fmt {{" \ "FMT_END_NAMESPACE=}}" \ "FMT_STRING_ALIAS=1" \ - "FMT_ENABLE_IF(B)=" + "FMT_DOC=1" EXCLUDE_SYMBOLS = fmt::formatter fmt::printf_formatter fmt::arg_join \ fmt::basic_format_arg::handle '''.format(include_dir, doxyxml_dir).encode('UTF-8')) @@ -107,7 +85,7 @@ def build_docs(version='dev', **kwargs): html_dir = os.path.join(work_dir, 'html') main_versions = reversed(versions[-3:]) - check_call(['sphinx-build', + check_call([os.path.join('virtualenv', 'bin', 'sphinx-build'), '-Dbreathe_projects.format=' + os.path.abspath(doxyxml_dir), '-Dversion=' + version, '-Drelease=' + version, '-Aversion=' + version, '-Aversions=' + ','.join(main_versions), diff --git a/include/fmt/core.h b/include/fmt/core.h index 005f20f8..2a26108e 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -274,7 +274,11 @@ struct monostate {}; // An enable_if helper to be used in template parameters which results in much // shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed // to workaround a bug in MSVC 2019 (see #1140 and #1186). -#define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 +#ifdef FMT_DOC +# define FMT_ENABLE_IF(...) +#else +# define FMT_ENABLE_IF(...) enable_if_t<(__VA_ARGS__), int> = 0 +#endif namespace detail {