X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_XMLReader.cpp;h=a9c56d7de1acb8c18b163c42197791899702ffbc;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=2149feba08c113ed6850c7cef0c14c50c9bcabb1;hpb=d4b0a5cb916f4eccf4a0bce02e43a54c7a67cb93;p=modules%2Fshaper.git diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 2149feba0..a9c56d7de 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// Copyright (C) 2014-2023 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -12,10 +12,9 @@ // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or -// email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include @@ -46,12 +45,15 @@ static const char FSEP = '/'; #endif -Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName) +Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName, bool isXMLContent) : myXmlDoc(NULL), myRootFileName(theXmlFileName) { - myDocumentPath = findConfigFile(theXmlFileName); - if (myDocumentPath.empty()) { - Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(theXmlFileName).send(); + isFromMemory = isXMLContent; + if (!isXMLContent) { + myDocumentPath = findConfigFile(theXmlFileName); + if (myDocumentPath.empty()) { + Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(theXmlFileName).send(); + } } } @@ -69,7 +71,7 @@ std::string Config_XMLReader::resourcesConfigFile() aValue = std::string(anEnv) + FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; } else { - anEnv = getenv("OPENPARTS_ROOT_DIR"); + anEnv = getenv("CADBUILDER_ROOT_DIR"); if (anEnv) { aValue = std::string(anEnv) + FSEP + "resources"; } @@ -85,7 +87,7 @@ std::string Config_XMLReader::pluginConfigFile() aValue = std::string(anEnv) + FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; } else { - anEnv = getenv("OPENPARTS_ROOT_DIR"); + anEnv = getenv("CADBUILDER_ROOT_DIR"); if (anEnv) { aValue = std::string(anEnv) + FSEP + "plugins"; } @@ -109,9 +111,9 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons if (aSolution == 1) anEnvName<<"SHAPER_ROOT_DIR"; else if (aSolution == 2) - anEnvName<<"OPENPARTS_ROOT_DIR"; + anEnvName<<"CADBUILDER_ROOT_DIR"; else - anEnvName<<"OPENPARTS_PLUGINS_DIR"; + anEnvName<<"CADBUILDER_ROOT_DIR"; char* anEnv = getenv(anEnvName.str().c_str()); if (!anEnv) @@ -149,7 +151,7 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons if (aResultIndex == theFindIndex) return aFileName; aResultIndex++; - if (aSolution == 1) // don't allow SHAPER and OpenParts paths treated simultaneously + if (aSolution == 1) // don't allow SHAPER and CADBuilder paths treated simultaneously aSolution++; } } @@ -158,6 +160,13 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons void Config_XMLReader::readAll() { + if (isFromMemory) { + myXmlDoc = xmlParseMemory(myRootFileName.c_str(), (int)myRootFileName.length()); + xmlNodePtr aRoot = xmlDocGetRootElement(myXmlDoc); + readRecursively(aRoot); + return; + } + // to load external modules dependencies (like GEOM for Connector Feature) Config_ModuleReader::loadScript("salome.shaper.initConfig", false); @@ -194,7 +203,7 @@ void Config_XMLReader::cleanup(xmlNodePtr) } // LCOV_EXCL_START -bool Config_XMLReader::processChildren(xmlNodePtr aNode) +bool Config_XMLReader::processChildren(xmlNodePtr /*aNode*/) { return true; }