Class Ase::Lib::StringFormatter
ClassList > Ase > Lib > StringFormatter
#include <formatter.hh>
Public Types
Type | Name |
---|---|
enum | LocaleContext |
Public Functions
Type | Name |
---|---|
std::string | render_arg (const Directive & dir, const char * modifier, Arg arg) |
Public Static Functions
Type | Name |
---|---|
static | __attribute__ ((__format__(printf, 2, 0), noinline)) |
Detailed Description
StringFormatter - sprintf() like string formatting for C++.
See format() for supported flags, modifiers and conversions. To find source code strings with size modifiers for possible cleanups, use: egrep "\"([^\"]|\\")*%[0-9\(]\*[-+#0 \'I]\*[<em>0-9\)]</em>[.*0-9$]*[hlLqjzt]+[nSspmCcdiouXxFfGgEeAa]"
Public Types Documentation
enum LocaleContext
enum Ase::Lib::StringFormatter::LocaleContext {
POSIX_LOCALE,
CURRENT_LOCALE
};
Public Functions Documentation
function render_arg [2/2]
template<class Arg>
std::string Ase::Lib::StringFormatter::render_arg (
const Directive & dir,
const char * modifier,
Arg arg
)
Public Static Functions Documentation
function __attribute__
template<LocaleContext LC, class ... Args>
static inline static Ase::Lib::StringFormatter::__attribute__ (
(__format__(printf, 2, 0), noinline)
)
Format a string according to an sprintf() format string with arguments. Refer to sprintf() for the format string details, this function is designed to serve as an sprintf() replacement and mimick its behaviour as close as possible. Supported format directive features are: * Formatting flags (sign conversion, padding, alignment), i.e. the flags: [-#0+ '] * Field width and precision specifications. * Positional arguments for field width, precision and value. * Length modifiers are tolerated: i.e. any of [hlLjztqZ]. * The conversion specifiers [spmcCdiouXxFfGgEeAa].
Additionally, arguments can be transformed after conversion by passing a std::string conversion function as arg_transform. This may e.g. be used for XML character escaping of the format argument values. @NOTE Format errors, e.g. missing arguments will produce a warning on stderr and return the format string unmodified.
Returns:
A formatted string.
The documentation for this class was generated from the following file /__w/anklang/anklang/ase/formatter.hh