IniLikeEntryException if either key is invalid.
auto ilf = new IniLikeFile(); ilf.addGenericGroup("Group"); auto entryException = collectException!IniLikeEntryException(ilf.group("Group")[""] = "Value1"); assert(entryException !is null); assert(entryException.groupName == "Group"); assert(entryException.key == ""); assert(entryException.value == "Value1"); entryException = collectException!IniLikeEntryException(ilf.group("Group")[" "] = "Value2"); assert(entryException !is null); assert(entryException.key == " "); assert(entryException.value == "Value2"); entryException = collectException!IniLikeEntryException(ilf.group("Group")["New\nLine"] = "Value3"); assert(entryException !is null); assert(entryException.key == "New\nLine"); assert(entryException.value == "Value3"); entryException = collectException!IniLikeEntryException(ilf.group("Group")["# Comment"] = "Value4"); assert(entryException !is null); assert(entryException.key == "# Comment"); assert(entryException.value == "Value4"); entryException = collectException!IniLikeEntryException(ilf.group("Group")["Everyone=Is"] = "Equal"); assert(entryException !is null); assert(entryException.key == "Everyone=Is"); assert(entryException.value == "Equal");
validateValue Note: Implementer should ensure that their implementation still validates key for format consistency (i.e. no new line characters, etc.). If not sure, just call super.validateKey(key, value) in your implementation.
Validate key before setting value to key for this group and throw exception if not valid. Can be reimplemented in derived classes.
Default implementation checks if key is not empty string, does not look like comment and does not contain new line or carriage return characters.