00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef VDKSTRING_H
00028 #define VDKSTRING_H
00029
00030 #define MAXPRINTFLEN 65535 // max size for Sprintf and Concatf buffer
00031 #define INT_DATE 0 // for FormatDate
00032 #define ENG_DATE 1
00033 #define EUR_DATE 2
00034
00035 struct STRING
00036 {
00037 char* s;
00038 unsigned int ref ;
00039 };
00040
00045 class VDKString
00046 {
00047 protected:
00048 STRING* p;
00049 public:
00056 VDKString();
00065 VDKString (const char*s);
00074 VDKString (const char& c);
00084 VDKString(const VDKString& s);
00085
00096 VDKString& operator= (const VDKString& s);
00097
00106 VDKString& operator= (const char* s);
00107
00111 ~VDKString();
00116 operator char*() { return p->s; }
00117
00121 int operator == (const VDKString& s) const ;
00125 int operator <( const VDKString& s) const ;
00129 int operator>(const VDKString& s) const ;
00133 int operator <=(const VDKString& s) const ;
00137 int operator >=(const VDKString& s) const ;
00141 int operator !=(const VDKString& s) const ;
00150 VDKString& operator +=(const char* s);
00160 VDKString& operator +=(const VDKString& s);
00168 VDKString operator + (const char* s) const;
00169 friend VDKString operator + (const char* s, const VDKString& vdks);
00174 VDKString operator +(const VDKString& s) const;
00178 bool isNull() const;
00182 int size() const;
00186 char operator[](unsigned int ix) const;
00190 const char* c_str() const;
00197 VDKString& DelSelection(unsigned int begin, unsigned int len);
00202 VDKString& RTrim();
00207 VDKString& LTrim();
00212 VDKString& Trim();
00221 unsigned int CharCount(const char car) const;
00227 VDKString& UpperCase();
00232 VDKString& LowerCase();
00237 bool isEmpty() const;
00251 VDKString& Concatf(const char* format, ...);
00265 VDKString& Sprintf(const char* format, ...);
00278 VDKString& GetPart(unsigned int i, const char sep = '|');
00284 int GetFCharPos(const char car) const;
00290 int GetLCharPos(const char car) const;
00295 double StrtoDouble() const;
00300 int StrtoInt() const;
00307 VDKString& SubStr(unsigned int start, unsigned int len);
00313 VDKString& Cut(unsigned int len);
00320 VDKString& LPad(unsigned int len, const char car);
00327 VDKString& RPad(unsigned int len, const char car);
00338 VDKString& DoubleChar(const char car = '\'');
00359 VDKString& FormatDate(const char sep, int orig, int ret);
00360 };
00361
00362 #endif
00363
00364
00365
00366