#ifndef STRINGARRAY_H #define STRINGARRAY_H //***************************************************************************** // // STringArray.h // //***************************************************************************** // // Copyright (C) 1996 // // Ronald A. MacCracken // Graduate Student // Computer Science Department // University of California // Davis, CA 95616 // // Permission is granted to use at your own risk and // distribute this software in source and binary forms // provided the above copyright notice and this paragraph // are preserved on all copies. This software is provided // "as is" with no express or implied warranty. // //***************************************************************************** #include #include "STring.h" class STringArray { private: int _length ; STring* _array ; private: void Copy ( const STringArray& ) ; void Delete ( void ) ; protected: void Output ( ostream& ) const ; void Input ( istream& ) ; public: // default constructor STringArray ( void ) ; // user-defined constructors STringArray ( const int& length ) ; STringArray ( const int& length , const STring& data ) ; STringArray ( const int& length , const STring* new_array ) ; // copy constructor STringArray ( const STringArray& ) ; // destructor ~STringArray ( void ) ; // assignment operators STringArray& operator= ( const STringArray& ) ; // index operators STring& operator[] ( const int& i ) ; const STring& operator[] ( const int& i ) const ; // access functions int Get_Length ( void ) const { return _length ; } // set all elements to data void Set_All ( const STring& data ) ; // swap element i with element j void Swap ( const int& i , const int& j ) ; // I/O operators friend ostream& operator<< ( ostream& , const STringArray& ) ; friend istream& operator>> ( istream& , STringArray& ) ; } ; #endif