X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleCatalog%2FSALOME_ModuleCatalog_Handler.cxx;h=c4104d9bdd6f06477c75abb2ff062f4c60b35881;hb=954e65a018fc5f2c0d2ffb4f4814e199ecdda5a5;hp=f22bf8ce042c4251ea7869df7d6236e8d6092407;hpb=dc36a3bbce62e88454d490e78d25c29f049fad83;p=modules%2Fkernel.git diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index f22bf8ce0..c4104d9bd 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -1,13 +1,45 @@ -using namespace std; -// File: SALOME_ModuleCatalog_Handler.cxx -// Created: Tue June 27 2001 -// Author: Estelle Deville -// Project: SALOME -// Copyright : CEA/DEN/DMSS/LGLS -// $Header$ +// SALOME ModuleCatalog : implementation of ModuleCatalog server which parsers xml description of modules +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_ModuleCatalog_Handler.cxx +// Author : Estelle Deville +// Module : SALOME +// $Header$ #define WRITE_CATA_COMPONENT + #include "SALOME_ModuleCatalog_Handler.hxx" +#include "SALOME_ModuleCatalog_Parser_IO.hxx" +#include "utilities.h" + +#include +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif //---------------------------------------------------------------------- // Function : SALOME_ModuleCatalog_Handler @@ -15,41 +47,64 @@ using namespace std; //---------------------------------------------------------------------- SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() { - MESSAGE("SALOME_ModuleCatalog_Handler creation") + if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler"); + // XML Tags initialisation // Used in the function endElement - test_path_prefix_name = "path-prefix-name"; - test_computer_name = "computer-name" ; - test_path_prefix = "path-prefix" ; + test_path_prefix_name = "path-prefix-name"; + test_computer_name = "computer-name" ; + test_computer_list = "computer-list" ; + test_path_prefix = "path-prefix" ; + test_path_prefix_list = "path-prefix-list" ; + + test_component_name = "component-name"; + test_component_username = "component-username"; + test_component_type = "component-type" ; + test_component_multistudy = "component-multistudy"; + test_component_icon = "component-icone" ; + test_component_impltype = "component-impltype"; + test_component_version = "component-version"; + test_component_comment = "component-comment"; + + test_interface_name = "component-interface-name" ; + + test_service_name = "service-name"; + test_defaultservice = "service-by-default"; - test_component_name = "component-name"; - test_component_username = "component-username"; - test_component_type = "component-type" ; - test_component_multistudy="component-multistudy"; - test_component_icone="component-icone" ; + test_typeofnode = "type-of-node"; - test_interface_name = "component-interface-name" ; - - test_service_name = "service-name"; - test_defaultservice = "service-by-default"; + test_inParameter_type = "inParameter-type"; + test_inParameter_name = "inParameter-name"; + test_inParameter = "inParameter"; + test_inParameter_list = "inParameter-list"; + + test_outParameter_type = "outParameter-type"; + test_outParameter_name = "outParameter-name"; + test_outParameter = "outParameter"; + test_outParameter_list = "outParameter-list"; - test_inParameter_type="inParameter-type"; - test_inParameter_name="inParameter-name"; - test_inParameter="inParameter"; - test_inParameter_list="inParameter-list"; + test_inDataStreamParameter_type = "inParameter-type"; + test_inDataStreamParameter_name = "inParameter-name"; + test_inDataStreamParameter_dependency = "inParameter-dependency"; + test_inDataStreamParameter = "inParameter"; + test_inDataStreamParameter_list = "DataStream-list"; - test_outParameter_type="outParameter-type"; - test_outParameter_name="outParameter-name"; - test_outParameter="outParameter"; - test_outParameter_list="outParameter-list"; + test_outDataStreamParameter_type = "outParameter-type"; + test_outDataStreamParameter_name = "outParameter-name"; + test_outDataStreamParameter_dependency = "outParameter-dependency"; + test_outDataStreamParameter = "outParameter"; + test_outDataStreamParameter_list = "DataStream-list"; - test_service= "component-service"; - test_service_list="component-service-list"; - test_interface_list="component-interface-list"; + test_service = "component-service"; + test_service_list = "component-service-list"; + test_interface_list = "component-interface-list"; - test_constraint="constraint"; + test_constraint = "constraint"; + test_component_list = "component-list"; test_component="component"; + + if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler"); } //---------------------------------------------------------------------- @@ -58,315 +113,476 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() //---------------------------------------------------------------------- SALOME_ModuleCatalog_Handler::~SALOME_ModuleCatalog_Handler() { - MESSAGE("SALOME_ModuleCatalog_Handler destruction") + if(MYDEBUG) BEGIN_OF("~SALOME_ModuleCatalog_Handler()") + if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()") } -//---------------------------------------------------------------------- -// Function : startDocument -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::startDocument() -{ - MESSAGE("Begin parse document") - // Empty the private elements - _pathlist.resize(0); - _path_prefix.ListOfComputer.resize(0); - _servicelist.resize(0); - _interfacelist.resize(0); - _modulelist.resize(0); - _inparamlist.resize(0); - _outparamlist.resize(0); - return true; -} -//---------------------------------------------------------------------- -// Function : startElement -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::startElement(const QString&, - const QString &, - const QString& qName, - const QXmlAttributes& atts) -{ - return true; -} +//============================================================================= +/*! + * Processes XML document and fills the list of modules + */ +//============================================================================= -//---------------------------------------------------------------------- -// Function : endElement -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::endElement(const QString&, - const QString &, - const QString& qName) +void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) { - // Path prefix - - // tag test_path_prefix_name - if((qName.compare(QString(test_path_prefix_name))==0)) - _path_prefix.path = content; - // tag test_computer_name - if((qName.compare(QString(test_computer_name))==0)) - _path_prefix.ListOfComputer.push_back(content); - - // tag test_path_prefix - if((qName.compare(QString(test_path_prefix))==0)) - { - _pathlist.push_back(_path_prefix); - _path_prefix.ListOfComputer.resize(0); - } - - // Component identification - - // tag test_component_name - if((qName.compare(QString(test_component_name))==0)) - _amodule.Parsercomponentname = content ; - // tag test_component_username - if((qName.compare(QString(test_component_username))==0)) - _amodule.Parsercomponentusername = content ; - // tag test_component_type - if((qName.compare(QString(test_component_type))==0)) - { - if ((content.compare("MESH") == 0) || - (content.compare("Mesh") == 0) || - (content.compare("mesh") == 0)) - _amodule.Parsercomponenttype = MESH ; - else if((content.compare("MED") == 0) || - (content.compare("Med") == 0) || - (content.compare("med") == 0)) - _amodule.Parsercomponenttype = Med ; - else if((content.compare("GEOM") == 0) || - (content.compare("Geom") == 0) || - (content.compare("geom") == 0)) - _amodule.Parsercomponenttype = GEOM ; - else if((content.compare("SOLVER") == 0) || - (content.compare("Solver") == 0) || - (content.compare("solver") == 0)) - _amodule.Parsercomponenttype = SOLVER ; - else if((content.compare("SUPERV") == 0) || - (content.compare("Superv") == 0) || - (content.compare("Supervision") == 0) || - (content.compare("superv") == 0)) - _amodule.Parsercomponenttype = SUPERV ; - else if((content.compare("DATA") == 0) || - (content.compare("Data") == 0) || - (content.compare("data") == 0)) - _amodule.Parsercomponenttype = DATA ; - else if((content.compare("VISU") == 0) || - (content.compare("Visu") == 0) || - (content.compare("visu") == 0)) - _amodule.Parsercomponenttype = VISU ; - else if((content.compare("OTHER") == 0) || - (content.compare("Other") == 0) || - (content.compare("other") == 0)) - _amodule.Parsercomponenttype = OTHER ; - else - // If it'not in all theses cases, the type is affected to OTHER - _amodule.Parsercomponenttype = OTHER ; - } - - // tag test_component_multistudy - if((qName.compare(QString(test_component_multistudy))==0)) - _amodule.Parsercomponentmultistudy = atoi(content.c_str()) ; - - // tag test_component_icone - if((qName.compare(QString(test_component_icone))==0)) - _amodule.Parsercomponenticone = content ; - - // interface identification - - // tag test_interface_name - if((qName.compare(QString(test_interface_name))==0)) - _aInterface.Parserinterfacename = content ; - - // Service identification - - // tag test_service_name - if((qName.compare(QString(test_service_name))==0)) - _aService.ParserServiceName = content ; - - //tag test_defaultservice - if((qName.compare(QString(test_defaultservice))==0)) - _aService.ParserServicebydefault = atoi(content.c_str()) ; - - // Parameter in - - // tag test_inParameter_type - if((qName.compare(QString(test_inParameter_type))==0)) - _inparam.ParserParamtype = content ; - //tag test_inParameter_name - if((qName.compare(QString(test_inParameter_name))==0)) - _inparam.ParserParamname = content ; - - //tag test_inParameter - if((qName.compare(QString(test_inParameter))==0)) - { - _inparamlist.push_back(_inparam) ; - - // Empty temporary structures - _inparam.ParserParamtype = ""; - _inparam.ParserParamname = ""; - } + if(MYDEBUG) MESSAGE("Begin parse document"); + // Empty the private elements + _pathList.resize(0); + _pathPrefix.listOfComputer.resize(0); + _serviceList.resize(0); + _interfaceList.resize(0); + _moduleList.resize(0); + _inDataStreamParamList.resize(0); + _outDataStreamParamList.resize(0); + _inParamList.resize(0); + _outParamList.resize(0); + + // Get the document root node + xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc); + aCurNode = aCurNode->xmlChildrenNode; - //tag test_inParameter_list - if((qName.compare(QString(test_inParameter_list))==0)) - { - _aService.ParserServiceinParameter = _inparamlist; - _inparamlist.resize(0); - } - - // Parameter out - - // tag test_outParameter_type - if((qName.compare(QString(test_outParameter_type))==0)) - _outparam.ParserParamtype = content ; - //tag test_outParameter_name - if((qName.compare(QString(test_outParameter_name))==0)) - _outparam.ParserParamname = content ; - - //tag test_outParameter - if((qName.compare(QString(test_outParameter))==0)) + // Processing the document nodes + while(aCurNode != NULL) + { + // Process path prefix list (tag test_path_prefix_list) + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) ) { - _outparamlist.push_back(_outparam) ; - - // Empty temporary structures - _outparam.ParserParamtype = ""; - _outparam.ParserParamname = ""; + xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode; + while(aCurSubNode != NULL) + { + // Forming a PathPrefix structure (tag test_path_prefix) + if ( xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_path_prefix) ) { + aCurSubNode = aCurSubNode->next; + continue; + } + + xmlNodePtr aCurSubSubNode = aCurSubNode->xmlChildrenNode; + while(aCurSubSubNode != NULL) + { + // Tag test_path_prefix_name + if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_path_prefix_name) ) { + xmlChar* aPath = xmlNodeGetContent(aCurSubSubNode); + if (aPath != NULL) { + _pathPrefix.path = (const char*)aPath; + xmlFree(aPath); + } + } + + // Tag test_computer_list + if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_computer_list) ) { + xmlNodePtr aComputerNode = aCurSubSubNode->xmlChildrenNode; + while (aComputerNode != NULL) { + // Tag test_computer_name + if ( !xmlStrcmp(aComputerNode->name, (const xmlChar*) test_computer_name) ) { + xmlChar* aCompName = xmlNodeGetContent(aComputerNode); + if (aCompName != NULL) { + _pathPrefix.listOfComputer.push_back((const char*)aCompName); + xmlFree(aCompName); + } + } + + aComputerNode = aComputerNode->next; + } + } + + aCurSubSubNode = aCurSubSubNode->next; + } + + _pathList.push_back(_pathPrefix); + _pathPrefix.listOfComputer.resize(0); + + aCurSubNode = aCurSubNode->next; + } } - //tag test_outParameter_list - if((qName.compare(QString(test_outParameter_list))==0)) - { - _aService.ParserServiceoutParameter=_outparamlist; - _outparamlist.resize(0); - } - - - // tag test_service - if((qName.compare(QString(test_service))==0)) - { - _servicelist.push_back(_aService); - - // Empty temporary structures - _aService.ParserServiceName = ""; - _aService.ParserServiceinParameter.resize(0); - _aService.ParserServiceoutParameter.resize(0); - } - - // tag test_service_list - if((qName.compare(QString(test_service_list))==0)) - { - _aInterface.Parserinterfaceservicelist = _servicelist ; - - // Empty temporary structures - _servicelist.resize(0); - _interfacelist.push_back(_aInterface); - _aInterface.Parserinterfacename =""; - _aInterface.Parserinterfaceservicelist.resize(0); - - } - - //tag test_interface_list - if((qName.compare(QString(test_interface_list))==0)) - { - _amodule.ParserListInterface = _interfacelist ; - _interfacelist.resize(0); - } - - //tag test_constraint - if((qName.compare(QString(test_constraint))==0)) - _amodule.Parserconstraint = content ; - - // tag test_component - if((qName.compare(QString(test_component))==0)) - { - _modulelist.push_back(_amodule) ; - - // Empty temporary structures - _amodule.Parsercomponentname = ""; - _amodule.Parserconstraint = ""; - _amodule.Parsercomponenticone=""; - _amodule.ParserListInterface.resize(0); - } - - return true; -} - -//---------------------------------------------------------------------- -// Function : characters -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::characters(const QString& chars) -{ - content = chars ; - return true; -} -//---------------------------------------------------------------------- -// Function : endDocument -// Purpose : overload handler function -// Print all informations find in the catalog -// (only in DEBUG mode!!) -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::endDocument() -{ - //_pathlist - for (unsigned int ind = 0; ind < _pathlist.size(); ind++) + //@ Process list of components (tag test_component_list) + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) ) { - MESSAGE("Path :"<<_pathlist[ind].path) - for (unsigned int i = 0; i < _pathlist[ind].ListOfComputer.size(); i++) - MESSAGE("Computer name :" << _pathlist[ind].ListOfComputer[i]) + xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode; + while (aComponentNode != NULL) + { + // Do not process tags differ from test_component here + if ( xmlStrcmp(aComponentNode->name, (const xmlChar*)test_component) ) { + aComponentNode = aComponentNode->next; + continue; + } + + // Component identification + + // Empty temporary structures + _aModule.name = ""; + _aModule.constraint = ""; + _aModule.icon=""; + _aModule.interfaces.resize(0); + + xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode; + while(aComponentSubNode != NULL) + { + xmlChar* aNodeContent = xmlNodeGetContent(aComponentSubNode); + + if (aNodeContent == NULL) { + aComponentSubNode = aComponentSubNode->next; + continue; + } + + std::string aContent = (const char*)aNodeContent; + + // Tag test_component_name + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_name) ) + _aModule.name = aContent; + + // Tag test_component_username + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_username) ) + _aModule.username = aContent; + + // Tag test_component_type + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_type) ) { + std::string aType = aContent; + + if ((aType.compare("MESH") == 0) || + (aType.compare("Mesh") == 0) || + (aType.compare("mesh") == 0)) + _aModule.type = MESH ; + else if((aType.compare("MED") == 0) || + (aType.compare("Med") == 0) || + (aType.compare("med") == 0)) + _aModule.type = Med ; + else if((aType.compare("GEOM") == 0) || + (aType.compare("Geom") == 0) || + (aType.compare("geom") == 0)) + _aModule.type = GEOM ; + else if((aType.compare("SOLVER") == 0) || + (aType.compare("Solver") == 0) || + (aType.compare("solver") == 0)) + _aModule.type = SOLVER ; + else if((aType.compare("SUPERV") == 0) || + (aType.compare("Superv") == 0) || + (aType.compare("Supervision") == 0) || + (aType.compare("superv") == 0)) + _aModule.type = SUPERV ; + else if((aType.compare("DATA") == 0) || + (aType.compare("Data") == 0) || + (aType.compare("data") == 0)) + _aModule.type = DATA ; + else if((aType.compare("VISU") == 0) || + (aType.compare("Visu") == 0) || + (aType.compare("visu") == 0)) + _aModule.type = VISU ; + else if((aType.compare("OTHER") == 0) || + (aType.compare("Other") == 0) || + (aType.compare("other") == 0)) + _aModule.type = OTHER ; + else + // If it'not in all theses cases, the type is affected to OTHER + _aModule.type = OTHER ; + } + + // Tag test_component_multistudy + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_multistudy) ) + _aModule.multistudy = atoi( aContent.c_str() ); + + // Tag test_component_impltype + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) ) + _aModule.implementationType = atoi(aContent.c_str()); + + // Tag test_component_icon + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) ) + _aModule.icon = aContent; + + // Tag test_component_version + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_version) ) + _aModule.version = aContent; + + // Tag test_component_comment + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_comment) ) + _aModule.comment = aContent; + + // Tag test_constraint + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_constraint) ) + _aModule.constraint = aContent; + + xmlFree(aNodeContent); + + // Process tag test_interface_list: + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_interface_list) ) { + + // Form an interface list for the component + xmlNodePtr aSubNode = aComponentSubNode->xmlChildrenNode; + while(aSubNode != NULL) { + // Tag test_interface_name + if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_interface_name) ) { + xmlChar* anInterfaceName = xmlNodeGetContent(aSubNode); + if (anInterfaceName != NULL) { + _aInterface.name = (const char*)anInterfaceName; + xmlFree(anInterfaceName); + } + } + + // Tag test_service_list + if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_service_list) ) { + // Form a service list for the interface + xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode; + while(aCompServiceNode != NULL) { + // Tag test_service + if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)test_interface_name) ) { + xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode; + while(aCompServiceSubNode != NULL) + { + xmlChar* aCompServiceData = xmlNodeGetContent(aCompServiceSubNode); + + if ( aCompServiceData != NULL) + { + // Tag test_service_name + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_service_name) ) + _aService.name = (const char*)aCompServiceData; + + // Tag test_defaultservice + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_defaultservice) ) + _aService.byDefault = (const char*)aCompServiceData; + + // Tag test_typeofnode + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_typeofnode) ) + _aService.typeOfNode = (const char*)aCompServiceData; + + xmlFree(aCompServiceData); + } + + // Tag test_inParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inParameter_list) ) { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_inParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* aParamData = xmlNodeGetContent(aParamItemNode); + + if (aParamData != NULL) + { + // Tag test_inParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_name) ) + _inParam.name = (const char*)aParamData; + + // Tag test_inParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_type) ) + _inParam.type = (const char*)aParamData; + + xmlFree(aParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _inParamList.push_back(_inParam) ; + + // Empty temporary structures + _inParam.type = ""; + _inParam.name = ""; + + aParamNode = aParamNode->next; + } + + _aService.inParameters = _inParamList; + _inParamList.resize(0); + } + + // Tag test_outParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outParameter_list) ) { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_outParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* anOutParamData = xmlNodeGetContent(aParamItemNode); + + if (anOutParamData != NULL) + { + // Tag test_outParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_name) ) + _outParam.name = (const char*)anOutParamData; + + // Tag test_outParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_type) ) + _outParam.type = (const char*)anOutParamData; + + xmlFree(anOutParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _outParamList.push_back(_outParam) ; + + // Empty temporary structures + _outParam.type = ""; + _outParam.name = ""; + + aParamNode = aParamNode->next; + } + + _aService.outParameters = _outParamList; + _outParamList.resize(0); + } + + //@ Tag test_inDataStreamParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inDataStreamParameter_list) ) + { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_inDataStreamParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inDataStreamParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* inDataStreamParamData = xmlNodeGetContent(aParamItemNode); + + if (inDataStreamParamData != NULL) + { + // Tag test_inDataStreamParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_name) ) + _inDataStreamParam.name = (const char*)inDataStreamParamData; + + // Tag test_inDataStreamParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_type) ) + _inDataStreamParam.type = (const char*)inDataStreamParamData; + + // Tag test_inDataStreamParameter_dependency + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_dependency) ) + _inDataStreamParam.dependency = (const char*)inDataStreamParamData; + + xmlFree(inDataStreamParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _inDataStreamParamList.push_back(_inDataStreamParam) ; + + // Empty temporary structures + _inDataStreamParam.type = ""; + _inDataStreamParam.name = ""; + _inDataStreamParam.dependency = ""; + + aParamNode = aParamNode->next; + } + + _aService.inDataStreamParameters = _inDataStreamParamList; + _inDataStreamParamList.resize(0); + } + + // Tag test_outDataStreamParameter_list + if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outDataStreamParameter_list) ) + { + xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode; + while (aParamNode != NULL) + { + // Tag test_outDataStreamParameter + if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outDataStreamParameter)) { + aParamNode = aParamNode->next; + continue; + } + + xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode; + while (aParamItemNode != NULL) + { + xmlChar* outDataStreamParamData = xmlNodeGetContent(aParamItemNode); + + if (outDataStreamParamData != NULL) + { + // Tag test_outDataStreamParameter_name + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_name) ) + _outDataStreamParam.name = (const char*)outDataStreamParamData; + + // Tag test_outDataStreamParameter_type + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_type) ) + _outDataStreamParam.type = (const char*)outDataStreamParamData; + + // Tag test_outDataStreamParameter_dependency + if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_dependency) ) + _outDataStreamParam.dependency = (const char*)outDataStreamParamData; + + xmlFree(outDataStreamParamData); + } + + aParamItemNode = aParamItemNode->next; + } + + _outDataStreamParamList.push_back(_outDataStreamParam) ; + + // Empty temporary structures + _outDataStreamParam.type = ""; + _outDataStreamParam.name = ""; + _outDataStreamParam.dependency = ""; + + aParamNode = aParamNode->next; + } + + _aService.outDataStreamParameters = _outDataStreamParamList; + _outDataStreamParamList.resize(0); + } + + aCompServiceSubNode = aCompServiceSubNode->next; + } + + // Put formed service into the list + _serviceList.push_back(_aService); + + // Empty temporary structures + _aService.name = ""; + _aService.typeOfNode = 1; + _aService.inParameters.resize(0); + _aService.outParameters.resize(0); + _aService.inDataStreamParameters.resize(0); + _aService.outDataStreamParameters.resize(0); + } + + aCompServiceNode = aCompServiceNode->next; + } + + _aInterface.services = _serviceList ; + + // Empty temporary structures + _serviceList.resize(0); + _interfaceList.push_back(_aInterface); + _aInterface.name =""; + _aInterface.services.resize(0); + } + + aSubNode = aSubNode->next; + } + + _aModule.interfaces = _interfaceList ; + _interfaceList.resize(0); + } + + aComponentSubNode = aComponentSubNode->next; + } + + _moduleList.push_back(_aModule); + + aComponentNode = aComponentNode->next; + } } - // _modulelist - for (unsigned int ind = 0; ind < _modulelist.size(); ind++) - { - MESSAGE("Component name : " << _modulelist[ind].Parsercomponentname); - // MESSAGE("Component type : " <<_modulelist[ind].Parsercomponenttype); -// MESSAGE("Component constraint : " << _modulelist[ind].Parserconstraint); -// MESSAGE("Component icone : " << _modulelist[ind].Parsercomponenticone); -// for (unsigned int i = 0; i < _modulelist[ind].ParserListInterface.size(); i++) -// { -// MESSAGE("Component interface name : " << _modulelist[ind].ParserListInterface[i].Parserinterfacename); -// for (unsigned int j=0; j< _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist.size(); j++) -// { -// MESSAGE("Service name : " << _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceName); -// MESSAGE("Service default : " << _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServicebydefault); -// for (unsigned int k=0; k< _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceinParameter.size() ; k++) -// { -// MESSAGE("Service Parameter in name : " <<_modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceinParameter[k].ParserParamname); -// MESSAGE("Service Parameter in type : " << _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceinParameter[k].ParserParamtype); -// } -// for (unsigned int k=0; k< _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceoutParameter.size() ; k++) -// { -// MESSAGE("Service Parameter out name : " << _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceoutParameter[k].ParserParamname); -// MESSAGE("Service Parameter out type : " << _modulelist[ind].ParserListInterface[i].Parserinterfaceservicelist[j].ParserServiceoutParameter[k].ParserParamtype); -// } -// } - } -// } - //MESSAGE("Document parsed"); - return true; -} - -//---------------------------------------------------------------------- -// Function : errorProtocol -// Purpose : overload handler function -//---------------------------------------------------------------------- -QString SALOME_ModuleCatalog_Handler::errorProtocol() -{ - return errorProt ; -} - - -//---------------------------------------------------------------------- -// Function : fatalError -// Purpose : overload handler function -//---------------------------------------------------------------------- -bool SALOME_ModuleCatalog_Handler::fatalError(const QXmlParseException& exception) -{ - errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" ) - .arg( exception.message() ) - .arg( exception.lineNumber() ) - .arg( exception.columnNumber() ); - - return QXmlDefaultHandler::fatalError( exception ); + aCurNode = aCurNode->next; + } }