X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.hxx;h=ca1f78337da2172d7152d79438c044b3940ba506;hp=607136e2f73cd93bb371c3e85c2bff78f4bf36af;hb=5482b99d07dd144fd5be299e722f39a81de3b5be;hpb=616481f67a7a1d9826de628d6c904caca32a3447 diff --git a/src/SMESH_I/SMESH_2smeshpy.hxx b/src/SMESH_I/SMESH_2smeshpy.hxx index 607136e2f..ca1f78337 100644 --- a/src/SMESH_I/SMESH_2smeshpy.hxx +++ b/src/SMESH_I/SMESH_2smeshpy.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -102,11 +102,12 @@ class _pyCommand: public Standard_Transient _AString myString; //!< command text _AString myRes, myObj, myMeth; //!< found parts of command TColStd_SequenceOfAsciiString myArgs; //!< found arguments + TColStd_SequenceOfAsciiString myResults; //!< found results TColStd_SequenceOfInteger myBegPos; //!< where myRes, myObj, ... begin std::list< Handle(_pyCommand) > myDependentCmds; //!< commands that sould follow me in the script enum { UNKNOWN=-1, EMPTY=0, RESULT_IND, OBJECT_IND, METHOD_IND, ARG1_IND }; - int GetBegPos( int thePartIndex ); + int GetBegPos( int thePartIndex ) const; void SetBegPos( int thePartIndex, int thePosition ); void SetPart( int thePartIndex, const _AString& theNewPart, _AString& theOldPart); void FindAllArgs() { GetArg(1); } @@ -114,23 +115,24 @@ class _pyCommand: public Standard_Transient public: _pyCommand() {}; _pyCommand( const _AString& theString, int theNb=-1 ) - : myString( theString ), myOrderNb( theNb ) {}; + : myOrderNb( theNb ), myString( theString ) {}; _AString & GetString() { return myString; } - int GetOrderNb() const { return myOrderNb; } + int GetOrderNb() const { return myOrderNb; } void SetOrderNb( int theNb ) { myOrderNb = theNb; } typedef void* TAddr; TAddr GetAddress() const { return (void*) this; } - int Length() { return myString.Length(); } + int Length() const { return myString.Length(); } void Clear() { myString.Clear(); myBegPos.Clear(); myArgs.Clear(); } bool IsEmpty() const { return myString.IsEmpty(); } _AString GetIndentation(); const _AString & GetResultValue(); int GetNbResultValues(); - _AString GetResultValue(int res); + const _AString & GetResultValue(int res); const _AString & GetObject(); const _AString & GetMethod(); const _AString & GetArg( int index ); int GetNbArgs() { FindAllArgs(); return myArgs.Length(); } + int GetArgBeginning() const; bool IsMethodCall(); bool MethodStartsFrom(const _AString& beg) { GetMethod(); return ( myMeth.Location( beg, 1, myMeth.Length() ) == 1 ); } @@ -148,6 +150,8 @@ public: const bool theForward, const bool dotIsWord = false); static bool IsStudyEntry( const _AString& str ); static bool IsID( const _AString& str ); + static bool IsIDChar( char c ) + { return ( isalnum( c ) || c == '_' || c == ':' ); } static std::list< _pyID > GetStudyEntries( const _AString& str ); void AddDependantCmd( Handle(_pyCommand) cmd, bool prepend = false) { if (prepend) myDependentCmds.push_front( cmd ); else myDependentCmds.push_back( cmd ); } @@ -179,11 +183,11 @@ public: const _pyID& GetID() { return myID.IsEmpty() ? myCreationCmd->GetResultValue() : myID; } static _pyID FatherID(const _pyID & childID); const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; } - int GetNbCalls() const { return myProcessedCmds.size(); } + int GetNbCalls() const { return myProcessedCmds.size(); } bool IsInStudy() const { return myIsPublished; } virtual void SetRemovedFromStudy(const bool isRemoved) { myIsPublished = !isRemoved; } void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; } - int GetCommandNb() { return myCreationCmd->GetOrderNb(); } + int GetCommandNb() { return myCreationCmd->GetOrderNb(); } void AddProcessedCmd( const Handle(_pyCommand) & cmd ) { if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );} std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; } @@ -234,7 +238,7 @@ class _pyStringFamily int isIn( const char* str ); public: bool Add( const char* str ); - bool IsIn( const _AString& str, _AString& subStr ); + bool IsInArgs( Handle( _pyCommand)& cmd, std::list<_AString>& subStr ); void Print( int level = 0 ); }; @@ -261,7 +265,7 @@ public: void PlaceSubmeshAfterItsCreation( Handle(_pyCommand) theCmdUsingSubmesh ) const; _pyID GenerateNewID( const _pyID& theID ); - void AddObject( Handle(_pyObject)& theObj ); + bool AddObject( Handle(_pyObject)& theObj ); void CheckObjectIsReCreated( Handle(_pyObject)& theObj ); void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj ); Handle(_pyObject) FindObject( const _pyID& theObjID ) const; @@ -305,8 +309,9 @@ private: private: std::map< _pyID, Handle(_pyMesh) > myMeshes; std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors; - std::map< _pyID, Handle(_pyObject) > myObjects; std::map< _pyID, Handle(_pyHypothesis) > myHypos; + std::map< _pyID, Handle(_pyObject) > myObjects; + std::list< Handle(_pyObject) > myOrderedObjects; // to know order of myObjects creation #ifdef USE_STRING_FAMILY _pyStringFamily myKeepAgrCmdsIDs; #else @@ -572,6 +577,8 @@ public: _pySelfEraser(const Handle(_pyCommand)& theCreationCmd); void IgnoreOwnCalls() { myIgnoreOwnCalls = true; } virtual void Flush(); + virtual bool CanClear(); + static bool IsAliveCmd( const Handle(_pyCommand)& theCmd ); DEFINE_STANDARD_RTTI (_pySelfEraser) };