X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Ftepal2med%2Fghs3dprl_msg_parser.cxx;h=f250b646b5ce0a3baeb6f2e130fb19c77d46af75;hb=60d8b6273a6c41554c890f70ad9ce00760ea6321;hp=74f5a6911a5276c96099d79cbbd0d2bf20e92f79;hpb=1635d9fabfa2e905dd4944cbcea696563c0fb5d7;p=plugins%2Fghs3dprlplugin.git diff --git a/src/tepal2med/ghs3dprl_msg_parser.cxx b/src/tepal2med/ghs3dprl_msg_parser.cxx old mode 100755 new mode 100644 index 74f5a69..f250b64 --- a/src/tepal2med/ghs3dprl_msg_parser.cxx +++ b/src/tepal2med/ghs3dprl_msg_parser.cxx @@ -1,248 +1,266 @@ +// Copyright (C) 2007-2023 CEA, EDF +// +// 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, or (at your option) any later version. +// +// 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 +// -//#include -//#include +// --- +// File : ghs3dprl_mesh_parser.cxx +// Author : Christian VAN WAMBEKE (CEA) (from Hexotic plugin Lioka RAZAFINDRAZAKA) +// --- +// #include #include "ghs3dprl_msg_parser.h" #include "ghs3dprl_mesh_wrap.h" -using namespace std; -using namespace med_2_2; - //************************************ bool ghs3dprl_msg_parser::startDocument() { - indent=""; - begin="distene_msg", - version="version", - neighbours="neighbours"; - count="count"; - neighbour="neighbour"; - indice="indice"; - send="send"; - vertices="vertices"; - edges="edges"; - faces="faces"; - elements="elements"; - receive="receive"; - etat=0; - neighbourscount=0; - neighbourcourant=0; - neighbourindice=0; - nbcount=0; - verbose=FALSE; //TRUE; //FALSE; - return TRUE; + indent=""; + begin="distene_msg"; + version="version"; + neighbours="neighbours"; + count="count"; + neighbour="neighbour"; + indice="indice"; + send="send"; + vertices="vertices"; + edges="edges"; + faces="faces"; + elements="elements"; + receive="receive"; + etat=0; + neighbourscount=0; + neighbourcourant=0; + neighbourindice=0; + nbcount=0; + verbose=false; //true; //false; + return true; } //************************************ -bool ghs3dprl_msg_parser::startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes &attrs) +bool ghs3dprl_msg_parser::startElement(const QString &/*namespaceURI*/, + const QString &/*localName*/, + const QString &qName, + const QXmlAttributes &attrs) { - bool ok; - if (verbose) cout<0 && attrs.localName(0)==count) - { - neighbourscount=attrs.value(0).toLong(&ok, 10); - neighbourcourant=-1; - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) - { - nbcount=attrs.value(0).toLong(&ok, 10); - if (verbose) cout<0 && attrs.localName(0)==count) + { + neighbourscount=attrs.value(0).toLong(&ok, 10); + neighbourcourant=-1; + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<0 && attrs.localName(0)==count) + { + nbcount=attrs.value(0).toLong(&ok, 10); + if (verbose) std::cout<nbfiles++; - return TRUE; - } - return TRUE; + indent.remove((uint)0,3); + if (verbose) std::cout<nbfiles++; + return true; + } + return true; } //************************************ bool ghs3dprl_msg_parser::characters(const QString &strini) { - bool ok; - med_int *tmint=NULL; - long nb=0; - //filtre rc,lf,tab et blancs successifs - QString str=strini.simplifyWhiteSpace(); - //if ( str.length() == 1 && str=="\n" ) - if (str.length()==0) - { - //cout<<"EMPTY_LINE_CR"<1) + else return true; + } + nb=str.count(' ',Qt::CaseSensitive) + 1; //nb chiffres detectes + if (nb>1) + { + //lecture vecteurs d'entiers separateur blanc + long i=0; + tmint=new med_int[nb]; + //printf("%staille attendue=%i taille vue=%i\n",(const char *)indent.toLatin1().constData(),nbcount,nb); + do + { + tmint[i]=str.section(' ',i,i).toLong(&ok); + //printf("tmint[%i]=%i\n",i,tmint[i]); + i++; + } while ((inofile,neighbourindice)+ - shorttypel+shortsendreceive; - tmp=tmp.simplifyWhiteSpace(); - ok=mailw->insert_key(tmp,montab); - return TRUE; + } + + } + //lecture ok stockage de tlong dans mailw.mestab + CVWtab *montab=new CVWtab(nb,tmint); + QString tmp; + /*std::cout<<"InsertKey type="<nofile,neighbourindice)+ + shorttypel+shortsendreceive; + tmp=tmp.simplified(); + ok=mailw->insert_key(tmp,montab); + return true; }