Inheritance diagram for Format:
Static Public Attributes | |
static ubyte | DefaultStyle [] |
Static Protected Member Functions | |
static int | print (inout Style style, TypeInfo[] arguments, void *argptr) |
static int | print (inout Style style, void *src, uint bytes, uint type) |
Private Types | |
enum | Flags { Fill = 1, Left = Fill << 1, Prec = Left << 1, Hash = Prec << 1, Space = Hash << 1, Zero = Space << 1, Sign = Zero << 1, Comma = Sign << 1, Plus = Comma << 1, Array = Plus << 1 } |
Static Private Member Functions | |
static void | error (char[] msg) |
Classes | |
struct | Sprintf |
While these functions are all static, they are encapsulated within a class inheritance to preserve some namespace cohesion. One might use structs for encapsualtion instead, but then inheritance would be lost. Note that the root class, Styled, is abstract to prevent accidental instantiation of these classes.
See Styled.parse() for the list of format specifiers.
Definition at line 62 of file Format.d.
|
Declare stylistic flags |
|
General purpose va_arg format routine, used by a number of classes and structs to emit printf() styled text. This implementation simply converts its arguments into the appropriate internal type, and invokes the standard Mango type-formatter for each. Note that this can handle type-arrays in addition to the usual char[] ~ e.g. one can print an array of integers just as easily as a single integer. See Styled.parse() for the list of format specifiers. Definition at line 147 of file Format.d. References Styled::error(). Referenced by Format::Sprintf::format(), and DisplayWriter::print(). |
|
Convert various types into textual representation. This is used by DisplayWriter/PrintWriter, and by the various users of the variadic-argument functions. See print() above, along with the DisplayWriter class. Note that print() can handle type-arrays in addition to the usual char[]; e.g. one can print an array of integers just as easily as a single integer. To support this, a new style flag has been introduced to terminate the format string at the point of use. That is, the rest of the format string is considered to be part of the current format specifier, and will be repeated for each array element. For example, the format string " %@x," has a preceeding space, a trailing comma, and the array flag '@'. This will output an array of numeric values (char, byte, short, int, long, float, double, real, pointer) as a set of formatted hexadecimal strings. See Styled.parse() for the list of format specifiers. Definition at line 231 of file Format.d. References DefaultStyle, and Styled::error(). |
|
Throw an exception with the provided messsage Definition at line 338 of file Styled.d. Referenced by Number::format(), print(), and Format::Sprintf::utf8(). |
|
Initial value: [ 's', 'd', 'u', 'd', 'u', 'd', 'u', 'd', 'u', 'f', 'f', 'f', 's', 's', 's', 'x' ] Definition at line 72 of file Format.d. Referenced by print(). |