From: adv Date: Mon, 30 Dec 2013 08:16:37 +0000 (+0000) Subject: QStrings changed to cascade ascii strings. X-Git-Tag: BR_hydro_v_0_7~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=92bbcbb42ab64143396876b7335c14b3097b0e48;p=modules%2Fhydro.git QStrings changed to cascade ascii strings. --- diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 44a61a11..f37c0ae6 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -60,11 +60,11 @@ QStringList HYDROData_Bathymetry::DumpToPython( MapOfTreatedObjects& theTreatedO aResList << QString( "%1.SetAltitudesInverted( %2 );" ) .arg( aBathymetryName ).arg( IsAltitudesInverted() ); - QString aFilePath = GetFilePath(); - if ( !aFilePath.isEmpty() ) + TCollection_AsciiString aFilePath = GetFilePath(); + if ( !aFilePath.IsEmpty() ) { aResList << QString( "%1.ImportFromFile( \"%2\" );" ) - .arg( aBathymetryName ).arg( aFilePath ); + .arg( aBathymetryName ).arg( aFilePath.ToCString() ); } else { @@ -325,22 +325,21 @@ double HYDROData_Bathymetry::GetAltitudeForPoint( const gp_XY& thePoint ) const return aResAltitude; } -void HYDROData_Bathymetry::SetFilePath(const QString& theFilePath) +void HYDROData_Bathymetry::SetFilePath( const TCollection_AsciiString& theFilePath ) { - TCollection_AsciiString anAsciiStr( theFilePath.toStdString().c_str() ); - TDataStd_AsciiString::Set( myLab.FindChild( DataTag_FilePath ), anAsciiStr ); + TDataStd_AsciiString::Set( myLab.FindChild( DataTag_FilePath ), theFilePath ); } -QString HYDROData_Bathymetry::GetFilePath() const +TCollection_AsciiString HYDROData_Bathymetry::GetFilePath() const { - QString aRes; + TCollection_AsciiString aRes; TDF_Label aLabel = myLab.FindChild( DataTag_FilePath, false ); if ( !aLabel.IsNull() ) { Handle(TDataStd_AsciiString) anAsciiStr; if ( aLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) - aRes = QString( anAsciiStr->Get().ToCString() ); + aRes = anAsciiStr->Get(); } return aRes; @@ -390,10 +389,10 @@ bool HYDROData_Bathymetry::IsAltitudesInverted() const return aRes; } -bool HYDROData_Bathymetry::ImportFromFile( const QString& theFileName ) +bool HYDROData_Bathymetry::ImportFromFile( const TCollection_AsciiString& theFileName ) { // Try to open the file - QFile aFile( theFileName ); + QFile aFile( theFileName.ToCString() ); if ( !aFile.exists() || !aFile.open( QIODevice::ReadOnly ) ) return false; diff --git a/src/HYDROData/HYDROData_Bathymetry.h b/src/HYDROData/HYDROData_Bathymetry.h index 352b8c70..a5dfb35b 100644 --- a/src/HYDROData/HYDROData_Bathymetry.h +++ b/src/HYDROData/HYDROData_Bathymetry.h @@ -84,12 +84,12 @@ public: * Stores the bathymetry file path * \param theFilePath image file path */ - HYDRODATA_EXPORT void SetFilePath( const QString& theFilePath ); + HYDRODATA_EXPORT void SetFilePath( const TCollection_AsciiString& theFilePath ); /** * Returns uploaded bathymetry file path */ - HYDRODATA_EXPORT QString GetFilePath() const; + HYDRODATA_EXPORT TCollection_AsciiString GetFilePath() const; /** * Set flag indicating needs to invert altitude values @@ -110,7 +110,7 @@ public: * \param theFileName the path to file * \return \c true if file has been successfully read */ - HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFileName ); + HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName ); HYDRODATA_EXPORT bool CreateBoundaryPolyline() const; diff --git a/src/HYDROData/test_HYDROData_Bathymetry.cxx b/src/HYDROData/test_HYDROData_Bathymetry.cxx index 37f5cbfe..9901c8ea 100755 --- a/src/HYDROData/test_HYDROData_Bathymetry.cxx +++ b/src/HYDROData/test_HYDROData_Bathymetry.cxx @@ -112,7 +112,7 @@ void test_HYDROData_Bathymetry::testFileImport() if ( !createTestFile( aFileName ) ) return; // No file has been created - CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName ) ); + CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName.toStdString().c_str() ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints(); CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 ); @@ -158,7 +158,7 @@ void test_HYDROData_Bathymetry::testCopy() if ( anIsFileCreated ) { - CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName ) ); + CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName.toStdString().c_str() ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints(); CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 ); diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx index ad2cc3df..60ae9a44 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx @@ -66,7 +66,7 @@ void HYDROGUI_ImportBathymetryOp::startOperation() if( !myEditedObject.IsNull() ) { QString aName = myEditedObject->GetName(); - QString aFileName = myEditedObject->GetFilePath(); + QString aFileName = HYDROGUI_Tool::ToQString( myEditedObject->GetFilePath() ); bool anIsAltitudesInverted = myEditedObject->IsAltitudesInverted(); aPanel->setObjectName( aName ); @@ -150,11 +150,11 @@ bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags, if ( aBathymetryObj.IsNull() ) return false; - QString anOldFileName = aBathymetryObj->GetFilePath(); + QString anOldFileName = HYDROGUI_Tool::ToQString( aBathymetryObj->GetFilePath() ); if ( aFileName != anOldFileName ) { aBathymetryObj->SetAltitudesInverted( anIsInvertAltitudes, false ); - if ( !aBathymetryObj->ImportFromFile( aFileName ) ) + if ( !aBathymetryObj->ImportFromFile( HYDROGUI_Tool::ToAsciiString( aFileName ) ) ) { theErrorMsg = tr( "BAD_IMPORTED_BATHYMETRY_FILE" ).arg( aFileName ); return false;