From 94fef7ca048de3b662539a1c577ca42e24cbb2bb Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 7 May 2007 07:34:30 +0000 Subject: [PATCH] Porting to Qt4 --- .../SALOME_ModuleCatalog_Handler.cxx | 12 ++++++------ src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx | 15 ++++++--------- .../SALOME_ResourcesCatalog_Handler.cxx | 6 +++--- src/ResourcesManager/SALOME_ResourcesManager.cxx | 4 ++-- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 82f1710b8..30cbaaa14 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -327,8 +327,8 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, //tag test_inParameter_name if ((qName.compare(test_inParameter_name)==0)) { - if(MYDEBUG) SCRUTE(parent); - if(MYDEBUG) SCRUTE(grandparent); + if(MYDEBUG) SCRUTE(parent.toLatin1().data()); + if(MYDEBUG) SCRUTE(grandparent.toLatin1().data()); if (grandparent.compare(test_inDataStreamParameter_list) == 0) _inDataStreamParam.name = content ; else @@ -395,7 +395,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, // Parameter out - if(MYDEBUG) SCRUTE(qName); + if(MYDEBUG) SCRUTE(qName.toLatin1().data()); // tag test_outParameter_type if ((qName.compare(test_outParameter_type)==0)) { @@ -426,8 +426,8 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, //tag test_outDataStreamParameter_name if ((qName.compare(test_outDataStreamParameter_name)==0)) { - if(MYDEBUG) SCRUTE(grandparent); - if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list); + if(MYDEBUG) SCRUTE(grandparent.toLatin1().data()); + if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list.toLatin1().data()); if (grandparent.compare(test_outDataStreamParameter_list) == 0) _outDataStreamParam.name = content ; else @@ -534,7 +534,7 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&, //---------------------------------------------------------------------- bool SALOME_ModuleCatalog_Handler::characters(const QString& chars) { - content = (const char*)chars ; + content = chars.toLatin1().data() ; return true; } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 55dd3cede..d8de3a179 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -117,15 +117,12 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: false ); // skip empty entries #else //check for new format - int isNew = QString( _general_path ).contains(SEPARATOR); - if ( isNew > 0 ) { + if ( QString( _general_path ).contains(SEPARATOR) ) { //using new format - dirList = QStringList::split( SEPARATOR, _general_path, - false ); // skip empty entries + dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries } else { //support old format - dirList = QStringList::split( OLD_SEPARATOR, _general_path, - false ); // skip empty entries + dirList = QString( _general_path ).split( OLD_SEPARATOR, QString::SkipEmptyParts ); // skip empty entries } #endif @@ -133,7 +130,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: //QFileInfo fileInfo( dirList[ i ] ); QFileInfo fileInfo( dirList[ i ].replace( '\"', "" ) ); //remove inverted commas from filename if ( fileInfo.isFile() && fileInfo.exists() ) { - _parse_xml_file(fileInfo.filePath(), + _parse_xml_file(fileInfo.filePath().toLatin1().data(), _general_module_list, _general_path_list); } @@ -484,7 +481,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) std::string s(name); ParserComponent *C_parser = NULL; - ParserPathPrefixes *pp = NULL; + //ParserPathPrefixes *pp = NULL; // VSR : commented : unused variable SALOME_ModuleCatalog::Acomponent_ptr compo = SALOME_ModuleCatalog::Acomponent::_nil(); @@ -577,7 +574,7 @@ SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file, SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(); QFile xmlFile(file); - QXmlInputSource source(xmlFile); + QXmlInputSource source(&xmlFile); QXmlSimpleReader reader; reader.setContentHandler( handler ); diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 53162f87c..e6c68b858 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -130,7 +130,7 @@ startElement( const QString&, for (int i = 0;i < attrs.count();i++) { QString qName(attrs.localName(i)); - std::string content(attrs.value(i).latin1()); + std::string content(attrs.value(i).toLatin1().data()); if ((qName.compare(QString(test_hostname)) == 0)) _resource.DataForSort._hostName = content; @@ -265,7 +265,7 @@ endElement(const QString&, bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars) { - content = (const char *)chars ; + content = chars.toLatin1().data() ; return true; } @@ -328,7 +328,7 @@ SALOME_ResourcesCatalog_Handler::fatalError .arg( exception.message() ) .arg( exception.lineNumber() ) .arg( exception.columnNumber() ); - INFOS("parser error: " << errorProt.latin1()); + INFOS("parser error: " << errorProt.toLatin1().data()); return QXmlDefaultHandler::fatalError( exception ); } diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 9914eb7d6..05e1a688d 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -289,7 +289,7 @@ void SALOME_ResourcesManager::WriteInXmlFile() QFile file( _path_resources ); - if ( !file.open( IO_WriteOnly ) ) + if ( !file.open( QIODevice::WriteOnly ) ) INFOS("WRITING ERROR !"); QTextStream ts( &file ); @@ -313,7 +313,7 @@ const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile() new SALOME_ResourcesCatalog_Handler(_resourcesList); QFile xmlFile(_path_resources); - QXmlInputSource source(xmlFile); + QXmlInputSource source(&xmlFile); QXmlSimpleReader reader; reader.setContentHandler( handler ); -- 2.39.2