|
| NumberStringHex () noexcept |
| Default constructor.
|
|
template<class T > |
| NumberStringHex (T input) noexcept |
| Default constructor for an integral.
|
|
template<class T > |
| NumberStringHex (T uInput, uint_t uFormat) noexcept |
| Default constructor for an integral with formatting.
|
|
template<class T > |
NumberStringHex & | operator= (T input) noexcept |
| Copy operator for an integral.
|
|
| operator const char * () const noexcept |
| Get a pointer to the string.
|
|
const char * | data (void) const noexcept |
| Get a pointer to the string.
|
|
const char * | c_str (void) const noexcept |
| Get a pointer to the string.
|
|
char | operator[] (uintptr_t uIndex) const noexcept |
| Get a character from the string.
|
|
const char & | operator[] (uintptr_t uIndex) noexcept |
| Get a character reference from the string.
|
|
void | clear (void) noexcept |
| Erase the string.
|
|
uint_t | empty (void) const noexcept |
| Return TRUE if the string is blank.
|
|
uintptr_t | length (void) const noexcept |
| Get the length of the string in bytes.
|
|
uintptr_t | capacity (void) const noexcept |
| Get the size of the internal buffer in bytes.
|
|
Simple "C" string hexadecimal conversion class.
To convert a hexadecimal number into a string quickly and without the worry of creating a text buffer to contain the ASCII string, use this class. Once the string is created, you can access via NumberStringHex::c_str() const or const char * accessors.
The main benefit of this class is that the string buffer is part of the class instance, so no behind the scenes memory allocation is performed. It's best used with creating a local on the stack instance with the number to be converted as input to the constructor. After which, the program can access the string and use it as needed.
Most constructors can take an optional format parameter so the code can have some control as to how the string is created.
uint64_t uValue = 0x123456789ABCDULL;
printf("uValue = 0x%s\n",Text.c_str());
Simple "C" string hexadecimal conversion class.
Definition burger.h:17204
template<class T >
Burger::NumberStringHex::NumberStringHex |
( |
T | input, |
|
|
uint_t | uFormat ) |
|
inlinenoexcept |
Default constructor for an integral with formatting.
Convert the integral into an ASCII hex string and store that string inside the class. The resulting string is from 1 to 8 digits in length in length depending on the number of bytes the integral occupies. Formatting will have some influence on the string's length.
The format parameter is passed directly to NumberToAsciiHex(char*,T,uint_t), please see that function's documentation for what values you can pass.
- Template Parameters
-
- Parameters
-
input | Integral value to print in HEX to a string. |
uFormat | Formatting parameter. |
- See also
- NumberToAsciiHex(char *, T, uint_t) or NumberStringHex(T, uint_t)