src/INICommand.cpp
branchv_0
changeset 5 d70ea23682aa
parent 2 f031a4dc7c52
child 6 fb717cfbfea1
equal deleted inserted replaced
4:d9b047731e18 5:d70ea23682aa
    68 		vector<AttributeMetadata> metadata;
    68 		vector<AttributeMetadata> metadata;
    69 		if (configuration.enableLineNumbers) metadata.push_back({L"line", TypeId::INTEGER});
    69 		if (configuration.enableLineNumbers) metadata.push_back({L"line", TypeId::INTEGER});
    70 		if (configuration.enableEventNumbers) metadata.push_back({L"event", TypeId::INTEGER});
    70 		if (configuration.enableEventNumbers) metadata.push_back({L"event", TypeId::INTEGER});
    71 		if (configuration.enableSections) metadata.push_back({L"section", TypeId::STRING});
    71 		if (configuration.enableSections) metadata.push_back({L"section", TypeId::STRING});
    72 		metadata.push_back({L"key", TypeId::STRING});
    72 		metadata.push_back({L"key", TypeId::STRING});
    73 		if (configuration.enableSubkeys) metadata.push_back({L"subkey", TypeId::STRING});
    73 		if (configuration.enableSubKeys) metadata.push_back({L"sub_key", TypeId::STRING});
    74 		metadata.push_back({L"value", TypeId::STRING});
    74 		metadata.push_back({L"value", TypeId::STRING});
    75 		if (configuration.enableComments) metadata.push_back({L"comment", TypeId::STRING});
    75 		if (configuration.enableComments) metadata.push_back({L"comment", TypeId::STRING});
    76 		writer->startRelation(configuration.relation, metadata, true);
    76 		writer->startRelation(configuration.relation, metadata, true);
    77 	};
    77 	};
    78 
    78 
    91 	void entry(const EntryEvent& event) override {
    91 	void entry(const EntryEvent& event) override {
    92 		if (configuration.enableLineNumbers) writer->writeAttribute(&event.lineNumber, typeid (event.lineNumber));
    92 		if (configuration.enableLineNumbers) writer->writeAttribute(&event.lineNumber, typeid (event.lineNumber));
    93 		if (configuration.enableEventNumbers) writer->writeAttribute(&event.eventNumber, typeid (event.eventNumber));
    93 		if (configuration.enableEventNumbers) writer->writeAttribute(&event.eventNumber, typeid (event.eventNumber));
    94 
    94 
    95 		std::string section = getCurrentSectionFullName();
    95 		std::string section = getCurrentSectionFullName();
    96 		std::string key = configuration.enableSubkeys ? event.key : event.fullKey;
    96 		std::string key = configuration.enableSubKeys ? event.key : event.fullKey;
    97 
    97 
    98 		if (configuration.enableSections) writer->writeAttribute(convertor.from_bytes(section));
    98 		if (configuration.enableSections) writer->writeAttribute(convertor.from_bytes(section));
    99 		else if (section.size()) key = section + "/" + key;
    99 		else if (section.size()) key = section + "/" + key;
   100 		writer->writeAttribute(convertor.from_bytes(key));
   100 		writer->writeAttribute(convertor.from_bytes(key));
   101 		if (configuration.enableSubkeys) writer->writeAttribute(convertor.from_bytes(event.subKey));
   101 		if (configuration.enableSubKeys) writer->writeAttribute(convertor.from_bytes(event.subKey));
   102 
   102 
   103 		writer->writeAttribute(convertor.from_bytes(event.value));
   103 		writer->writeAttribute(convertor.from_bytes(event.value));
   104 		if (configuration.enableComments) writer->writeAttribute(convertor.from_bytes(event.comment));
   104 		if (configuration.enableComments) writer->writeAttribute(convertor.from_bytes(event.comment));
   105 	};
   105 	};
   106 
   106