ScummVM API documentation
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 #ifndef KYRA_UTIL_H
23 #define KYRA_UTIL_H
24 
25 #include "common/language.h"
26 #include "common/path.h"
27 #include "common/scummsys.h"
28 #include "common/str.h"
29 
30 namespace Kyra {
31 
32 class Util {
33 public:
34  static int decodeString1(const char *src, char *dst);
35  static void decodeString2(const char *src, char *dst);
36  static Common::String decodeString1(const Common::String &src);
37  static Common::String decodeString2(const Common::String &src);
38 
39  static void convertString_KYRAtoGUI(char *str, int bufferSize, Common::CodePage srcCP = Common::kDos850);
40  static void convertString_GUItoKYRA(char *str, int bufferSize, Common::CodePage dstCP = Common::kDos850);
41  static Common::String convertString_GUItoKYRA(Common::String &str, Common::CodePage dstCP = Common::kDos850);
42  static Common::String convertISOToUTF8(Common::String &str);
43  static void convertISOToDOS(char &c);
44 
45  static uint16 convertDOSToJohab(char c, uint8 *mergeFlags = 0);
46  // This method does not only need a ref to the new character, but also to the one before that, since
47  // both of these will be used to calculate the output and also both of these may get modfied. The
48  // reset parameter will reset the internal merge state (useful when the build-up process is broken,
49  // e. g. when typing a one-byte character, like a digit).
50  static void mergeUpdateJohabChars(uint16 &destJohabChar0, uint16 &destJohabChar1, char asciiInput, bool reset);
51 
52  static Common::Path findMacResourceFile(const char *baseName, const char *suffix = "");
53 
54 private:
55  struct DOS2JOHABEntry {
56  char key;
57  uint16 johabChar;
58  uint8 flags;
59  };
60 
61  static const DOS2JOHABEntry _johabConvTable[52];
62 };
63 
64 } // End of namespace Kyra
65 
66 #endif
Definition: str.h:59
Definition: path.h:52
Definition: double_serialization.h:36
Definition: detection.h:27