iniLikeRangeReader

Convenient function for creation of IniLikeReader instance.

iniLikeRangeReader
(
Range
)
(
Range range
)

Parameters

range Range

input range of strings (strings must be without trailing new line characters)

Return Value

Type: auto

IniLikeReader for given range.

Examples

    string contents =
`First comment
Second comment
[First group]
KeyValue1
KeyValue2
[Second group]
KeyValue3
KeyValue4
[Empty group]
[Third group]
KeyValue5
KeyValue6`;
    auto r = iniLikeRangeReader(contents.splitLines());

    auto byLeadingLines = r.byLeadingLines;

    assert(byLeadingLines.front == "First comment");
    assert(byLeadingLines.equal(["First comment", "Second comment"]));

    auto byGroup = r.byGroup;

    assert(byGroup.front.groupName == "First group");
    assert(byGroup.front.originalLine == "[First group]");


    assert(byGroup.front.byEntry.front == "KeyValue1");
    assert(byGroup.front.byEntry.equal(["KeyValue1", "KeyValue2"]));
    byGroup.popFront();
    assert(byGroup.front.groupName == "Second group");
    byGroup.popFront();
    assert(byGroup.front.groupName == "Empty group");
    assert(byGroup.front.byEntry.empty);
    byGroup.popFront();
    assert(byGroup.front.groupName == "Third group");
    byGroup.popFront();
    assert(byGroup.empty);

See Also

Meta