OpenTTD Source 20250428-master-ga5578166bb
|
Information about the currently known strings. More...
#include <strgen.h>
Public Member Functions | |
StringData (size_t tabs) | |
Create a new string data container. | |
void | FreeTranslation () |
Free all data related to the translation. | |
void | Add (std::shared_ptr< LangString > ls) |
Add a newly created LangString. | |
LangString * | Find (std::string_view s) |
Find a LangString based on the string name. | |
uint32_t | Version () const |
Make a hash of the file to get a unique "version number". | |
size_t | CountInUse (size_t tab) const |
Count the number of tab elements that are in use. | |
Data Fields | |
std::vector< std::shared_ptr< LangString > > | strings |
List of all known strings. | |
std::unordered_map< std::string, std::shared_ptr< LangString >, StringHash, std::equal_to<> > | name_to_string |
Lookup table for the strings. | |
size_t | tabs |
The number of 'tabs' of strings. | |
size_t | max_strings |
The maximum number of strings. | |
size_t | next_string_id |
The next string ID to allocate. | |
StringData::StringData | ( | size_t | tabs | ) |
Create a new string data container.
tabs | The maximum number of strings. |
Definition at line 72 of file strgen_base.cpp.
References max_strings, next_string_id, and strings.
void StringData::Add | ( | std::shared_ptr< LangString > | ls | ) |
Add a newly created LangString.
s | The name of the string. |
ls | The string to add. |
Definition at line 92 of file strgen_base.cpp.
References name_to_string, and strings.
size_t StringData::CountInUse | ( | size_t | tab | ) | const |
Count the number of tab elements that are in use.
tab | The tab to count the elements of. |
Definition at line 160 of file strgen_base.cpp.
References strings, and TAB_SIZE.
Referenced by LanguageWriter::WriteLang().
LangString * StringData::Find | ( | std::string_view | s | ) |
Find a LangString based on the string name.
s | The string name to search on. |
Definition at line 103 of file strgen_base.cpp.
References name_to_string.
void StringData::FreeTranslation | ( | ) |
Free all data related to the translation.
Definition at line 79 of file strgen_base.cpp.
References LangString::FreeTranslation(), max_strings, and strings.
Referenced by GameStrings::Compile().
uint32_t StringData::Version | ( | ) | const |
Make a hash of the file to get a unique "version number".
Definition at line 130 of file strgen_base.cpp.
References DontCount, LangString::english, max_strings, LangString::name, strings, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and VersionHashStr().
Referenced by GameStrings::Compile(), HeaderFileWriter::Finalise(), and LanguageWriter::WriteLang().
size_t StringData::max_strings |
The maximum number of strings.
Definition at line 47 of file strgen.h.
Referenced by FreeTranslation(), StringReader::ParseFile(), StringData(), Version(), and HeaderWriter::WriteHeader().
std::unordered_map<std::string, std::shared_ptr<LangString>, StringHash, std::equal_to<> > StringData::name_to_string |
size_t StringData::next_string_id |
The next string ID to allocate.
Definition at line 48 of file strgen.h.
Referenced by FileStringReader::HandlePragma(), StringReader::ParseFile(), and StringData().
std::vector<std::shared_ptr<LangString> > StringData::strings |
List of all known strings.
Definition at line 44 of file strgen.h.
Referenced by Add(), CountInUse(), FreeTranslation(), StringData(), Version(), HeaderWriter::WriteHeader(), and LanguageWriter::WriteLang().
size_t StringData::tabs |
The number of 'tabs' of strings.
Definition at line 46 of file strgen.h.
Referenced by LanguageWriter::WriteLang().