Evo C++ Library v0.5.1
Public Types | Public Member Functions | Public Attributes | List of all members
FmtIntT< T > Struct Template Reference

#include <evo/impl/str.h>

Detailed Description

template<class T>
struct evo::FmtIntT< T >

Explicitly format an integer.

Example

Example using FmtInt

#include <evo/string.h>
using namespace evo;
int main() {
// Format string as: 07B,45,67
String str;
str << FmtInt(123, fHEX, 3) << ',' FmtInt(45, fDEC) << ',' 67;
return 0;
}

Public Types

typedef FmtFieldNum< T > FmtFieldType
 This type paired with field info. More...
 
typedef IntegerT< T >::This IntClass
 Number class type. More...
 
typedef T IntPod
 Number POD type. More...
 
typedef FmtIntT< T > This
 This type More...
 

Public Member Functions

 FmtIntT (T num, int base=fbCURRENT, FmtBasePrefix prefix=fbpCURRENT, int width=-1, char ch=0)
 Constructor for POD number type with all attributes. More...
 
 FmtIntT (const IntClass &num, int base=fbCURRENT, FmtBasePrefix prefix=fbpCURRENT, int width=-1, char ch=0)
 Constructor for class number type (Int, etc) with all attributes. More...
 
Thiswidth (int width, char ch=0)
 Helper for setting padding attributes. More...
 

Public Attributes

FmtSetInt fmt
 Formatting attributes. More...
 
num
 Number to format. More...
 

Member Typedef Documentation

◆ FmtFieldType

This type paired with field info.

◆ IntClass

typedef IntegerT<T>::This IntClass

Number class type.

◆ IntPod

typedef T IntPod

Number POD type.

◆ This

typedef FmtIntT<T> This

This type

Constructor & Destructor Documentation

◆ FmtIntT() [1/2]

FmtIntT ( num,
int  base = fbCURRENT,
FmtBasePrefix  prefix = fbpCURRENT,
int  width = -1,
char  ch = 0 
)
inline

Constructor for POD number type with all attributes.

Parameters
numNumber to format
baseFormatting base to use (see FmtBase), fbCURRENT for unspecified (default: fDEC)
prefixFormatting prefix to use (see FmtBasePrefix), fbpCURRENT for unspecified (default: fPREFIX0)
widthWidth to pad to, -1 for unspecified (default: 0)
chPadding character to use, 0 for unspecified (default: '0')

◆ FmtIntT() [2/2]

FmtIntT ( const IntClass num,
int  base = fbCURRENT,
FmtBasePrefix  prefix = fbpCURRENT,
int  width = -1,
char  ch = 0 
)
inline

Constructor for class number type (Int, etc) with all attributes.

Parameters
numNumber to format
baseFormatting base to use (see FmtBase), fbCURRENT for unspecified (default: fDEC)
prefixFormatting prefix to use (see FmtBasePrefix), fbpCURRENT for unspecified (default: fPREFIX0)
widthWidth to pad to, -1 for unspecified (default: 0)
chPadding character to use, 0 for unspecified (default: '0')

Member Function Documentation

◆ width()

This& width ( int  width,
char  ch = 0 
)
inline

Helper for setting padding attributes.

Parameters
widthWidth to pad to, -1 for unspecified (default: 0)
chPadding character to use, 0 for unspecified (default: '0')
Returns
This

Member Data Documentation

◆ fmt

FmtSetInt fmt

Formatting attributes.

◆ num

T num

Number to format.


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