-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "utilities.h"
#include <Basics_Utils.hxx>
+#include <Basics_OCCTVersion.hxx>
#include <TDF_Tool.hxx>
#include <TDF_Data.hxx>
#include <TColStd_DataMapIteratorOfDataMapOfIntegerTransient.hxx>
+#if OCC_VERSION_LARGE < 0x07050000
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
+#endif
#include <BinDrivers.hxx>
#include <StdDrivers_DocumentRetrievalDriver.hxx>
#define C_SQR_BRACKET ']'
#define PY_NULL "None"
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
// VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
// Next macro, when defined, causes appearing of SubShapeAllIDs(), SubShapeAllSortedIDs(), GetSameIDs()
// and other such commands in Python dump.
TCollection_AsciiString& theScript,
TCollection_AsciiString& theAfterScript,
const TVariablesList& theVariables,
- const bool theIsPublished,
+ const bool /*theIsPublished*/,
TDF_LabelMap& theProcessed,
std::set<TCollection_AsciiString>& theIgnoreObjs,
bool& theIsDumpCollected);
std::string aFileName = theFileName;
#endif
- _OCAFApp->SaveAs( _document, aFileName.c_str() );
-
- return true;
+ return _OCAFApp->SaveAs( _document, aFileName.c_str() ) == PCDM_SS_OK;
}
//=============================================================================
void ReplaceVariables(TCollection_AsciiString& theCommand,
const TVariablesList& theVariables)
{
- if (MYDEBUG)
- cout<<"Command : "<<theCommand<<endl;
+ if (SALOME::VerbosityActivated())
+ std::cout<<"Command : "<<theCommand<<std::endl;
- if (MYDEBUG) {
- cout<<"All Entries:"<<endl;
+ if (SALOME::VerbosityActivated()) {
+ std::cout<<"All Entries:"<<std::endl;
TVariablesList::const_iterator it = theVariables.begin();
for(;it != theVariables.end();it++)
- cout<<"\t'"<<(*it).first<<"'"<<endl;
+ std::cout<<"\t'"<<(*it).first<<"'"<<std::endl;
}
//Additional case - multi-row commands
if( aCommand.Length() == 0 )
break;
- if (MYDEBUG)
- cout<<"Sub-command : "<<aCommand<<endl;
+ if (SALOME::VerbosityActivated())
+ std::cout<<"Sub-command : "<<aCommand<<std::endl;
Standard_Integer aStartCommandPos = theCommand.Location(aCommand,1,theCommand.Length());
Standard_Integer aEndCommandPos = aStartCommandPos + aCommand.Length();
//Remove white spaces
anEntry.RightAdjust();
anEntry.LeftAdjust();
- if(MYDEBUG)
- cout<<"Result entry : '" <<anEntry<<"'"<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"Result entry : '" <<anEntry<<"'"<<std::endl;
if ( anEntry.IsEmpty() ) {
aCommandIndex++;
anEntry.Remove( 1, 1 );
anEntry.RightAdjust();
anEntry.LeftAdjust();
- if(MYDEBUG)
- cout<<"Sub-entry : '" <<anEntry<<"'"<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"Sub-entry : '" <<anEntry<<"'"<<std::endl;
}
//Find variables used for object construction
aStates = (*it).second;
if(!aStates) {
- if(MYDEBUG)
- cout<<"Valiables list empty!!!"<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"Valiables list empty!!!"<<std::endl;
aCommandIndex++;
continue;
}
TState aVariables = aStates->GetCurrectState();
- if(MYDEBUG) {
- cout<<"Variables from SObject:"<<endl;
+ if(SALOME::VerbosityActivated()) {
+ std::cout<<"Variables from SObject:"<<std::endl;
for (size_t i = 0; i < aVariables.size();i++)
- cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<endl;
+ std::cout<<"\t Variable["<<i<<"] = "<<aVariables[i].myVariable<<std::endl;
}
//Calculate total number of parameters
while(aCommand.Location(aTotalNbParams,COMMA,1,aCommand.Length()))
aTotalNbParams++;
- if(MYDEBUG)
- cout<<"aTotalNbParams = "<<aTotalNbParams<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aTotalNbParams = "<<aTotalNbParams<<std::endl;
Standard_Integer aFirstParam = aNbEntries;
if ( aStartPos == aEndPos )
continue; // PAL20889: for "[]"
- if(MYDEBUG)
- cout<<"aStartPos = "<<aStartPos<<", aEndPos = "<<aEndPos<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aStartPos = "<<aStartPos<<", aEndPos = "<<aEndPos<<std::endl;
aVar = aCommand.SubString(aStartPos, aEndPos-1);
aVar.RightAdjust();
aVar.LeftAdjust();
- if(MYDEBUG)
- cout<<"Variable: '"<< aVar <<"'"<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"Variable: '"<< aVar <<"'"<<std::endl;
// specific case for sketcher
if(aVar.Location( TCollection_AsciiString("Sketcher:"), 1, aVar.Length() ) != 0) {
aEndSectionPos = aVar.Length();
aSection = aVar.SubString(aStartSectionPos, aEndSectionPos-1);
- if(MYDEBUG)
- cout<<"aSection: "<<aSection<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aSection: "<<aSection<<std::endl;
Standard_Integer aNbParams = 1;
while( aSection.Location( aNbParams, ' ', 1, aSection.Length() ) )
else
aEndParamPos = aSection.Length() + 1;
- if(MYDEBUG)
- cout<<"aParamIndex: "<<aParamIndex<<" aStartParamPos: " <<aStartParamPos<<" aEndParamPos: "<<aEndParamPos<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aParamIndex: "<<aParamIndex<<" aStartParamPos: " <<aStartParamPos<<" aEndParamPos: "<<aEndParamPos<<std::endl;
if ( aStartParamPos == aEndParamPos)
continue;
aParameter = aSection.SubString(aStartParamPos, aEndParamPos-1);
- if(MYDEBUG)
- cout<<"aParameter: "<<aParameter<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aParameter: "<<aParameter<<std::endl;
if(iVar >= aVariables.size())
continue;
aReplacedParameter.InsertAfter(aReplacedParameter.Length(),"'");
}
- if(MYDEBUG)
- cout<<"aSection before : "<<aSection<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aSection before : "<<aSection<< std::endl;
aSection.Remove(aStartParamPos, aEndParamPos - aStartParamPos);
aSection.Insert(aStartParamPos, aReplacedParameter);
- if(MYDEBUG)
- cout<<"aSection after : "<<aSection<<endl<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aSection after : "<<aSection<<std::endl<<std::endl;
iVar++;
}
- if(MYDEBUG)
- cout<<"aVar before : "<<aVar<<endl;
+
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aVar before : "<<aVar<<std::endl;
+
aVar.Remove(aStartSectionPos, aEndSectionPos - aStartSectionPos);
aVar.Insert(aStartSectionPos, aSection);
- if(MYDEBUG)
- cout<<"aVar after : "<<aVar<<endl<<endl;
+
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aVar after : "<<aVar<<std::endl<<std::endl;
}
- if(MYDEBUG)
- cout<<"aCommand before : "<<aCommand<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aCommand before : "<<aCommand<<std::endl;
aCommand.Remove(aStartPos, aEndPos - aStartPos);
aCommand.Insert(aStartPos, aVar);
- if(MYDEBUG)
- cout<<"aCommand after : "<<aCommand<<endl;
+ if(SALOME::VerbosityActivated())
+ std::cout<<"aCommand after : "<<aCommand<<std::endl;
break;
} // end of specific case for sketcher
aStates->IncrementState();
}
- if (MYDEBUG)
- cout<<"Command : "<<theCommand<<endl;
+ if (SALOME::VerbosityActivated())
+ std::cout<<"Command : "<<theCommand<<std::endl;
}
//=============================================================================
//=============================================================================
void ReplaceEntriesByNames (TCollection_AsciiString& theScript,
TSting2ObjDataMap& aEntry2ObjData,
- const bool theIsPublished,
+ const bool /*theIsPublished*/,
TColStd_SequenceOfAsciiString& theObjListToPublish,
Standard_Integer& objectCounter,
Resource_DataMapOfAsciiStringAsciiString& aNameToEntry)