--- a/src/INILiteralHandler.h Wed Dec 09 17:55:03 2020 +0100
+++ b/src/INILiteralHandler.h Wed Dec 09 23:53:30 2020 +0100
@@ -39,14 +39,14 @@
class INILiteralHandler : public relpipe::reader::handlers::RelationalReaderStringHandler {
private:
INIWriter& writer;
- relpipe::common::type::StringX sectionAttributeName;
+ bool hasSections = false;
relpipe::common::type::StringX currentSection;
std::vector<relpipe::reader::handlers::AttributeMetadata> currentAttributes;
relpipe::common::type::Integer relationCount = 0;
relpipe::common::type::Integer currentAttributeIndex = 0;
public:
- INILiteralHandler(INIWriter& writer, relpipe::common::type::StringX sectionAttributeName = L"") : writer(writer), sectionAttributeName(sectionAttributeName) {
+ INILiteralHandler(INIWriter& writer) : writer(writer) {
}
virtual ~INILiteralHandler() {
@@ -59,6 +59,7 @@
INIWriter::SectionStartEvent e;
e.name = name;
writer.startSection(e);
+ hasSections = true;
relationCount++;
}
@@ -72,6 +73,7 @@
INIWriter::SectionStartEvent e;
e.name = currentSection;
writer.startSection(e);
+ hasSections = true;
}
INIWriter::EntryEvent e;
@@ -83,7 +85,7 @@
}
void endOfPipe() {
- writer.endSection();
+ if (hasSections) writer.endSection();
}
};