1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DataFlowBase_XmlHandler.cxx
25 // Author : Arnaud RES
30 #include "DataFlowBase_XmlHandler.hxx"
33 //#include <qxmlattributes.h>
38 //static string NULLSTRING = string("") ;
40 GraphBase::XmlHandler::XmlHandler( CORBA::ORB_ptr Orb ,
41 const bool aConstructor ) :
42 _Orb( Orb ) , dataflowxml(false), depth(0), constructor(aConstructor) {
44 for ( i = 0 ; i < maxlevel ; i++ ) {
45 fieldname[i] = NULLSTRING ;
46 fieldvalue[i] = NULLSTRING ;
53 GraphBase::XmlHandler::XmlHandler() {}
55 GraphBase::XmlHandler::~XmlHandler() {}
57 QString GraphBase::XmlHandler::errorProtocol() {
61 bool GraphBase::XmlHandler::startDocument() {
62 MESSAGE( "====================startDocument " ) ;
63 // at the beginning of parsing: do some initialization
68 bool GraphBase::XmlHandler::endDocument() {
69 MESSAGE( "====================endDocument " ) ;
73 bool GraphBase::XmlHandler::startElement( const QString&, const QString&,
75 const QXmlAttributes& atts ) {
76 // do different actions depending on the name of the tag and the
80 MESSAGE( "====================startElement " << depth << " " << qName)
84 if ( ( qName == "dataflow" || qName == "supergraph" ) && depth == 0 ) {
86 aListOfDataFlows.resize( GraphsNumber + 1 ) ;
88 for ( i = 0 ; i < maxlevel ; i++ ) {
89 fieldname[i] = NULLSTRING ;
90 fieldvalue[i] = NULLSTRING ;
97 if ( qName == "supergraph" ) {
98 fieldname[depth] = qName.latin1() ;
101 fieldname[depth++] = qName.latin1() ;
104 if ( depth == maxlevel+1 )
110 static bool returnfalse( GraphBase::XmlHandler *myXmlHandler ,
112 const QString& qName ) {
113 MESSAGE( "returnfalse ERROR qName " << qName << " " << msg
114 << " fieldname " << myXmlHandler->getfieldname(myXmlHandler->getdepth())
116 << myXmlHandler->getfieldvalue(myXmlHandler->getdepth()) << "'" )
120 bool GraphBase::XmlHandler::endElement( const QString&,
122 const QString& qName) {
124 if ( qName == "supergraph" ) {
126 MESSAGE( " ====================endElement supergraph" ) ;
132 // * On a eu endElement(dataflow)
133 // * Ou bien on a eu uniquement startElement(dataflow) et qName != fieldname et fieldvalue != NULLSTRING
135 ( qName != QString( fieldname[depth].c_str() ) &&
136 fieldvalue[depth] != NULLSTRING ) ) {
137 MESSAGE( "endElement ERROR dataflowxml " << dataflowxml << " qName " << qName
138 << " fieldname[" << depth << "] "<< fieldname[depth] << " fieldvalue "
139 << fieldvalue[depth] )
140 return returnfalse( this , "top" , qName ) ;
142 if ( fieldvalue[depth] == NULLSTRING ) {
147 MESSAGE( " ====================endElement step[" << depth << "]="
148 << step[depth] << " qName " << qName << " fieldvalue '"
149 << fieldvalue[depth] << "'")
153 if ( step[depth] == 0 && qName == "dataflow" ) {
155 dataflowxml = false ;
158 return returnfalse( this , "depth0" , qName ) ;
163 switch ( step[depth] ) {
165 if ( qName == "info-list" ) {
166 // aListOfDataFlows[ GraphsNumber ].Info = aNode ;
170 return returnfalse( this , "depth1-0" , qName ) ;
173 if ( qName == "node-list" ) {
180 return returnfalse( this , "depth1-1" , qName ) ;
183 if ( qName == "link-list" ) {
187 return returnfalse( this , "depth1-2" , qName ) ;
190 if ( qName == "data-list" ) {
194 return returnfalse( this , "depth1-3" , qName ) ;
197 return returnfalse( this , "depth1-d" , qName ) ;
204 switch ( step[depth] ) {
206 if ( qName == "node" ) {
208 if ( step[1] == 0 ) {
209 aListOfDataFlows[ GraphsNumber ].Info = aNode ;
211 else if ( step[1] == 1 ) {
212 int sizenode = aListOfDataFlows[ GraphsNumber ].Nodes.size() ;
213 aListOfDataFlows[ GraphsNumber ].Nodes.resize( sizenode+1 ) ;
214 aListOfDataFlows[ GraphsNumber ].Nodes[ sizenode ] = aNode ;
217 aNode.theService.ServiceinParameter.length( 0 ) ;
218 aNode.theService.ServiceoutParameter.length( 0 ) ;
219 aNode.theListOfInDataStreams.resize( 0 ) ;
220 aNode.theListOfOutDataStreams.resize( 0 ) ;
221 aNode.theListOfFuncName.resize( 0 ) ;
222 aNode.theListOfPythonFunctions.resize( 0 ) ;
225 else if ( qName == "link" || qName == "data" ) {
229 return returnfalse( this , "depth2-0" , qName ) ;
233 if ( qName == "link" ) {
234 int sizelink = aListOfDataFlows[ GraphsNumber ].Links.size() ;
235 aListOfDataFlows[ GraphsNumber ].Links.resize( sizelink+1 ) ;
236 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ] = aLink ;
238 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords.resize( VXSize ) ;
240 for ( ic = 0 ; ic < VXSize ; ic++ ) {
241 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theX = VX[ic] ;
242 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theY = VY[ic] ;
249 else if ( qName == "data" ) {
253 return returnfalse( this , "depth2-1" , qName ) ;
257 if ( qName == "data" ) {
260 int sizedata = aListOfDataFlows[ GraphsNumber ].Datas.size() ;
261 aListOfDataFlows[ GraphsNumber ].Datas.resize( sizedata+1 ) ;
262 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ] = aLink ;
264 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
266 for ( ic = 0 ; ic < VXSize ; ic++ ) {
267 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theX = VX[ic] ;
268 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theY = VY[ic] ;
276 return returnfalse( this , "depth2-2" , qName ) ;
279 return returnfalse( this , "depth2-d" , qName ) ;
286 switch ( step[depth] ) {
288 if ( qName == "component-name" ) {
289 if ( fieldvalue[depth] == NULLSTRING )
290 return returnfalse( this , "depth3-0" , qName ) ;
291 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
292 aNode.theComponentName = fieldvalue[depth].c_str() ;
294 aNode.theComponentName = "" ;
295 fieldvalue[depth] = NULLSTRING ;
299 return returnfalse( this , "depth3-0" , qName ) ;
302 if ( qName == "interface-name" ) {
303 if ( fieldvalue[depth] == NULLSTRING )
304 return returnfalse( this , "depth3-1" , qName ) ;
305 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
306 aNode.theInterfaceName = fieldvalue[depth].c_str() ;
308 aNode.theInterfaceName = "" ;
309 fieldvalue[depth] = NULLSTRING ;
313 return returnfalse( this , "depth3-1" , qName ) ;
316 if ( qName == "node-name" ) {
317 if ( fieldvalue[depth] == NULLSTRING )
318 return returnfalse( this , "depth3-2" , qName ) ;
319 aNode.theName = fieldvalue[depth].c_str() ;
320 fieldvalue[depth] = NULLSTRING ;
324 return returnfalse( this , "depth3-2" , qName ) ;
327 if ( qName == "kind" ) {
328 if ( fieldvalue[depth] == NULLSTRING )
329 return returnfalse( this , "depth3-3" , qName ) ;
331 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
332 fieldvalue[depth] = NULLSTRING ;
333 if ( aNode.theKind != SUPERV::DataStreamGraph ) {
339 else if ( qName == "streamgraph-timeout" ) {
340 if ( fieldvalue[depth] == NULLSTRING )
341 return returnfalse( this , "depth3-3" , qName ) ;
342 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theTimeout ) ;
343 fieldvalue[depth] = NULLSTRING ;
348 else if ( qName == "streamgraph-datastreamtrace" ) {
349 if ( fieldvalue[depth] == NULLSTRING )
350 return returnfalse( this , "depth3-3" , qName ) ;
351 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theDataStreamTrace ) ;
352 fieldvalue[depth] = NULLSTRING ;
357 else if ( qName == "streamgraph-deltatime" ) {
358 if ( fieldvalue[depth] == NULLSTRING )
359 return returnfalse( this , "depth3-3" , qName ) ;
360 sscanf( fieldvalue[depth].c_str() ,"%lf" , (double * ) &aNode.theDeltaTime ) ;
361 fieldvalue[depth] = NULLSTRING ;
370 // return returnfalse( this , "depth3-3" , qName ) ;
373 if ( qName == "coupled-node" ) {
374 if ( fieldvalue[depth] == NULLSTRING )
375 return returnfalse( this , "depth3-4" , qName ) ;
376 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
377 aNode.theCoupledNode = fieldvalue[depth].c_str() ;
379 aNode.theCoupledNode = "" ;
380 fieldvalue[depth] = NULLSTRING ;
386 // return returnfalse( this , "depth3-4" , qName ) ;
389 if ( qName == "service" ) {
390 if ( fieldvalue[depth] != NULLSTRING )
391 return returnfalse( this , "depth3-5" , qName ) ;
392 fieldvalue[depth] = NULLSTRING ;
399 return returnfalse( this , "depth3-5" , qName ) ;
402 if ( qName == "DataStream-list" || qName == "Parameter-list" ) {
403 if ( fieldvalue[depth] != NULLSTRING )
404 return returnfalse( this , "depth3-6" , qName ) ;
405 fieldvalue[depth] = NULLSTRING ;
417 // return returnfalse( this , "depth3-6" , qName ) ;
420 if ( qName == "PyFunction-list" ) {
421 if ( fieldvalue[depth] != NULLSTRING )
422 return returnfalse( this , "depth3-7" , qName ) ;
423 fieldvalue[depth] = NULLSTRING ;
434 // NO PyFunction-list
435 // return returnfalse( this , "depth3-7" , qName ) ;
438 if ( qName == "creation-date" ) {
441 strcpy( Date , fieldvalue[depth].c_str() ) ;
443 for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
444 if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
447 // MESSAGE( "Date(" << Date << ")" );
448 int Day , Month , Year , Hour , Minute , Second ;
449 sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
461 aNode.theFirstCreation = D ;
462 fieldvalue[depth] = NULLSTRING ;
466 return returnfalse( this , "depth3-8" , qName ) ;
469 if ( qName == "lastmodification-date" ) {
472 strcpy( Date , fieldvalue[depth].c_str() ) ;
474 for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
475 if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
478 // MESSAGE( "Date(" << Date << ")" );
479 int Day , Month , Year , Hour , Minute , Second ;
480 sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
492 aNode.theLastModification = D ;
493 fieldvalue[depth] = NULLSTRING ;
497 return returnfalse( this , "depth3-9" , qName ) ;
500 if ( qName == "editor-release" ) {
501 aNode.theEditorRelease = fieldvalue[depth].c_str() ;
502 fieldvalue[depth] = NULLSTRING ;
506 return returnfalse( this , "depth3-10" , qName ) ;
509 if ( qName == "author" ) {
510 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
511 aNode.theAuthor = fieldvalue[depth].c_str() ;
513 aNode.theAuthor = "" ;
514 fieldvalue[depth] = NULLSTRING ;
518 return returnfalse( this , "depth3-11" , qName ) ;
521 if ( qName == "container" ) {
522 if ( fieldvalue[depth] == NULLSTRING )
523 return returnfalse( this , "depth3-12" , qName ) ;
525 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
526 aNode.theContainer = fieldvalue[depth].c_str() ;
528 aNode.theContainer = "" ;
529 fieldvalue[depth] = NULLSTRING ;
533 return returnfalse( this , "depth3-12" , qName ) ;
536 if ( qName == "comment" ) {
537 if ( fieldvalue[depth] == NULLSTRING )
538 return returnfalse( this , "depth3-13" , qName ) ;
540 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
541 aNode.theComment = fieldvalue[depth].c_str() ;
543 aNode.theComment = "" ;
544 fieldvalue[depth] = NULLSTRING ;
548 return returnfalse( this , "depth3-13" , qName ) ;
551 if ( qName == "x-position" ) {
552 if ( fieldvalue[depth] == NULLSTRING )
553 return returnfalse( this , "depth3-14" , qName ) ;
554 sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theX ) ;
555 fieldvalue[depth] = NULLSTRING ;
560 return returnfalse( this , "depth3-14" , qName ) ;
563 if ( qName == "y-position" ) {
564 if ( fieldvalue[depth] == NULLSTRING )
565 return returnfalse( this , "depth3-15" , qName ) ;
566 sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theY ) ;
567 fieldvalue[depth] = NULLSTRING ;
572 return returnfalse( this , "depth3-15" , qName ) ;
575 if ( qName == "fromnode-name" ) {
576 if ( fieldvalue[depth] == NULLSTRING )
577 return returnfalse( this , "depth3-16" , qName ) ;
578 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
579 aLink.FromNodeName = fieldvalue[depth].c_str() ;
581 aLink.FromNodeName = "" ;
582 fieldvalue[depth] = NULLSTRING ;
587 return returnfalse( this , "depth3-16" , qName ) ;
590 if ( qName == "fromserviceparameter-name" ) {
591 if ( fieldvalue[depth] == NULLSTRING )
592 return returnfalse( this , "depth3-17" , qName ) ;
593 aLink.FromServiceParameterName = fieldvalue[depth].c_str() ;
594 fieldvalue[depth] = NULLSTRING ;
598 return returnfalse( this , "depth3-17" , qName ) ;
601 if ( qName == "tonode-name" ) {
602 if ( fieldvalue[depth] == NULLSTRING )
603 return returnfalse( this , "depth3-18" , qName ) ;
604 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
605 aLink.ToNodeName = fieldvalue[depth].c_str() ;
607 aLink.ToNodeName = "" ;
608 fieldvalue[depth] = NULLSTRING ;
612 return returnfalse( this , "depth3-18" , qName ) ;
615 if ( qName == "toserviceparameter-name" ) {
616 if ( fieldvalue[depth] == NULLSTRING )
617 return returnfalse( this , "depth3-19" , qName ) ;
618 aLink.ToServiceParameterName = fieldvalue[depth].c_str() ;
619 fieldvalue[depth] = NULLSTRING ;
623 return returnfalse( this , "depth3-19" , qName ) ;
627 if ( qName == "data-value" ) {
628 if ( fieldvalue[depth] != NULLSTRING )
629 return returnfalse( this , "depth3-20" , qName ) ;
637 // return returnfalse( this , "depth3-20" , qName ) ;
640 if ( qName == "coord-list" ) {
641 if ( fieldvalue[depth] != NULLSTRING )
642 return returnfalse( this , "depth3-21" , qName ) ;
648 return returnfalse( this , "depth3-21" , qName ) ;
651 return returnfalse( this , "depth3-d" , qName ) ;
659 switch ( step[depth] ) {
661 if ( qName == "service-name" ) {
662 if ( fieldvalue[depth] == NULLSTRING )
663 return returnfalse( this , "depth4-0" , qName ) ;
664 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
665 aNode.theService.ServiceName = fieldvalue[depth].c_str() ;
667 aNode.theService.ServiceName = "" ;
668 aNode.theService.ServiceinParameter.length( 0 ) ;
669 aNode.theService.ServiceoutParameter.length( 0 ) ;
670 fieldvalue[depth] = NULLSTRING ;
674 return returnfalse( this , "depth4-0" , qName ) ;
677 if ( qName == "inParameter-list" ) {
678 if ( fieldvalue[depth] != NULLSTRING )
679 return returnfalse( this , "depth4-1" , qName ) ;
680 fieldvalue[depth] = NULLSTRING ;
683 step[6] = 2 ; // First outParameter
684 // inParameterlist ok
687 return returnfalse( this , "depth4-1" , qName ) ;
690 if ( qName == "outParameter-list" ) {
691 if ( fieldvalue[depth] != NULLSTRING )
692 return returnfalse( this , "depth4-2" , qName ) ;
693 fieldvalue[depth] = NULLSTRING ;
695 // outParameterlist ok
700 return returnfalse( this , "depth4-2" , qName ) ;
703 if ( qName == "value-type" ) {
704 if ( fieldvalue[depth] == NULLSTRING )
705 return returnfalse( this , "depth4-3" , qName ) ;
707 sscanf( fieldvalue[depth].c_str() , "%d" , &Kind ) ;
708 // switch ( D.Value.type()->kind() ) {
709 aLink.aLinkValue = CORBA::Any() ;
711 case CORBA::tk_string: {
712 aLink.aLinkValue <<= (char *) NULL ;
714 aLink.aLinkValue >>= t;
716 MESSAGE( t << " (string)" );
720 case CORBA::tk_double: {
721 aLink.aLinkValue <<= (double ) 0. ;
723 aLink.aLinkValue >>= d;
725 MESSAGE( d << " (double)" );
729 case CORBA::tk_long: {
730 aLink.aLinkValue <<= (long ) 0 ;
732 aLink.aLinkValue >>= l;
734 MESSAGE( l << " (long)" );
738 case CORBA::tk_objref: {
739 // aLink.aLinkValue.replace(CORBA::_tc_Object, NULL);
740 aLink.aLinkValue <<= CORBA::Object::_nil() ;
742 MESSAGE( " (object reference)" );
747 MESSAGE( "(other ERROR)" );
749 fieldvalue[depth] = NULLSTRING ;
755 // return returnfalse( this , "depth4-3" , qName ) ;
758 if ( qName == "value" ) {
759 if ( fieldvalue[depth] == NULLSTRING )
760 return returnfalse( this , "depth4-4" , qName ) ;
761 if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
762 aLink.aLinkValue <<= "" ;
765 switch ( aLink.aLinkValue.type()->kind() ) {
766 case CORBA::tk_string: {
767 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
769 aLink.aLinkValue >>= t;
771 MESSAGE( t << " (string)" );
775 case CORBA::tk_double: {
777 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
778 aLink.aLinkValue <<= d;
780 MESSAGE( d << " (double)" );
784 case CORBA::tk_long: {
786 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
787 aLink.aLinkValue <<= l;
789 MESSAGE( l << " (long)" );
793 case CORBA::tk_objref: {
794 CORBA::Object_ptr ObjRef ;
795 const char * IORObjRef = fieldvalue[depth].c_str() ;
796 ObjRef = _Orb->string_to_object( IORObjRef ) ;
797 aLink.aLinkValue <<= ObjRef;
799 MESSAGE( IORObjRef << "(object reference)" );
804 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
805 MESSAGE( "(other ERROR)" );
809 fieldvalue[depth] = NULLSTRING ;
816 // return returnfalse( this , "depth4-4" , qName ) ;
819 if ( qName == "coord" ) {
820 if ( fieldvalue[depth] != NULLSTRING )
821 return returnfalse( this , "depth4-5" , qName ) ;
822 if ( VXSize == (int ) VX.size() ) {
823 VX.resize( VX.size() + 10 ) ;
824 VY.resize( VY.size() + 10 ) ;
832 return returnfalse( this , "depth4-5" , qName ) ;
835 if ( qName == "inParameter" ) {
836 if ( fieldvalue[depth] != NULLSTRING )
837 return returnfalse( this , "depth4-6" , qName ) ;
838 int size = aNode.theListOfInDataStreams.size() ;
839 aNode.theListOfInDataStreams.resize( size+1 ) ;
840 aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
842 // One more aParameter input
846 // return returnfalse( this , "depth4-6" , qName ) ;
849 if ( qName == "outParameter" ) {
850 if ( fieldvalue[depth] != NULLSTRING )
851 return returnfalse( this , "depth4-7" , qName ) ;
852 int size = aNode.theListOfOutDataStreams.size() ;
853 aNode.theListOfOutDataStreams.resize( size+1 ) ;
854 aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
855 // One more aParameter output
860 return returnfalse( this , "depth4-7" , qName ) ;
863 if ( qName == "PyFunction" ) {
864 if ( fieldvalue[depth] != NULLSTRING )
865 return returnfalse( this , "depth4-8" , qName ) ;
866 // One more PyFunction
871 return returnfalse( this , "depth4-8" , qName ) ;
874 return returnfalse( this , "depth4-d" , qName ) ;
882 switch ( step[depth] ) {
884 if ( qName == "inParameter" ) {
885 if ( fieldvalue[depth] != NULLSTRING )
886 return returnfalse( this , "depth5-0" , qName ) ;
887 fieldvalue[depth] = NULLSTRING ;
888 int size = aNode.theService.ServiceinParameter.length() ;
889 aNode.theService.ServiceinParameter.length( size+1 ) ;
890 aNode.theService.ServiceinParameter[size] = aParameter ;
891 // One more aParameter input
892 step[6] = 0 ; // Next one
895 return returnfalse( this , "depth5-0" , qName ) ;
898 if ( qName == "outParameter" ) {
899 if ( fieldvalue[depth] != NULLSTRING )
900 return returnfalse( this , "depth5-1" , qName ) ;
901 fieldvalue[depth] = NULLSTRING ;
902 int size = aNode.theService.ServiceoutParameter.length() ;
903 aNode.theService.ServiceoutParameter.length( size+1 ) ;
904 aNode.theService.ServiceoutParameter[size] = aParameter ;
905 // One more aParameter Output
906 step[6] = 2 ; // Next one
909 return returnfalse( this , "depth5-1" , qName ) ;
912 if ( qName == "x" ) {
913 if ( fieldvalue[depth] == NULLSTRING )
914 return returnfalse( this , "depth5-2" , qName ) ;
915 sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
916 fieldvalue[depth] = NULLSTRING ;
920 return returnfalse( this , "depth5-2" , qName ) ;
923 if ( qName == "y" ) {
924 if ( fieldvalue[depth] == NULLSTRING )
925 return returnfalse( this , "depth5-3" , qName ) ;
926 sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
927 fieldvalue[depth] = NULLSTRING ;
930 return returnfalse( this , "depth5-3" , qName ) ;
933 if ( qName == "inParameter-type" ) {
934 if ( fieldvalue[depth] == NULLSTRING )
935 return returnfalse( this , "depth5-4" , qName ) ;
936 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
937 fieldvalue[depth] = NULLSTRING ;
940 //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
946 // return returnfalse( this , "depth5-4" , qName ) ;
949 if ( qName == "inParameter-name" ) {
950 if ( fieldvalue[depth] == NULLSTRING )
951 return returnfalse( this , "depth5-5" , qName ) ;
952 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
953 anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
956 anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
958 fieldvalue[depth] = NULLSTRING ;
960 //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
966 else if ( qName == "inParameter-dependency" ) {
967 if ( fieldvalue[depth] == NULLSTRING )
968 return returnfalse( this , "depth5-5" , qName ) ;
969 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
970 fieldvalue[depth] = NULLSTRING ;
972 //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
973 // << step[depth] << endl ;
979 else if ( qName == "inParameter-schema" ) {
980 if ( fieldvalue[depth] == NULLSTRING )
981 return returnfalse( this , "depth5-5" , qName ) ;
982 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
983 fieldvalue[depth] = NULLSTRING ;
985 //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
986 // << step[depth] << endl ;
992 else if ( qName == "inParameter-interpolation" ) {
993 if ( fieldvalue[depth] == NULLSTRING )
994 return returnfalse( this , "depth5-5" , qName ) ;
995 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
996 fieldvalue[depth] = NULLSTRING ;
998 //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
999 // << step[depth] << endl ;
1002 // step[depth] = 4 ;
1005 else if ( qName == "inParameter-extrapolation" ) {
1006 if ( fieldvalue[depth] == NULLSTRING )
1007 return returnfalse( this , "depth5-5" , qName ) ;
1008 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
1009 fieldvalue[depth] = NULLSTRING ;
1013 //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
1014 // << step[depth] << endl ;
1019 // return returnfalse( this , "depth5-5" , qName ) ;
1022 if ( qName == "outParameter-type" ) {
1023 if ( fieldvalue[depth] == NULLSTRING )
1024 return returnfalse( this , "depth5-6" , qName ) ;
1025 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
1026 fieldvalue[depth] = NULLSTRING ;
1030 //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
1031 // << step[depth] << endl ;
1035 return returnfalse( this , "depth5-6" , qName ) ;
1038 if ( qName == "outParameter-name" ) {
1039 if ( fieldvalue[depth] == NULLSTRING )
1040 return returnfalse( this , "depth5-7" , qName ) ;
1041 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1042 anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
1045 anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
1047 fieldvalue[depth] = NULLSTRING ;
1049 //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
1050 // << step[depth] << endl ;
1053 // step[depth] = 6 ;
1055 else if ( qName == "outParameter-dependency" ) {
1056 if ( fieldvalue[depth] == NULLSTRING )
1057 return returnfalse( this , "depth5-7" , qName ) ;
1058 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
1059 fieldvalue[depth] = NULLSTRING ;
1061 //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
1062 // << step[depth] << endl ;
1065 // step[depth] = 6 ;
1067 else if ( qName == "outParameter-values" ) {
1068 if ( fieldvalue[depth] == NULLSTRING )
1069 return returnfalse( this , "depth5-7" , qName ) ;
1070 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
1071 fieldvalue[depth] = NULLSTRING ;
1075 //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
1076 // << step[depth] << endl ;
1080 return returnfalse( this , "depth5-7" , qName ) ;
1083 if ( qName == "FuncName" ) {
1084 if ( fieldvalue[depth] == NULLSTRING )
1085 return returnfalse( this , "depth5-8" , qName ) ;
1086 int l = aNode.theListOfFuncName.size() ;
1087 aNode.theListOfFuncName.resize( l+1 ) ;
1088 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1089 aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
1092 aNode.theListOfFuncName[ l ] = "" ;
1094 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1095 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
1097 MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
1100 fieldvalue[depth] = NULLSTRING ;
1104 return returnfalse( this , "depth5-8" , qName ) ;
1107 if ( qName == "PyFunc" ) {
1108 if ( fieldvalue[depth] == NULLSTRING )
1109 return returnfalse( this , "depth5-9" , qName ) ;
1110 int l = aNode.theListOfPythonFunctions.size() - 1 ;
1111 SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
1112 int ll = aPythonFunction.length() ;
1113 aPythonFunction.length( ll+1 ) ;
1114 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1115 aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
1118 aPythonFunction[ ll ] = NULLSTRING ;
1121 aNode.theListOfPythonFunctions.resize( l ) ;
1122 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1124 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
1126 MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
1127 << " [" << ll << "] = " << aPythonFunction[ ll ] )
1129 fieldvalue[depth] = NULLSTRING ;
1133 return returnfalse( this , "depth5-9" , qName ) ;
1136 return returnfalse( this , "depth5-d" , qName ) ;
1143 switch ( step[depth] ) {
1145 if ( qName == "inParameter-type" ) {
1146 if ( fieldvalue[depth] == NULLSTRING )
1147 return returnfalse( this , "depth6-0" , qName ) ;
1148 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1149 fieldvalue[depth] = NULLSTRING ;
1153 return returnfalse( this , "depth6-0" , qName ) ;
1156 if ( qName == "inParameter-name" ) {
1157 if ( fieldvalue[depth] == NULLSTRING )
1158 return returnfalse( this , "depth6-1" , qName ) ;
1159 aParameter.Parametername = fieldvalue[depth].c_str() ;
1160 fieldvalue[depth] = NULLSTRING ;
1164 return returnfalse( this , "depth6-1" , qName ) ;
1167 if ( qName == "outParameter-type" ) {
1168 if ( fieldvalue[depth] == NULLSTRING )
1169 return returnfalse( this , "depth6-2" , qName ) ;
1170 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1171 fieldvalue[depth] = NULLSTRING ;
1175 return returnfalse( this , "depth6-2" , qName ) ;
1178 if ( qName == "outParameter-name" ) {
1179 if ( fieldvalue[depth] == NULLSTRING )
1180 return returnfalse( this , "depth6-3" , qName ) ;
1181 aParameter.Parametername = fieldvalue[depth].c_str() ;
1182 fieldvalue[depth] = NULLSTRING ;
1186 return returnfalse( this , "depth6-3" , qName ) ;
1189 return returnfalse( this , "depth6-d" , qName ) ;
1197 //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
1203 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1204 // we are not interested in whitespaces
1205 QString ch_simplified = ch.simplifyWhiteSpace();
1206 if ( ch_simplified.isEmpty() ) {
1211 MESSAGE( "characters step[" << depth << "]=" << step[depth]
1212 << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
1214 if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1215 return returnfalse( this , "characters " , ch ) ;
1217 // fieldvalue[depth] = (const char * ) ch ;
1218 fieldvalue[depth] = ch.latin1() ;
1223 QString GraphBase::XmlHandler::errorString() {
1224 //cout << "the document is not in the quote file format" << endl ;
1225 return "the document is not in the quote file format";
1229 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1230 errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1231 .arg( exception.message() )
1232 .arg( exception.lineNumber() )
1233 .arg( exception.columnNumber() );
1234 //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1235 return QXmlDefaultHandler::fatalError( exception );
1239 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1241 SALOME_SuperVision::Date aDate;
1242 QString qstrDate(myStrDate);
1246 int iPos = qstrDate.find("/");
1247 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1248 aDate.Day = qstrTemp.toShort();
1249 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1250 iPos = qstrDate.find("/");
1251 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1252 aDate.Month = qstrTemp.toShort();
1253 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1254 iPos = qstrDate.find(" ");
1255 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1256 aDate.Year = qstrTemp.toShort();
1259 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1260 iPos = qstrDate.find(":");
1261 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1262 aDate.Hour = qstrTemp.toShort();
1263 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1264 iPos = qstrDate.find(":");
1265 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1266 aDate.Minute = qstrTemp.toShort();
1267 qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1268 aDate.Second = qstrDate.toShort();