Function IniLikeGroup.validateValue

Validate value for key before setting value to key for this group and throw exception if not valid. Can be reimplemented in derived classes. The key is provided because you may want to implement specific checks depending on the key name.

void validateValue (
  string key,
  string value
) @trusted const;

Default implementation checks if value is escaped. It does not check the key in any way.

Parameters

NameDescription
key key the value is being set to.
value value to validate. Considered to be escaped.

Throws

IniLikeEntryException if value is invalid.

See Also

validateKey

Example

auto ilf = new IniLikeFile();
ilf.addGenericGroup("Group");

auto entryException = collectException!IniLikeEntryException(ilf.group("Group").setEscapedValue("Key", "New\nline"));
assert(entryException !is null);
assert(entryException.key == "Key");
assert(entryException.value == "New\nline");