+
+ TPythonDump&
+ TPythonDump::
+ operator<<(SMESH::Measurements_i* theArg)
+ {
+ myStream<<"aMeasurements";
+ return *this;
+ }
+
+
+ TPythonDump& TPythonDump:: operator<<(SMESH_Gen_i* theArg)
+ {
+ myStream << SMESHGenName(); return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<<(SMESH_MeshEditor_i* theArg)
+ {
+ myStream << MeshEditorName() << "_" << ( theArg ? theArg->GetMeshId() : -1 ); return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<<(const TCollection_AsciiString & theStr)
+ {
+ myStream << theStr; return *this;
+ }
+
+
+ TPythonDump& TPythonDump::operator<<(SMESH::MED_VERSION theVersion)
+ {
+ switch (theVersion) {
+ case SMESH::MED_V2_1: myStream << "SMESH.MED_V2_1"; break;
+ case SMESH::MED_V2_2: myStream << "SMESH.MED_V2_2"; break;
+ default: myStream << theVersion;
+ }
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<<(const SMESH::AxisStruct & theAxis)
+ {
+ *this << "SMESH.AxisStruct( "
+ << TVar( theAxis.x ) << ", "
+ << TVar( theAxis.y ) << ", "
+ << TVar( theAxis.z ) << ", "
+ << TVar( theAxis.vx ) << ", "
+ << TVar( theAxis.vy ) << ", "
+ << TVar( theAxis.vz ) << " )";
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<<(const SMESH::DirStruct & theDir)
+ {
+ const SMESH::PointStruct & P = theDir.PS;
+ *this << "SMESH.DirStruct( SMESH.PointStruct ( "
+ << TVar( P.x ) << ", "
+ << TVar( P.y ) << ", "
+ << TVar( P.z ) << " ))";
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<<(const SMESH::PointStruct & P)
+ {
+ *this << "SMESH.PointStruct ( "
+ << TVar( P.x ) << ", "
+ << TVar( P.y ) << ", "
+ << TVar( P.z ) << " )";
+ return *this;
+ }
+
+ TPythonDump& TPythonDump::operator<<(const SMESH::ListOfGroups& theList)
+ {
+ DumpArray( theList, *this );
+ return *this;
+ }
+ TPythonDump& TPythonDump::operator<<(const SMESH::ListOfGroups * theList)
+ {
+ DumpArray( *theList, *this );
+ return *this;
+ }
+ TPythonDump& TPythonDump::operator<<(const SMESH::ListOfIDSources& theList)
+ {
+ DumpArray( theList, *this );
+ return *this;
+ }
+ const char* TPythonDump::NotPublishedObjectName()
+ {
+ return theNotPublishedObjectName;
+ }
+
+ TCollection_AsciiString myLongStringStart( "TPythonDump::LongStringStart" );
+ TCollection_AsciiString myLongStringEnd ( "TPythonDump::LongStringEnd" );
+
+ //================================================================================
+ /*!
+ * \brief Return marker of long string literal beginning
+ * \param type - a name of functionality producing the string literal
+ * \retval TCollection_AsciiString - the marker string to be written into
+ * a raw python script
+ */
+ //================================================================================
+
+ TCollection_AsciiString TPythonDump::LongStringStart(const char* type)
+ {
+ return
+ myLongStringStart +
+ (Standard_Integer) strlen(type) +
+ " " +
+ (char*) type;
+ }
+
+ //================================================================================
+ /*!
+ * \brief Return marker of long string literal end
+ * \retval TCollection_AsciiString - the marker string to be written into
+ * a raw python script
+ */
+ //================================================================================
+
+ TCollection_AsciiString TPythonDump::LongStringEnd()
+ {
+ return myLongStringEnd;
+ }
+
+ //================================================================================
+ /*!
+ * \brief Cut out a long string literal from a string
+ * \param theText - text possibly containing string literals
+ * \param theFrom - position in the text to search from
+ * \param theLongString - the retrieved literal
+ * \param theStringType - a name of functionality produced the literal
+ * \retval bool - true if a string literal found
+ *
+ * The literal is removed from theText; theFrom points position right after
+ * the removed literal
+ */
+ //================================================================================
+
+ bool TPythonDump::CutoutLongString( TCollection_AsciiString & theText,
+ int & theFrom,
+ TCollection_AsciiString & theLongString,
+ TCollection_AsciiString & theStringType)
+ {
+ if ( theFrom < 1 || theFrom > theText.Length() )
+ return false;
+
+ // ...script \ beg marker \ \ type \ literal \ end marker \ script...
+ // "theText myLongStringStart7 Pattern!!! SALOME Mesh Pattern file myLongStringEndtextEnd"
+ // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+ // 0 1 2 3 4 5 6 7 8
+
+ theFrom = theText.Location( myLongStringStart, theFrom, theText.Length() ); // = 09
+ if ( !theFrom )
+ return false;
+
+ // find where literal begins
+ int literalBeg = theFrom + myLongStringStart.Length(); // = 26
+ char* typeLenStr = (char*) theText.ToCString() + literalBeg - 1; // = "7 Pattern!!! SALO...."
+ int typeLen = atoi ( typeLenStr ); // = 7
+ while ( *typeLenStr != ' ' ) { // look for ' ' after typeLen
+ literalBeg++; // 26 -> 27
+ typeLenStr++;
+ }
+ literalBeg += typeLen + 1; // = 35
+ if ( literalBeg > theText.Length() )
+ return false;
+
+ // where literal ends (i.e. end marker begins)
+ int literalEnd = theText.Location( myLongStringEnd, literalBeg, theText.Length() ); // = 64
+ if ( !literalEnd )
+ literalEnd = theText.Length();
+
+ // literal
+ theLongString = theText.SubString( literalBeg, literalEnd - 1); // "!!! SALOME Mesh Pattern file "
+ // type
+ theStringType = theText.SubString( literalBeg - typeLen, literalBeg - 1 ); // "Pattern"
+ // cut off literal
+ literalEnd += myLongStringEnd.Length(); // = 79
+ TCollection_AsciiString textEnd = theText.SubString( literalEnd, theText.Length() ); // "textE..."
+ theText = theText.SubString( 1, theFrom - 1 ) + textEnd;
+
+ return true;
+ }