G3string.h

Go to the documentation of this file.
00001 #ifndef _PLSTRING_H
00002 #define _PLSTRING_H
00003 
00004 #include <OPS_Stream.h>
00005 #include <iostream>
00006 using std::istream;
00007 
00008 // A first class string type
00009 class String {
00010 public:
00011    // Constructors and destructor
00012    String(const char s[] = ""); // Constructs a deep copy of a C-string.
00013                                 //  ASSUME: s is a valid C-string.
00014    String(const String& s);     // Constructs a deep copy of s.
00015    ~String();                   // Deallocates String memory.          
00016 
00017    // Assignment operators
00018    String& operator= (const String& rhs);   // Assigns a deep copy of rhs. 
00019    String& operator+= (const String& rhs);  // Adds a deep copy of rhs on the
00020                                             //   end of this string.
00021 
00022    char& operator[](int i);          // The element at subscript i. 
00023                                      // ASSUME: i < length of the string
00024    char operator[](int i) const;     // The element at subscript i.
00025                                      // ASSUME: i < length of the string
00026 
00027    int length() const;               // Number of string characters.
00028    const char* charString( ) const;  // C-String equivalent value.
00029 
00030    // Comparison operators
00031    friend bool operator== (const String& s, const String& t);
00032    friend bool operator!= (const String& s, const String& t);
00033    friend bool operator<  (const String& s, const String& t);
00034    friend bool operator<= (const String& s, const String& t);
00035    friend bool operator>  (const String& s, const String& t);
00036    friend bool operator>= (const String& s, const String& t);
00037 
00038    friend OPS_Stream& operator<<(OPS_Stream& out, const String& s);
00039                // Writes the C-string equivalent to out.
00040    friend istream& operator>> (istream& in, String & s);   
00041                // Reads at most 999 characters up to the next newline from 
00042                //   from in. The newline is extracted but not assigned.   
00043    friend String operator+(const String& s, const String& t);  
00044                // A deep copy of s with a deep copy of t appended to the end.
00045 
00046 private:
00047    char* info_;
00048 };
00049 
00050 #endif
00051 

Generated on Mon Oct 23 15:05:27 2006 for OpenSees by doxygen 1.5.0