Version: 8.3.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,... 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 agrument. 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 sting. 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, ... 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

typedef void* _pyCommand::TAddr

Member Enumeration Documentation

anonymous enum
private
Enumerator
UNKNOWN 
EMPTY 
RESULT_IND 
OBJECT_IND 
METHOD_IND 
ARG1_IND 

Constructor & Destructor Documentation

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

Member Function Documentation

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().

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

Comment a python command.

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

void _pyCommand::FindAllArgs ( )
private

References GetArg().

Referenced by GetNbArgs(), and SetArg().

TAddr _pyCommand::GetAddress ( ) const
int _pyCommand::GetArgBeginning ( ) const

Return position where arguments begin.

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

Referenced by _pyStringFamily::IsInArgs().

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().

TCollection_AsciiString _pyCommand::GetIndentation ( )

Returns whitespace symbols at the line beginning.

Return values
TCollection_AsciiString- result

References Length(), and myString.

int _pyCommand::GetNbResultValues ( )

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

References GetResultValue(), and myResults.

Referenced by _pyGroup::_pyGroup().

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(), _pyFilter::Process(), and SetObject().

int _pyCommand::GetOrderNb ( ) const
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 _pyObject::GetID(), GetNbResultValues(), GetResultValue(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), _pyGroup::Process(), and SetResultValue().

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.

std::list< _pyID > _pyCommand::GetStudyEntries ( const _AString str)
static
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, isWord(), and theEmptyString.

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

bool _pyCommand::IsEmpty ( ) const
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().

static bool _pyCommand::IsIDChar ( char  c)
static
bool _pyCommand::IsMethodCall ( )

Returns true if there are brackets after the method.

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

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 _pyGen::IsGeomObject().

bool _pyCommand::MethodStartsFrom ( const _AString beg)

References GetMethod(), and myMeth.

Referenced by _pyMesh::_pyMesh(), and _pyMesh::Process().

void _pyCommand::SetArg ( int  index,
const _AString theArg 
)
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().

bool _pyCommand::SetDependentCmdsAfter ( ) const

Set dependent commands after this one.

References GetOrderNb(), myDependentCmds, and _pyGen::SetCommandAfter().

void _pyCommand::SetOrderNb ( int  theNb)

References myOrderNb.

Referenced by _pyGen::ExchangeCommands().

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(), SetMethod(), SetObject(), and SetResultValue().

void _pyCommand::SetResultValue ( const _AString theResult)
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

TColStd_SequenceOfAsciiString _pyCommand::myArgs
private

found arguments

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

TColStd_SequenceOfInteger _pyCommand::myBegPos
private

where myRes, myObj, ...

begin

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

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

commands that should follow me in the script

Referenced by AddDependantCmd(), and SetDependentCmdsAfter().

_AString _pyCommand::myMeth
private

found parts of command

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

_AString _pyCommand::myObj
private

Referenced by GetMethod(), GetObject(), and SetObject().

int _pyCommand::myOrderNb
private

position within the script

Referenced by GetOrderNb(), and SetOrderNb().

_AString _pyCommand::myRes
private
TColStd_SequenceOfAsciiString _pyCommand::myResults
private

found results

Referenced by GetNbResultValues(), and GetResultValue().