class HString

Inherits: IScriptExportable

String handle.

Provides a wrapper around an Unicode string, primarily for localization purposes.

Actual value for this string is looked up in a global string table based on the provided identifier string and currently active language. If such value doesn't exist then the identifier is used as is.

Use {0}, {1}, etc. in the string value for values that might change dynamically.

Public

Constructors

HString

explicit HString(const String &identifier, u32 stringTableId = 0)

Creates a new localized string with the specified identifier.

If the identifier doesn't previously exist in the string table, identifier value will also be used for initializing the default language version of the string.

identifier
String you can use for later referencing the localized string.
stringTableId
Unique identifier of the string table to retrieve the string from.

HString

explicit HString(const String &identifier, const String &defaultString, u32 stringTableId = 0)

Creates a new localized string with the specified identifier and sets the default language version of the string.

If a string with that identifier already exists default language string will be updated.

identifier
String you can use for later referencing the localized string.
defaultString
Default string to assign to the specified identifier. Language to which it will be assigned depends on the StringTable::DEFAULT_LANGUAGE value.
stringTableId
Unique identifier of the string table to retrieve the string from.

HString

HString(u32 stringTableId)

Creates a new empty localized string.

stringTableId
Unique identifier of the string table to retrieve the string from.

HString

HString()

Creates a new empty localized string.

HString

HString(const HString &copy)

Methods

~HString

~HString() noexcept

GetValue

const String &GetValue() const

SetParameter

void SetParameter(u32 index, const String &value)

Sets a value of a string parameter.

Parameters are specified as bracketed values within the string itself (for example {0}, {1}) etc. Use ^ as an escape character.

index
Index of the parameter to set.
value
Value to assign to the parameter.

staticDummy

static const HString &Dummy()

Returns an empty string.

Operators

operator=

HString &operator=(const HString &rhs)

operator const std::basic_string<char, std::char_traits<char>, b3d::StdAlloc<char> > &

explicit operator const String &() const

Private

Fields

mStringData

SPtr<LocalizedStringData> mStringData

mParameters

String * mParameters

mIsDirty

bool mIsDirty

mCachedString

String mCachedString

mStringPtr

String * mStringPtr