Skip to content
Open
Changes from 1 commit
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
91 changes: 89 additions & 2 deletions source/diagnostics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,9 @@
constexpr bool @\libglobal{is_error_code_enum_v}@ = is_error_code_enum<T>::value;
template<class T>
constexpr bool @\libglobal{is_error_condition_enum_v}@ = is_error_condition_enum<T>::value;

// \ref{system.error.fmt}, formatter
template<class T> struct formatter<error_code, charT>;
}
\end{codeblock}

Expand Down Expand Up @@ -836,7 +839,7 @@
\begin{itemdescr}
\pnum
\returns
A string naming the error category.
A string in the ordinary literal encoding naming the error category.
\end{itemdescr}

\indexlibrarymember{default_error_condition}{error_category}%
Expand Down Expand Up @@ -880,7 +883,8 @@
\begin{itemdescr}
\pnum
\returns
A string that describes the error condition denoted by \tcode{ev}.
A string of multibyte characters in the execution character set that describes the error condition
denoted by \tcode{ev}.
Comment thread
notdanhan marked this conversation as resolved.
Outdated
\end{itemdescr}

\rSec3[syserr.errcat.nonvirtuals]{Non-virtual members}
Expand Down Expand Up @@ -1235,6 +1239,89 @@
Equivalent to: \tcode{return os << ec.category().name() << ':' << ec.value();}
\end{itemdescr}

\rSec3[system.error.fmt]{Formatting}
Comment thread
notdanhan marked this conversation as resolved.
Outdated
\pnum
\begin{codeblock}
template<class charT> struct formatter<error_code, charT> {
Comment thread
notdanhan marked this conversation as resolved.
constexpr void set_debug_format();

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

template<class Out>
typename basic_format_context<Out, charT>::iterator
format(const error_code& ec, basic_format_context<Out, charT>& ctx) const;
};
\end{codeblock}

\pnum
Comment thread
notdanhan marked this conversation as resolved.
Outdated
\begin{itemdecl}
constexpr void set_debug_format();
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Modifies the state of the \tcode{formatter} to be as if the
\defnx{error-code-format-spec}{error-code-format-spec!syserr err fmt} passed by the
Comment thread
notdanhan marked this conversation as resolved.
Outdated
last call to \tcode{parse} contained the \tcode{?} option.
\end{itemdescr}

\pnum
Comment thread
notdanhan marked this conversation as resolved.
Outdated
\begin{itemdecl}
constexpr typename basic_format_parse_context<charT>::iterator
parse(basic_format_parse_context<charT>& ctx);
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
Parses the format specifier as a \defnx{error-code-format-spec}{error-code-format-spec!syserr err fmt}
and stores the parsed specifiers in \tcode{*this}.

\begin{ncbnf}
\fmtnontermdef{error-code-format-spec}\br
\opt{fill-and-align} \opt{width} \opt{\tcode{?}} \opt{\tcode{s}}
\end{ncbnf}

where the productions and \defnx{width}{width!format string} are described in\iref{format.string}
Comment thread
jensmaurer marked this conversation as resolved.
Outdated

\pnum
\returns
An iterator past the end of the \defnx{error-code-format-spec}{error-code-format-spec!syserr err fmt}.
\end{itemdescr}

\pnum
\begin{itemdecl}
template<class Out>
typename basic_format_context<Out, charT>::iterator
format(const error_code& ec, basic_format_context<Out, charT>& ctx) const;
\end{itemdecl}

\begin{itemdescr}
\pnum
\effects
If the \tcode{s} option is used, then:
\begin{itemize}
\item If \tcode{charT} is \tcode{char} and the ordinary literal encoding is UTF-8, let
\tcode{msg} be \tcode{ec.message()} transcoded to UTF-8 with maximal subparts of ill-formed
subsequences substituted with \unicode{fffd}{replacement character} per the Unicode Standard, Chapter
3.9 \unicode{fffd} Substitution in Conversion.
\item Otherwise, let \tcode{msg} be \tcode{ec.message()} transcoded to an implementation-defined encoding.
Comment thread
notdanhan marked this conversation as resolved.
Outdated
\end{itemize}

\pnum
Otherwise, let \tcode{msg} be \tcode{std::format("{}:{}", ec.category().name(), ec.value())}.
Comment thread
notdanhan marked this conversation as resolved.
Outdated

\pnum
If the \tcode{?} option is used then \tcode{msg} is formatted as an escaped string(\iref{format.string.escaped}).
Comment thread
notdanhan marked this conversation as resolved.
Outdated
Writes \tcode{msg} into \tcode{ctx.out()}, adjusted according to the \defnx{error-code-format-spec}{error-code-format-spec!syserr err fmt}.

\pnum
\returns
An iterator past the end of the output range.
\end{itemdescr}


\rSec2[syserr.errcondition]{Class \tcode{error_condition}}

Expand Down
Loading