/*! An unbounded sequence of strings
*/
typedef sequence<string> ListOfStrings ;
+/*! An unbounded sequence of sequence of strings
+*/
+ typedef sequence<ListOfStrings> ListOfListOfStrings ;
/*! A byte stream which is used for binary data transfer between different components
*/
typedef sequence<octet> TMPFile;
\param string with variables, separated by special symbol.
\return Variables list.
*/
- ListOfStrings ParseVariables( in string theVars );
+ ListOfListOfStrings ParseVariables( in string theVars );
};
return aResult;
}
-vector<string> SALOMEDS_Study::ParseVariables(const string& theVars)
+vector< vector<string> > SALOMEDS_Study::ParseVariables(const string& theVars)
{
- vector<string> aResult;
+ vector< vector<string> > aResult;
if (_isLocal) {
SALOMEDS::Locker lock;
aResult = _local_impl->ParseVariables(theVars);
}
else {
- SALOMEDS::ListOfStrings_var aSeq = _corba_impl->ParseVariables(theVars.c_str());
- int aLength = aSeq->length();
- for (int i = 0; i < aLength; i++)
- aResult.push_back( string(aSeq[i].in()) );
+ SALOMEDS::ListOfListOfStrings_var aSeq = _corba_impl->ParseVariables(theVars.c_str());
+ for (int i = 0, n = aSeq->length(); i < n; i++) {
+ vector<string> aVector;
+ SALOMEDS::ListOfStrings aSection = aSeq[i];
+ for (int j = 0, m = aSection.length(); j < m; j++) {
+ aVector.push_back( string(aSection[j].in()) );
+ }
+ aResult.push_back( aVector );
+ }
}
return aResult;
}
virtual bool RemoveVariable(const std::string& theVarName);
virtual bool RenameVariable(const std::string& theVarName, const std::string& theNewVarName);
virtual bool IsVariableUsed(const std::string& theVarName);
- virtual std::vector<std::string> ParseVariables(const std::string& theVars);
+ virtual std::vector< std::vector<std::string> > ParseVariables(const std::string& theVars);
std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);
* Purpose :
*/
//============================================================================
-SALOMEDS::ListOfStrings* SALOMEDS_Study_i::ParseVariables(const char* theVarName)
+SALOMEDS::ListOfListOfStrings* SALOMEDS_Study_i::ParseVariables(const char* theVarName)
{
- vector<string> aVarNames = _impl->ParseVariables(string(theVarName));
- SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
+ vector< vector<string> > aSections = _impl->ParseVariables(string(theVarName));
- int aLen = aVarNames.size();
- aResult->length(aLen);
+ SALOMEDS::ListOfListOfStrings_var aResult = new SALOMEDS::ListOfListOfStrings;
+
+ int aSectionsLen = aSections.size();
+ aResult->length(aSectionsLen);
+
+ for (int aSectionInd = 0; aSectionInd < aSectionsLen; aSectionInd++) {
+ vector<string> aVarNames = aSections[aSectionInd];
+
+ SALOMEDS::ListOfStrings_var aList = new SALOMEDS::ListOfStrings;
+
+ int aLen = aVarNames.size();
+ aList->length(aLen);
+
+ for (int anInd = 0; anInd < aLen; anInd++)
+ aList[anInd] = CORBA::string_dup(aVarNames[anInd].c_str());
+
+ aResult[aSectionInd] = aList;
+ }
- for (int anInd = 0; anInd < aLen; anInd++)
- aResult[anInd] = CORBA::string_dup(aVarNames[anInd].c_str());
-
return aResult._retn();
}
virtual CORBA::Boolean IsVariableUsed(const char* theVarName);
- virtual SALOMEDS::ListOfStrings* ParseVariables(const char* theVars);
+ virtual SALOMEDS::ListOfListOfStrings* ParseVariables(const char* theVars);
virtual char* GetDefaultScript(const char* theModuleName, const char* theShift);
const std::string& theNewVarName) = 0;
virtual bool IsVariableUsed(const std::string& theVarName) = 0;
- virtual std::vector<std::string> ParseVariables(const std::string& theVars) = 0;
+ virtual std::vector< std::vector<std::string> > ParseVariables(const std::string& theVars) = 0;
};
#define DIRECTORYID 16661
#define FILELOCALID 26662
#define FILEID "FILE: "
-#define VARIABLE_SEPARATOR ':'
+#define VARIABLE_SEPARATOR ':'
+#define OPERATION_SEPARATOR '|'
//============================================================================
{
string aString = aStringAttr->Value();
- vector<string> aVector = SALOMEDSImpl_Tool::splitStringWithEmpty( aString, VARIABLE_SEPARATOR );
- for( int i = 0, len = aVector.size(); i < len; i++ )
+ vector< vector<string> > aSections = ParseVariables( aString );
+ for( int i = 0, n = aSections.size(); i < n; i++ )
{
- string aStr = aVector[i];
- if( aStr.compare( theName ) == 0 )
- return true;
+ vector<string> aVector = aSections[i];
+ for( int j = 0, m = aVector.size(); j < m; j++ )
+ {
+ string aStr = aVector[j];
+ if( aStr.compare( theName ) == 0 )
+ return true;
+ }
}
}
}
bool isChanged = false;
string aNewString, aCurrentString = aStringAttr->Value();
- vector<string> aVector = SALOMEDSImpl_Tool::splitStringWithEmpty( aCurrentString, VARIABLE_SEPARATOR );
- for( int i = 0, len = aVector.size(); i < len; i++ )
+ vector< vector<string> > aSections = ParseVariables( aCurrentString );
+ for( int i = 0, n = aSections.size(); i < n; i++ )
{
- string aStr = aVector[i];
- if( aStr.compare( theSource ) == 0 )
+ vector<string> aVector = aSections[i];
+ for( int j = 0, m = aVector.size(); j < m; j++ )
{
- isChanged = true;
- aStr = theDest;
- }
+ string aStr = aVector[j];
+ if( aStr.compare( theSource ) == 0 )
+ {
+ isChanged = true;
+ aStr = theDest;
+ }
- aNewString.append( aStr );
- if( i != len - 1 )
- aNewString.append( ":" );
+ aNewString.append( aStr );
+ if( j != m - 1 )
+ aNewString.append( ":" );
+ }
+ if( i != n - 1 )
+ aNewString.append( "|" );
}
if( isChanged )
}
//============================================================================
-/*! Function : EnableUseCaseAutoFilling
+/*! Function : ParseVariables
* Purpose :
*/
//============================================================================
-vector<string> SALOMEDSImpl_Study::ParseVariables(const string& theVariables) const
+vector< vector< string > > SALOMEDSImpl_Study::ParseVariables(const string& theVariables) const
{
- return SALOMEDSImpl_Tool::splitStringWithEmpty( theVariables, VARIABLE_SEPARATOR );
+ return SALOMEDSImpl_Tool::splitStringWithEmpty( theVariables, OPERATION_SEPARATOR, VARIABLE_SEPARATOR );
}
//============================================================================
const std::string& theDest);
void ReplaceVariableAttribute(const std::string& theSource, const std::string& theDest);
- std::vector<std::string> ParseVariables(const std::string& theVariables) const;
+ std::vector< std::vector<std::string> > ParseVariables(const std::string& theVariables) const;
//Returns a callback
SALOMEDSImpl_Callback* GetCallback() { return _cb; }
return aResult;
}
+//============================================================================
+// function :
+// purpose : The functions returns a list of lists of substrings of initial string
+// divided by two given separators include empty strings
+//============================================================================
+vector< vector<string> > SALOMEDSImpl_Tool::splitStringWithEmpty(const string& theValue, char sep1, char sep2)
+{
+ vector< vector<string> > aResult;
+ vector<string> aSections = splitStringWithEmpty( theValue, sep1 );
+ for( int i = 0, n = aSections.size(); i < n; i++ )
+ aResult.push_back( splitStringWithEmpty( aSections[i], sep2 ) );
+ return aResult;
+}
+
void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
{
//include empty strings
static std::vector<std::string> splitStringWithEmpty(const std::string& theValue, char separator);
+ //The functions returns a list of substring of initial string divided by given separator,
+ //include empty strings
+ static std::vector< std::vector<std::string> > splitStringWithEmpty(const std::string& theValue,
+ char separator1,
+ char separator2);
+
//Returns a system date
static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds);