HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT::Format::Formatter Class Reference

#include <UT_Format.h>

Public Types

using W = CustomWriter
 

Public Member Functions

 Formatter ()
 Constructs a new Formatter object. More...
 
 ~Formatter ()=default
 
void setReportErrors (bool flag)
 Sets whether to report format string errors or not. More...
 
void setForceDigitGroupings (bool flag)
 
size_t format (W &writer, const char *format, std::initializer_list< ArgValue > args)
 
size_t format (W &writer, const char *format, const UT_Array< ArgValue > &args)
 Same as regular format() except with array instead of initializer list. More...
 
size_t printf (W &writer, const char *format, std::initializer_list< ArgValue > args)
 

Detailed Description

The main formatting class. This accepts a set of arguments and can subsequently format them in various ways.

Definition at line 517 of file UT_Format.h.

Member Typedef Documentation

Definition at line 520 of file UT_Format.h.

Constructor & Destructor Documentation

UT::Format::Formatter::Formatter ( )
inline

Constructs a new Formatter object.

Definition at line 523 of file UT_Format.h.

UT::Format::Formatter::~Formatter ( )
default

Member Function Documentation

size_t UT::Format::Formatter::format ( W writer,
const char *  format,
std::initializer_list< ArgValue args 
)

Format the arguments into the writer, using the format string given. Returns the number of bytes written.

Parameters
writerA functor that does the writing of the formatted output. See CustomWriter for an example of how to do a custom writer.
formatThe formatting codes, as defined in Format Grammar. If nullptr; will be treated as space separated {} for each argument.
argsAn initializer list that forms the list of arguments to bake into the formatted result using the format string.
Returns
The number of bytes written out to the writer functor.
size_t UT::Format::Formatter::format ( W writer,
const char *  format,
const UT_Array< ArgValue > &  args 
)

Same as regular format() except with array instead of initializer list.

size_t UT::Format::Formatter::printf ( W writer,
const char *  format,
std::initializer_list< ArgValue args 
)

Format the arguments into the writer, using the format string given. Returns the number of bytes written.

Parameters
writerA functor that does the writing of the formatted output. See CustomWriter for an example of how to do a custom writer.
formatThe formatting codes, as defined by std::printf If nullptr; will be treated as space separated {} for each argument.
argsAn initializer list that forms the list of arguments to bake into the formatted result using the format string.
Returns
The number of bytes written out to the writer functor.
void UT::Format::Formatter::setForceDigitGroupings ( bool  flag)
inline

Sets whether to force numbers to print with digit grouping. Otherwise only the ',' (format), or '\'' (printf) flags dictate whether digit grouping is done.

Definition at line 534 of file UT_Format.h.

void UT::Format::Formatter::setReportErrors ( bool  flag)
inline

Sets whether to report format string errors or not.

Definition at line 529 of file UT_Format.h.


The documentation for this class was generated from the following file: