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#ifndef TITANIC_STRING_H
23#define TITANIC_STRING_H
24
25#include "common/scummsys.h"
26#include "common/array.h"
27#include "common/str.h"
28
29namespace Titanic {
30
31enum FileType {
32 FILETYPE_UNKNOWN = 0, FILETYPE_IMAGE = 1, FILETYPE_MOVIE = 2,
33 FILETYPE_WAV = 3, FILETYPE_DLG = 4
34};
35
36enum ImageType {
37 IMAGETYPE_UNKNOWN = 0, IMAGETYPE_TARGA = 1, IMAGETYPE_JPEG = 2
38};
39
40class CString : public Common::String {
41public:
42 CString() : Common::String() {}
43 CString(const char *str) : Common::String(str) {}
44 CString(const char *str, uint32 len) : Common::String(str, len) {}
45 CString(const char *beginP, const char *endP) : Common::String(beginP, endP) {}
46 CString(const String &str) : Common::String(str) {}
47 CString(char c, uint32 len);
48 explicit CString(char c) : Common::String(c) {}
49 explicit CString(int val);
50
51 bool operator==(const CString &x) const;
52 bool operator==(const char *x) const;
53 bool operator!=(const CString &x) const;
54 bool operator!=(const char *x) const;
55
59 CString left(uint count) const;
60
64 CString right(uint count) const;
65
69 CString mid(uint start, uint count) const;
70
74 CString mid(uint start) const;
75
80 CString deleteRight(uint count) const;
81
85 int indexOf(char c) const;
86
90 int indexOf(const char *s) const;
91
95 int lastIndexOf(char c) const;
96
100 bool containsIgnoreCase(const CString &str) const;
101
105 FileType fileTypeSuffix() const;
106
110 ImageType imageTypeSuffix() const;
111
115 int readInt() const {
116 return atoi(c_str());
117 }
118
122 static CString format(const char *fmt, ...);
123};
124
126
127} // End of namespace Titanic
128
129#endif /* TITANIC_STRING_H */
Definition: str.h:59
constexpr String()
Definition: str.h:69
Definition: string.h:40
CString left(uint count) const
int indexOf(const char *s) const
CString right(uint count) const
int indexOf(char c) const
static CString format(const char *fmt,...)
FileType fileTypeSuffix() const
ImageType imageTypeSuffix() const
CString mid(uint start, uint count) const
CString mid(uint start) const
int lastIndexOf(char c) const
bool containsIgnoreCase(const CString &str) const
int readInt() const
Definition: string.h:115
CString deleteRight(uint count) const
Array< String > StringArray
Definition: str-array.h:43