//---------------------------------------------------------------------------- #ifndef STRINGCLASS_H #define STRINGCLASS_H //---------------------------------------------------------------------------- #include "boolean.h" #include //---------------------------------------------------------------------------- class string { //----Friends //----Input and output operators friend istream& operator >>(istream& InputStream,string& AString); friend ostream& operator <<(ostream& OutputStream,const string& AString); //----Public parts public: //----Default string length const int DEFAULT_STRING_LENGTH = 80; //----Constructor with specified length string(int Size = DEFAULT_STRING_LENGTH); //----Initial value constructor string(const char* StringLiteral); //----Copy constructor string::string(const string& AString); //----Destructor ~string(void); //----Concatenate two strings regardless void operator +=(const string& AString); //----Checks if first string is lexicographically greater than the second boolean operator >(const string& AString) const ; //----Checks if first string is the same as the second boolean operator ==(const string& AString) const ; //----Checks if first string is lexicographically smaller than the second boolean operator <(const string& AString) const ; //----Assignment operator. Has to be a class member (C++ strikes again) string& operator =(const string& AString); //----Length int Length(void) const ; //----Test if all characters meet the test function boolean CharsAreAll(boolean (*TestFunction)(int)) const; //----Private parts private: //----The local data char* TheCString; int TheCStringLength; }; //---------------------------------------------------------------------------- #endif //----------------------------------------------------------------------------