Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/format is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_FORMAT
0011 #define _LIBCPP_FORMAT
0012 
0013 /*
0014 
0015 namespace std {
0016   // [format.context], class template basic_format_context
0017   template<class Out, class charT> class basic_format_context;
0018   using format_context = basic_format_context<unspecified, char>;
0019   using wformat_context = basic_format_context<unspecified, wchar_t>;
0020 
0021   // [format.args], class template basic_format_args
0022   template<class Context> class basic_format_args;
0023   using format_args = basic_format_args<format_context>;
0024   using wformat_args = basic_format_args<wformat_context>;
0025 
0026   // [format.fmt.string], class template basic_format_string
0027   template<class charT, class... Args>
0028     struct basic_format_string {                                // since C++23, exposition only before C++23
0029     private:
0030       basic_string_view<charT> str;                             // exposition only
0031 
0032     public:
0033       template<class T> consteval basic_format_string(const T& s);
0034       basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {}   // since C++26
0035 
0036       constexpr basic_string_view<charT> get() const noexcept { return str; }
0037     };
0038   template<class... Args>
0039     using format_string =                                       // since C++23, exposition only before C++23
0040       basic_format_string<char, type_identity_t<Args>...>;
0041   template<class... Args>
0042     using wformat_string =                                      // since C++23, exposition only before C++23
0043       basic_format_string<wchar_t, type_identity_t<Args>...>;
0044 
0045   template<class charT> struct runtime-format-string {          // since C++26, exposition-only
0046   private:
0047     basic_string_view<charT> str;                               // exposition-only
0048 
0049   public:
0050     runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {}
0051 
0052     runtime-format-string(const runtime-format-string&) = delete;
0053     runtime-format-string& operator=(const runtime-format-string&) = delete;
0054   };
0055 
0056   runtime-format-string<char> runtime_format(string_view fmt) noexcept {
0057     return fmt;
0058   }
0059   runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept {
0060     return fmt;
0061   }
0062 
0063   // [format.functions], formatting functions
0064   template<class... Args>
0065     string format(format-string<Args...> fmt, Args&&... args);
0066   template<class... Args>
0067     wstring format(wformat-string<Args...> fmt, Args&&... args);
0068   template<class... Args>
0069     string format(const locale& loc, format-string<Args...> fmt, Args&&... args);
0070   template<class... Args>
0071     wstring format(const locale& loc, wformat-string<Args...> fmt, Args&&... args);
0072 
0073   string vformat(string_view fmt, format_args args);
0074   wstring vformat(wstring_view fmt, wformat_args args);
0075   string vformat(const locale& loc, string_view fmt, format_args args);
0076   wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
0077 
0078   template<class Out, class... Args>
0079     Out format_to(Out out, format-string<Args...> fmt, Args&&... args);
0080   template<class Out, class... Args>
0081     Out format_to(Out out, wformat-string<Args...> fmt, Args&&... args);
0082   template<class Out, class... Args>
0083     Out format_to(Out out, const locale& loc, format-string<Args...> fmt, Args&&... args);
0084   template<class Out, class... Args>
0085     Out format_to(Out out, const locale& loc, wformat-string<Args...> fmt, Args&&... args);
0086 
0087   template<class Out>
0088     Out vformat_to(Out out, string_view fmt, format_args args);
0089   template<class Out>
0090     Out vformat_to(Out out, wstring_view fmt, wformat_args args);
0091   template<class Out>
0092     Out vformat_to(Out out, const locale& loc, string_view fmt,
0093                    format_args char> args);
0094   template<class Out>
0095     Out vformat_to(Out out, const locale& loc, wstring_view fmt,
0096                    wformat_args args);
0097 
0098   template<class Out> struct format_to_n_result {
0099     Out out;
0100     iter_difference_t<Out> size;
0101   };
0102   template<class Out, class... Args>
0103     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
0104                                         format-string<Args...> fmt, Args&&... args);
0105   template<class Out, class... Args>
0106     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
0107                                         wformat-string<Args...> fmt, Args&&... args);
0108   template<class Out, class... Args>
0109     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
0110                                         const locale& loc, format-string<Args...> fmt,
0111                                         Args&&... args);
0112   template<class Out, class... Args>
0113     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
0114                                         const locale& loc, wformat-string<Args...> fmt,
0115                                         Args&&... args);
0116 
0117   template<class... Args>
0118     size_t formatted_size(format-string<Args...> fmt, Args&&... args);
0119   template<class... Args>
0120     size_t formatted_size(wformat-string<Args...> fmt, Args&&... args);
0121   template<class... Args>
0122     size_t formatted_size(const locale& loc, format-string<Args...> fmt, Args&&... args);
0123   template<class... Args>
0124     size_t formatted_size(const locale& loc, wformat-string<Args...> fmt, Args&&... args);
0125 
0126   // [format.formatter], formatter
0127   template<class T, class charT = char> struct formatter;
0128 
0129   template<class T>
0130   constexpr bool enable_nonlocking_formatter_optimization = false;   // since C++23
0131 
0132   // [format.parse.ctx], class template basic_format_parse_context
0133   template<class charT> class basic_format_parse_context;
0134   using format_parse_context = basic_format_parse_context<char>;
0135   using wformat_parse_context = basic_format_parse_context<wchar_t>;
0136 
0137   // [format.range], formatting of ranges
0138   // [format.range.fmtkind], variable template format_kind
0139   enum class range_format {                                          // since C++23
0140     disabled,
0141     map,
0142     set,
0143     sequence,
0144     string,
0145     debug_string
0146   };
0147 
0148   template<class R>
0149     constexpr unspecified format_kind = unspecified;                 // since C++23
0150 
0151   template<ranges::input_range R>
0152       requires same_as<R, remove_cvref_t<R>>
0153     constexpr range_format format_kind<R> = see below;               // since C++23
0154 
0155   // [format.range.formatter], class template range_formatter
0156   template<class T, class charT = char>
0157     requires same_as<remove_cvref_t<T>, T> && formattable<T, charT>
0158   class range_formatter;                                             // since C++23
0159 
0160   // [format.range.fmtdef], class template range-default-formatter
0161   template<range_format K, ranges::input_range R, class charT>
0162     struct range-default-formatter;                                  // exposition only, since C++23
0163 
0164   // [format.range.fmtmap], [format.range.fmtset], [format.range.fmtstr],
0165   // specializations for maps, sets, and strings
0166   template<ranges::input_range R, class charT>
0167     requires (format_kind<R> != range_format::disabled) &&
0168              formattable<ranges::range_reference_t<R>, charT>
0169   struct formatter<R, charT> : range-default-formatter<format_kind<R>, R, charT> { }; // since C++23
0170 
0171   // [format.arguments], arguments
0172   // [format.arg], class template basic_format_arg
0173   template<class Context> class basic_format_arg;
0174 
0175   template<class Visitor, class Context>
0176     see below visit_format_arg(Visitor&& vis, basic_format_arg<Context> arg); // Deprecated in C++26
0177 
0178   // [format.arg.store], class template format-arg-store
0179   template<class Context, class... Args> struct format-arg-store;    // exposition only
0180 
0181   template<class Context = format_context, class... Args>
0182     format-arg-store<Context, Args...>
0183       make_format_args(Args&... args);
0184   template<class... Args>
0185     format-arg-store<wformat_context, Args...>
0186       make_wformat_args(Args&... args);
0187 
0188   // [format.error], class format_error
0189   class format_error;
0190 }
0191 
0192 */
0193 
0194 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0195 #  include <__cxx03/format>
0196 #else
0197 #  include <__config>
0198 
0199 #  if _LIBCPP_STD_VER >= 20
0200 #    include <__format/buffer.h>
0201 #    include <__format/concepts.h>
0202 #    include <__format/container_adaptor.h>
0203 #    include <__format/enable_insertable.h>
0204 #    include <__format/escaped_output_table.h>
0205 #    include <__format/extended_grapheme_cluster_table.h>
0206 #    include <__format/format_arg.h>
0207 #    include <__format/format_arg_store.h>
0208 #    include <__format/format_args.h>
0209 #    include <__format/format_context.h>
0210 #    include <__format/format_error.h>
0211 #    include <__format/format_functions.h>
0212 #    include <__format/format_parse_context.h>
0213 #    include <__format/format_string.h>
0214 #    include <__format/format_to_n_result.h>
0215 #    include <__format/formatter.h>
0216 #    include <__format/formatter_bool.h>
0217 #    include <__format/formatter_char.h>
0218 #    include <__format/formatter_floating_point.h>
0219 #    include <__format/formatter_integer.h>
0220 #    include <__format/formatter_pointer.h>
0221 #    include <__format/formatter_string.h>
0222 #    include <__format/formatter_tuple.h>
0223 #    include <__format/parser_std_format_spec.h>
0224 #    include <__format/range_default_formatter.h>
0225 #    include <__format/range_formatter.h>
0226 #    include <__format/unicode.h>
0227 #    include <__fwd/format.h>
0228 #  endif
0229 
0230 #  include <version>
0231 
0232 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0233 #    pragma GCC system_header
0234 #  endif
0235 
0236 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0237 #    include <array>
0238 #    include <cctype>
0239 #    include <cerrno>
0240 #    include <clocale>
0241 #    include <cmath>
0242 #    include <cstddef>
0243 #    include <cstdint>
0244 #    include <cstdlib>
0245 #    include <cstring>
0246 #    include <initializer_list>
0247 #    include <limits>
0248 #    include <locale>
0249 #    include <new>
0250 #    include <optional>
0251 #    include <queue>
0252 #    include <stack>
0253 #    include <stdexcept>
0254 #    include <string>
0255 #    include <string_view>
0256 #    include <tuple>
0257 
0258 #    if _LIBCPP_HAS_WIDE_CHARACTERS
0259 #      include <cwchar>
0260 #    endif
0261 #  endif
0262 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0263 
0264 #endif // _LIBCPP_FORMAT