From b5d73934783b855df128bb71b104e3a7fd509a16 Mon Sep 17 00:00:00 2001 From: azv Date: Sat, 20 Feb 2021 00:06:16 +0300 Subject: [PATCH] Reconfigure generation of the documentation to be able to merge documentations of several plugins into a single group. --- src/Config/Config_FeatureReader.cpp | 9 +++++++-- src/Config/Config_FeatureReader.h | 2 ++ src/Config/Config_Keywords.h | 1 + src/Config/Config_ModuleReader.cpp | 7 +++++-- src/Config/Config_ModuleReader.h | 3 ++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index 5f397d638..3d53a63d6 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -40,9 +40,11 @@ Config_FeatureReader::Config_FeatureReader(const std::string& theXmlFile, const std::string& theLibraryName, + const std::string& theDocSection, const char* theEventGenerated) : Config_XMLReader(theXmlFile), myLibraryName(theLibraryName), + myLibraryDocSection(theDocSection), myEventGenerated(theEventGenerated ? theEventGenerated : Config_FeatureMessage::GUI_EVENT()), myIsProcessWidgets(theEventGenerated != NULL) { @@ -176,8 +178,11 @@ void Config_FeatureReader::fillFeature(xmlNodePtr theFeatureNode, outFeatureMessage->setInternal(isInternal); std::string aHelpFile = getProperty(theFeatureNode, HELP_FILE); - if (!aHelpFile.empty()) - outFeatureMessage->setHelpFileName(myLibraryName + "/" + aHelpFile); + if (!aHelpFile.empty()) { + aHelpFile = + (myLibraryDocSection.empty() ? myLibraryName : myLibraryDocSection) + "/" + aHelpFile; + outFeatureMessage->setHelpFileName(aHelpFile); + } bool isHideFaces = getBooleanAttribute(theFeatureNode, HIDEFACES_PANEL, false); outFeatureMessage->setHideFacesPanel(isHideFaces); diff --git a/src/Config/Config_FeatureReader.h b/src/Config/Config_FeatureReader.h index 015090889..e3d1098f9 100644 --- a/src/Config/Config_FeatureReader.h +++ b/src/Config/Config_FeatureReader.h @@ -40,6 +40,7 @@ class Config_FeatureReader : public Config_XMLReader /// Constructor Config_FeatureReader(const std::string& theXmlFile, const std::string& theLibraryName, + const std::string& theDocSection = std::string(), const char* theEventGenerated = 0); virtual ~Config_FeatureReader(); /// Returns list of all features defined in reader's file @@ -61,6 +62,7 @@ class Config_FeatureReader : public Config_XMLReader private: std::string myLibraryName; + std::string myLibraryDocSection; std::list myFeatures; /// event generated on feature data sending, by default it is Config_FeatureMessage::GUI_EVENT() diff --git a/src/Config/Config_Keywords.h b/src/Config/Config_Keywords.h index 9774c3519..cfbbcc2a1 100644 --- a/src/Config/Config_Keywords.h +++ b/src/Config/Config_Keywords.h @@ -145,6 +145,7 @@ MAYBE_UNUSED const static char* PLUGIN_LIBRARY = "library"; MAYBE_UNUSED const static char* PLUGIN_SCRIPT = "script"; MAYBE_UNUSED const static char* PLUGIN_DEPENDENCY = "dependency"; MAYBE_UNUSED const static char* PLUGIN_USES = "uses"; +MAYBE_UNUSED const static char* PLUGIN_DOCSECTION = "docsection"; /* * Hardcoded xml entities of dataModel.xml diff --git a/src/Config/Config_ModuleReader.cpp b/src/Config/Config_ModuleReader.cpp index ca2bd6d85..afbd79c85 100644 --- a/src/Config/Config_ModuleReader.cpp +++ b/src/Config/Config_ModuleReader.cpp @@ -103,6 +103,7 @@ void Config_ModuleReader::processNode(xmlNodePtr theNode) std::string aPluginLibrary = getProperty(theNode, PLUGIN_LIBRARY); std::string aPluginScript = getProperty(theNode, PLUGIN_SCRIPT); std::string aPluginName = addPlugin(aPluginLibrary, aPluginScript, aPluginConf); + std::string aPluginDocSection = getProperty(theNode, PLUGIN_DOCSECTION); std::string aUsesPlugin = getProperty(theNode, PLUGIN_USES); if (!aUsesPlugin.empty()) { // send information about the plugin dependencies std::shared_ptr aMess(new Config_PluginMessage( @@ -111,7 +112,7 @@ void Config_ModuleReader::processNode(xmlNodePtr theNode) Events_Loop::loop()->send(aMess); } - std::list aFeatures = importPlugin(aPluginName, aPluginConf); + std::list aFeatures = importPlugin(aPluginName, aPluginConf, aPluginDocSection); std::list::iterator it = aFeatures.begin(); for (; it != aFeatures.end(); it++) { addFeature(*it, aPluginConf); @@ -137,7 +138,8 @@ bool Config_ModuleReader::hasRequiredModules(xmlNodePtr theNode) const } std::list Config_ModuleReader::importPlugin(const std::string& thePluginLibrary, - const std::string& thePluginXmlConf) + const std::string& thePluginXmlConf, + const std::string& thePluginDocSection) { if (thePluginXmlConf.empty()) { //probably a third party library loadLibrary(thePluginLibrary); @@ -146,6 +148,7 @@ std::list Config_ModuleReader::importPlugin(const std::string& theP Config_FeatureReader aReader = Config_FeatureReader(thePluginXmlConf, thePluginLibrary, + thePluginDocSection, myEventGenerated); aReader.readAll(); return aReader.features(); diff --git a/src/Config/Config_ModuleReader.h b/src/Config/Config_ModuleReader.h index b5533bda5..ce6198edb 100644 --- a/src/Config/Config_ModuleReader.h +++ b/src/Config/Config_ModuleReader.h @@ -77,7 +77,8 @@ class Config_ModuleReader : public Config_XMLReader bool hasRequiredModules(xmlNodePtr aNode) const; /// reads info about plugin's features from plugin xml description std::list importPlugin(const std::string& thePluginLibrary, - const std::string& thePluginFile); + const std::string& thePluginFile, + const std::string& thePluginDocSection); /// stores information about plugin in the internal cache std::string addPlugin(const std::string& aPluginLibrary, const std::string& aPluginScript, -- 2.39.2