Jungo WinDriver  
Official Documentation
cstring.h
Go to the documentation of this file.
1 /* @JUNGO_COPYRIGHT@ */
2 
3 #ifndef _CSTRING_H_
4 #define _CSTRING_H_
5 
6 #include <stdarg.h>
7 
8 typedef const char* PCSTR;
9 class CCString
10 {
11 public:
12  // Constructors
14  CCString(const CCString& stringSrc);
15  CCString(PCSTR pcwStr);
16 
17  virtual ~CCString();
18 
19  operator PCSTR() const;
20  operator char *() const;
21 
22  // MFC compatibility functions
23  // overloaded assignment
24  const int operator==(const CCString& s);
25  const int operator==(const char *s);
26  const int operator!=(const CCString& s);
27  const int operator!=(const char *s);
28  const CCString& operator=(const CCString& s);
30  const CCString& operator+=(const PCSTR s);
31  const CCString& cat_printf(const PCSTR format, ...);
32  char& operator[](int i);
33  int Compare(PCSTR s);
35  const int operator!=(char *s);
36  void MakeUpper();
37  void MakeLower();
38 
39  // sub-string extraction
40  CCString Mid(int nFirst, int nCount);
41  CCString Mid(int nFirst);
42 
44  CCString StrReplace(PCSTR str, PCSTR new_str);
45 
46  int Length() const;
48  bool is_empty();
49  char *m_str; // The String itself
50 
51  void Format(const PCSTR format, ...);
52  int IsAllocOK();
53  int GetBuffer(unsigned long size);
54 
55  // ANSI C compatibility functions
56  int strcmp(const PCSTR s);
57  int stricmp(const PCSTR s);
58  void sprintf(const PCSTR format, ...);
59  void toupper();
60  void tolower();
61  CCString tolower_copy(void) const;
62  CCString toupper_copy(void) const;
63  int find_first(char c) const;
64  int find_last(char c) const;
65  CCString substr(int start, int end) const;
66  CCString trim(int index) const;
67 
68 protected:
69  void Init();
70  void vsprintf(const PCSTR format, va_list ap);
72 };
73 
74 const CCString operator+(const CCString &str1, const CCString &str2);
75 
76 #if !defined(WIN32)
77  int stricmp(PCSTR str1, PCSTR str2);
78 #endif
79 
80 #endif /* _CSTRING_H_ */
81 
int Compare(PCSTR s)
char * m_str
Definition: cstring.h:49
CCString substr(int start, int end) const
void sprintf(const PCSTR format,...)
void Init()
CCString Mid(int nFirst)
CCString StrReplace(PCSTR str, PCSTR new_str)
const CCString & operator+=(const PCSTR s)
void toupper()
const CCString & operator=(PCSTR s)
int find_last(char c) const
void Format(const PCSTR format,...)
const CCString & operator=(const CCString &s)
const CCString & cat_printf(const PCSTR format,...)
void MakeLower()
int strcmp(const PCSTR s)
void MakeUpper()
int CompareNoCase(PCSTR s)
CCString(PCSTR pcwStr)
CCString(const CCString &stringSrc)
const int operator!=(const char *s)
int stricmp(const PCSTR s)
virtual ~CCString()
bool contains(PCSTR substr)
int find_first(char c) const
const int operator==(const char *s)
CCString trim(int index) const
const int operator!=(const CCString &s)
char & operator[](int i)
int GetBuffer(unsigned long size)
bool is_empty()
void vsprintf(const PCSTR format, va_list ap)
CCString StrRemove(PCSTR str)
int IsAllocOK()
void tolower()
int Length() const
CCString Mid(int nFirst, int nCount)
CCString tolower_copy(void) const
const int operator!=(char *s)
const int operator==(const CCString &s)
int m_buf_size
Definition: cstring.h:71
CCString toupper_copy(void) const
const char * PCSTR
Definition: cstring.h:8
int stricmp(PCSTR str1, PCSTR str2)
const CCString operator+(const CCString &str1, const CCString &str2)