Class operating on a command string looking like ResultValue = Object.Method( Arg1, Arg2,...) More...
#include <SMESH_2smeshpy.hxx>
Public Types | |
typedef void * | TAddr |
Public Member Functions | |
_pyCommand () | |
_pyCommand (const _AString &theString, int theNb=-1) | |
_AString & | GetString () |
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 _AString & | GetResultValue () |
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 _AString & | GetResultValue (int res) |
Return substring of python command looking like ResultValue1 , ResultValue2,... More... | |
const _AString & | GetObject () |
Return substring of python command looking like ResVal = Object.Meth() More... | |
const _AString & | GetMethod () |
Return substring of python command looking like ResVal = Obj.Method() More... | |
const _AString & | GetArg (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< _pyID > | GetStudyEntries (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... | |
Class operating on a command string looking like ResultValue = Object.Method( Arg1, Arg2,...)
typedef void* _pyCommand::TAddr |
_pyCommand::_pyCommand | ( | ) |
Insert accessor method after theObjectID.
theObjectID | - id of the accessed object |
theAcsMethod | - name of the method giving access to the object |
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 |
||
) |
References myDependentCmds.
Referenced by _pyLayerDistributionHypo::Addition2Creation(), and _pyFilter::Process().
void _pyCommand::Clear | ( | ) |
References myArgs, myBegPos, and myString.
Referenced by _pyMeshEditor::_pyMeshEditor(), _pyGen::Process(), _pyMesh::Process(), _pyFilter::Process(), and _pyGroup::Process().
void _pyCommand::Comment | ( | ) |
Comment a python command.
References EMPTY, GetBegPos(), IsEmpty(), Length(), myBegPos, myString, SetBegPos(), and UNKNOWN.
|
private |
References GetArg().
Referenced by GetNbArgs(), and SetArg().
TAddr _pyCommand::GetAddress | ( | ) | const |
Referenced by _pyHypothesis::ComputeDiscarded(), and _pyHypothesis::MeshComputed().
const TCollection_AsciiString & _pyCommand::GetArg | ( | int | index | ) |
Return substring of python command looking like ResVal = Obj.Meth(Arg1,...)
const | TCollection_AsciiString & - Arg<index> substring |
References ARG1_IND, GetBegPos(), Length(), METHOD_IND, myArgs, myMeth, myString, SetBegPos(), theEmptyString, and UNKNOWN.
Referenced by _pyGroup::_pyGroup(), _pyMesh::_pyMesh(), _pyHypothesis::Addition2Creation(), _pyLayerDistributionHypo::Addition2Creation(), _pySegmentLengthAroundVertexHyp::Addition2Creation(), FindAllArgs(), Handle(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), _pyHypothesis::Process(), _pyComplexParamHypo::Process(), _pyLayerDistributionHypo::Process(), _pyFilter::Process(), _pyGroup::Process(), _pyHypothesis::rememberCmdOfParameter(), and SetArg().
int _pyCommand::GetArgBeginning | ( | ) | const |
Return position where arguments begin.
References ARG1_IND, GetBegPos(), Length(), METHOD_IND, myMeth, myString, and UNKNOWN.
Referenced by _pyStringFamily::IsInArgs().
Return starting position of a part of python command.
thePartIndex | - The index of command part |
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 | ( | ) |
const TCollection_AsciiString & _pyCommand::GetMethod | ( | ) |
Return substring of python command looking like ResVal = Obj.Method()
const | TCollection_AsciiString & - Method substring |
References GetBegPos(), GetWord(), Length(), METHOD_IND, myMeth, myObj, myString, OBJECT_IND, SetBegPos(), and UNKNOWN.
Referenced by _pyGroup::_pyGroup(), _pyHypothesisReader::_pyHypothesisReader(), _pyMesh::_pyMesh(), _pyHypothesis::Addition2Creation(), IsMethodCall(), MethodStartsFrom(), _pyMesh::NeedMeshAccess(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), _pyHypothesis::Process(), _pyComplexParamHypo::Process(), _pyLayerDistributionHypo::Process(), _pyFilter::Process(), _pyGroup::Process(), _pyHypothesis::rememberCmdOfParameter(), and SetMethod().
int _pyCommand::GetNbArgs | ( | ) |
References FindAllArgs(), and myArgs.
Referenced by Handle(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), _pyComplexParamHypo::Process(), _pyHypothesis::rememberCmdOfParameter(), and SetArg().
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()
const | TCollection_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 |
References myOrderNb.
Referenced by _pyGen::ExchangeCommands(), and SetDependentCmdsAfter().
const TCollection_AsciiString & _pyCommand::GetResultValue | ( | ) |
Return substring of python command looking like ResultValue = Obj.Meth()
const | TCollection_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().
Return substring of python command looking like ResultValue1 , ResultValue2,...
= Obj.Meth() with res index
const | TCollection_AsciiString & - ResultValue with res index substring |
References GetResultValue(), GetWord(), IsEmpty(), myRes, myResults, SkipSpaces(), and theEmptyString.
_AString& _pyCommand::GetString | ( | ) |
References myString.
Referenced by _pyMeshEditor::_pyMeshEditor(), Handle(), _pyStringFamily::IsInArgs(), _pyFilter::Process(), and _pyHypothesis::rememberCmdOfParameter().
Finds entries in a sting.
References IsStudyEntry().
Referenced by _pyMesh::_pyMesh(), _pyHypothesis::GetReferredMeshesAndGeom(), _pyGen::Process(), and _pyMesh::Process().
|
static |
Looks for a word in the string and returns word's beginning.
theString | - The input string |
theStartPos | - The position to start the search, returning word's beginning |
theForward | - The search direction |
TCollection_AsciiString | - The found word |
References EMPTY, isWord(), and theEmptyString.
Referenced by _pyHypothesisReader::_pyHypothesisReader(), GetMethod(), GetObject(), and GetResultValue().
bool _pyCommand::IsEmpty | ( | ) | const |
References myString.
Referenced by Comment(), GetBegPos(), GetResultValue(), _pySelfEraser::IsAliveCmd(), IsMethodCall(), and _pyMesh::Process().
Returns true if the string looks like an object ID but not like a list, string, command etc.
References IsIDChar().
|
static |
Referenced by AddAccessorMethod(), IsID(), _pyStringFamily::isIn(), and _pyStringFamily::IsInArgs().
bool _pyCommand::IsMethodCall | ( | ) |
Returns true if there are brackets after the method.
References GetBegPos(), GetMethod(), IsEmpty(), METHOD_IND, myMeth, and myString.
Returns true if the string looks like a study entry.
Referenced by _pyGen::_pyGen(), _pyGen::CheckObjectIsReCreated(), GetStudyEntries(), and _pyGen::IsGeomObject().
int _pyCommand::Length | ( | ) | const |
References myString.
Referenced by AddAccessorMethod(), Comment(), GetArg(), GetArgBeginning(), GetIndentation(), GetMethod(), GetObject(), GetResultValue(), _pyHypothesis::rememberCmdOfParameter(), RemoveArgs(), SetArg(), and SetPart().
References GetMethod(), and myMeth.
Referenced by _pyMesh::_pyMesh(), and _pyMesh::Process().
void _pyCommand::RemoveArgs | ( | ) |
Empty arg list.
References ARG1_IND, GetBegPos(), Length(), Max(), METHOD_IND, myArgs, myBegPos, and myString.
Referenced by _pyGroup::_pyGroup(), _pyHypothesis::Addition2Creation(), _pyGen::Process(), _pyMesh::Process(), and _pyMeshEditor::Process().
Set agrument.
index | - The argument index, it counts from 1 |
theArg | - The argument string |
References ARG1_IND, FindAllArgs(), GetArg(), GetBegPos(), GetNbArgs(), Length(), myArgs, myString, SetBegPos(), and SetPart().
Referenced by _pyGroup::_pyGroup(), _pyHypothesis::Addition2Creation(), _pySegmentLengthAroundVertexHyp::Addition2Creation(), Handle(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), and _pyGroup::Process().
Store starting position of a part of python command.
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::SetMethod | ( | const _AString & | theMethod | ) |
References GetMethod(), METHOD_IND, myMeth, and SetPart().
Referenced by _pyGroup::_pyGroup(), _pyHypothesis::Addition2Creation(), _pyGen::Process(), _pyMesh::Process(), _pyMeshEditor::Process(), and _pyFilter::Process().
void _pyCommand::SetObject | ( | const _AString & | theObject | ) |
References GetObject(), myObj, OBJECT_IND, and SetPart().
Referenced by _pyHypothesis::Addition2Creation(), _pyMesh::AddMeshAccess(), _pyGen::Process(), _pyMeshEditor::Process(), and _pyFilter::Process().
void _pyCommand::SetOrderNb | ( | int | theNb | ) |
References myOrderNb.
Referenced by _pyGen::ExchangeCommands().
|
private |
Modify a part of the command.
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 | ) |
References GetResultValue(), myRes, RESULT_IND, and SetPart().
Referenced by _pyHypothesis::Addition2Creation(), _pyMeshEditor::Process(), and _pyFilter::Process().
Look for position where not space char is.
theString | - The string |
thePos | - The position to search from and which returns result |
bool | - false if there are only space after thePos in theString |
Referenced by GetResultValue().
|
private |
found arguments
Referenced by Clear(), GetArg(), GetNbArgs(), RemoveArgs(), and SetArg().
|
private |
where myRes, myObj, ...
begin
Referenced by AddAccessorMethod(), Clear(), Comment(), GetBegPos(), RemoveArgs(), SetBegPos(), and SetPart().
|
private |
commands that should follow me in the script
Referenced by AddDependantCmd(), and SetDependentCmdsAfter().
|
private |
found parts of command
Referenced by GetArg(), GetArgBeginning(), GetMethod(), IsMethodCall(), MethodStartsFrom(), and SetMethod().
|
private |
Referenced by GetMethod(), GetObject(), and SetObject().
|
private |
position within the script
Referenced by GetOrderNb(), and SetOrderNb().
|
private |
Referenced by GetObject(), GetResultValue(), and SetResultValue().
|
private |
found results
Referenced by GetNbResultValues(), and GetResultValue().
|
private |
command text
Referenced by AddAccessorMethod(), Clear(), Comment(), GetArg(), GetArgBeginning(), GetIndentation(), GetMethod(), GetObject(), GetResultValue(), GetString(), IsEmpty(), IsMethodCall(), Length(), RemoveArgs(), SetArg(), and SetPart().