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"), myIsAutoImport(false), myEventGenerated(theEventGenerated)
27 Config_ModuleReader::~Config_ModuleReader()
32 * Get module name from plugins.xml
35 std::string Config_ModuleReader::getModuleName()
37 xmlNodePtr aRoot = findRoot();
38 return getProperty(aRoot, PLUGINS_MODULE);
44 void Config_ModuleReader::processNode(xmlNodePtr theNode)
46 if (isNode(theNode, NODE_PLUGIN, NULL)) {
47 std::string aPluginConf = getProperty(theNode, PLUGIN_CONFIG);
48 std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY);
50 importPlugin(aPluginConf, aPluginLibrary);
51 myPluginsMap[aPluginLibrary] = aPluginConf;
55 bool Config_ModuleReader::processChildren(xmlNodePtr theNode)
57 return isNode(theNode, NODE_PLUGINS, NULL);
60 void Config_ModuleReader::importPlugin(const std::string& thePluginName,
61 const std::string& thePluginLibrary)
63 Config_FeatureReader* aReader;
64 if(thePluginLibrary.empty()) {
65 aReader = new Config_FeatureReader(thePluginName);
67 aReader = new Config_FeatureReader(thePluginName, thePluginLibrary, myEventGenerated);
72 void Config_ModuleReader::setAutoImport(bool theEnabled)
74 myIsAutoImport = theEnabled;
77 const std::map<std::string, std::string>& Config_ModuleReader::plugins() const