A number manipulation class. More...
#include <numbers.h>
Public Member Functions | |
const char * | c_str () const |
Get string buffer representing the number. | |
long | get () const |
Get value of string buffer as a long integer. | |
Number (char *buffer, unsigned size) | |
Create an instance of a number. | |
operator char * () | |
Cast object as a string to retrieve buffer. | |
operator long () | |
Cast string as long integer and get value of buffer. | |
long | operator() () |
Get value of string buffer as expression of object. | |
long | operator++ () |
Increment the number object. | |
long | operator+= (const long value) |
Add a value to the number. | |
long | operator-- () |
Decrement the number object. | |
long | operator-= (const long value) |
Subtract a value from the number. | |
long | operator= (long value) |
Assign a value to the number. | |
long | operator= (const Number &number) |
Assign another number to this number. | |
void | set (long value) |
Set string based on a new value. | |
Protected Attributes | |
char * | buffer |
unsigned | size |
A number manipulation class.
This is used to extract, convert, and manage simple numbers that are represented in C ascii strings in a very quick and optimal way. This class modifies the string representation each time the value is changed. No math expressions or explicit comparison operators are supported for the Numbers class because these are best done by casting to long first.
Definition at line 46 of file numbers.h.
ucc::Number::Number | ( | char * | buffer, | |
unsigned | size | |||
) |
Create an instance of a number.
buffer | or NULL if created internally. | |
size | of field if not null terminated. |
const char* ucc::Number::c_str | ( | void | ) | const [inline] |
long ucc::Number::get | ( | ) | const |
Get value of string buffer as a long integer.
ucc::Number::operator char * | ( | ) | [inline] |
ucc::Number::operator long | ( | ) | [inline] |
long ucc::Number::operator() | ( | void | ) | [inline] |
long ucc::Number::operator++ | ( | ) |
Increment the number object.
This rewrites the string buffer.
long ucc::Number::operator+= | ( | const long | value | ) |
Add a value to the number.
This rewrites the string buffer.
value | to add. |
long ucc::Number::operator-- | ( | ) |
Decrement the number object.
This rewrites the string buffer.
long ucc::Number::operator-= | ( | const long | value | ) |
Subtract a value from the number.
This rewrites the string buffer.
value | to subtract. |
long ucc::Number::operator= | ( | const Number & | number | ) |
Assign another number to this number.
number | to assign to assign. |
long ucc::Number::operator= | ( | long | value | ) |
Assign a value to the number.
This rewrites the string buffer.
value | to assign. |
Reimplemented in ucc::ZNumber.
void ucc::Number::set | ( | long | value | ) |