src/INIDispatchHandler.h
branchv_0
changeset 1 e04e5bbc147b
parent 0 1bb084f84eb9
child 3 ae8775e0bc7a
equal deleted inserted replaced
0:1bb084f84eb9 1:e04e5bbc147b
    33 
    33 
    34 #include "Configuration.h"
    34 #include "Configuration.h"
    35 #include "INIWriter.h"
    35 #include "INIWriter.h"
    36 #include "INIStandardHandler.h"
    36 #include "INIStandardHandler.h"
    37 #include "INILiteralHandler.h"
    37 #include "INILiteralHandler.h"
       
    38 #include "INISectionFirstHandler.h"
    38 
    39 
    39 namespace relpipe {
    40 namespace relpipe {
    40 namespace out {
    41 namespace out {
    41 namespace ini {
    42 namespace ini {
    42 
    43 
    63 	relpipe::reader::handlers::RelationalReaderStringHandler* createHandler(const relpipe::common::type::StringX& name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) {
    64 	relpipe::reader::handlers::RelationalReaderStringHandler* createHandler(const relpipe::common::type::StringX& name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) {
    64 		for (auto rc : configuration.relationConfigurations) {
    65 		for (auto rc : configuration.relationConfigurations) {
    65 			if (std::regex_match(name, std::wregex(rc.relation))) {
    66 			if (std::regex_match(name, std::wregex(rc.relation))) {
    66 				if (rc.style == Style::Standard) return new INIStandardHandler(writer);
    67 				if (rc.style == Style::Standard) return new INIStandardHandler(writer);
    67 				else if (rc.style == Style::Literal) return new INILiteralHandler(writer);
    68 				else if (rc.style == Style::Literal) return new INILiteralHandler(writer);
    68 				else if (rc.style == Style::LiteralWithSectionAttribute) return new INILiteralHandler(writer, L"section");
    69 				else if (rc.style == Style::SectionFirst) return new INISectionFirstHandler(writer);
    69 				else if (rc.style == Style::Dropped) return nullptr;
    70 				else if (rc.style == Style::Dropped) return nullptr;
    70 				else if (rc.style == Style::Automatic) return createHandlerAuto(name, attributes);
    71 				else if (rc.style == Style::Automatic) return createHandlerAuto(name, attributes);
    71 				else throw std::invalid_argument("Unsupported style: " + std::to_string((int) rc.style));
    72 				else throw std::invalid_argument("Unsupported style: " + std::to_string((int) rc.style));
    72 			}
    73 			}
    73 		}
    74 		}