IniLikeEntryException if either key is invalid.
auto ilf = new IniLikeFile(); ilf.addGroup("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
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.