Lines Matching full:format
29 #include "utils/format/formatter.hpp"
35 #include "utils/format/exceptions.hpp"
40 namespace format = utils::format;
49 /// \param format The original format string provided by the user; needed for
65 find_next_placeholder(const std::string& format, in find_next_placeholder() argument
75 throw format::bad_format_error(format, "Trailing %"); in find_next_placeholder()
83 throw format::bad_format_error(format, "Unterminated placeholder '" + in find_next_placeholder()
91 /// \param format The format string; for error reporting purposes only.
98 to_int(const std::string& format, const std::string& str, const char* what) in to_int() argument
103 throw format::bad_format_error(format, "Invalid " + std::string(what) + in to_int()
111 /// \param format The format placeholder; may be empty.
113 /// \return A new std::ostringstream that is prepared to format a single
114 /// object in the manner specified by the format placeholder.
116 /// \throw bad_format_error If the format string is bad. We do minimal
119 new_ostringstream(const std::string& format) in new_ostringstream() argument
123 if (format.length() <= 2) { in new_ostringstream()
124 // If the format is empty, we create a new stream so that we don't have in new_ostringstream()
128 // Otherwise, if the format is a regular '%s', then we don't have to do in new_ostringstream()
132 std::string partial = format.substr(1, format.length() - 2); in new_ostringstream()
140 output->width(to_int(format, partial.substr(0, dot), "width")); in new_ostringstream()
143 output->precision(to_int(format, partial.substr(dot + 1), in new_ostringstream()
186 format::formatter::init(void) in init()
203 /// \param format The format string.
204 /// \param expansion The format string with any replacements performed so far.
209 format::formatter::formatter(const std::string& format, in formatter() argument
212 _format(format), in formatter()
223 /// \param format The format string. The formatters in the string are not
226 format::formatter::formatter(const std::string& format) : in formatter() argument
227 _format(format), in formatter()
228 _expansion(format), in formatter()
236 format::formatter::~formatter(void) in ~formatter()
246 format::formatter::str(void) const in str()
256 format::formatter::operator const std::string&(void) const in operator const std::string&()
264 /// \param value The boolean to inject into the format string.
266 /// \return A new formatter that has one less format placeholder.
267 format::formatter
268 format::formatter::operator%(const bool& value) const in operator %()
282 /// \throw utils::format::extra_args_error If there are no more formatting
284 format::formatter
285 format::formatter::replace(const std::string& arg) const in replace()
288 throw format::extra_args_error(_format, arg); in replace()