IniLikeGroup

This class represents the group (section) of key-value entries in the ini-like file. Instances of this class can be created only in the context of IniLikeFile or its derivatives. Values are stored in the escaped form, but the interface allows to set and get values in both escaped and unescaped forms. Note: Keys are case-sensitive.

Constructors

this
this(string groupName)

Create IniLikeGroup instance with given name.

Members

Enums

InvalidKeyPolicy
enum InvalidKeyPolicy

Functions

addCommentAfter
auto addCommentAfter(LineNode node, string comment)

Add comment after some node.

addCommentBefore
auto addCommentBefore(LineNode node, string comment)

Add comment before some node.

appendComment
auto appendComment(string comment)

Add comment line into the group.

appendValue
auto appendValue(string key, string value, InvalidKeyPolicy invalidKeyPolicy)

Add key-value entry without diret association of the value with the key. Can be used to add duplicates.

byIniLine
auto byIniLine()
byKeyValue
auto byKeyValue()

Iterate by Key-Value pairs. Values are left in escaped form.

byNode
auto byNode()

Iterate over nodes of internal list.

contains
bool contains(string key)

Check if the group contains a value associated with the key.

escapedValue
string escapedValue(string key)

Get value by key in escaped form.

escapedValue
string escapedValue(string key, string locale, Flag!"nonLocaleFallback" nonLocaleFallback)

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

getNode
auto getNode(string key)

Get internal list node for key.

groupName
string groupName()

Get name of this group.

moveLineAfter
void moveLineAfter(LineNode other, LineNode toMove)

Move line after other line in the group. Prerequisites: toMove and other are not null and belong to this group.

moveLineBefore
void moveLineBefore(LineNode other, LineNode toMove)

Move line before other line in the group. Prerequisites: toMove and other are not null and belong to this group.

moveLineToBack
void moveLineToBack(LineNode toMove)

Move line to the end of group. Prerequisites: toMove is not null and belongs to this group.

moveLineToFront
void moveLineToFront(LineNode toMove)

Move line to the start of group. Prerequisites: toMove is not null and belongs to this group.

prependComment
auto prependComment(string comment)

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

removeEntry
bool removeEntry(string key)

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

removeEntry
bool removeEntry(string key, string locale)

ditto, but remove entry by localized key.

removeEntry
void removeEntry(LineNode node)

ditto, but remove entry by node.

setEscapedValue
string setEscapedValue(string key, string value, InvalidKeyPolicy invalidKeyPolicy)

Set value associated with key.

setEscapedValue
string setEscapedValue(string key, string locale, string value, InvalidKeyPolicy invalidKeyPolicy)

Set value associated with key and locale.

setUnescapedValue
string setUnescapedValue(string key, string value, InvalidKeyPolicy invalidKeyPolicy)

Set value by key. The value is considered to be in the unescaped form.

setUnescapedValue
string setUnescapedValue(string key, string locale, string value, InvalidKeyPolicy invalidKeyPolicy)

ditto, localized version

unescapedValue
string unescapedValue(string key, string locale, Flag!"nonLocaleFallback" nonLocaleFallback)

Get value by key.

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.

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. The key is provided because you may want to implement specific checks depending on the key name.

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 an empty range.

Structs

LineNode
struct LineNode

Wrapper for internal ListMap node.

Meta