IniLikeGroup

This class represents the group (section) in the ini-like file. You can create and use instances of this class only in the context of IniLikeFile or its derivatives. Note: Keys are case-sensitive.

Constructors

this
this(string groupName)

Create instance on IniLikeGroup and set its name to groupName.

Members

Functions

appendComment
string appendComment(string comment)

Add comment line into the group.

byIniLine
auto byIniLine()
byKeyValue
auto byKeyValue()

Iterate by Key-Value pairs.

contains
bool contains(string key)

Tell if group contains value associated with the key.

groupName
string groupName()

Get name of this group.

localizedValue
string localizedValue(string key, string locale, bool nonLocaleFallback)

Perform locale matching lookup as described in Localized values for keys.

opIndex
string opIndex(string key)
opIndexAssign
string opIndexAssign(string value, string key)

Insert new value or replaces the old one if value associated with key already exists. Note: The value is not escaped automatically upon writing. It's your responsibility to escape it.

opIndexAssign
string opIndexAssign(string value, string key, string locale)

Assign localized value. Note: The value is not escaped automatically upon writing. It's your responsibility to escape it.

prependComment
string prependComment(string comment)

Add comment line at the start of group (after group header, before any key-value pairs).

readEntry
string readEntry(string key, string locale)

Get value by key. This function automatically unescape the found value before returning.

removeEntries
void removeEntries()

Remove all entries satisying ToDelete function. ToDelete should be function accepting string key and value and return boolean.

removeEntry
bool removeEntry(string key)

Removes entry by key. Do nothing if not value associated with key found.

removeEntry
void removeEntry(string key, string locale)

ditto, but remove entry by localized key

setLocalizedValue
void setLocalizedValue(string key, string locale, string value)

Same as localized version of opIndexAssign, but uses function syntax. Note: The value is not escaped automatically upon writing. It's your responsibility to escape it.

validateKey
void validateKey(string key, string value)

Validate key before setting value to key for this group and throw exception if not valid. Can be reimplemented in derived classes. Default implementation checks if key is not empty string, does not look like comment and does not contain new line or carriage return characters.

validateKeyAndValue
void validateKeyAndValue(string key, string value)

Utility function that calls validateKey and validateValue.

validateValue
void validateValue(string key, string value)

Validate value for key before setting value to key for this group and throw exception if not valid. Can be reimplemented in derived classes. Default implementation checks if value is escaped.

value
string value(string key, string defaultValue)

Get value by key.

writeEntry
string writeEntry(string key, string value, string locale)

Set value by key. This function automatically escape the value (you should not escape value yourself) when writing it.

Static functions

emptyByKeyValue
auto emptyByKeyValue()

Empty range of the same type as byKeyValue. Can be used in derived classes if it's needed to have empty range.

Meta