Back to index

salome-smesh  6.5.0
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
_pyCommand Class Reference

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

#include <SMESH_2smeshpy.hxx>

Collaboration diagram for _pyCommand:
Collaboration graph
[legend]

List of all members.

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 ()
void Clear ()
bool IsEmpty () const
_AString GetIndentation ()
 Returns whitespace symbols at the line beginning.
const _AStringGetResultValue ()
 Return substring of python command looking like ResultValue = Obj.Meth()
const int GetNbResultValues ()
 Return number of python command result value ResultValue = Obj.Meth()
_AString GetResultValue (int res)
 Return substring of python command looking like ResultValue1 , ResultValue2,...
const _AStringGetObject ()
 Return substring of python command looking like ResVal = Object.Meth()
const _AStringGetMethod ()
 Return substring of python command looking like ResVal = Obj.Method()
const _AStringGetArg (int index)
 Return substring of python command looking like ResVal = Obj.Meth(Arg1,...)
int GetNbArgs ()
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.
void RemoveArgs ()
 Empty arg list.
void Comment ()
 Comment a python command.
void AddDependantCmd (Handle(_pyCommand) cmd, bool prepend=false)
bool SetDependentCmdsAfter () const
 Set dependent commands after this one.
bool AddAccessorMethod (_pyID theObjectID, const char *theAcsMethod)
 Insert accessor method after theObjectID.

Static Public Member Functions

static bool SkipSpaces (const _AString &theSring, int &thePos)
 Look for position where not space char is.
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.
static bool IsStudyEntry (const _AString &str)
 Returns true if the string looks like a study entry.
static std::list< _pyIDGetStudyEntries (const _AString &str)
 Finds entries in a sting.

Private Types

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

Private Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 96 of file SMESH_2smeshpy.hxx.


Member Typedef Documentation

typedef void* _pyCommand::TAddr

Definition at line 118 of file SMESH_2smeshpy.hxx.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
UNKNOWN 
EMPTY 
RESULT_IND 
OBJECT_IND 
METHOD_IND 
ARG1_IND 

Definition at line 105 of file SMESH_2smeshpy.hxx.


Constructor & Destructor Documentation

_pyCommand::_pyCommand ( ) [inline]

Definition at line 112 of file SMESH_2smeshpy.hxx.

{};
_pyCommand::_pyCommand ( const _AString theString,
int  theNb = -1 
) [inline]

Definition at line 113 of file SMESH_2smeshpy.hxx.

    : myString( theString ), myOrderNb( theNb ) {};

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

Definition at line 3536 of file SMESH_2smeshpy.cxx.

{
  if ( !theAcsMethod )
    return false;
  // start object search from the object, i.e. ignore result
  GetObject();
  int beg = GetBegPos( OBJECT_IND );
  if ( beg < 1 || beg > Length() )
    return false;
  bool added = false;
  while (( beg = myString.Location( theObjectID, beg, Length() )))
  {
    // check that theObjectID is not just a part of a longer ID
    int afterEnd = beg + theObjectID.Length();
    Standard_Character c = myString.Value( afterEnd );
    if ( !isalnum( c ) && c != ':' ) {
      // check if accessor method already present
      if ( c != '.' ||
           myString.Location( (char*) theAcsMethod, afterEnd, Length() ) != afterEnd+1) {
        // insertion
        int oldLen = Length();
        myString.Insert( afterEnd, (char*) theAcsMethod );
        myString.Insert( afterEnd, "." );
        // update starting positions of the parts following the modified one
        int posDelta = Length() - oldLen;
        for ( int i = 1; i <= myBegPos.Length(); ++i ) {
          if ( myBegPos( i ) > afterEnd )
            myBegPos( i ) += posDelta;
        }
        added = true;
      }
    }
    beg = afterEnd; // is a part - next search
  }
  return added;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 147 of file SMESH_2smeshpy.hxx.

  { if (prepend) myDependentCmds.push_front( cmd ); else myDependentCmds.push_back( cmd ); }

Here is the caller graph for this function:

void _pyCommand::Clear ( ) [inline]

Definition at line 121 of file SMESH_2smeshpy.hxx.

{ myString.Clear(); myBegPos.Clear(); myArgs.Clear(); }

Here is the caller graph for this function:

Comment a python command.

Definition at line 3490 of file SMESH_2smeshpy.cxx.

{
  if ( IsEmpty() ) return;

  int i = 1;
  while ( i <= Length() && isspace( myString.Value(i) )) ++i;
  if ( i <= Length() )
  {
    myString.Insert( i, "#" );
    for ( int iPart = 0; iPart < myBegPos.Length(); ++iPart )
    {
      int begPos = GetBegPos( iPart );
      if ( begPos != UNKNOWN )
        SetBegPos( iPart, begPos + 1 );
    }
  }
}

Here is the call graph for this function:

void _pyCommand::FindAllArgs ( ) [inline, private]

Definition at line 109 of file SMESH_2smeshpy.hxx.

{ GetArg(1); }

Here is the call graph for this function:

Here is the caller graph for this function:

TAddr _pyCommand::GetAddress ( ) const [inline]

Definition at line 119 of file SMESH_2smeshpy.hxx.

{ return (void*) this; }

Here is the caller graph for this function:

const TCollection_AsciiString & _pyCommand::GetArg ( int  index)

Return substring of python command looking like ResVal = Obj.Meth(Arg1,...)

Return values:
constTCollection_AsciiString & - Arg<index> substring

Definition at line 3161 of file SMESH_2smeshpy.cxx.

{
  if ( GetBegPos( ARG1_IND ) == UNKNOWN )
  {
    // Find all args

    int pos = GetBegPos( METHOD_IND ) + myMeth.Length();
    if ( pos < 1 )
      pos = myString.Location( "(", 1, Length() );
    else
      --pos;

    // we are at or before '(', skip it if present
    if ( pos > 0 ) {
      while ( pos <= Length() && myString.Value( pos ) != '(' ) ++pos;
      if ( pos > Length() )
        pos = 0;
    }
    if ( pos < 1 ) {
      SetBegPos( ARG1_IND, 0 ); // even no '('
      return theEmptyString;
    }
    ++pos;

    list< TCollection_AsciiString > separatorStack( 1, ",)");
    bool ignoreNesting = false;
    int prevPos = pos;
    while ( pos <= Length() )
    {
      const char chr = myString.Value( pos );

      if ( separatorStack.back().Location( chr, 1, separatorStack.back().Length()))
      {
        if ( separatorStack.size() == 1 ) // a comma dividing args or a terminal ')' found
        {
          while ( pos-1 >= prevPos && isspace( myString.Value( prevPos )))
            ++prevPos;
          TCollection_AsciiString arg;
          if ( pos-1 >= prevPos ) {
            arg = myString.SubString( prevPos, pos-1 );
            arg.RightAdjust(); // remove spaces
            arg.LeftAdjust();
          }
          if ( !arg.IsEmpty() || chr == ',' )
          {
            SetBegPos( ARG1_IND + myArgs.Length(), prevPos );
            myArgs.Append( arg );
          }
          if ( chr == ')' )
            break;
          prevPos = pos+1;
        }
        else // end of nesting args found
        {
          separatorStack.pop_back();
          ignoreNesting = false;
        }
      }
      else if ( !ignoreNesting )
      {
        switch ( chr ) {
        case '(' : separatorStack.push_back(")"); break;
        case '[' : separatorStack.push_back("]"); break;
        case '\'': separatorStack.push_back("'");  ignoreNesting=true; break;
        case '"' : separatorStack.push_back("\""); ignoreNesting=true; break;
        default:;
        }
      }
      ++pos;
    }
  }
  if ( myArgs.Length() < index )
    return theEmptyString;
  return myArgs( index );
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _pyCommand::GetBegPos ( int  thePartIndex) [private]

Return starting position of a part of python command.

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

Definition at line 2950 of file SMESH_2smeshpy.cxx.

{
  if ( IsEmpty() )
    return EMPTY;
  if ( myBegPos.Length() < thePartIndex )
    return UNKNOWN;
  return myBegPos( thePartIndex );
}

Here is the call graph for this function:

Here is the caller graph for this function:

TCollection_AsciiString _pyCommand::GetIndentation ( )

Returns whitespace symbols at the line beginning.

Return values:
TCollection_AsciiString- result

Definition at line 2981 of file SMESH_2smeshpy.cxx.

{
  int end = 1;
  if ( GetBegPos( RESULT_IND ) == UNKNOWN )
    GetWord( myString, end, true );
  else
    end = GetBegPos( RESULT_IND );
  return myString.SubString( 1, end - 1 );
}

Here is the call graph for this function:

const TCollection_AsciiString & _pyCommand::GetMethod ( )

Return substring of python command looking like ResVal = Obj.Method()

Return values:
constTCollection_AsciiString & - Method substring

Definition at line 3135 of file SMESH_2smeshpy.cxx.

{
  if ( GetBegPos( METHOD_IND ) == UNKNOWN )
  {
    // beginning
    int begPos = GetBegPos( OBJECT_IND ) + myObj.Length();
    bool forward = true;
    if ( begPos < 1 ) {
      begPos = myString.Location( "(", 1, Length() ) - 1;
      forward = false;
    }
    // store
    myMeth = GetWord( myString, begPos, forward );
    SetBegPos( METHOD_IND, begPos );
  }
  //SCRUTE(myMeth);
  return myMeth;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _pyCommand::GetNbArgs ( ) [inline]

Definition at line 130 of file SMESH_2smeshpy.hxx.

{ FindAllArgs(); return myArgs.Length(); }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Return values:
constint

Definition at line 3027 of file SMESH_2smeshpy.cxx.

{
  int begPos = 1;
  int Nb=0;
  int endPos = myString.Location( "=", 1, Length() );
  TCollection_AsciiString str = "";
  while ( begPos < endPos) {
    str = GetWord( myString, begPos, true );
    begPos = begPos+ str.Length();
    Nb++;
  }
  return (Nb-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const TCollection_AsciiString & _pyCommand::GetObject ( )

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

Return values:
constTCollection_AsciiString & - Object substring

Definition at line 3078 of file SMESH_2smeshpy.cxx.

{
  if ( GetBegPos( OBJECT_IND ) == UNKNOWN )
  {
    // beginning
    int begPos = GetBegPos( RESULT_IND ) + myRes.Length();
    if ( begPos < 1 ) {
      begPos = myString.Location( "=", 1, Length() ) + 1;
      // is '=' in the string argument (for example, name) or not
      int nb1 = 0; // number of ' character at the left of =
      int nb2 = 0; // number of " character at the left of =
      for ( int i = 1; i < begPos-1; i++ ) {
        if ( myString.Value( i )=='\'' )
          nb1 += 1;
        else if ( myString.Value( i )=='"' )
          nb2 += 1;
      }
      // if number of ' or " is not divisible by 2,
      // then get an object at the start of the command
      if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
        begPos = 1;
    }
    myObj = GetWord( myString, begPos, true );
    // check if object is complex,
    // so far consider case like "smesh.smesh.Method()"
    if ( int bracketPos = myString.Location( "(", begPos, Length() )) {
      //if ( bracketPos==0 ) bracketPos = Length();
      int dotPos = begPos+myObj.Length();
      while ( dotPos+1 < bracketPos ) {
        if ( int pos = myString.Location( ".", dotPos+1, bracketPos ))
          dotPos = pos;
        else
          break;
      }
      if ( dotPos > begPos+myObj.Length() )
        myObj = myString.SubString( begPos, dotPos-1 );
    }
    // 1st word after '=' is an object
    // else // no method -> no object
    // {
    //   myObj.Clear();
    //   begPos = EMPTY;
    // }
    // store
    SetBegPos( OBJECT_IND, begPos );
  }
  //SCRUTE(myObj);
  return myObj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _pyCommand::GetOrderNb ( ) const [inline]

Definition at line 116 of file SMESH_2smeshpy.hxx.

{ return myOrderNb; }

Here is the caller graph for this function:

const TCollection_AsciiString & _pyCommand::GetResultValue ( )

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

Return values:
constTCollection_AsciiString & - ResultValue substring

Definition at line 2998 of file SMESH_2smeshpy.cxx.

{
  if ( GetBegPos( RESULT_IND ) == UNKNOWN )
  {
    SetBegPos( RESULT_IND, EMPTY );
    int begPos, endPos = myString.Location( "=", 1, Length() );
    if ( endPos )
    {
      begPos = 1;
      while ( begPos < endPos && isspace( myString.Value( begPos ))) ++begPos;
      if ( begPos < endPos )
      {
        SetBegPos( RESULT_IND, begPos );
        --endPos;
        while ( begPos < endPos && isspace( myString.Value( endPos ))) --endPos;
        myRes = myString.SubString( begPos, endPos );
      }
    }
  }
  return myRes;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TCollection_AsciiString _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

Definition at line 3049 of file SMESH_2smeshpy.cxx.

{
  int begPos = 1;
  if ( SkipSpaces( myString, begPos ) && myString.Value( begPos ) == '[' )
    ++begPos; // skip [, else the whole list is returned
  int endPos = myString.Location( "=", 1, Length() );
  int Nb=0;
  while ( begPos < endPos) {
    _AString result = GetWord( myString, begPos, true );
    begPos = begPos + result.Length();
    Nb++;
    if(res == Nb) {
      result.RemoveAll('[');
      result.RemoveAll(']');
      return result;
    }
    if(Nb>res)
      break;
  }
  return theEmptyString;
}

Here is the call graph for this function:

Definition at line 115 of file SMESH_2smeshpy.hxx.

{ return myString; }

Here is the caller graph for this function:

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

Finds entries in a sting.

Definition at line 3346 of file SMESH_2smeshpy.cxx.

{
  std::list< _pyID > resList;
  int pos = 0;
  while ( ++pos <= str.Length() )
  {
    if ( !isdigit( str.Value( pos ))) continue;
    if ( pos != 1 && ( isalpha( str.Value( pos-1 ) || str.Value( pos-1 ) == ':'))) continue;

    int end = pos;
    while ( ++end <= str.Length() && ( isdigit( str.Value( end )) || str.Value( end ) == ':' ));
    _pyID entry = str.SubString( pos, end-1 );
    pos = end;
    if ( IsStudyEntry( entry ))
      resList.push_back( entry );
  }
  return resList;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TCollection_AsciiString _pyCommand::GetWord ( const _AString theSring,
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

Definition at line 3261 of file SMESH_2smeshpy.cxx.

{
  int beg = theStartPos, end = theStartPos;
  theStartPos = EMPTY;
  if ( beg < 1 || beg > theString.Length() )
    return theEmptyString;

  if ( theForward ) { // search forward
    // beg
    while ( beg <= theString.Length() && !isWord( theString.Value( beg ), dotIsWord))
      ++beg;
    if ( beg > theString.Length() )
      return theEmptyString; // no word found
    // end
    end = beg + 1;
    char begChar = theString.Value( beg );
    if ( begChar == '"' || begChar == '\'' || begChar == '[') {
      char endChar = ( begChar == '[' ) ? ']' : begChar;
      // end is at the corresponding quoting mark or bracket
      while ( end < theString.Length() &&
              ( theString.Value( end ) != endChar || theString.Value( end-1 ) == '\\'))
        ++end;
    }
    else {
      while ( end <= theString.Length() && isWord( theString.Value( end ), dotIsWord))
        ++end;
      --end;
    }
  }
  else {  // search backward
    // end
    while ( end > 0 && !isWord( theString.Value( end ), dotIsWord))
      --end;
    if ( end == 0 )
      return theEmptyString; // no word found
    beg = end - 1;
    char endChar = theString.Value( end );
    if ( endChar == '"' || endChar == '\'' || endChar == ']') {
      char begChar = ( endChar == ']' ) ? '[' : endChar;
      // beg is at the corresponding quoting mark
      while ( beg > 1 &&
              ( theString.Value( beg ) != begChar || theString.Value( beg-1 ) == '\\'))
        --beg;
    }
    else {
      while ( beg > 0 && isWord( theString.Value( beg ), dotIsWord))
        --beg;
      ++beg;
    }
  }
  theStartPos = beg;
  //cout << theString << " ---- " << beg << " - " << end << endl;
  return theString.SubString( beg, end );
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool _pyCommand::IsEmpty ( ) const [inline]

Definition at line 122 of file SMESH_2smeshpy.hxx.

{ return myString.IsEmpty(); }

Here is the caller graph for this function:

bool _pyCommand::IsStudyEntry ( const _AString str) [static]

Returns true if the string looks like a study entry.

Definition at line 3325 of file SMESH_2smeshpy.cxx.

{
  if ( str.Length() < 5 ) return false;

  int nbColons = 0, isColon;
  for ( int i = 1; i <= str.Length(); ++i )
  {
    char c = str.Value(i);
    if (!( isColon = (c == ':')) && ( c < '0' || c > '9' ))
      return false;
    nbColons += isColon;
  }
  return nbColons > 2 && str.Length()-nbColons > 2;
}

Here is the caller graph for this function:

int _pyCommand::Length ( ) [inline]

Definition at line 120 of file SMESH_2smeshpy.hxx.

{ return myString.Length(); }

Here is the caller graph for this function:

bool _pyCommand::MethodStartsFrom ( const _AString beg) [inline]

Definition at line 131 of file SMESH_2smeshpy.hxx.

  { GetMethod(); return ( myMeth.Location( beg, 1, myMeth.Length() ) == 1 ); }

Here is the call graph for this function:

Here is the caller graph for this function:

Empty arg list.

Definition at line 3474 of file SMESH_2smeshpy.cxx.

{
  if ( int pos = myString.Location( '(', 1, Length() ))
    myString.Trunc( pos );
  myString += ")";
  myArgs.Clear();
  if ( myBegPos.Length() >= ARG1_IND )
    myBegPos.Remove( ARG1_IND, myBegPos.Length() );
}

Here is the caller graph for this function:

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

Set agrument.

Parameters:
index- The argument index, it counts from 1
theArg- The argument string

Definition at line 3433 of file SMESH_2smeshpy.cxx.

{
  FindAllArgs();
  int argInd = ARG1_IND + index - 1;
  int pos = GetBegPos( argInd );
  if ( pos < 1 ) // no index-th arg exist, append inexistent args
  {
    // find a closing parenthesis
    if ( GetNbArgs() != 0 && index <= GetNbArgs() ) {
      int lastArgInd = GetNbArgs();
      pos = GetBegPos( ARG1_IND + lastArgInd  - 1 ) + GetArg( lastArgInd ).Length();
      while ( pos > 0 && pos <= Length() && myString.Value( pos ) != ')' )
        ++pos;
    }
    else {
      pos = Length();
      while ( pos > 0 && myString.Value( pos ) != ')' )
        --pos;
    }
    if ( pos < 1 || myString.Value( pos ) != ')' ) { // no parentheses at all
      myString += "()";
      pos = Length();
    }
    while ( myArgs.Length() < index ) {
      if ( myArgs.Length() )
        myString.Insert( pos++, "," );
      myArgs.Append("None");
      myString.Insert( pos, myArgs.Last() );
      SetBegPos( ARG1_IND + myArgs.Length() - 1, pos );
      pos += myArgs.Last().Length();
    }
  }
  SetPart( argInd, theArg, myArgs( index ));
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2967 of file SMESH_2smeshpy.cxx.

{
  while ( myBegPos.Length() < thePartIndex )
    myBegPos.Append( UNKNOWN );
  myBegPos( thePartIndex ) = thePosition;
}

Here is the caller graph for this function:

Set dependent commands after this one.

Definition at line 3514 of file SMESH_2smeshpy.cxx.

{
  bool orderChanged = false;
  list< Handle(_pyCommand)>::const_reverse_iterator cmd = myDependentCmds.rbegin();
  for ( ; cmd != myDependentCmds.rend(); ++cmd ) {
    if ( (*cmd)->GetOrderNb() < GetOrderNb() ) {
      orderChanged = true;
      theGen->SetCommandAfter( *cmd, this );
      (*cmd)->SetDependentCmdsAfter();
    }
  }
  return orderChanged;
}

Here is the call graph for this function:

void _pyCommand::SetMethod ( const _AString theMethod) [inline]

Definition at line 137 of file SMESH_2smeshpy.hxx.

  { GetMethod(); SetPart( METHOD_IND, theMethod, myMeth ); }

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyCommand::SetObject ( const _AString theObject) [inline]

Definition at line 135 of file SMESH_2smeshpy.hxx.

  { GetObject(); SetPart( OBJECT_IND, theObject, myObj ); }

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyCommand::SetOrderNb ( int  theNb) [inline]

Definition at line 117 of file SMESH_2smeshpy.hxx.

{ myOrderNb = theNb; }

Here is the caller graph for this function:

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

Definition at line 3394 of file SMESH_2smeshpy.cxx.

{
  int pos = GetBegPos( thePartIndex );
  if ( pos <= Length() && theOldPart != thePart)
  {
    TCollection_AsciiString seperator;
    if ( pos < 1 ) {
      pos = GetBegPos( thePartIndex + 1 );
      if ( pos < 1 ) return;
      switch ( thePartIndex ) {
      case RESULT_IND: seperator = " = "; break;
      case OBJECT_IND: seperator = "."; break;
      case METHOD_IND: seperator = "()"; break;
      default:;
      }
    }
    myString.Remove( pos, theOldPart.Length() );
    if ( !seperator.IsEmpty() )
      myString.Insert( pos , seperator );
    myString.Insert( pos, thePart );
    // update starting positions of the following parts
    int posDelta = thePart.Length() + seperator.Length() - theOldPart.Length();
    for ( int i = thePartIndex + 1; i <= myBegPos.Length(); ++i ) {
      if ( myBegPos( i ) > 0 )
        myBegPos( i ) += posDelta;
    }
    theOldPart = thePart;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyCommand::SetResultValue ( const _AString theResult) [inline]

Definition at line 133 of file SMESH_2smeshpy.hxx.

  { GetResultValue(); SetPart( RESULT_IND, theResult, myRes ); }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3374 of file SMESH_2smeshpy.cxx.

{
  if ( thePos < 1 || thePos > theString.Length() )
    return false;

  while ( thePos <= theString.Length() && isspace( theString.Value( thePos )))
    ++thePos;

  return thePos <= theString.Length();
}

Here is the caller graph for this function:


Member Data Documentation

TColStd_SequenceOfAsciiString _pyCommand::myArgs [private]

found arguments

Definition at line 101 of file SMESH_2smeshpy.hxx.

TColStd_SequenceOfInteger _pyCommand::myBegPos [private]

where myRes, myObj, ...

begin

Definition at line 102 of file SMESH_2smeshpy.hxx.

commands that sould follow me in the script

Definition at line 103 of file SMESH_2smeshpy.hxx.

found parts of command

Definition at line 100 of file SMESH_2smeshpy.hxx.

Definition at line 100 of file SMESH_2smeshpy.hxx.

int _pyCommand::myOrderNb [private]

position within the script

Definition at line 98 of file SMESH_2smeshpy.hxx.

Definition at line 100 of file SMESH_2smeshpy.hxx.

command text

Definition at line 99 of file SMESH_2smeshpy.hxx.


The documentation for this class was generated from the following files: