Evo C++ Library v0.5.1
Public Types | Public Member Functions | Public Attributes | List of all members
String::Format Struct Reference

#include <evo/string.h>

Detailed Description

String formatter with state.

Example
#include <evo/string.h>
using namespace evo;
int main() {
String str;
// Use a temporary formatter to append line to str: 7B,1C8
String::Format(str) << fHEX << 123 << ',' << 456 << NL;
// Create a formatter and use to append line to str: 001,002
out << FmtSetInt(fDEC, 3) << 1 << ',' << 2 << NL;
return 0;
}

For more examples see: String Formatting

Public Types

typedef String Out
 Associated output string type, type returned by write_out() More...
 
typedef String::Size Size
 String data size type More...
 
typedef Format This
 This type. More...
 

Public Member Functions

 Format (Out &out)
 Constructor. More...
 
 Format (const This &src)
 Copy constructor. More...
 
Thisoperator<< (FmtAlign align)
 Set field alignment type to use. More...
 
Thisoperator<< (FmtWidth width)
 Set field width to use. More...
 
Thisoperator<< (const FmtSetField &field)
 Set field attributes to use. More...
 
Thisoperator<< (Newline nl)
 Append a newline. More...
 
Thisoperator<< (Flush)
 Flush output buffer – no-op for string. More...
 
Thisoperator<< (const FmtSetNull &null)
 Set attributes for null values. More...
 
Thisoperator<< (bool val)
 Append operator. More...
 
Thisoperator<< (char ch)
 Append a character. More...
 
Thisoperator<< (const FmtChar &ch)
 Append a repeated character. More...
 
Thisoperator<< (const char *val)
 Append a terminated string. More...
 
Thisoperator<< (const StringBase &val)
 Append a string. More...
 
Thisoperator<< (FmtBase base)
 Set base for formatting integers. More...
 
Thisoperator<< (FmtBasePrefix prefix)
 Set prefix for formatting integers. More...
 
Thisoperator<< (const FmtSetInt &fmt_int)
 Set integer formatting attributes. More...
 
Thisoperator<< (short num)
 Append a formatted signed integer. More...
 
Thisoperator<< (int num)
 Append a formatted signed integer. More...
 
Thisoperator<< (long num)
 Append a formatted signed integer. More...
 
Thisoperator<< (longl num)
 Append a formatted signed integer. More...
 
Thisoperator<< (ushort num)
 Append a formatted unsigned integer. More...
 
Thisoperator<< (uint num)
 Append a formatted unsigned integer. More...
 
Thisoperator<< (ulong num)
 Append a formatted unsigned integer. More...
 
Thisoperator<< (ulongl num)
 Append a formatted unsigned integer. More...
 
template<class T >
Thisoperator<< (const IntegerT< T > &num)
 Append a formatted integer class. More...
 
Thisoperator<< (FmtPrecision prec)
 Set floating point formatting precision. More...
 
Thisoperator<< (const FmtSetFloat &fmt_flt)
 Set floating point formatting attributes. More...
 
Thisoperator<< (float num)
 Append a formatting floating point number. More...
 
Thisoperator<< (double num)
 Append a formatting floating point number. More...
 
Thisoperator<< (ldouble num)
 Append a formatting floating point number. More...
 
template<class T >
Thisoperator<< (const FloatT< T > &num)
 Append a formatted integer class. More...
 
Thisoperator<< (const FmtDump &fmtdump)
 
Thisoperator= (const This &src)
 Assignment operator copies attributes. More...
 
Outwrite_out ()
 Get parent output string. More...
 

Public Attributes

FmtAttribs fmt
 Formatting attributes (state) More...
 
Outout
 Associated output string. More...
 

Member Typedef Documentation

◆ Out

typedef String Out

Associated output string type, type returned by write_out()

◆ Size

typedef String::Size Size

String data size type

◆ This

typedef Format This

This type.

Constructor & Destructor Documentation

◆ Format() [1/2]

Format ( Out out)
inline

Constructor.

Parameters
outOutput string to associate and format to

◆ Format() [2/2]

Format ( const This src)
inline

Copy constructor.

  • This will reference the same string as src
Parameters
srcSource to copy

Member Function Documentation

◆ operator<<() [1/30]

This& operator<< ( FmtAlign  align)
inline

Set field alignment type to use.

Parameters
alignAlignment type
Returns
This

◆ operator<<() [2/30]

This& operator<< ( FmtWidth  width)
inline

Set field width to use.

Parameters
widthField width to use
Returns
This

◆ operator<<() [3/30]

This& operator<< ( const FmtSetField field)
inline

Set field attributes to use.

Parameters
fieldField attributes
Returns
This

◆ operator<<() [4/30]

This& operator<< ( Newline  nl)
inline

Append a newline.

Parameters
nlNewline type to append, NL for system default
Returns
This

◆ operator<<() [5/30]

This& operator<< ( Flush  )
inline

Flush output buffer – no-op for string.

  • Use param: fFLUSH
Returns
This

◆ operator<<() [6/30]

This& operator<< ( const FmtSetNull null)
inline

Set attributes for null values.

Parameters
nullNull attributes
Returns
This

◆ operator<<() [7/30]

This& operator<< ( bool  val)
inline

Append operator.

  • Bool value is formatted as either "true" or "false" (without quotes)
Parameters
valBool value to append
Returns
This

◆ operator<<() [8/30]

This& operator<< ( char  ch)
inline

Append a character.

Parameters
chCharacter to append
Returns
This

◆ operator<<() [9/30]

This& operator<< ( const FmtChar ch)
inline

Append a repeated character.

Parameters
chCharacter info to append
Returns
This

◆ operator<<() [10/30]

This& operator<< ( const char *  val)
inline

Append a terminated string.

  • Field attributes apply
Parameters
valString pointer, must be terminated, NULL for null string
Returns
This

◆ operator<<() [11/30]

This& operator<< ( const StringBase val)
inline

Append a string.

  • Field attributes apply
Parameters
valString value
Returns
This

◆ operator<<() [12/30]

This& operator<< ( FmtBase  base)
inline

Set base for formatting integers.

Parameters
baseBase to use, see FmtBase
Returns
This

◆ operator<<() [13/30]

This& operator<< ( FmtBasePrefix  prefix)
inline

Set prefix for formatting integers.

Parameters
prefixInteger prefix to use, see FmtBasePrefix
Returns
This

◆ operator<<() [14/30]

This& operator<< ( const FmtSetInt fmt_int)
inline

Set integer formatting attributes.

Parameters
fmt_intInteger formatting attributes
Returns
This

◆ operator<<() [15/30]

This& operator<< ( short  num)
inline

Append a formatted signed integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [16/30]

This& operator<< ( int  num)
inline

Append a formatted signed integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [17/30]

This& operator<< ( long  num)
inline

Append a formatted signed integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [18/30]

This& operator<< ( longl  num)
inline

Append a formatted signed integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [19/30]

This& operator<< ( ushort  num)
inline

Append a formatted unsigned integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [20/30]

This& operator<< ( uint  num)
inline

Append a formatted unsigned integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [21/30]

This& operator<< ( ulong  num)
inline

Append a formatted unsigned integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [22/30]

This& operator<< ( ulongl  num)
inline

Append a formatted unsigned integer.

  • Integer and field attributes apply
Parameters
numInteger to format
Returns
This

◆ operator<<() [23/30]

This& operator<< ( const IntegerT< T > &  num)
inline

Append a formatted integer class.

  • Integer, field, and null attributes apply
Template Parameters
TInteger POD type, deduced from param
Parameters
numInteger to format (Int, UInt, etc)
Returns
This

◆ operator<<() [24/30]

This& operator<< ( FmtPrecision  prec)
inline

Set floating point formatting precision.

Parameters
precPrecision value, see FmtPrecision
Returns
This

◆ operator<<() [25/30]

This& operator<< ( const FmtSetFloat fmt_flt)
inline

Set floating point formatting attributes.

Parameters
fmt_fltFloating point formatting attributes
Returns
This

◆ operator<<() [26/30]

This& operator<< ( float  num)
inline

Append a formatting floating point number.

  • Floating point and field attributes apply
Parameters
numNumber to format
Returns
This

◆ operator<<() [27/30]

This& operator<< ( double  num)
inline

Append a formatting floating point number.

  • Floating point and field attributes apply
Parameters
numNumber to format
Returns
This

◆ operator<<() [28/30]

This& operator<< ( ldouble  num)
inline

Append a formatting floating point number.

  • Floating point and field attributes apply
Parameters
numNumber to format
Returns
This

◆ operator<<() [29/30]

This& operator<< ( const FloatT< T > &  num)
inline

Append a formatted integer class.

  • Floating point, field, and null attributes apply
Template Parameters
TFloating point POD type, deduced from param
Parameters
numNumber to format (Float, FloatD, etc)
Returns
This

◆ operator<<() [30/30]

This& operator<< ( const FmtDump fmtdump)
inline

◆ operator=()

This& operator= ( const This src)
inline

Assignment operator copies attributes.

  • This does not copy the referenced string
Parameters
srcSource to copy attributes from
Returns
This

◆ write_out()

Out& write_out ( )
inline

Get parent output string.

Returns
Parent output string

Member Data Documentation

◆ fmt

Formatting attributes (state)

◆ out

Out& out

Associated output string.


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