inilike.common

Common functions for dealing with entries in ini-like file.

Members

Functions

chooseLocalizedValue
auto chooseLocalizedValue(String locale, String firstLocale, String firstValue, String secondLocale, String secondValue)

Choose the better localized value matching to locale between two localized values. The "goodness" is determined using algorithm described in Localized values for keys.

doUnescape
auto doUnescape(inout(char)[] value, Tuple!(char, char)[] pairs)
Undocumented in source. Be warned that the author may not have intended to support it.
escapeValue
String escapeValue(String value)

Escapes string by replacing special symbols with escaped sequences. These symbols are: '\\' (backslash), '\n' (newline), '\r' (carriage return) and '\t' (tab). Note: Currently the library stores values as they were loaded from file, i.e. escaped. To keep things consistent you should take care about escaping the value before inserting. The library will not do it for you.

isBoolean
bool isBoolean(const(char)[] value)

Check if the entry value can be interpreted as boolean value.

isComment
bool isComment(const(char)[] s)

Test whether the string s represents a comment.

isFalse
bool isFalse(const(char)[] value)

Test whether the entry value represents false

isGroupHeader
bool isGroupHeader(const(char)[] s)

Test whether the string s represents a group header. Note: "[]" is not considered as valid group header.

isTrue
bool isTrue(const(char)[] value)

Test whether the entry value represents true

isValidKey
bool isValidKey(String key)

Test whether the string is valid key. Only the characters A-Za-z0-9- may be used in key names. See Basic format of the file Note: this function automatically separate key from locale. It does not check validity of the locale itself.

keyValueTuple
auto keyValueTuple(String key, String value)
Undocumented in source. Be warned that the author may not have intended to support it.
localizedKey
String localizedKey(String key, String locale)

Construct localized key name from key and locale.

localizedKey
String localizedKey(String key, String lang, String country, String modifier)

ditto, but constructs locale name from arguments.

makeLocaleName
String makeLocaleName(String lang, String country, String encoding, String modifier)

Make locale name based on language, country, encoding and modifier.

parseGroupHeader
auto parseGroupHeader(inout(char)[] s)

Retrieve group name from header entry.

parseKeyValue
auto parseKeyValue(String s)

Parse entry of kind Key=Value into pair of Key and Value.

parseLocaleName
auto parseLocaleName(String locale)

Parse locale name into the tuple of 4 values corresponding to language, country, encoding and modifier

separateFromLocale
auto separateFromLocale(String key)

Separate key name into non-localized key and locale name. If key is not localized returns original key and empty string.

unescapeValue
auto unescapeValue(inout(char)[] value)

Unescapes string. You should unescape values returned by library before displaying until you want keep them as is (e.g., to allow user to edit values in escaped form).

Manifest constants

nogc
enum nogc;
Undocumented in source.

See Also

Meta