String.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2011, SRI International (R)
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #ifndef __OpenKarto_String_h__
21 #define __OpenKarto_String_h__
22 
23 #include <stdio.h>
24 #include <ostream>
25 #include <sstream>
26 
27 #include <OpenKarto/Macros.h>
28 #include <OpenKarto/Types.h>
29 
30 namespace karto
31 {
32 
34 
35 
39 
40 #ifdef _DEBUG
41  struct StringPrivate
42  {
43  std::string m_String;
44  };
45 #else
46  struct StringPrivate;
47 #endif
48 
53  {
54  public:
58  String();
59 
64  String(char c);
65 
70  String(const char* pString);
71 
77  String(const char* pString, kt_int32u size);
78 
82  String(const String& rOther);
83 
87  virtual ~String();
88 
89  public:
94  void Append(const String& rString);
95 
100  const char* ToCString() const;
101 
106  kt_size_t Size() const;
107 
111  void Clear();
112 
118  String SubString(kt_size_t index) const;
119 
126  String SubString(kt_size_t index, kt_size_t length) const;
127 
133  kt_size_t Find(const String& rValue) const;
134 
140  kt_size_t FindFirstOf(const String& rValue) const;
141 
147  kt_size_t FindLastOf(const String& rValue) const;
148 
153  static String NewLine();
154 
160  void Erase(kt_size_t index, kt_size_t length);
161 
162  public:
168  int operator[](kt_int32u index) const;
169 
173  String& operator=(const String& rOther);
174 
178  kt_bool operator==(const String& rOther) const;
179 
183  kt_bool operator!=(const String& rOther) const;
184 
188  kt_bool operator<(const String& rOther) const;
189 
193  kt_bool operator>(const String& rOther) const;
194 
198  String operator+(const String& rOther);
199 
203  String operator+(const char* pChar);
204 
211  friend String operator+(const char* pChar, const String& rOther)
212  {
213  String string(pChar);
214  string.Append(rOther);
215  return string;
216  }
217 
224  friend String operator+(const String& rOther1, const String& rOther2)
225  {
226  String string;
227  string.Append(rOther1);
228  string.Append(rOther2);
229  return string;
230  }
231 
235  friend KARTO_FORCEINLINE std::ostream& operator << (std::ostream& rStream, const String& rString)
236  {
237  rStream << rString.ToCString();
238  return rStream;
239  }
240 
241  private:
243  }; // class String
244 
246 
247 }
248 
249 #endif // __OpenKarto_String_h__
void Append(const String &rString)
Definition: String.cpp:82
bool kt_bool
Definition: Types.h:145
std::size_t kt_size_t
Definition: Types.h:138
std::string m_String
Definition: String.cpp:34
TFSIMD_FORCE_INLINE bool operator==(const Matrix3x3 &m1, const Matrix3x3 &m2)
#define KARTO_EXPORT
Definition: Macros.h:78
friend String operator+(const String &rOther1, const String &rOther2)
Definition: String.h:224
friend String operator+(const char *pChar, const String &rOther)
Definition: String.h:211
StringPrivate * m_pStringPrivate
Definition: String.h:242
bool operator<(const CellData &a, const CellData &b)
#define KARTO_FORCEINLINE
Definition: Macros.h:56
uint32_t kt_int32u
Definition: Types.h:111
TFSIMD_FORCE_INLINE bool operator!=(const Vector3 &other) const
Append
TFSIMD_FORCE_INLINE Vector3 operator+(const Vector3 &v1, const Vector3 &v2)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
Definition: Any.cpp:20
const char * ToCString() const
Definition: String.cpp:72


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Tue Nov 7 2017 06:02:36