00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef skASCIISTRING_H
00024 #define skASCIISTRING_H
00025
00026 #include "skGeneral.h"
00027
00028 #ifdef STREAMS_ENABLED
00029 #include <iostream.h>
00030 #endif
00031
00032
00033
00034 class P_AsciiString;
00035
00040 class CLASSEXPORT skAsciiString
00041 {
00042 public:
00046 skAsciiString();
00050 skAsciiString(const char *);
00054 skAsciiString(const skAsciiString&);
00060 skAsciiString(const char * buffer, USize len);
00066 skAsciiString(const char repeatchar, USize len);
00070 virtual ~skAsciiString();
00074 skAsciiString& operator=(const skAsciiString&);
00078 skAsciiString& operator=(const char *);
00083 bool operator<(const skAsciiString&) const;
00088 bool operator==(const skAsciiString&) const;
00093 bool operator==(const char *) const;
00098 bool operator!=(const skAsciiString&) const;
00103 bool operator!=(const char *) const;
00108 operator const char * () const;
00113 bool equalsIgnoreCase(const skAsciiString&) const;
00117 USize hash() const;
00123 char at(USize index) const;
00130 skAsciiString substr(USize start,USize length) const;
00136 skAsciiString substr(USize start) const;
00141 skAsciiString operator+(const skAsciiString&) const ;
00146 skAsciiString& operator+=(const skAsciiString&);
00151 USize length() const;
00156 int indexOf(const skAsciiString& s) const;
00161 int indexOf(char c) const;
00166 int indexOfLast(char c) const;
00170 int to() const;
00171 #ifdef USE_FLOATING_POINT
00172
00175 float toFloat() const;
00176 #endif
00177
00180 static skAsciiString literal(const char *);
00184 static skAsciiString from(int);
00188 static skAsciiString from(USize);
00189 #ifdef USE_FLOATING_POINT
00190
00193 static skAsciiString from(float);
00194 #endif
00195
00198 static skAsciiString from(char ch);
00202 static skAsciiString fromBuffer(char * buffer);
00206 skAsciiString ltrim() const;
00207 protected:
00211 skAsciiString(P_AsciiString *);
00215 skAsciiString(const char * s,int);
00219 void assign(const char *,int len=0);
00223 void deRef();
00227 P_AsciiString * pimp;
00228 };
00229
00230
00231
00232 inline USize hashKey(const skAsciiString * s)
00233 {
00234 return s->hash();
00235 }
00236
00237
00238
00239 CLASSEXPORT skAsciiString operator+(const char * s1,const skAsciiString& s2);
00240
00241 #ifdef STREAMS_ENABLED
00242
00243
00244
00245 CLASSEXPORT ostream& operator<<(ostream&,const skAsciiString&s);
00246 #endif
00247
00248 #include "skAsciiString.inl"
00249
00250 #endif
00251
00252
00253