Debian Codegraph @

Descent3/localization.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/localization.h $
21 * $Revision: 4 $
22 * $Date: 2/22/99 3:19p $
23 * $Author: Jeff $
24 *
25 * Localization system header
26 *
27 * $Log: /DescentIII/main/localization.h $
28 *
29 * 4 2/22/99 3:19p Jeff
30 * added function to get current language
31 *
32 * 3 2/11/99 10:35p Jeff
33 * added support for multiple languages in string table files
34 *
35 * 2 6/12/98 5:55p Jeff
36 * initial creation
37 *
38 * $NoKeywords: $
39 */
40
41 #ifndef __LOCALIZATION_H__
42 #define __LOCALIZATION_H__
43
44 #define LANGUAGE_ENGLISH 0
45 #define LANGUAGE_GERMAN 1
46 #define LANGUAGE_SPANISH 2
47 #define LANGUAGE_ITALIAN 3
48 #define LANGUAGE_FRENCH 4
49 void Localization_SetLanguage(int type);
50 int Localization_GetLanguage(void);
51
52 // Call this to load up the string tables into memory
53 // Returns the number of strings loaded, if this is 0, then the program MUST not continue
54 int LoadStringTables(void);
55
56 // Deallocates all the memory used for the string tables
57 void FreeStringTables(void);
58
59 // Returns a pointer to the string at the index location from the string table
60 // if it is a bad index given, then the pointer to the error string "ERROR MISSING STRING" is given
61 const char *GetStringFromTable(int index);
62
63 // Given a filename, pointer to a char * array and a pointer to an int,
64 // it will load the string table and fill in the information
65 // returns true on success
66 bool CreateStringTable(const char *filename, char ***table, int *size);
67 // Given a string table and it's count of strings, it will free up it's memory
68 void DestroyStringTable(char **table, int size);
69
70 // GrowString class
71 // handles a string of increasing size (using +,=,+=)
72 struct tbufferinfo {
73 char *string_data;
74 tbufferinfo *next;
75 };
76
77 class GrowString {
78 public:
79 GrowString();
80 ~GrowString();
81 void Destroy(void);
82 void operator+=(char *str);
83 GrowString operator+(char *str);
84 GrowString operator+(GrowString &gs);
85 void operator+=(GrowString &gs);
86 void operator=(char *str);
87 void operator=(GrowString &gs);
88 void GetString(char **str);
89 int Length(void);
90
91 private:
92 tbufferinfo root;
93 tbufferinfo *curr;
94 };
95
96 #endif