mirror of https://github.com/deavmi/niknaks
Compare commits
5 Commits
f65b442376
...
e9cb212194
Author | SHA1 | Date |
---|---|---|
Tristan B. Velloza Kildaire | e9cb212194 | |
Tristan B. Velloza Kildaire | 4771d5fafe | |
Tristan B. Velloza Kildaire | fa80d17cd2 | |
Tristan B. Velloza Kildaire | c5c7a02ac0 | |
Tristan B. Velloza Kildaire | e8c510eeaa |
|
@ -266,6 +266,8 @@ public struct Registry
|
|||
setAllowOverwrite(allowOverwritingOfEntries);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool hasEntry(string name)
|
||||
{
|
||||
return getEntry0(name) !is null;
|
||||
|
@ -278,6 +280,12 @@ public struct Registry
|
|||
}
|
||||
|
||||
|
||||
public ConfigEntry* opBinaryRight(string op)(string name)
|
||||
if(op == "in")
|
||||
{
|
||||
return getEntry0(name);
|
||||
}
|
||||
|
||||
public bool getEntry_nothrow(string name, ref ConfigEntry entry)
|
||||
{
|
||||
ConfigEntry* potEntry = getEntry0(name);
|
||||
|
@ -482,6 +490,13 @@ unittest
|
|||
reg["age"] = 25;
|
||||
assert(cast(int)reg["age"] == 25);
|
||||
|
||||
// Obtain a handle on the configuration
|
||||
// entry, then update it and read it back
|
||||
// to confirm
|
||||
ConfigEntry* ageEntry = "age" in reg;
|
||||
*ageEntry = ConfigEntry.ofNumeric(69_420);
|
||||
assert(cast(int)reg["age"] == 69_420);
|
||||
|
||||
// Should not be able to set entry it not yet existent
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue