2 * Config_ModuleReader.cpp
4 * Created on: Mar 20, 2014
8 #include <Config_Keywords.h>
9 #include <Config_Common.h>
10 #include <Config_ModuleReader.h>
11 #include <Config_FeatureReader.h>
13 #include <libxml/parser.h>
14 #include <libxml/tree.h>
22 Config_ModuleReader::Config_ModuleReader(const char* theEventGenerated)
23 : Config_XMLReader("plugins.xml"),
24 myEventGenerated(theEventGenerated)
28 Config_ModuleReader::~Config_ModuleReader()
32 const std::map<std::string, std::string>& Config_ModuleReader::featuresInFiles() const
34 return myFeaturesInFiles;
38 * Get module name from plugins.xml
41 std::string Config_ModuleReader::getModuleName()
43 xmlNodePtr aRoot = findRoot();
44 return getProperty(aRoot, PLUGINS_MODULE);
50 void Config_ModuleReader::processNode(xmlNodePtr theNode)
52 if (isNode(theNode, NODE_PLUGIN, NULL)) {
53 std::string aPluginConf = getProperty(theNode, PLUGIN_CONFIG);
54 std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY);
55 std::list<std::string> aFeatures = importPlugin(aPluginConf, aPluginLibrary);
56 std::list<std::string>::iterator it = aFeatures.begin();
57 for( ; it != aFeatures.end(); it++ ) {
58 myFeaturesInFiles[*it] = aPluginConf;
63 bool Config_ModuleReader::processChildren(xmlNodePtr theNode)
65 return isNode(theNode, NODE_PLUGINS, NULL);
68 std::list<std::string>
69 Config_ModuleReader::importPlugin(const std::string& thePluginFile,
70 const std::string& thePluginLibrary)
72 Config_FeatureReader aReader = Config_FeatureReader(thePluginFile,
76 return aReader.features();