6 #include "ghs3dprl_msg_parser.h"
7 #include "ghs3dprl_mesh_wrap.h"
10 using namespace med_2_2;
12 //************************************
13 bool ghs3dprl_msg_parser::startDocument()
18 neighbours="neighbours";
20 neighbour="neighbour";
33 verbose=FALSE; //TRUE; //FALSE;
37 //************************************
38 bool ghs3dprl_msg_parser::startElement(const QString &namespaceURI,
39 const QString &localName,
41 const QXmlAttributes &attrs)
44 if (verbose) cout<<indent<<qName<<endl;
45 typel=qName; shorttypel="";
53 if (qName==neighbours)
56 if (attrs.count()>0 && attrs.localName(0)==count)
58 neighbourscount=attrs.value(0).toLong(&ok, 10);
60 if (verbose) cout<<indent<<attrs.localName(0)<<
61 "="<<neighbourscount<<endl;
69 if (attrs.count()>0 && attrs.localName(0)==indice)
71 neighbourindice=attrs.value(0).toLong(&ok, 10);
73 //mailw.neighbourindices[mailw.neighbourcourant]=neighbourindice;
74 if (verbose) cout<<indent<<attrs.localName(0)<<
75 "="<<neighbourindice<<endl;
83 sendreceive="s/r=send ";
84 shortsendreceive="SE ";
91 sendreceive="s/r=receive ";
92 shortsendreceive="RE ";
100 if (attrs.count()>0 && attrs.localName(0)==count)
102 nbcount=attrs.value(0).toLong(&ok, 10);
103 if (verbose) cout<<indent<<attrs.localName(0)<<
113 if (attrs.count()>0 && attrs.localName(0)==count)
115 nbcount=attrs.value(0).toLong(&ok, 10);
116 if (verbose) cout<<indent<<attrs.localName(0)<<
126 if (attrs.count()>0 && attrs.localName(0)==count)
128 nbcount=attrs.value(0).toLong(&ok, 10);
129 if (verbose) cout<<indent<<attrs.localName(0)<<
139 if (attrs.count()>0 && attrs.localName(0)==count)
141 nbcount=attrs.value(0).toLong(&ok, 10);
142 if (verbose) cout<<indent<<attrs.localName(0)<<
148 /*for( int i=0; i<attrs.count(); i++ )
150 cout<<indent<<attrs.localName(i)<<"="<<attrs.value(i)<<endl;
156 //************************************
157 bool ghs3dprl_msg_parser::endElement(const QString &namespaceURI,
158 const QString &localName,
159 const QString &qName)
161 indent.remove((uint)0,3);
162 if (verbose) cout<<indent<<"\\"<<qName<<endl;
163 nbcount=0; //precaution
164 if (qName==send || qName==receive)
178 //************************************
179 bool ghs3dprl_msg_parser::characters(const QString &strini)
184 //filtre rc,lf,tab et blancs successifs
185 QString str=strini.simplifyWhiteSpace();
186 //if ( str.length() == 1 && str=="\n" )
189 //cout<<"EMPTY_LINE_CR"<<endl;
196 double ver=str.toDouble(&ok);
199 cout<<"version "<<str<<" fichier .msg inconnue"<<endl;
204 nb=str.contains(' ',TRUE) + 1; //nb chiffres detectes
207 //lecture vecteurs d'entiers separateur blanc
209 tmint=new med_int[nb];
210 //printf("%staille attendue=%i taille vue=%i\n",(const char *)indent,nbcount,nb);
213 tmint[i]=str.section(' ',i,i).toLong(&ok);
214 //printf("tmint[%i]=%i\n",i,tmint[i]);
216 } while ((i<nb) && ok );
219 cout<<"pb conversion "<<i<<" eme entier="<<str.section(' ',i-1,i-1)<<endl;
220 cout<<indent<<"etat="<<etat<<" nb="<<nb<<endl<<str<<endl;
225 tmint=new med_int[nb];
226 tmint[0]=str.toLong(&ok);
229 cout<<"pb conversion 1er entier="<<str<<endl;
230 cout<<indent<<"etat="<<etat<<" nb="<<nb<<endl;
235 //lecture ok stockage de tlong dans mailw.mestab
236 CVWtab *montab=new CVWtab(nb,tmint);
238 /*cout<<"InsertKey type="<<typel<<" "<<sendreceive<<
239 " neighbour="<<neighbourindice<<
240 " file="<<mailw->nofile<<endl;*/
241 tmp=tmp.sprintf("MS%ld NE%ld ",
242 mailw->nofile,neighbourindice)+
243 shorttypel+shortsendreceive;
244 tmp=tmp.simplifyWhiteSpace();
245 ok=mailw->insert_key(tmp,montab);