2 * Config_ModuleReader.cpp
4 * Created on: Mar 20, 2014
8 #include <Config_Keywords.h>
9 #include <Config_ModuleReader.h>
10 #include <Config_FeatureReader.h>
12 #include <libxml\parser.h>
13 #include <libxml\tree.h>
21 Config_ModuleReader::Config_ModuleReader()
22 : Config_XMLReader("plugins.xml"), myIsAutoImport(false)
26 Config_ModuleReader::~Config_ModuleReader()
31 * Get module name from plugins.xml
34 std::string Config_ModuleReader::getModuleName()
36 xmlNodePtr aRoot = findRoot();
37 return getProperty(aRoot, PLUGINS_MODULE);
43 void Config_ModuleReader::processNode(xmlNodePtr theNode)
45 if (isNode(theNode, NODE_PLUGIN, NULL)) {
46 std::string aPluginConf = getProperty(theNode, PLUGIN_CONFIG);
47 std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY);
49 importPlugin(aPluginConf, aPluginLibrary);
50 myPluginsMap[aPluginLibrary] = aPluginConf;
54 bool Config_ModuleReader::processChildren(xmlNodePtr theNode)
56 return isNode(theNode, NODE_PLUGINS, NULL);
59 void Config_ModuleReader::importPlugin(const std::string& thePluginName,
60 const std::string& thePluginLibrary)
62 Config_FeatureReader* aReader;
63 if(thePluginLibrary.empty()) {
64 aReader = new Config_FeatureReader(thePluginName);
66 aReader = new Config_FeatureReader(thePluginName, thePluginLibrary);
71 void Config_ModuleReader::setAutoImport(bool theEnabled)
73 myIsAutoImport = theEnabled;
76 const std::map<std::string, std::string>& Config_ModuleReader::plugins() const