//-------------------------------------------------------------------- // // Laboratory 3 stradt.h // // Class declaration for the array implementation of the stradt ADT // //-------------------------------------------------------------------- class stradt { public: // Constructors stradt ( int numChars = 0 ); // Create an empty string stradt ( const char *charSeq ); // Initialize using char* // Destructor ~stradt ( ); // String operations int length () const; // # characters char operator [] ( int n ) const; // Subscript void operator = ( const stradt &rightString ); // Assignment void clear (); // Clear string // Output the string structure -- used in testing/debugging void showStructure () const; // In-lab operation stradt ( const stradt &valueString ); // Copy constructor private: // Data members int bufferSize; // Size of the string buffer char *buffer; // String buffer containing a null-terminated // sequence of characters // Friends // String input/output operations (In-lab Exercise 1) friend istream & operator >> ( istream &input, stradt &inputString ); friend ostream & operator << ( ostream &output, const stradt &outputString ); // Relational operations (In-lab Exercise 3) friend int operator == ( const stradt &leftString, const stradt &rightString ); friend int operator < ( const stradt &leftString, const stradt &rightString ); friend int operator > ( const stradt &leftString, const stradt &rightString ); };