IniLikeGroup

This class represents the group (section) in the ini-like file. Instances of this class can be created only in the context of IniLikeFile or its derivatives. Note: Keys are case-sensitive.

class IniLikeGroup {}

Constructors

this
this(string groupName)

Create instance on IniLikeGroup and set its name to groupName.

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 association of value with 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)

Tell if group contains value associated with the key.

getNode
auto getNode(string key)

Get internal list node for key.

groupName
string groupName()

Get name of this group.

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

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

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.

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
auto 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.

removeEntry
bool removeEntry(string key)

Removes entry by key. Do nothing if not 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.

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

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.

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

Set value associated with 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.

value
string value(string key)

Get value by key.

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

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

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

ditto, localized version

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.

Structs

LineNode
struct LineNode

Wrapper for internal ListMap node.

Meta