ScummVM API documentation
string_util.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  * This file is based on WME Lite.
24  * http://dead-code.org/redir.php?target=wmelite
25  * Copyright (c) 2011 Jan Nedoma
26  */
27 
28 #ifndef WINTERMUTE_STRINGUTIL_H
29 #define WINTERMUTE_STRINGUTIL_H
30 
31 #include "engines/wintermute/dctypes.h"
32 
33 namespace Wintermute {
34 
35 class StringUtil {
36 public:
37  static bool compareNoCase(const AnsiString &str1, const AnsiString &str2);
38  //static bool compareNoCase(const WideString &str1, const WideString &str2);
39  static WideString utf8ToWide(const Utf8String &Utf8Str);
40  static Utf8String wideToUtf8(const WideString &WideStr);
41  static WideString ansiToWide(const AnsiString &str, TTextCharset charset = CHARSET_ANSI);
42  static AnsiString wideToAnsi(const WideString &str, TTextCharset charset = CHARSET_ANSI);
43 
44  static bool isUtf8BOM(const byte *buffer, uint32 bufferSize);
45  static int indexOf(const WideString &str, const WideString &toFind, size_t startFrom);
46 
47  static Common::String encodeSetting(const Common::String &str);
48  static Common::String decodeSetting(const Common::String &str);
49 
50  static AnsiString toString(int val);
51 
52 private:
53  static Common::CodePage mapCodePage(TTextCharset charset);
54 };
55 
56 } // End of namespace Wintermute
57 
58 #endif
Definition: str.h:59
Definition: ustr.h:57
Definition: string_util.h:35
Definition: achievements_tables.h:27