From 290a70345b8930a17fdcc5d9c3c6c65d3fb72f68 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 30 Aug 2010 11:44:16 +0000 Subject: [PATCH] Fix TPythonDump::operator<<(const SMESH::ListOfGroups& theList) for an empty list --- src/SMESH_I/SMESH_DumpPython.cxx | 36 +++++++++++++++++--------------- src/SMESH_I/SMESH_PythonDump.hxx | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 5be4f5de4..c50fa07ed 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -354,21 +354,23 @@ namespace SMESH return *this; } - TPythonDump& TPythonDump::operator<<(const SMESH::ListOfGroups * theList){ - if(theList && theList->length() > 0 ) { - SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); - SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); - myStream << "["; - int aListLen = theList->length(); - for(int i = 0 ; i < aListLen; i++){ - SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,(*theList)[i]); - if(!aSObject->_is_nil()) { - myStream << aSObject->GetID(); - i < (aListLen - 1) ? myStream<<", " : myStream<<"]"; - } - + TPythonDump& TPythonDump::operator<<(const SMESH::ListOfGroups& theList) + { + SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); + SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy(); + myStream << "["; + int aListLen = theList.length(); + for(int i = 0 ; i < aListLen; i++) + { + SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theList[i]); + if(!aSObject->_is_nil()) { + CORBA::String_var entry = aSObject->GetID(); + myStream << entry; + if ( i < (aListLen - 1) ) + myStream<<", "; } } + myStream<<"]"; return *this; } @@ -377,10 +379,10 @@ namespace SMESH //================================================================================ /*! - * \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 + * \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 */ //================================================================================ diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index afcd15ddb..f8567b41d 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -161,7 +161,7 @@ namespace SMESH operator<<(const TCollection_AsciiString & theArg); TPythonDump& - operator<<(const SMESH::ListOfGroups * theList); + operator<<(const SMESH::ListOfGroups& theList); static const char* SMESHGenName() { return "smeshgen"; } static const char* MeshEditorName() { return "mesh_editor"; } -- 2.39.2