00001 00033 #ifndef ABA_STRING_H 00034 #define ABA_STRING_H 00035 #include <iostream> 00036 using namespace std; 00037 00038 #include "abacus/abacusroot.h" 00039 00040 class ABA_GLOBAL; 00041 00042 #ifdef ABACUS_PARALLEL 00043 class ABA_MESSAGE; 00044 #endif 00045 class ABA_STRING : public ABA_ABACUSROOT { 00046 public: 00047 00053 ABA_STRING(ABA_GLOBAL *glob, const char* cString = ""); 00054 00065 ABA_STRING(ABA_GLOBAL *glob, const char* cString, int index); 00066 00071 ABA_STRING(const ABA_STRING &rhs); 00072 00074 ~ABA_STRING(); 00075 #ifdef ABACUS_PARALLEL 00076 00082 ABA_STRING(ABA_GLOBAL *glob, ABA_MESSAGE &msg); 00083 00088 void unpack(ABA_MESSAGE &msg); 00089 00094 void pack(ABA_MESSAGE &msg) const; 00095 #endif 00096 00104 const ABA_STRING& operator=(const ABA_STRING &rhs); 00105 00109 const ABA_STRING& operator=(const char *rhs); 00110 00121 friend int operator==(const ABA_STRING &lhs, const ABA_STRING &rhs); 00122 00126 friend int operator==(const ABA_STRING &lhs, const char *rhs); 00127 00138 friend int operator!=(const ABA_STRING &lhs, const ABA_STRING &rhs); 00139 00143 friend int operator!=(const ABA_STRING &lhs, const char *rhs); 00144 00152 friend ostream& operator<<(ostream &out, const ABA_STRING &rhs); 00153 00166 char& operator[](int i); 00167 00171 const char& operator[](int i) const; 00172 00176 int size() const; 00177 00190 int ascii2int(int i = 0) const; 00191 00197 unsigned int ascii2unsignedint() const; 00198 00204 double ascii2double() const; 00205 00212 bool ascii2bool() const; 00213 00219 bool ending(const char *end) const; 00220 00224 char *string() const; 00225 00226 private: 00227 00235 void rangeCheck(int i) const; 00236 00239 ABA_GLOBAL *glob_; 00240 00244 char *string_; 00245 }; 00246 #endif // ABA_STRING_H 00247