SMESHGUI_HypothesesUtils.* : replace STL classes (map, list, ...) by Qt classes (QMap, QList, ...)

This commit is contained in:
mkr 2008-04-11 15:50:30 +00:00
parent e618e38681
commit a5468aa66e

View File

@ -44,9 +44,12 @@
#include <utilities.h> #include <utilities.h>
// STL includes // STL includes
#include <map>
#include <string> #include <string>
// Qt includes
#include <QMap>
//#include <QList>
// Other includes // Other includes
#ifdef WNT #ifdef WNT
#include <windows.h> #include <windows.h>
@ -74,14 +77,15 @@ static int MYDEBUG = 0;
namespace SMESH namespace SMESH
{ {
typedef std::map<std::string,HypothesisData*> THypothesisDataMap; typedef QMap<std::string,HypothesisData*> THypothesisDataMap;
THypothesisDataMap myHypothesesMap; THypothesisDataMap myHypothesesMap;
THypothesisDataMap myAlgorithmsMap; THypothesisDataMap myAlgorithmsMap;
typedef std::map<std::string,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap; typedef QMap<std::string,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
THypCreatorMap myHypCreatorMap; THypCreatorMap myHypCreatorMap;
std::list<HypothesesSet*> myListOfHypothesesSets; std::list<HypothesesSet*> myListOfHypothesesSets;
//QList<HypothesesSet*> myListOfHypothesesSets;
void processHypothesisStatus(const int theHypStatus, void processHypothesisStatus(const int theHypStatus,
SMESH::SMESH_Hypothesis_ptr theHyp, SMESH::SMESH_Hypothesis_ptr theHyp,
@ -169,10 +173,8 @@ namespace SMESH
bool ok = reader.parse(source); bool ok = reader.parse(source);
file.close(); file.close();
if (ok) { if (ok) {
myHypothesesMap.insert( aXmlHandler->myHypothesesMap.begin(), myHypothesesMap = QMap<std::string,HypothesisData*>( aXmlHandler->myHypothesesMap );
aXmlHandler->myHypothesesMap.end() ); myAlgorithmsMap = QMap<std::string,HypothesisData*>( aXmlHandler->myAlgorithmsMap );
myAlgorithmsMap.insert( aXmlHandler->myAlgorithmsMap.begin(),
aXmlHandler->myAlgorithmsMap.end() );
myListOfHypothesesSets.splice( myListOfHypothesesSets.begin(), myListOfHypothesesSets.splice( myListOfHypothesesSets.begin(),
aXmlHandler->myListOfHypothesesSets ); aXmlHandler->myListOfHypothesesSets );
} }
@ -219,14 +221,14 @@ namespace SMESH
THypothesisDataMap::iterator anIter; THypothesisDataMap::iterator anIter;
for ( anIter = pMap->begin(); anIter != pMap->end(); anIter++ ) for ( anIter = pMap->begin(); anIter != pMap->end(); anIter++ )
{ {
HypothesisData* aData = (*anIter).second; HypothesisData* aData = anIter.value();
if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux)
if (checkGeometry){ if (checkGeometry){
if (aData->IsNeedGeometry == isNeedGeometry) if (aData->IsNeedGeometry == isNeedGeometry)
aHypList.append(((*anIter).first).c_str()); aHypList.append(anIter.key().c_str());
} }
else else
aHypList.append(((*anIter).first).c_str()); aHypList.append(anIter.key().c_str());
} }
return aHypList; return aHypList;
} }
@ -240,6 +242,7 @@ namespace SMESH
InitAvailableHypotheses(); InitAvailableHypotheses();
std::list<HypothesesSet*>::iterator hypoSet = myListOfHypothesesSets.begin(); std::list<HypothesesSet*>::iterator hypoSet = myListOfHypothesesSets.begin();
//QList<HypothesesSet*>::iterator hypoSet = myListOfHypothesesSets.begin();
for ( ; hypoSet != myListOfHypothesesSets.end(); ++hypoSet ) for ( ; hypoSet != myListOfHypothesesSets.end(); ++hypoSet )
{ {
HypothesesSet* aSet = *hypoSet; HypothesesSet* aSet = *hypoSet;
@ -254,6 +257,7 @@ namespace SMESH
HypothesesSet* GetHypothesesSet(const QString& theSetName) HypothesesSet* GetHypothesesSet(const QString& theSetName)
{ {
std::list<HypothesesSet*>::iterator hypoSet = myListOfHypothesesSets.begin(); std::list<HypothesesSet*>::iterator hypoSet = myListOfHypothesesSets.begin();
//QList<HypothesesSet*>::iterator hypoSet = myListOfHypothesesSets.begin();
for ( ; hypoSet != myListOfHypothesesSets.end(); ++hypoSet ) for ( ; hypoSet != myListOfHypothesesSets.end(); ++hypoSet )
{ {
HypothesesSet* aSet = *hypoSet; HypothesesSet* aSet = *hypoSet;
@ -272,12 +276,12 @@ namespace SMESH
THypothesisDataMap::iterator type_data = myHypothesesMap.find(aHypType.toLatin1().data()); THypothesisDataMap::iterator type_data = myHypothesesMap.find(aHypType.toLatin1().data());
if (type_data != myHypothesesMap.end()) { if (type_data != myHypothesesMap.end()) {
aHypData = type_data->second; aHypData = type_data.value();
} }
else { else {
type_data = myAlgorithmsMap.find(aHypType.toLatin1().data()); type_data = myAlgorithmsMap.find(aHypType.toLatin1().data());
if (type_data != myAlgorithmsMap.end()) if (type_data != myAlgorithmsMap.end())
aHypData = type_data->second; aHypData = type_data.value();
} }
return aHypData; return aHypData;
} }