Fixed Length String
Topics
:Overview
Conditional Directives
Constants
Data Members
Functions
The fixed length string class used by database key types or members that must be fixed in length.
The following conditional directives are used to define non-portable string routines that need to be ported between UNIX and WIN32 platforms.
__DOS__ - Directive used for all DOS compilers
__UNIX__ - Directive used for all UNIX compilers
__WIN32__ - Directive used for all WIN32 compilers
The length constant sets the string length for all FString objects. The total length for all FString objects is equal to the length specified in this constant plus one byte for a null terminator.
const unsigned FStringLength = 255; // Length not including null terminator
char FString::sptr[FStringLength+1]
- Fixed string buffer equal to the fixed length plus a null terminator.FString::FString()
FString::~FString()
FString::Clear()
FString::Copy()
FString::SetString()
FString::SizeOf()
FString::c_str()
FString::is_null()
FString::length()
FString::strdup()
FString Overloaded Operators
Standalone Helper Functions
FString::FString()
- Default class constructor.FString::FString(const char *s, unsigned bytes = 0)
- Class constructor used to construct a FString object and load the specified string in memory. This constructor will truncate the number of bytes requested if the number of bytes exceeds maximum fixed string length. By Default this constructor assumes that "s" is a null terminated string. If a byte size is specified by the "bytes" variable the string is treated as raw pattern of bytes and a null terminator is not required.FString::FString(const FString &s)
- Class copy constructor. This copy constructor does not use share semantics and guarantees that each copy will be unique. - Class destructor. - Public member function used to clear the string.void FString::Copy(const FString &s)
- Public member function used to uniquely copy string objectsint FString::SetString(const char *s, unsigned bytes = 0)
- Public member function used to set the string value for this object. This function will truncate the number of bytes requested if the number of bytes exceeds maximum fixed string length. Returns true if successful or false if the string was truncated. NOTE: The FString class guarantees that each string object is unique by storing a unique copy of the string with each object. This ensures that FString objects can be safely copy constructed, assigned, resized, and deleted by multiple threads. Multiple threads accessing shared memory segments must be handled by the application. - Public member function that returns the size of an FString object. - Public member function that returns the null terminated string this object is referencing. - Public member function that returns true if this string is null. - Public member function that returns the string length of this string. - Public member function that returns a duplicate string object or a null value if an error occurs.Overloaded operators:
friend int operator==(const FString &a, const FString &b) - Overloaded operator that returns true if its operands are equal to each other. NOTE: Applications can force a case insensitive compare by setting the FStringCaseCompare global variable to 0. By default a case sensitive compare is used.
friend int operator!=(const FString &a, const FString &b)
- Overloaded operator that returns true if its operands are not equal to each other. NOTE: Applications can force a case insensitive compare by setting the FStringCaseCompare global variable to 0. By default a case sensitive compare is used.friend int operator>(const FString &a, const FString &b)
- Overloaded operator that returns true if its operand "a" is greater then "b. NOTE: Applications can force a case insensitive compare by setting the FStringCaseCompare global variable to 0. By default a case sensitive compare is used.friend int operator<(const FString &a, const FString &b)
- Overloaded operator that returns true if its operand "a" is less then "b." NOTE: Applications can force a case insensitive compare by setting the FStringCaseCompare global variable to 0. By default a case sensitive compare is used.Standalone Helper Functions:
int CaseICmp(const FString &s1, const FString &s2) - Compare two FString objects without regard to the case of the letters. Returns -1 if a < b, 0 if a == b, and 1 if a > b
int CaseICmp(const FString &s1, const char *s)
- Compare a FString object to a null terminated string without regard to the case of the letters. Returns -1 if a < b, 0 if a == b, and 1 if a > bint CaseICmp(const char *s, const FString &s2)
- Compare a null terminated string to a FString object without regard to the case of the letters. Returns -1 if a < b, 0 if a == b, and 1 if a > b
End Of Document |