StringTable cleanup and improvements
cleaned up function interface to avoid referencing the file system in the worker functions. replaced StringTable's operators with functions.. The main reason is that these are far easier to look up when browsing the source. This also fixes a premature translation in SBARINFO that was done in the parsing stage, not the printing stage.
This commit is contained in:
parent
f4a42dae1d
commit
ebd4ebf298
50 changed files with 245 additions and 246 deletions
|
|
@ -95,20 +95,15 @@ public:
|
|||
|
||||
const char *GetLanguageString(const char *name, uint32_t langtable, int gender = -1) const;
|
||||
bool MatchDefaultString(const char *name, const char *content) const;
|
||||
const char *GetString(const char *name, uint32_t *langtable, int gender = -1) const;
|
||||
const char *operator() (const char *name) const; // Never returns NULL
|
||||
const char* operator() (const FString& name) const { return operator()(name.GetChars()); }
|
||||
const char *operator[] (const char *name) const
|
||||
{
|
||||
return GetString(name, nullptr);
|
||||
}
|
||||
const char *CheckString(const char *name, uint32_t *langtable = nullptr, int gender = -1) const;
|
||||
const char* GetString(const char* name) const;
|
||||
const char* GetString(const FString& name) const { return GetString(name.GetChars()); }
|
||||
bool exists(const char *name);
|
||||
|
||||
void InsertString(int lumpnum, int langid, FName label, const FString& string);
|
||||
void InsertString(int filenum, int langid, FName label, const FString& string);
|
||||
|
||||
private:
|
||||
|
||||
FileSys::FileSystem* fileSystem;
|
||||
FString activeLanguage;
|
||||
StringMacroMap allMacros;
|
||||
LangMap allStrings;
|
||||
|
|
@ -116,11 +111,11 @@ private:
|
|||
|
||||
void LoadLanguage (int lumpnum, const char* buffer, size_t size);
|
||||
TArray<TArray<FString>> parseCSV(const char* buffer, size_t size);
|
||||
bool ParseLanguageCSV(int lumpnum, const char* buffer, size_t size);
|
||||
bool ParseLanguageCSV(int filenum, const char* buffer, size_t size);
|
||||
|
||||
bool readMacros(int lumpnum);
|
||||
bool readMacros(const char* buffer, size_t size);
|
||||
void DeleteString(int langid, FName label);
|
||||
void DeleteForLabel(int lumpnum, FName label);
|
||||
void DeleteForLabel(int filenum, FName label);
|
||||
|
||||
static size_t ProcessEscapes (char *str);
|
||||
public:
|
||||
|
|
@ -138,7 +133,7 @@ public:
|
|||
|
||||
const char* localize(const char* str)
|
||||
{
|
||||
return *str == '$' ? operator()(str + 1) : str;
|
||||
return *str == '$' ? GetString(str + 1) : str;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue