From: jfa Date: Wed, 19 Sep 2007 09:15:55 +0000 (+0000) Subject: NPAL16955: syntax storage in a python supervisiongraph. Fix for already sreened singl... X-Git-Tag: T_24092007 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=215b97b7e270641166f3b764e87ebf7bdfb851e0;p=modules%2Fsuperv.git NPAL16955: syntax storage in a python supervisiongraph. Fix for already sreened single quote and other meta-symbols. --- diff --git a/src/GraphBase/DataFlowBase_ComputingNode.cxx b/src/GraphBase/DataFlowBase_ComputingNode.cxx index 51b902f..b97d441 100644 --- a/src/GraphBase/DataFlowBase_ComputingNode.cxx +++ b/src/GraphBase/DataFlowBase_ComputingNode.cxx @@ -35,11 +35,32 @@ using namespace std; static string protectQuotes (const string theText) { string aRes (theText); - for (unsigned int pos = 0; pos < aRes.size(); pos+=2) { + unsigned int pos; + + // screen back slash + for (pos = 0; pos < aRes.size(); pos++) { + pos = aRes.find("\\", pos); + if (pos < 0 || pos > aRes.size()) break; + + aRes.insert(pos, "\\"); + pos++; + + // screen symbol after back slash (except single quote, which will be processed below) + if (pos + 1 < aRes.size() && aRes[pos + 1] != '\'') { + aRes.insert(pos + 1, "\\"); + pos++; + } + } + + // screen single quote + for (pos = 0; pos < aRes.size(); pos++) { pos = aRes.find("'", pos); if (pos < 0 || pos > aRes.size()) break; - aRes.replace(pos, 1, "\\\'"); + + aRes.insert(pos, "\\"); + pos++; } + return aRes; }