Evo C++ Library v0.5.1
|
#include <evo/string.h>
String fixed-size buffer for formatting an integer.
T | Integer type |
PADDING | Additional padding for buffer, defaults to 1 for terminator |
This example uses printf()
as a function that requires a terminated string.
Output:
Public Types | |
typedef ListBase< char, StrSizeT > | ListBaseType |
List base type (this) More... | |
typedef StrSizeT | Size |
Size type. More... | |
typedef StringInt< T, PADDING > | ThisType |
This type. More... | |
Public Member Functions | |
StringInt () | |
Constructor intializes to null. More... | |
StringInt (T num, int base=fDEC, bool terminated=true, uint end_padding=0) | |
Constructor intializes with set(). More... | |
ThisType & | add (const char *data, Size size) |
Append additional data to buffer. More... | |
char * | addnew (Size size) |
Add additional space to buffer and return pointer to new uninitialized space in buffer. More... | |
char * | data () |
Get formatted string pointer. More... | |
ThisType & | set () |
Set as null. More... | |
char * | set (T num, int base=fDEC, bool terminated=true, uint end_padding=0) |
Set as formatted integer. More... | |
Size | size () const |
Get formatting string size. More... | |
Public Attributes | |
char | buffer [BUF_SIZE] |
String buffer More... | |
char * | data_ |
Data pointer, NULL if null. More... | |
StrSizeT | size_ |
Data size as item count, 0 if empty or null. More... | |
Static Public Attributes | |
static const int | BUF_SIZE = IntegerT<T>::MAXSTRLEN + PADDING |
Buffer size. More... | |
|
inherited |
List base type (this)
|
inline |
Constructor intializes to null.
Constructor intializes with set().
num | Number to set/format |
base | Number base to format with (2 - 36) |
terminated | Whether to add terminator after number |
end_padding | Padding to leave at end (PADDING template param must make room for this) |
Append additional data to buffer.
PADDING
template param, and via end_padding
argument when setdata | Data pointer to copy from |
size | Size to copy and add |
|
inline |
Add additional space to buffer and return pointer to new uninitialized space in buffer.
PADDING
template param, and via end_padding
argument when setsize | Size to add |
|
inline |
Get formatted string pointer.
|
inline |
Set as null.
|
inline |
Set as formatted integer.
num | Number to set/format |
base | Number base to format with (2 - 36) |
terminated | Whether to add terminator after number |
end_padding | Padding in buffer to leave after string value (PADDING template param must make room for this) |
|
inline |
Get formatting string size.
|
static |
Buffer size.
char buffer[BUF_SIZE] |
String buffer
|
inherited |
Data pointer, NULL if null.
|
inherited |
Data size as item count, 0 if empty or null.