Back to index

salome-smesh  6.5.0
Namespaces | Functions | Variables
SMESH_DumpPython.cxx File Reference
#include "SMESH_PythonDump.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Filter_i.hxx"
#include "SMESH_MeshEditor_i.hxx"
#include "SMESH_2smeshpy.hxx"
#include <TColStd_HSequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include <SMESH_Comment.hxx>

Go to the source code of this file.

Namespaces

namespace  SMESH

Functions

static TCollection_AsciiString NotPublishedObjectName ()
template<class TArray >
void SMESH::DumpArray (const TArray &theArray, TPythonDump &theStream)
TCollection_AsciiString SMESH::myLongStringStart ("TPythonDump::LongStringStart")
TCollection_AsciiString SMESH::myLongStringEnd ("TPythonDump::LongStringEnd")
void RemoveTabulation (TCollection_AsciiString &theScript)
 Handle (TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString &theString)
 FindEntries: Returns a sequence of start/end positions of entries in the string.

Variables

static int MYDEBUG = 0

Function Documentation

Handle ( TColStd_HSequenceOfInteger  )

FindEntries: Returns a sequence of start/end positions of entries in the string.

Definition at line 710 of file SMESH_DumpPython.cxx.

{
  Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
  Standard_Integer aLen = theString.Length();
  Standard_Boolean isFound = Standard_False;

  char* arr = (char*) theString.ToCString();
  Standard_Integer i = 0, j;

  while(i < aLen) {
    int c = (int)arr[i];
    j = i+1;
    if ( isdigit( c )) { //Is digit?

      isFound = Standard_False;
      while((j < aLen) && ( isdigit(c) || c == ':' )) { //Check if it is an entry
        c = (int)arr[j++];
        if(c == ':') isFound = Standard_True;
      }

      if (isFound) {
        int prev = (i < 1) ? 0 : (int)arr[i - 1];
        // to distinguish from a sketcher command:
        // last char should be a digit, not ":",
        // previous char should not be '"'.
        if (arr[j-2] != ':' && prev != '"') {
          aSeq->Append(i+1); // +1 because AsciiString starts from 1
          aSeq->Append(j-1);
        }
      }
    }

    i = j;
  }

  return aSeq;
}

Here is the call graph for this function:

static TCollection_AsciiString NotPublishedObjectName ( ) [static]

Definition at line 44 of file SMESH_DumpPython.cxx.

{
  return "__NOT__Published__Object__";
}
void RemoveTabulation ( TCollection_AsciiString &  theScript)

Definition at line 565 of file SMESH_DumpPython.cxx.

{
  std::string aString( theScript.ToCString() );
  std::string::size_type aPos = 0;
  while( aPos < aString.length() )
  {
    aPos = aString.find( "\n\t", aPos );
    if( aPos == std::string::npos )
      break;
    aString.replace( aPos, 2, "\n" );
    aPos++;
  }
  theScript = aString.c_str();
}

Variable Documentation

int MYDEBUG = 0 [static]

Definition at line 41 of file SMESH_DumpPython.cxx.