X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_WidgetReader.cpp;h=7ba92f9961f5f6b7a5d7e08f4e2fd54ff1e8b29d;hb=2b4f4bf278c841500eb29bb5d204690427b0d56b;hp=3558c659652307e27ab1bf6ac314cc1d31bc8121;hpb=a002dc2fe33da6b7ab8e0faff3b6b591efaf17b0;p=modules%2Fshaper.git diff --git a/src/Config/Config_WidgetReader.cpp b/src/Config/Config_WidgetReader.cpp index 3558c6596..7ba92f996 100644 --- a/src/Config/Config_WidgetReader.cpp +++ b/src/Config/Config_WidgetReader.cpp @@ -7,11 +7,12 @@ #include #include +#include -#include -#include -#include -#include +#include +#include +#include +#include #ifdef _DEBUG #include @@ -28,22 +29,49 @@ Config_WidgetReader::~Config_WidgetReader() { } -std::string Config_WidgetReader::featureWidgetCfg(std::string theFeatureName) +std::string Config_WidgetReader::featureWidgetCfg(const std::string& theFeatureName) { return myWidgetCache[theFeatureName]; } +std::string Config_WidgetReader::featureDescription(const std::string& theFeatureName) +{ + return myDescriptionCache[theFeatureName]; +} + + void Config_WidgetReader::processNode(xmlNodePtr theNode) { if (isNode(theNode, NODE_FEATURE, NULL)) { - xmlBufferPtr buffer = xmlBufferCreate(); - int size = xmlNodeDump(buffer, theNode->doc, theNode, 0, 1); std::string aNodeName = getProperty(theNode, _ID); - myWidgetCache[aNodeName] = std::string((char*) buffer->content); + myWidgetCache[aNodeName] = dumpNode(theNode);; + myDescriptionCache[aNodeName] = getProperty(theNode, FEATURE_TEXT); } + //Process SOURCE nodes. + Config_XMLReader::processNode(theNode); } bool Config_WidgetReader::processChildren(xmlNodePtr theNode) { return isNode(theNode, NODE_WORKBENCH, NODE_GROUP, NULL); } + +std::string Config_WidgetReader::dumpNode(xmlNodePtr theNode) +{ + std::string result = ""; + if (!hasChild(theNode)) { + return result; + } + xmlNodePtr aChildrenNode = xmlFirstElementChild(theNode); + xmlBufferPtr buffer = xmlBufferCreate(); + if (isNode(aChildrenNode, NODE_SOURCE, NULL)) { + Config_XMLReader aSourceReader = + Config_XMLReader(getProperty(aChildrenNode, SOURCE_FILE)); + xmlNodePtr aSourceRoot = aSourceReader.findRoot(); + int size = xmlNodeDump(buffer, aSourceRoot->doc, aSourceRoot, 0, 1); + } else { + int size = xmlNodeDump(buffer, theNode->doc, theNode, 0, 1); + } + result = std::string((char*) (buffer->content)); + return result; +}