vdk 2.4.0
vdkstring.h
1 /*
2 * ===========================
3 * VDK Visual Development Kit
4 * Version 1.2.3
5 * October 1998, August 2000
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 * 02111-130
25 */
26 
27 #ifndef VDKSTRING_H
28 #define VDKSTRING_H
29 
30 #define MAXPRINTFLEN 65535 // max size for Sprintf and Concatf buffer
31 #define INT_DATE 0 // for FormatDate
32 #define ENG_DATE 1
33 #define EUR_DATE 2
34 
35 struct STRING
36 {
37  char* s;
38  unsigned int ref ;
39 };
40 
45 class VDKString
46 {
47 protected:
48  STRING* p;
49 public:
56  VDKString();
65  VDKString (const char*s);
74  VDKString (const char& c);
84  VDKString(const VDKString& s);
85 
96  VDKString& operator= (const VDKString& s);
97 
106  VDKString& operator= (const char* s);
107 
111 ~VDKString();
116  operator char*() { return p->s; }
117 
121  int operator == (const VDKString& s) const ;
125  int operator <( const VDKString& s) const ;
129  int operator>(const VDKString& s) const ;
133  int operator <=(const VDKString& s) const ;
137  int operator >=(const VDKString& s) const ;
141  int operator !=(const VDKString& s) const ;
150  VDKString& operator +=(const char* s);
160  VDKString& operator +=(const VDKString& s);
168  VDKString operator + (const char* s) const;
169  friend VDKString operator + (const char* s, const VDKString& vdks);
174  VDKString operator +(const VDKString& s) const;
178  bool isNull() const;
182  int size() const;
186 char operator[](unsigned int ix) const;
190 const char* c_str() const;
197  VDKString& DelSelection(unsigned int begin, unsigned int len);
202  VDKString& RTrim();
207  VDKString& LTrim();
212  VDKString& Trim();
221  unsigned int CharCount(const char car) const;
227  VDKString& UpperCase();
232  VDKString& LowerCase();
237  bool isEmpty() const;
251  VDKString& Concatf(const char* format, ...);
265  VDKString& Sprintf(const char* format, ...);
278  VDKString& GetPart(unsigned int i, const char sep = '|');
284  int GetFCharPos(const char car) const;
290  int GetLCharPos(const char car) const;
295  double StrtoDouble() const;
300  int StrtoInt() const;
307  VDKString& SubStr(unsigned int start, unsigned int len);
313  VDKString& Cut(unsigned int len);
320  VDKString& LPad(unsigned int len, const char car);
327  VDKString& RPad(unsigned int len, const char car);
338  VDKString& DoubleChar(const char car = '\'');
359  VDKString& FormatDate(const char sep, int orig, int ret);
360 };
361 
362 #endif
363 
364 
365 
366 
Implements famous cont referenced string objects.
Definition: vdkstring.h:45