Files
2025-10-25 03:02:53 +03:00

3.8 KiB
Raw Permalink Blame History

[fs.path.fmtr]

31 Input/output library [input.output]

31.12 File systems [filesystems]

31.12.6 Class path [fs.class.path]

31.12.6.9 Formatting support [fs.path.fmtr]

31.12.6.9.1 Formatting support overview [fs.path.fmtr.general]

🔗

namespace std {template struct formatter<filesystem::path, charT> {constexpr void set_debug_format(); constexpr typename basic_format_parse_context::iterator parse(basic_format_parse_context& ctx); templatetypename FormatContext::iterator format(const filesystem::path& path, FormatContext& ctx) const; };}

31.12.6.9.2 Formatting support functions [fs.path.fmtr.funcs]

1

#

Formatting of paths uses formatting specifiers of the form

path-format-spec:
fill-and-alignopt widthopt ?opt gopt

where the productions fill-and-align and width are described in [format.string].

If the ? option is used then the path is formatted as an escaped string ([format.string.escaped]).

🔗

constexpr void set_debug_format();

2

#

Effects: Modifies the state of the formatter to be as if the path-format-spec parsed by the last call to parse contained the ? option.

🔗

constexpr typename basic_format_parse_context<charT>::iterator parse(basic_format_parse_context<charT>& ctx);

3

#

Effects: Parses the format specifier as a path-format-spec and stores the parsed specifiers in *this.

4

#

Returns: An iterator past the end of the path-format-spec.

🔗

template<class FormatContext> typename FormatContext::iterator format(const filesystem::path& p, FormatContext& ctx) const;

5

#

Effects: Let s be p.generic_string<filesystem::path::value_type>() if the g option is used, otherwise p.native().

Writes s into ctx.out(), adjusted according to the path-format-spec.

If charT is char,path::value_type is wchar_t, and the literal encoding is UTF-8, then the escaped path is transcoded from the native encoding for wide character strings to UTF-8 with maximal subparts of ill-formed subsequences substituted with U+fffd replacement character per the Unicode Standard, Chapter 3.9 U+fffd Substitution in Conversion.

If charT and path::value_type are the same then no transcoding is performed.

Otherwise, transcoding isimplementation-defined.

6

#

Returns: An iterator past the end of the output range.