Struct IconThemeFile.IconThemeReadOptions
Options to manage icon theme file reading
struct IconThemeReadOptions
;
Constructors
Name | Description |
this
|
Setting parameters in any order, leaving not mentioned ones in default state.
|
Example
string contents =
`[Icon Theme]
Name=Theme
[X-SomeGroup]
Key=Value`;
alias IconThemeFile.IconThemeReadOptions IconThemeReadOptions;
auto iconTheme = new IconThemeFile(iniLikeStringReader(contents), IconThemeReadOptions(ExtensionGroupPolicy.skip));
assert(iconTheme.group("X-SomeGroup") is null);
contents =
`[Icon Theme]
Name=Theme
[/invalid group]
$=StrangeKey`;
iconTheme = new IconThemeFile(iniLikeStringReader(contents), IconThemeReadOptions(UnknownGroupPolicy.preserve, IniLikeGroup.InvalidKeyPolicy.save));
assert(iconTheme.group("/invalid group") !is null);
assert(iconTheme.group("/invalid group").escapedValue("$") == "StrangeKey");
contents =
`[X-SomeGroup]
Key=Value`;
auto thrown = collectException!IniLikeReadException(new IconThemeFile(iniLikeStringReader(contents)));
assert(thrown !is null);
assert(thrown.lineNumber == 0);
contents =
`[Icon Theme]
Valid=Key
$=Invalid`;
assertThrown(new IconThemeFile(iniLikeStringReader(contents)));
assertNotThrown(new IconThemeFile(iniLikeStringReader(contents), IconThemeReadOptions(IniLikeGroup.InvalidKeyPolicy.skip)));
contents =
`[Icon Theme]
Name=Name
[/invalidpath]
Key=Value`;
assertThrown(new IconThemeFile(iniLikeStringReader(contents), IconThemeReadOptions(UnknownGroupPolicy.throwError)));
assertNotThrown(iconTheme = new IconThemeFile(iniLikeStringReader(contents), IconThemeReadOptions(UnknownGroupPolicy.preserve)));
assert(iconTheme.cachePath().empty);
assert(iconTheme.group("/invalidpath") !is null);