Version: 9.16.0
_pyCommand Class Reference

Class operating on a command string looking like ResultValue = Object.Method( Arg1, Arg2,...) More...

#include <SMESH_2smeshpy.hxx>

Inheritance diagram for _pyCommand:

Public Types

typedef void * TAddr
 

Public Member Functions

 _pyCommand ()
 
 _pyCommand (const _AString &theString, int theNb=-1)
 
_AStringGetString ()
 
int GetOrderNb () const
 
void SetOrderNb (int theNb)
 
TAddr GetAddress () const
 
int Length () const
 
void Clear ()
 
bool IsEmpty () const
 
_AString GetIndentation ()
 Returns whitespace symbols at the line beginning. More...
 
const _AStringGetResultValue ()
 Return substring of python command looking like ResultValue = Obj.Meth() More...
 
int GetNbResultValues ()
 Return number of python command result value ResultValue = Obj.Meth() More...
 
const _AStringGetResultValue (int res)
 Return substring of python command looking like ResultValue1 , ResultValue2,... = Obj.Meth() with res index. More...
 
const _AStringGetObject ()
 Return substring of python command looking like ResVal = Object.Meth() More...
 
const _AStringGetMethod ()
 Return substring of python command looking like ResVal = Obj.Method() More...
 
const _AStringGetArg (int index)
 Return substring of python command looking like ResVal = Obj.Meth(Arg1,...) More...
 
int GetNbArgs ()
 
int GetArgBeginning () const
 Return position where arguments begin. More...
 
bool IsMethodCall ()
 Returns true if there are brackets after the method. More...
 
bool MethodStartsFrom (const _AString &beg)
 
void SetResultValue (const _AString &theResult)
 
void SetObject (const _AString &theObject)
 
void SetMethod (const _AString &theMethod)
 
void SetArg (int index, const _AString &theArg)
 Set argument. More...
 
void RemoveArgs ()
 Empty arg list. More...
 
void Comment ()
 Comment a python command. More...
 
void AddDependantCmd (Handle(_pyCommand) cmd, bool prepend=false)
 
bool SetDependentCmdsAfter () const
 Set dependent commands after this one. More...
 
bool AddAccessorMethod (_pyID theObjectID, const char *theAcsMethod)
 Insert accessor method after theObjectID. More...
 

Static Public Member Functions

static bool SkipSpaces (const _AString &theSring, int &thePos)
 Look for position where not space char is. More...
 
static _AString GetWord (const _AString &theSring, int &theStartPos, const bool theForward, const bool dotIsWord=false)
 Looks for a word in the string and returns word's beginning. More...
 
static bool IsStudyEntry (const _AString &str)
 Returns true if the string looks like a study entry. More...
 
static bool IsID (const _AString &str)
 Returns true if the string looks like an object ID but not like a list, string, command etc. More...
 
static bool IsIDChar (char c)
 
static std::list< _pyIDGetStudyEntries (const _AString &str)
 Finds entries in a string. More...
 

Private Types

enum  {
  UNKNOWN =-1 , EMPTY =0 , RESULT_IND , OBJECT_IND ,
  METHOD_IND , ARG1_IND
}
 

Private Member Functions

int GetBegPos (int thePartIndex) const
 Return starting position of a part of python command. More...
 
void SetBegPos (int thePartIndex, int thePosition)
 Store starting position of a part of python command. More...
 
void SetPart (int thePartIndex, const _AString &theNewPart, _AString &theOldPart)
 Modify a part of the command. More...
 
void FindAllArgs ()
 

Private Attributes

int myOrderNb
 position within the script More...
 
_AString myString
 command text More...
 
_AString myRes
 
_AString myObj
 
_AString myMeth
 found parts of command More...
 
TColStd_SequenceOfAsciiString myArgs
 found arguments More...
 
TColStd_SequenceOfAsciiString myResults
 found results More...
 
TColStd_SequenceOfInteger myBegPos
 where myRes, myObj, ... begin More...
 
std::list< Handle(_pyCommand) > myDependentCmds
 commands that should follow me in the script More...
 

Detailed Description

Class operating on a command string looking like ResultValue = Object.Method( Arg1, Arg2,...)

Member Typedef Documentation

◆ TAddr

typedef void* _pyCommand::TAddr

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
UNKNOWN 
EMPTY 
RESULT_IND 
OBJECT_IND 
METHOD_IND 
ARG1_IND 

Constructor & Destructor Documentation

◆ _pyCommand() [1/2]

_pyCommand::_pyCommand ( )

◆ _pyCommand() [2/2]

_pyCommand::_pyCommand ( const _AString theString,
int  theNb = -1 
)

Member Function Documentation

◆ AddAccessorMethod()

bool _pyCommand::AddAccessorMethod ( _pyID  theObjectID,
const char *  theAcsMethod 
)

Insert accessor method after theObjectID.

Parameters
theObjectID- id of the accessed object
theAcsMethod- name of the method giving access to the object
Return values
bool- false if theObjectID is not found in the command string

References GetBegPos(), GetObject(), IsIDChar(), Length(), myBegPos, myString, and OBJECT_IND.

Referenced by _pyGen::AddAlgoAccessorMethod(), and _pyGen::AddMeshAccessorMethod().

◆ AddDependantCmd()

void _pyCommand::AddDependantCmd ( Handle(_pyCommand cmd,
bool  prepend = false 
)

◆ Clear()

◆ Comment()

void _pyCommand::Comment ( )

Comment a python command.

References EMPTY, GetBegPos(), IsEmpty(), Length(), myBegPos, myString, SetBegPos(), and UNKNOWN.

◆ FindAllArgs()

void _pyCommand::FindAllArgs ( )
private

Referenced by SetArg().

◆ GetAddress()

TAddr _pyCommand::GetAddress ( ) const

◆ GetArg()

◆ GetArgBeginning()

int _pyCommand::GetArgBeginning ( ) const

Return position where arguments begin.

References ARG1_IND, GetBegPos(), Length(), METHOD_IND, myMeth, myString, and UNKNOWN.

Referenced by _pyStringFamily::IsInArgs().

◆ GetBegPos()

int _pyCommand::GetBegPos ( int  thePartIndex) const
private

Return starting position of a part of python command.

Parameters
thePartIndex- The index of command part
Return values
int- Part position

References EMPTY, IsEmpty(), myBegPos, and UNKNOWN.

Referenced by AddAccessorMethod(), Comment(), GetArg(), GetArgBeginning(), GetMethod(), GetObject(), GetResultValue(), IsMethodCall(), RemoveArgs(), SetArg(), and SetPart().

◆ GetIndentation()

TCollection_AsciiString _pyCommand::GetIndentation ( )

Returns whitespace symbols at the line beginning.

Return values
TCollection_AsciiString- result

References end(), Length(), and myString.

◆ GetMethod()

◆ GetNbArgs()

◆ GetNbResultValues()

int _pyCommand::GetNbResultValues ( )

Return number of python command result value ResultValue = Obj.Meth()

References GetResultValue(), and myResults.

Referenced by _pyGroup::_pyGroup().

◆ GetObject()

const TCollection_AsciiString & _pyCommand::GetObject ( )

Return substring of python command looking like ResVal = Object.Meth()

Return values
constTCollection_AsciiString & - Object substring

References EMPTY, GetBegPos(), GetWord(), Length(), myObj, myRes, myString, OBJECT_IND, RESULT_IND, SetBegPos(), and UNKNOWN.

Referenced by _pyMesh::_pyMesh(), _pyMeshEditor::_pyMeshEditor(), _pySubMesh::_pySubMesh(), AddAccessorMethod(), _pyMesh::AddMeshAccess(), _pySelfEraser::IsAliveCmd(), and _pyFilter::Process().

◆ GetOrderNb()

int _pyCommand::GetOrderNb ( ) const

◆ GetResultValue() [1/2]

const TCollection_AsciiString & _pyCommand::GetResultValue ( )

Return substring of python command looking like ResultValue = Obj.Meth()

Return values
constTCollection_AsciiString & - ResultValue substring

References EMPTY, GetBegPos(), Length(), myRes, myString, RESULT_IND, SetBegPos(), and UNKNOWN.

Referenced by GetNbResultValues(), GetResultValue(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), and _pyGroup::Process().

◆ GetResultValue() [2/2]

const _AString & _pyCommand::GetResultValue ( int  res)

Return substring of python command looking like ResultValue1 , ResultValue2,... = Obj.Meth() with res index.

Return values
constTCollection_AsciiString & - ResultValue with res index substring

References GetResultValue(), GetWord(), IsEmpty(), myRes, myResults, SkipSpaces(), and theEmptyString.

◆ GetString()

◆ GetStudyEntries()

std::list< _pyID > _pyCommand::GetStudyEntries ( const _AString str)
static

◆ GetWord()

TCollection_AsciiString _pyCommand::GetWord ( const _AString theString,
int &  theStartPos,
const bool  theForward,
const bool  dotIsWord = false 
)
static

Looks for a word in the string and returns word's beginning.

Parameters
theString- The input string
theStartPos- The position to start the search, returning word's beginning
theForward- The search direction
Return values
TCollection_AsciiString- The found word

References EMPTY, end(), isWord(), and theEmptyString.

Referenced by _pyHypothesisReader::_pyHypothesisReader(), GetMethod(), GetObject(), and GetResultValue().

◆ IsEmpty()

◆ IsID()

bool _pyCommand::IsID ( const _AString str)
static

Returns true if the string looks like an object ID but not like a list, string, command etc.

References IsIDChar().

◆ IsIDChar()

static bool _pyCommand::IsIDChar ( char  c)
static

◆ IsMethodCall()

bool _pyCommand::IsMethodCall ( )

Returns true if there are brackets after the method.

References GetBegPos(), GetMethod(), IsEmpty(), METHOD_IND, myMeth, and myString.

◆ IsStudyEntry()

bool _pyCommand::IsStudyEntry ( const _AString str)
static

Returns true if the string looks like a study entry.

Referenced by _pyGen::_pyGen(), _pyGen::CheckObjectIsReCreated(), GetStudyEntries(), and _pyMesh::Process().

◆ Length()

◆ MethodStartsFrom()

bool _pyCommand::MethodStartsFrom ( const _AString beg)

◆ RemoveArgs()

◆ SetArg()

void _pyCommand::SetArg ( int  index,
const _AString theArg 
)

◆ SetBegPos()

void _pyCommand::SetBegPos ( int  thePartIndex,
int  thePosition 
)
private

Store starting position of a part of python command.

Parameters
thePartIndex- The index of command part
thePosition- Part position

References myBegPos, and UNKNOWN.

Referenced by Comment(), GetArg(), GetMethod(), GetObject(), GetResultValue(), and SetArg().

◆ SetDependentCmdsAfter()

bool _pyCommand::SetDependentCmdsAfter ( ) const

Set dependent commands after this one.

References GetOrderNb(), Handle(), and myDependentCmds.

◆ SetMethod()

◆ SetObject()

◆ SetOrderNb()

void _pyCommand::SetOrderNb ( int  theNb)

◆ SetPart()

void _pyCommand::SetPart ( int  thePartIndex,
const _AString theNewPart,
_AString theOldPart 
)
private

Modify a part of the command.

Parameters
thePartIndex- The index of the part
thePart- The new part string
theOldPart- The old part

References GetBegPos(), Length(), METHOD_IND, myBegPos, myString, OBJECT_IND, and RESULT_IND.

Referenced by SetArg().

◆ SetResultValue()

void _pyCommand::SetResultValue ( const _AString theResult)

◆ SkipSpaces()

bool _pyCommand::SkipSpaces ( const _AString theSring,
int &  thePos 
)
static

Look for position where not space char is.

Parameters
theString- The string
thePos- The position to search from and which returns result
Return values
bool- false if there are only space after thePos in theString

Referenced by GetResultValue().

Field Documentation

◆ myArgs

TColStd_SequenceOfAsciiString _pyCommand::myArgs
private

found arguments

Referenced by GetArg(), RemoveArgs(), and SetArg().

◆ myBegPos

TColStd_SequenceOfInteger _pyCommand::myBegPos
private

where myRes, myObj, ... begin

Referenced by AddAccessorMethod(), Comment(), GetBegPos(), RemoveArgs(), SetBegPos(), and SetPart().

◆ myDependentCmds

std::list< Handle(_pyCommand) > _pyCommand::myDependentCmds
private

commands that should follow me in the script

Referenced by SetDependentCmdsAfter().

◆ myMeth

_AString _pyCommand::myMeth
private

found parts of command

Referenced by GetArg(), GetArgBeginning(), GetMethod(), and IsMethodCall().

◆ myObj

_AString _pyCommand::myObj
private

Referenced by GetMethod(), and GetObject().

◆ myOrderNb

int _pyCommand::myOrderNb
private

position within the script

◆ myRes

_AString _pyCommand::myRes
private

Referenced by GetObject(), and GetResultValue().

◆ myResults

TColStd_SequenceOfAsciiString _pyCommand::myResults
private

found results

Referenced by GetNbResultValues(), and GetResultValue().

◆ myString