initial: re-vendor @ c00e0fa
c00e0fa avoid converting objects twice baafe10 fix doc comment
This commit is contained in:
parent
6bd5af01f8
commit
d5cacb0401
1 changed files with 3 additions and 3 deletions
|
@ -218,7 +218,7 @@ struct INISection
|
|||
keys = new string[string];
|
||||
}
|
||||
|
||||
/+
|
||||
/++
|
||||
+ Returns the value of `k` in this section or
|
||||
+ `defaultValue` if the key is not present.
|
||||
+/
|
||||
|
@ -234,10 +234,10 @@ struct INISection
|
|||
+ with a message containing location information.
|
||||
+/
|
||||
T
|
||||
keyAs(T)(string k, string defaultValue = null)
|
||||
keyAs(T)(string k, T defaultValue)
|
||||
{
|
||||
try
|
||||
return key(k, defaultValue).to!T();
|
||||
return k in keys ? keys[k].to!T() : defaultValue;
|
||||
catch (ConvException)
|
||||
throw new INITypeException(
|
||||
format!"unable to convert [%s].%s to %s"(name, k, T.stringof));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue