//--------------------------------------------------------------------
//
//  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 );
};
