Defined in file: hzString.h

hzString is for the creaton and manipulation of general string values. Implementation and operation of hzString is described in the synopsys, chapter 1.2.

Constructors/Detructors

hzString*hzString(void)
hzString*hzString(const char* pStr)
hzString*hzString(hzString& op)
NULL-TYPEhzString(void)
NULL-TYPEhzString(const char* pStr)
NULL-TYPEhzString(hzString& op)
void~hzString(void)
NULL-TYPE~hzString(void)

Public Methods:

voidClear(void)Clear this string. The end result will be this string has a null pointer and the string space that was being pointed to, has its copy count reduced by 1. If this means the copy count falls to zero, then the string space shall be freed. Clears the string. Note that if other string instances share the same internal string space (have equal contents) then all that occurs is a decrement of the copy count. This leaves the string value intact maintaining the integrity of the other string instances. Only if there are no other string instances sharing the internal string space (copy count is zero) is the internal string space is released (deleted). In both cases the local internal string space pointer is then set to null. Subsequent setting of this hzString instance will then allocate fresh memory. Arguments: None Returns: None
int32_tCompare(hzString& s)
int32_tCompareF(hzString& s)
int32_tCompareI(hzString& s)
boolContains(const char c)Test if the string contains one or more instances of a test char
boolContains(const char* cpNeedle)Test if the string contains a char string (case sensitive)
boolContains(hzString& S)
boolContainsI(const char* cpNeedle)Test if the string contains a char string (case insensitive)
boolContainsI(hzString& S)
uint32_tCopies(void)Returns numbers of copies for diagnostics Arguments: None
hzString&DelWhiteLead(void)Removes leading whitespace from the string Arguments: None
hzString&DelWhiteTrail(void)Removes trailing whitespace Arguments: None
boolEquiv(const char* cpStr)Test if this string is equal to the operand char string (on a case insensitive basis)
boolEquiv(hzString& S)
int32_tFirst(const char c)
int32_tFirst(const char* str)
int32_tFirst(hzString& S)
int32_tFirstI(const char c)
int32_tFirstI(const char* str)
int32_tFirstI(hzString& S)
int32_tLast(const char c)
int32_tLast(const char* str)
int32_tLast(hzString& S)
int32_tLastI(const char c)
int32_tLastI(const char* str)
int32_tLastI(hzString& S)
uint32_tLength(void)Returns length of string, not including a null terminator Arguments: None
hzString&Replace(const char* strA)const char* strB, Text substitution Replace within this string, all instances of strA with strB. This string is unchanged if strA does not exist within it.
hzString&Reverse(void)Reverse the string content. This first ensures the string is independent. Arguments: None
hzEcodeSetValue(const char* cpStr)uint32_t nLen, Set a string to a non-terminated char string
hzEcodeSetValue(const char* cpStr)const char* cpTerm, Set a string to a char string that is terminated by a char sequence rather than a null
hzEcodeSetValue(const char* cpStr)char termchar, Set a string to a char string that is terminated by a char other than a null
hzStringSubString(uint32_t nPosn)uint32_t nBytes, Purpose: Populate a string with a substring of this string. Return an empty string if the requested position goes beyong length of string, Return a partial string if the length requested goes beyond the end of the string
hzString&ToLower(void)Convert string to all lower case. As this function can alter string content, it follows the protocol described in chapter 3.1 "Smart Pointers" in the HadronZoo Library manual. Arguments: None
hzString&ToUpper(void)Convert string to all upper case. As this function can alter string content, it follows the protocol described in chapter 3.1 "Smart Pointers" in the HadronZoo Library manual. Arguments: None
hzString&TopAndTail(void)Text substitution Removes leading and trailing whitespce from this string. If no whitespace exists within this string, it is unchanged Arguments: None
hzString&Truncate(uint32_t limit)Truncate the string
hzString&TruncateBeyond(const char* patern)Conditional, content based truncation. If the supplied patern exists in the string, the new string will be everything beyond but not including the first instance of the patern. If the pattern is empty or does not exist in the string, the string content will be unchanged.
hzString&TruncateUpto(const char* patern)Conditional, content based truncation. If the supplied patern exists in the string, the new string will be everything upto but not including the first instance of the patern. If the pattern is empty or does not exist in the string, the string content will be unchanged.
hzString&UrlDecode(void)Performs URL-Decoding on the current string content. If the current string does not contain URL-encoded sequences, the string will be unchanged. Arguments: None
hzString&UrlEncode(bool bResv)Performs URL-Encoding on the current string content. This is transformation is only carried out if URL characters exist in the string value
int32_t_cmp(hzString&)Case sensitive compare based on strcmp
int32_t_cmp(const char*)Case sensitive compare based on strcmp
int32_t_cmpF(hzString&)Fast compare. This provides a string comparison based on 32-bit chunks rather than bytes. It is faster but only the equivelent to lexical comparison in big-endian architetures. This method should be considered only for unordered collections where only uniqueness of entries is important.
int32_t_cmpI(hzString&)Case insensitive compare based on strcasecmp
int32_t_cmpI(const char*)Case insensitive compare based on strcasecmp
void_dec_copy(void)
bool_feq(hzString&)Determine equality by fast compare technique. This works in both big and little endian architectures.
void_inc_copy(void)
uint32_t_int_addr(void)
void_int_clr(void)
void_int_set(uint32_t addr)

Overloaded operators:

const char*hzString :: operator const char *(void)Returns the string data (a null terminated string) Arguments: None
const char*operator const char *(void)
booloperator!(void)
booloperator!=(const char* s)
booloperator!=(hzString& s)
const char*operator*(void)Returns the string data (a null terminated string) Arguments: None
hzStringoperator+(hzString S)hzString S2,
hzStringoperator+(hzString S)const char* s,
hzStringoperator+(const char* s)hzString S,
hzString&operator+=(hzString& op)Append the operand string to the contents of this.
hzString&operator+=(const char* cpStr)Append the operand char string to the contents of this.
booloperator<(const char* s)
booloperator<(hzString& s)
ostream&operator<<(ostream& os)hzString& obj,
booloperator<=(const char* s)
booloperator<=(hzString& s)
hzString&operator=(hzString& op)Purpose: Set this string equal to the operand. If the internal address of this string instance is already equal to that of the operand, this function does nothing. Otherwise this string is cleared, the copy count of the operand string is incremented, then the internal address is set to that of the operand.
hzString&operator=(hzChain& C)Set string equal to content of the supplied chain. Note this function will fail (with the string empty) if the chain contents are too large
hzString&operator=(const char* cpStr)Set the value of this hzString instance to the operand null terminated char string. Note that it is possible for the operand to have come from the string itself. For this reason we do not clear the existing string until we have allocated and populated the new buffer.
hzString&operator=(unsigned char* cpStr)Set the value of this hzString instance to the operand null terminated char string. Note that it is possible for the operand to have come from the string itself. For this reason we do not clear the existing string until we have allocated and populated the new buffer.
booloperator==(const char* s)
booloperator==(hzString& s)
booloperator>(const char* s)
booloperator>(hzString& s)
booloperator>=(const char* s)
booloperator>=(hzString& s)
istream&operator>>(istream& is)hzString& obj,
const charoperator[](uint32_t nIndex)Returns the (char) value of the Nth position in the buffer. A zero is returned if N is less than zero or overshoots the text part of the buffer

Member Variables:

uint32_tm_addrInternal address of string