src/XMLDocumentConstructor.h
branchv_0
changeset 28 0e7c57d48d1e
parent 27 fd669e73d39a
child 29 06aaad12c207
equal deleted inserted replaced
27:fd669e73d39a 28:0e7c57d48d1e
    18 
    18 
    19 #include <stdexcept>
    19 #include <stdexcept>
    20 #include <libxml++-2.6/libxml++/libxml++.h>
    20 #include <libxml++-2.6/libxml++/libxml++.h>
    21 
    21 
    22 #include "lib/INIReader.h"
    22 #include "lib/INIReader.h"
    23 #include "lib/BasicUnescapingINIHandler.h"
    23 #include "lib/BasicUnescapingProcessor.h"
    24 #include "lib/JavaPropertiesUnescapingINIHandler.h"
    24 #include "lib/BackspaceUnescapingProcessor.h"
       
    25 #include "lib/JavaPropertiesUnescapingProcessor.h"
    25 #include "lib/XMLNameCodec.h"
    26 #include "lib/XMLNameCodec.h"
    26 
    27 
    27 using namespace relpipe::in::ini::lib;
    28 using namespace relpipe::in::ini::lib;
    28 
    29 
    29 namespace relpipe {
    30 namespace relpipe {
   109 	}
   110 	}
   110 
   111 
   111 	void process() {
   112 	void process() {
   112 		HierarchicalINIContentHandler handler(parser);
   113 		HierarchicalINIContentHandler handler(parser);
   113 		std::shared_ptr<INIReader> reader(INIReader::create(*input));
   114 		std::shared_ptr<INIReader> reader(INIReader::create(*input));
   114 		BasicUnescapingINIContentHandler unescapingHandler(handler, false);
   115 		reader->addUnescapingProcessor(std::make_shared<BasicUnescapingProcessor>(), "unescape-basic", true);
   115 		JavaPropertiesUnescapingINIContentHandler javaHandler(handler, true);
   116 		reader->addUnescapingProcessor(std::make_shared<JavaPropertiesUnescapingProcessor>(), "unescape-java-properties", false);
   116 		reader->addHandler(&javaHandler);
   117 		reader->addUnescapingProcessor(std::make_shared<BackspaceUnescapingProcessor>(false), "unescape-backspace-disorder", false);
       
   118 		reader->addUnescapingProcessor(std::make_shared<BackspaceUnescapingProcessor>(), "unescape-backspace", true);
       
   119 		reader->addHandler(&handler);
       
   120 		// TODO: smart pointers vs. references: are we going to call addUnescapingProcessor() dynamically/conditionally or share instances? Then pointers will be better.
       
   121 		// TODO: call setOption() according to the configuration
       
   122 		// for (ParserOptionRecipe option : configuration.parserOptions) reader->setOption(convertor.to_bytes(option.uri), convertor.to_bytes(option.value));
   117 		reader->process();
   123 		reader->process();
   118 	}
   124 	}
   119 };
   125 };
   120 
   126 
   121 }
   127 }