| 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__cxx . . $ `Descent3/localization.h:42:9`! |
| 43 | |
| 44 | #define LANGUAGE_ENGLISHcxx . . $ `Descent3/localization.h:44:9`! 0 |
| 45 | #define LANGUAGE_GERMANcxx . . $ `Descent3/localization.h:45:9`! 1 |
| 46 | #define LANGUAGE_SPANISHcxx . . $ `Descent3/localization.h:46:9`! 2 |
| 47 | #define LANGUAGE_ITALIANcxx . . $ `Descent3/localization.h:47:9`! 3 |
| 48 | #define LANGUAGE_FRENCHcxx . . $ `Descent3/localization.h:48:9`! 4 |
| 49 | void Localization_SetLanguagecxx . . $ Localization_SetLanguage(d4f767463ce0a6b3).(int type); |
| 50 | int Localization_GetLanguagecxx . . $ Localization_GetLanguage(b126dc7c1de90089).(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 LoadStringTablescxx . . $ LoadStringTables(b126dc7c1de90089).(void); |
| 55 | |
| 56 | // Deallocates all the memory used for the string tables |
| 57 | void FreeStringTablescxx . . $ FreeStringTables(49f6e7a06ebc5aa8).(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 *GetStringFromTablecxx . . $ GetStringFromTable(f7ae7e56280f18ae).(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 CreateStringTablecxx . . $ CreateStringTable(c1b497ce97e7b78).(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 DestroyStringTablecxx . . $ DestroyStringTable(a50bc8ce1fe710a2).(char **table, int size); |
| 69 | |
| 70 | // GrowString class |
| 71 | // handles a string of increasing size (using +,=,+=) |
| 72 | struct tbufferinfocxx . . $ tbufferinfo# { |
| 73 | char *string_datacxx . . $ tbufferinfo#string_data.; |
| 74 | tbufferinfocxx . . $ tbufferinfo# *nextcxx . . $ tbufferinfo#next.; |
| 75 | }; |
| 76 | |
| 77 | class GrowStringcxx . . $ GrowString# { |
| 78 | public: |
| 79 | GrowStringcxx . . $ GrowString#GrowString(49f6e7a06ebc5aa8).(); |
| 80 | ~cxx . . $ GrowString#`~GrowString`(49f6e7a06ebc5aa8).GrowStringcxx . . $ GrowString#(); |
| 81 | void Destroycxx . . $ GrowString#Destroy(49f6e7a06ebc5aa8).(void); |
| 82 | void operatorcxx . . $ GrowString#`operator+=`(fda57c8427c60377).+=(char *str); |
| 83 | GrowStringcxx . . $ GrowString# operatorcxx . . $ GrowString#operator+(cfed376955f0f75f).+(char *str); |
| 84 | GrowStringcxx . . $ GrowString# operatorcxx . . $ GrowString#operator+(40432a41a67ae3e9).+(GrowStringcxx . . $ GrowString# &gs); |
| 85 | void operatorcxx . . $ GrowString#`operator+=`(a92de8bf1fe4f3e2).+=(GrowStringcxx . . $ GrowString# &gs); |
| 86 | void operatorcxx . . $ GrowString#`operator=`(fda57c8427c60377).=(char *str); |
| 87 | void operatorcxx . . $ GrowString#`operator=`(a92de8bf1fe4f3e2).=(GrowStringcxx . . $ GrowString# &gs); |
| 88 | void GetStringcxx . . $ GrowString#GetString(3ed91490e421178f).(char **str); |
| 89 | int Lengthcxx . . $ GrowString#Length(b126dc7c1de90089).(void); |
| 90 | |
| 91 | private: |
| 92 | tbufferinfocxx . . $ tbufferinfo# rootcxx . . $ GrowString#root.; |
| 93 | tbufferinfocxx . . $ tbufferinfo# *currcxx . . $ GrowString#curr.; |
| 94 | }; |
| 95 | |
| 96 | #endif |