* Author: sbh
*/
+#include <Config_Keywords.h>
+#include <Config_Common.h>
#include <Config_ModuleReader.h>
#include <Config_FeatureReader.h>
-#include <libxml\parser.h>
-#include <libxml\tree.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
#ifdef _DEBUG
#include <iostream>
#endif
-//Hardcoded xml entities
-// * Nodes
-const static char* NODE_PLUGIN = "plugin";
-const static char* NODE_PLUGINS = "plugins";
-// * Properties
-const static char* PLUGINS_MODULE = "module";
-const static char* PLUGIN_CONFIG = "configuration";
-const static char* PLUGIN_LIBRARY = "library";
-
-Config_ModuleReader::Config_ModuleReader()
+Config_ModuleReader::Config_ModuleReader(const char* theEventGenerated)
: Config_XMLReader("plugins.xml"),
- m_isAutoImport(false)
+ myEventGenerated(theEventGenerated)
{
}
{
}
+const std::map<std::string, std::string>& Config_ModuleReader::featuresInFiles() const
+{
+ return myFeaturesInFiles;
+}
+
/*
* Get module name from plugins.xml
* (property "module")
*/
void Config_ModuleReader::processNode(xmlNodePtr theNode)
{
- if(isNode(theNode, NODE_PLUGIN, NULL)) {
- std::string aPluginName = getProperty(theNode, PLUGIN_CONFIG);
- if(m_isAutoImport)
- importPlugin(aPluginName);
- m_pluginsList.push_back(aPluginName);
+ if (isNode(theNode, NODE_PLUGIN, NULL)) {
+ std::string aPluginConf = getProperty(theNode, PLUGIN_CONFIG);
+ std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY);
+ std::list<std::string> aFeatures = importPlugin(aPluginConf, aPluginLibrary);
+ std::list<std::string>::iterator it = aFeatures.begin();
+ for( ; it != aFeatures.end(); it++ ) {
+ myFeaturesInFiles[*it] = aPluginConf;
+ }
}
}
return isNode(theNode, NODE_PLUGINS, NULL);
}
-void Config_ModuleReader::importPlugin(const std::string& thePluginName)
+std::list<std::string>
+Config_ModuleReader::importPlugin(const std::string& thePluginFile,
+ const std::string& thePluginLibrary)
{
- Config_FeatureReader aReader(thePluginName);
+ Config_FeatureReader aReader = Config_FeatureReader(thePluginFile,
+ thePluginLibrary,
+ myEventGenerated);
aReader.readAll();
+ return aReader.features();
}
-void Config_ModuleReader::setAutoImport(bool enabled)
-{
- m_isAutoImport = enabled;
-}
-
-const std::list<std::string>& Config_ModuleReader::pluginsList() const
-{
- return m_pluginsList;
-}