QbStringClass is a utility class that is not derived from any other class. It performs string functions and related memory management. The class contains a set of overloaded operators to allow the object to be cast to either an unsigned char or char variable type.
In this class, the +=
operator has been overloaded to concatenate two QbString objects.
This chapter describes the following methods:
You can see coding examples in Appendix C, "Sample Code" on page 185. Other programs are located in the qbic/QbicApi
directory.
This is the constructor for the class. This method has overloaded functions. Depending on which function you use, the length of the object's internal buffer is the same as the length of the input string, or is a size you specify. The second argument indicates that the memory of the internal buffer is cleared when the object is destroyed.
QbStringClass( const char * string, Boolean destructorDeleteArg = True ) QbStringClass( const unsigned long size, Boolean destructorDeleteArg = True )
This is the destructor for the class.
virtual ~QbStringClass( void )
This method encodes the input string to a hexadecimal representation and appends the result to the internal buffer of the object.
int EncodeAndConcat ( const unsigned char *input, const unsigned long size )
An integer value: 0 indicates success; -1 indicates failure
This method returns the size of the object's internal buffer that holds the string.
unsigned long GetSize( void )
An unsigned long integer that represents the size of the object's internal buffer
This method returns a Boolean value that indicates the current state of the object. Any operation that requires memory, such as the += operator, could fail and leave the object in an "unhealthy" state.
Boolean IsOK( void )
A Boolean value: True means the object is "healthy"; False means the object experienced a memory allocation error
This method indicates whether the destructor should delete the internal buffer. This method overrides what you specify in the class constructor for destructorDeleteArg.
void SetDestructorDelete( Boolean destructorDeleteArg )
destructorDeleteArg-A Boolean value: True indicates that the destructor will delete the buffer; False indicates that it will not.