nw::kernel::Strings

struct Strings : public nw::kernel::Service

Public Functions

Strings(MemoryResource *memory)
virtual ~Strings() = default
virtual void initialize(ServiceInitTime time) override

Initializes strings system.

String get(const LocString &locstring, bool feminine = false) const

Gets string by LocString

Note

if Tlk strref, use that; if not look in localized strings

String get(uint32_t strref, bool feminine = false) const

Gets string by Tlk strref.

InternedString get_interned(StringView str) const

Gets interned string

Note

Return will not be valid if there is no interned string

InternedString intern(StringView str)

Interns a string

Note

Multiple calls to intern with the same string will and must return the same exact underlying string, such that equality can be determined by a comparison of pointers.

InternedString intern(uint32_t strref)

Interns a string by strref

Note

Multiple calls to intern with the same string will and must return the same exact underlying string, such that equality can be determined by a comparison of pointers.

void load_custom_tlk(const std::filesystem::path &path)

Loads a modules custom Tlk and feminine version if available.

void load_dialog_tlk(const std::filesystem::path &path)

Loads a dialog Tlk and feminine version if available.

nw::MemoryPool *pool() noexcept

Gets the global string memory pool.

LanguageID global_language() const noexcept

Gets the language ID that is considered ‘default’

Note

This determines the character encoding of strings as they are stored in game resources, TLK, GFF, etc. In EE the only encoding that isn’t CP1252 is Polish, so generally safe to not worry too much.

void set_global_language(LanguageID language) noexcept

Sets the language ID that is considered ‘default’.

virtual nlohmann::json stats() const override

Log service stats, if the service wants.

void unload_custom_tlk()

Unloads a modules custom Tlk and feminine version if available.

MemoryResource *allocator() const noexcept

Gets the memory allocator for the servce.

Public Static Attributes

static const std::type_index type_index = {typeid(Strings)}