diff -r bda9d3c83cb7 -r 7c85dc9a310b src/INIWriter.h --- a/src/INIWriter.h Sun Dec 13 16:47:25 2020 +0100 +++ b/src/INIWriter.h Thu Sep 09 18:57:37 2021 +0200 @@ -43,6 +43,9 @@ relpipe::common::type::StringX hierarchySeparator = L"/"; bool allowSections = true; + + bool skipEmpty = false; + bool skipNull = false; bool hasContent = false; @@ -196,6 +199,8 @@ else if (uri == option::KeyValueSeparator) keyValueSeparator = convertor.to_bytes(value); else if (uri == option::HierarchySeparator) hierarchySeparator = value; else if (uri == option::AllowSections) allowSections = parseBoolean(value); + else if (uri == option::SkipEmpty) skipEmpty = parseBoolean(value); + else if (uri == option::SkipNull) skipNull = parseBoolean(value); else if (uri == option::QuotesTypeForSections) quotingForSections.type = parseQuotingType(value); else if (uri == option::QuotesTypeForKeys) quotingForKeys.type = parseQuotingType(value); else if (uri == option::QuotesTypeForValues) quotingForValues.type = parseQuotingType(value); @@ -243,6 +248,8 @@ } void entry(const EntryEvent& event) { + if (skipEmpty && event.value.empty()) return; + if (skipNull && event.value.empty()) return; // TODO: distinguish null and empty (when supported in the relpipe format) // TODO: escape/quote parts separately + configurable quoting of parts or whole + the same for sub keys if (!allowSections && currentSection.size()) output << escape(getCurrentSectionFullName(), EscapingProcessor::TextType::EntryKey) << convertor.to_bytes(hierarchySeparator); output << escape(event.key, EscapingProcessor::TextType::EntryKey);