// File: bstring.h // // Header file for buffered string #ifndef _bstring_h #define _bstring_h #include class BString { friend ostream& operator <<(ostream&, const BString&) ; public: // Constructors // BString() ; // Default constructor BString(int) ; // Constructor with initial buffer size BString(char *s, int n=0); // Initialize with string & opt buffer size BString(const BString&) ; // Copy Constructor // Destructor // ~BString() ; // Add char(s) to the end of this string // void append(char) ; void append(const char *) ; void append(const BString&) ; // Remove char(s) at the end of the string // void chop(int n=1) ; // Reduce buffer size if possible // void trim() ; void force_trim() ; // Overloaded Operators // BString& operator =(const BString&) ; // assignment BString operator +(const BString&) ; // + is concatenate char& operator [](int) ; bool operator <(const BString&) ; // comparisons bool operator <=(const BString&) ; bool operator ==(const BString&) ; bool operator >=(const BString&) ; bool operator >(const BString&) ; // Type conversion // operator char *() ; void GetLine(istream&) ; inline int length() { return len ;} void debug() ; private: char *str ; int len ; int bufsize ; } ; istream& operator >>(istream&, BString&) ; ostream& operator <<(ostream&, const BString&) ; #endif