![]() |
Provides basic extensions on the stl string functionality. More...
#include <StringTool.h>
Static Public Member Functions | |
static ErrorCode | split (char *pSourcePtr, const char *pSepLevelsPtr, StringDictionary &pDestRef) |
Split the given pSource string, expecting it has a two level separator, and order the parts inside a dictionary. | |
static ErrorCode | split (string &pSourceRef, const string pSeparator, StringArray &pDestRef) |
Fast split processor using the stl string facilities. | |
static ErrorCode | toHex (void *pSource, size_t pSize, string &pDestination) |
static ErrorCode | fromHex (string &pSource, void *pDestination, size_t pDestinationSize) |
static ErrorCode | ltrim (string &pStringRef) |
Eliminates all white space before the first non-white space in the provided string. | |
static ErrorCode | drop (string &pStringRef, const char *pDropHead) |
Eliminates all string content after the occurrence of the pDropHead element. | |
Provides basic extensions on the stl string functionality.
Definition at line 64 of file StringTool.h.
|
static |
Eliminates all string content after the occurrence of the pDropHead element.
pStringRef | |
pDropHead |
Definition at line 282 of file StringTool.cpp.
References HSEP::EC::IncompleteProcessing, and HSEP::EC::OK.
Referenced by HSEP::FileTool::retrieve().
|
static |
Definition at line 189 of file StringTool.cpp.
References HSEP::EC::BufferOverflow, HSEP::EC::EvenSizeExpected, HSEP::HEXVALUES, HSEP::EC::InvalidHexValue, HSEP::EC::NotCatalogedError, HSEP::EC::OK, and HSEP::REVHEX.
|
static |
Eliminates all white space before the first non-white space in the provided string.
pStringRef |
Definition at line 236 of file StringTool.cpp.
References HSEP::EC::IncompleteProcessing, and HSEP::EC::OK.
Referenced by HSEP::FileTool::retrieve().
|
static |
Split the given pSource string, expecting it has a two level separator, and order the parts inside a dictionary.
The two levels are defined as independent and different characters. The first one separates each ordered pair and the second one separates the key from the value. A typical value for pSepLevels would be ";=".
The present implementation defines that each key has a maximum of 128 characters. The present implementation defines that each value has a maximum of 512 characters.
pSourcePtr | Where the data comes from |
pSepLevelsPtr | The two level separator |
pDestRef | Dictionary destination |
Definition at line 30 of file StringTool.cpp.
References HSEP::EC::BufferOverflow, HSEP::EC::IncompleteParameter, HSEP::EC::IncompleteProcessing, MAXTOKEN_SIZE, MAXVALUE_SIZE, HSEP::EC::OK, and HSEP::Dictionary< T >::put().
|
static |
Fast split processor using the stl string facilities.
pSourceRef | Where the data comes from |
pSeparator | A string using to split the pSource |
pDestRef | Vector destination |
This split implementation differs from others in the sense that it calculates where could be the last possible position to find a separator. If we find a separator beyond that point, this would be the last separator.
This way, we only calculate the difference once, instead of one time for each cycle.
static const size_type npos = static_cast<size_type>(-1)
This works because natural overflow, becoming the biggest possible int number.
Definition at line 108 of file StringTool.cpp.
References HSEP::Array< T >::clear(), HSEP::EC::IncompleteProcessing, HSEP::EC::OK, and HSEP::Array< T >::push().
|
static |
Definition at line 172 of file StringTool.cpp.
References HSEP::HEXVALUES, and HSEP::EC::OK.