ScummVM API documentation
String.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_STRING_H
29 #define HPL_STRING_H
30 
31 #include "hpl1/engine/system/SystemTypes.h"
32 
33 #include "hpl1/engine/graphics/GraphicsTypes.h"
34 #include "hpl1/engine/math/MathTypes.h"
35 
36 namespace hpl {
37 
38 class cString {
39 public:
43  static tWString To16Char(const tString &asString);
44 
48  static tString To8Char(const tWString &awsString);
49 
53  static tWString Get16BitFromArray(const tString &asArray);
54 
62  static tString Sub(const tString &asString, int alStart, int alCount = -1);
63  static tWString SubW(const tWString &asString, int alStart, int alCount = -1);
69  static tString GetFileExt(const tString &aString);
70  static tWString GetFileExtW(const tWString &aString);
77  static tString SetFileExt(tString aString, tString aExt);
78  static tWString SetFileExtW(tWString aString, tWString aExt);
79 
85  static tString GetFileName(const tString &aString);
86  static tWString GetFileNameW(const tWString &aString);
92  static tString GetFilePath(const tString &aString);
93  static tWString GetFilePathW(const tWString &aString);
100  static tString SetFilePath(const tString &aString, tString aPath);
101  static tWString SetFilePathW(tWString aString, tWString aPath);
107  static tString ToLowerCase(tString aString);
108  static tWString ToLowerCaseW(tWString aString);
109 
117  static tString ReplaceCharTo(tString aString, const tString &asOldChar, const tString &asNewChar);
118  static tWString ReplaceCharToW(tWString aString, const tWString &asOldChar, const tWString &asNewChar);
119 
127  static tString ReplaceStringTo(const tString &aString, const tString &asOldString, const tString &asNewString);
128 
129  static tString ToString(const char *asString, const tString &asDefault);
130  static int ToInt(const char *asString, int alDefault);
131  static bool ToBool(const char *asString, bool abDefault);
132  static float ToFloat(const char *asString, float afDefault);
133  static cColor ToColor(const char *asString, const cColor &aDefault);
134  static cVector2f ToVector2f(const char *asString, const cVector2f &avDefault);
135  static cVector3f ToVector3f(const char *asString, const cVector3f &avDefault);
136  static cVector2l ToVector2l(const char *asString, const cVector2l &avDefault);
137  static cVector3l ToVector3l(const char *asString, const cVector3l &avDefault);
138  static cMatrixf ToMatrixf(const char *asString, const cMatrixf &a_mtxDefault);
139 
140  static tString ToString(int alX);
141  static tString ToString(float afX);
142 
143  static tWString ToStringW(int alX);
144  static tWString ToStringW(float afX);
145 
153  static tIntVec &GetIntVec(const tString &asData, tIntVec &avVec, tString *apSeparators = NULL);
154 
162  static tUIntVec &GetUIntVec(const tString &asData, tUIntVec &avVec, tString *apSeparators = NULL);
163 
171  static tFloatVec &GetFloatVec(const tString &asData, tFloatVec &avVec, tString *apSeparators = NULL);
172 
180  static tStringVec &GetStringVec(const tString &asData, tStringVec &avVec, tString *apSeparators = NULL);
181 
187  static tString GetLastChar(const tString &aString);
188  static tWString GetLastCharW(const tWString &aString);
195  static int GetLastStringPos(const tString &aString, const tString &aChar);
196  static int GetLastStringPosW(const tWString &aString, const tWString &aChar);
197 
198  static void UIntStringToArray(unsigned int *apArray, const char *apString, int alSize);
199  static void FloatStringToArray(float *apArray, const char *apString, int alSize);
200 
201 private:
202 };
203 
204 } // namespace hpl
205 
206 #endif // HPL_STRING_H
static tString GetFileExt(const tString &aString)
Definition: AI.h:36
static tIntVec & GetIntVec(const tString &asData, tIntVec &avVec, tString *apSeparators=NULL)
static tString SetFilePath(const tString &aString, tString aPath)
Definition: str.h:59
static tString ToLowerCase(tString aString)
static tString SetFileExt(tString aString, tString aExt)
static int GetLastStringPos(const tString &aString, const tString &aChar)
static tString GetFilePath(const tString &aString)
static tWString Get16BitFromArray(const tString &asArray)
static tString ReplaceStringTo(const tString &aString, const tString &asOldString, const tString &asNewString)
static tFloatVec & GetFloatVec(const tString &asData, tFloatVec &avVec, tString *apSeparators=NULL)
static tString GetFileName(const tString &aString)
Definition: ustr.h:57
Definition: String.h:38
static tString Sub(const tString &asString, int alStart, int alCount=-1)
static tString To8Char(const tWString &awsString)
static tString GetLastChar(const tString &aString)
static tStringVec & GetStringVec(const tString &asData, tStringVec &avVec, tString *apSeparators=NULL)
static tString ReplaceCharTo(tString aString, const tString &asOldChar, const tString &asNewChar)
static tWString To16Char(const tString &asString)
Definition: Color.h:37
static tUIntVec & GetUIntVec(const tString &asData, tUIntVec &avVec, tString *apSeparators=NULL)