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 ;
52 aLinkValue = CORBA::Any();
55 GraphBase::XmlHandler::XmlHandler() {}
57 GraphBase::XmlHandler::~XmlHandler() {}
59 QString GraphBase::XmlHandler::errorProtocol() {
63 bool GraphBase::XmlHandler::startDocument() {
64 MESSAGE( "====================startDocument " ) ;
65 // at the beginning of parsing: do some initialization
70 bool GraphBase::XmlHandler::endDocument() {
71 MESSAGE( "====================endDocument " ) ;
75 bool GraphBase::XmlHandler::startElement( const QString&, const QString&,
77 const QXmlAttributes& atts ) {
78 // do different actions depending on the name of the tag and the
82 MESSAGE( "====================startElement " << depth << " " << qName)
86 if ( ( qName == "dataflow" || qName == "supergraph" ) && depth == 0 ) {
88 aListOfDataFlows.resize( GraphsNumber + 1 ) ;
90 for ( i = 0 ; i < maxlevel ; i++ ) {
91 fieldname[i] = NULLSTRING ;
92 fieldvalue[i] = NULLSTRING ;
99 if ( qName == "supergraph" ) {
100 fieldname[depth] = qName.latin1() ;
103 fieldname[depth++] = qName.latin1() ;
106 if ( depth == maxlevel+1 )
112 static bool returnfalse( GraphBase::XmlHandler *myXmlHandler ,
114 const QString& qName ) {
115 MESSAGE( "returnfalse ERROR qName " << qName << " " << msg
116 << " fieldname " << myXmlHandler->getfieldname(myXmlHandler->getdepth())
118 << myXmlHandler->getfieldvalue(myXmlHandler->getdepth()) << "'" )
122 bool GraphBase::XmlHandler::endElement( const QString&,
124 const QString& qName) {
126 if ( qName == "supergraph" ) {
128 MESSAGE( " ====================endElement supergraph" ) ;
134 // * On a eu endElement(dataflow)
135 // * Ou bien on a eu uniquement startElement(dataflow) et qName != fieldname et fieldvalue != NULLSTRING
137 ( qName != QString( fieldname[depth].c_str() ) &&
138 fieldvalue[depth] != NULLSTRING ) ) {
139 MESSAGE( "endElement ERROR dataflowxml " << dataflowxml << " qName " << qName
140 << " fieldname[" << depth << "] "<< fieldname[depth] << " fieldvalue "
141 << fieldvalue[depth] )
142 return returnfalse( this , "top" , qName ) ;
144 if ( fieldvalue[depth] == NULLSTRING ) {
149 MESSAGE( " ====================endElement step[" << depth << "]="
150 << step[depth] << " qName " << qName << " fieldvalue '"
151 << fieldvalue[depth] << "'")
155 if ( step[depth] == 0 && qName == "dataflow" ) {
157 dataflowxml = false ;
160 return returnfalse( this , "depth0" , qName ) ;
165 switch ( step[depth] ) {
167 if ( qName == "info-list" ) {
168 // aListOfDataFlows[ GraphsNumber ].Info = aNode ;
172 return returnfalse( this , "depth1-0" , qName ) ;
175 if ( qName == "node-list" ) {
182 return returnfalse( this , "depth1-1" , qName ) ;
185 if ( qName == "link-list" ) {
189 return returnfalse( this , "depth1-2" , qName ) ;
192 if ( qName == "data-list" ) {
196 return returnfalse( this , "depth1-3" , qName ) ;
199 return returnfalse( this , "depth1-d" , qName ) ;
206 switch ( step[depth] ) {
208 if ( qName == "node" ) {
210 if ( step[1] == 0 ) {
211 aListOfDataFlows[ GraphsNumber ].Info = aNode ;
213 else if ( step[1] == 1 ) {
214 int sizenode = aListOfDataFlows[ GraphsNumber ].Nodes.size() ;
215 aListOfDataFlows[ GraphsNumber ].Nodes.resize( sizenode+1 ) ;
216 aListOfDataFlows[ GraphsNumber ].Nodes[ sizenode ] = aNode ;
219 aNode.theService.ServiceinParameter.length( 0 ) ;
220 aNode.theService.ServiceoutParameter.length( 0 ) ;
221 aNode.theListOfInDataStreams.resize( 0 ) ;
222 aNode.theListOfOutDataStreams.resize( 0 ) ;
223 aNode.theListOfFuncName.resize( 0 ) ;
224 aNode.theListOfPythonFunctions.resize( 0 ) ;
227 else if ( qName == "link" || qName == "data" ) {
231 return returnfalse( this , "depth2-0" , qName ) ;
235 if ( qName == "link" ) {
236 int sizelink = aListOfDataFlows[ GraphsNumber ].Links.size() ;
237 aListOfDataFlows[ GraphsNumber ].Links.resize( sizelink+1 ) ;
238 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ] = aLink ;
240 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords.resize( VXSize ) ;
242 for ( ic = 0 ; ic < VXSize ; ic++ ) {
243 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theX = VX[ic] ;
244 aListOfDataFlows[ GraphsNumber ].Links[ sizelink ].aListOfCoords[ ic ].theY = VY[ic] ;
251 else if ( qName == "data" ) {
255 return returnfalse( this , "depth2-1" , qName ) ;
259 if ( qName == "data" ) {
262 int sizedata = aListOfDataFlows[ GraphsNumber ].Datas.size() ;
263 aListOfDataFlows[ GraphsNumber ].Datas.resize( sizedata+1 ) ;
265 if ( aLink.aLinkValue.type()->kind() == CORBA::tk_double ) // mkr : PAL12235
266 aLink.aLinkValue = *aLinkDoubleValue ;
268 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ] = aLink ;
271 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
273 for ( ic = 0 ; ic < VXSize ; ic++ ) {
274 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theX = VX[ic] ;
275 aListOfDataFlows[ GraphsNumber ].Datas[ sizedata ].aListOfCoords[ ic ].theY = VY[ic] ;
283 return returnfalse( this , "depth2-2" , qName ) ;
286 return returnfalse( this , "depth2-d" , qName ) ;
293 switch ( step[depth] ) {
295 if ( qName == "component-name" ) {
296 if ( fieldvalue[depth] == NULLSTRING )
297 return returnfalse( this , "depth3-0" , qName ) ;
298 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
299 aNode.theComponentName = fieldvalue[depth].c_str() ;
301 aNode.theComponentName = "" ;
302 fieldvalue[depth] = NULLSTRING ;
306 return returnfalse( this , "depth3-0" , qName ) ;
309 if ( qName == "interface-name" ) {
310 if ( fieldvalue[depth] == NULLSTRING )
311 return returnfalse( this , "depth3-1" , qName ) ;
312 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
313 aNode.theInterfaceName = fieldvalue[depth].c_str() ;
315 aNode.theInterfaceName = "" ;
316 fieldvalue[depth] = NULLSTRING ;
320 return returnfalse( this , "depth3-1" , qName ) ;
323 if ( qName == "node-name" ) {
324 if ( fieldvalue[depth] == NULLSTRING )
325 return returnfalse( this , "depth3-2" , qName ) ;
326 aNode.theName = fieldvalue[depth].c_str() ;
327 fieldvalue[depth] = NULLSTRING ;
331 return returnfalse( this , "depth3-2" , qName ) ;
334 if ( qName == "kind" ) {
335 if ( fieldvalue[depth] == NULLSTRING )
336 return returnfalse( this , "depth3-3" , qName ) ;
338 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
339 fieldvalue[depth] = NULLSTRING ;
340 if ( aNode.theKind != SUPERV::DataStreamGraph ) {
346 else if ( qName == "streamgraph-timeout" ) {
347 if ( fieldvalue[depth] == NULLSTRING )
348 return returnfalse( this , "depth3-3" , qName ) ;
349 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theTimeout ) ;
350 fieldvalue[depth] = NULLSTRING ;
355 else if ( qName == "streamgraph-datastreamtrace" ) {
356 if ( fieldvalue[depth] == NULLSTRING )
357 return returnfalse( this , "depth3-3" , qName ) ;
358 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theDataStreamTrace ) ;
359 fieldvalue[depth] = NULLSTRING ;
364 else if ( qName == "streamgraph-deltatime" ) {
365 if ( fieldvalue[depth] == NULLSTRING )
366 return returnfalse( this , "depth3-3" , qName ) ;
367 sscanf( fieldvalue[depth].c_str() ,"%lf" , (double * ) &aNode.theDeltaTime ) ;
368 fieldvalue[depth] = NULLSTRING ;
377 // return returnfalse( this , "depth3-3" , qName ) ;
380 if ( qName == "coupled-node" ) {
381 if ( fieldvalue[depth] == NULLSTRING )
382 return returnfalse( this , "depth3-4" , qName ) ;
383 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
384 aNode.theCoupledNode = fieldvalue[depth].c_str() ;
386 aNode.theCoupledNode = "" ;
387 fieldvalue[depth] = NULLSTRING ;
393 // return returnfalse( this , "depth3-4" , qName ) ;
396 if ( qName == "service" ) {
397 if ( fieldvalue[depth] != NULLSTRING )
398 return returnfalse( this , "depth3-5" , qName ) ;
399 fieldvalue[depth] = NULLSTRING ;
406 return returnfalse( this , "depth3-5" , qName ) ;
409 if ( qName == "DataStream-list" || qName == "Parameter-list" ) {
410 if ( fieldvalue[depth] != NULLSTRING )
411 return returnfalse( this , "depth3-6" , qName ) ;
412 fieldvalue[depth] = NULLSTRING ;
424 // return returnfalse( this , "depth3-6" , qName ) ;
427 if ( qName == "PyFunction-list" ) {
428 if ( fieldvalue[depth] != NULLSTRING )
429 return returnfalse( this , "depth3-7" , qName ) ;
430 fieldvalue[depth] = NULLSTRING ;
441 // NO PyFunction-list
442 // return returnfalse( this , "depth3-7" , qName ) ;
445 if ( qName == "creation-date" ) {
448 strcpy( Date , fieldvalue[depth].c_str() ) ;
450 for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
451 if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
454 // MESSAGE( "Date(" << Date << ")" );
455 int Day , Month , Year , Hour , Minute , Second ;
456 sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
468 aNode.theFirstCreation = D ;
469 fieldvalue[depth] = NULLSTRING ;
473 return returnfalse( this , "depth3-8" , qName ) ;
476 if ( qName == "lastmodification-date" ) {
479 strcpy( Date , fieldvalue[depth].c_str() ) ;
481 for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
482 if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
485 // MESSAGE( "Date(" << Date << ")" );
486 int Day , Month , Year , Hour , Minute , Second ;
487 sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
499 aNode.theLastModification = D ;
500 fieldvalue[depth] = NULLSTRING ;
504 return returnfalse( this , "depth3-9" , qName ) ;
507 if ( qName == "editor-release" ) {
508 aNode.theEditorRelease = fieldvalue[depth].c_str() ;
509 fieldvalue[depth] = NULLSTRING ;
513 return returnfalse( this , "depth3-10" , qName ) ;
516 if ( qName == "author" ) {
517 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
518 aNode.theAuthor = fieldvalue[depth].c_str() ;
520 aNode.theAuthor = "" ;
521 fieldvalue[depth] = NULLSTRING ;
525 return returnfalse( this , "depth3-11" , qName ) ;
528 if ( qName == "container" ) {
529 if ( fieldvalue[depth] == NULLSTRING )
530 return returnfalse( this , "depth3-12" , qName ) ;
532 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
533 aNode.theContainer = fieldvalue[depth].c_str() ;
535 aNode.theContainer = "" ;
536 fieldvalue[depth] = NULLSTRING ;
540 return returnfalse( this , "depth3-12" , qName ) ;
543 if ( qName == "comment" ) {
544 if ( fieldvalue[depth] == NULLSTRING )
545 return returnfalse( this , "depth3-13" , qName ) ;
547 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
548 aNode.theComment = fieldvalue[depth].c_str() ;
550 aNode.theComment = "" ;
551 fieldvalue[depth] = NULLSTRING ;
555 return returnfalse( this , "depth3-13" , qName ) ;
558 if ( qName == "x-position" ) {
559 if ( fieldvalue[depth] == NULLSTRING )
560 return returnfalse( this , "depth3-14" , qName ) ;
561 sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theX ) ;
562 fieldvalue[depth] = NULLSTRING ;
567 return returnfalse( this , "depth3-14" , qName ) ;
570 if ( qName == "y-position" ) {
571 if ( fieldvalue[depth] == NULLSTRING )
572 return returnfalse( this , "depth3-15" , qName ) ;
573 sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theY ) ;
574 fieldvalue[depth] = NULLSTRING ;
579 return returnfalse( this , "depth3-15" , qName ) ;
582 if ( qName == "fromnode-name" ) {
583 if ( fieldvalue[depth] == NULLSTRING )
584 return returnfalse( this , "depth3-16" , qName ) ;
585 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
586 aLink.FromNodeName = fieldvalue[depth].c_str() ;
588 aLink.FromNodeName = "" ;
589 fieldvalue[depth] = NULLSTRING ;
594 return returnfalse( this , "depth3-16" , qName ) ;
597 if ( qName == "fromserviceparameter-name" ) {
598 if ( fieldvalue[depth] == NULLSTRING )
599 return returnfalse( this , "depth3-17" , qName ) ;
600 aLink.FromServiceParameterName = fieldvalue[depth].c_str() ;
601 fieldvalue[depth] = NULLSTRING ;
605 return returnfalse( this , "depth3-17" , qName ) ;
608 if ( qName == "tonode-name" ) {
609 if ( fieldvalue[depth] == NULLSTRING )
610 return returnfalse( this , "depth3-18" , qName ) ;
611 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
612 aLink.ToNodeName = fieldvalue[depth].c_str() ;
614 aLink.ToNodeName = "" ;
615 fieldvalue[depth] = NULLSTRING ;
619 return returnfalse( this , "depth3-18" , qName ) ;
622 if ( qName == "toserviceparameter-name" ) {
623 if ( fieldvalue[depth] == NULLSTRING )
624 return returnfalse( this , "depth3-19" , qName ) ;
625 aLink.ToServiceParameterName = fieldvalue[depth].c_str() ;
626 fieldvalue[depth] = NULLSTRING ;
630 return returnfalse( this , "depth3-19" , qName ) ;
634 if ( qName == "data-value" ) {
635 if ( fieldvalue[depth] != NULLSTRING )
636 return returnfalse( this , "depth3-20" , qName ) ;
644 // return returnfalse( this , "depth3-20" , qName ) ;
647 if ( qName == "coord-list" ) {
648 if ( fieldvalue[depth] != NULLSTRING )
649 return returnfalse( this , "depth3-21" , qName ) ;
655 return returnfalse( this , "depth3-21" , qName ) ;
658 return returnfalse( this , "depth3-d" , qName ) ;
666 switch ( step[depth] ) {
668 if ( qName == "service-name" ) {
669 if ( fieldvalue[depth] == NULLSTRING )
670 return returnfalse( this , "depth4-0" , qName ) ;
671 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
672 aNode.theService.ServiceName = fieldvalue[depth].c_str() ;
674 aNode.theService.ServiceName = "" ;
675 aNode.theService.ServiceinParameter.length( 0 ) ;
676 aNode.theService.ServiceoutParameter.length( 0 ) ;
677 fieldvalue[depth] = NULLSTRING ;
681 return returnfalse( this , "depth4-0" , qName ) ;
684 if ( qName == "inParameter-list" ) {
685 if ( fieldvalue[depth] != NULLSTRING )
686 return returnfalse( this , "depth4-1" , qName ) ;
687 fieldvalue[depth] = NULLSTRING ;
690 step[6] = 2 ; // First outParameter
691 // inParameterlist ok
694 return returnfalse( this , "depth4-1" , qName ) ;
697 if ( qName == "outParameter-list" ) {
698 if ( fieldvalue[depth] != NULLSTRING )
699 return returnfalse( this , "depth4-2" , qName ) ;
700 fieldvalue[depth] = NULLSTRING ;
702 // outParameterlist ok
707 return returnfalse( this , "depth4-2" , qName ) ;
710 if ( qName == "value-type" ) {
711 if ( fieldvalue[depth] == NULLSTRING )
712 return returnfalse( this , "depth4-3" , qName ) ;
714 sscanf( fieldvalue[depth].c_str() , "%d" , &Kind ) ;
715 // switch ( D.Value.type()->kind() ) {
716 aLink.aLinkValue = CORBA::Any() ;
718 case CORBA::tk_string: {
719 //Mandrake 10.1/Salome 3 aLink.aLinkValue <<= (char *) NULL ;
720 aLink.aLinkValue <<= (char *) "" ;
722 aLink.aLinkValue >>= t;
724 MESSAGE( t << " (string)" );
728 case CORBA::tk_double: {
729 //aLink.aLinkValue <<= (double ) 0. ;
731 aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
732 aLink.aLinkValue >>= d;
734 MESSAGE( d << " (double)" );
738 case CORBA::tk_long: {
739 aLink.aLinkValue <<= (long ) 0 ;
741 aLink.aLinkValue >>= l;
743 MESSAGE( l << " (long)" );
747 case CORBA::tk_objref: {
748 // aLink.aLinkValue.replace(CORBA::_tc_Object, NULL);
749 aLink.aLinkValue <<= CORBA::Object::_nil() ;
751 MESSAGE( " (object reference)" );
756 MESSAGE( "(other ERROR)" );
758 fieldvalue[depth] = NULLSTRING ;
764 // return returnfalse( this , "depth4-3" , qName ) ;
767 if ( qName == "value" ) {
768 if ( fieldvalue[depth] == NULLSTRING )
769 return returnfalse( this , "depth4-4" , qName ) ;
770 if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
771 aLink.aLinkValue <<= "" ;
774 switch ( aLink.aLinkValue.type()->kind() ) {
775 case CORBA::tk_string: {
776 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
778 aLink.aLinkValue >>= t;
780 MESSAGE( t << " (string)" );
784 case CORBA::tk_double: {
786 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
787 //aLink.aLinkValue <<= d;
788 aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
789 aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
790 aLinkDoubleValue = new CORBA::Any( aLinkValue );
792 MESSAGE( d << " (double)" );
796 case CORBA::tk_long: {
798 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
799 aLink.aLinkValue <<= l;
801 MESSAGE( l << " (long)" );
805 case CORBA::tk_objref: {
806 CORBA::Object_ptr ObjRef ;
807 const char * IORObjRef = fieldvalue[depth].c_str() ;
808 ObjRef = _Orb->string_to_object( IORObjRef ) ;
809 aLink.aLinkValue <<= ObjRef;
811 MESSAGE( IORObjRef << "(object reference)" );
816 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
817 MESSAGE( "(other ERROR)" );
821 fieldvalue[depth] = NULLSTRING ;
828 // return returnfalse( this , "depth4-4" , qName ) ;
831 if ( qName == "coord" ) {
832 if ( fieldvalue[depth] != NULLSTRING )
833 return returnfalse( this , "depth4-5" , qName ) ;
834 if ( VXSize == (int ) VX.size() ) {
835 VX.resize( VX.size() + 10 ) ;
836 VY.resize( VY.size() + 10 ) ;
844 return returnfalse( this , "depth4-5" , qName ) ;
847 if ( qName == "inParameter" ) {
848 if ( fieldvalue[depth] != NULLSTRING )
849 return returnfalse( this , "depth4-6" , qName ) ;
850 int size = aNode.theListOfInDataStreams.size() ;
851 aNode.theListOfInDataStreams.resize( size+1 ) ;
852 aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
854 // One more aParameter input
858 // return returnfalse( this , "depth4-6" , qName ) ;
861 if ( qName == "outParameter" ) {
862 if ( fieldvalue[depth] != NULLSTRING )
863 return returnfalse( this , "depth4-7" , qName ) ;
864 int size = aNode.theListOfOutDataStreams.size() ;
865 aNode.theListOfOutDataStreams.resize( size+1 ) ;
866 aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
867 // One more aParameter output
872 return returnfalse( this , "depth4-7" , qName ) ;
875 if ( qName == "PyFunction" ) {
876 if ( fieldvalue[depth] != NULLSTRING )
877 return returnfalse( this , "depth4-8" , qName ) ;
878 // One more PyFunction
883 return returnfalse( this , "depth4-8" , qName ) ;
886 return returnfalse( this , "depth4-d" , qName ) ;
894 switch ( step[depth] ) {
896 if ( qName == "inParameter" ) {
897 if ( fieldvalue[depth] != NULLSTRING )
898 return returnfalse( this , "depth5-0" , qName ) ;
899 fieldvalue[depth] = NULLSTRING ;
900 int size = aNode.theService.ServiceinParameter.length() ;
901 aNode.theService.ServiceinParameter.length( size+1 ) ;
902 aNode.theService.ServiceinParameter[size] = aParameter ;
903 // One more aParameter input
904 step[6] = 0 ; // Next one
907 return returnfalse( this , "depth5-0" , qName ) ;
910 if ( qName == "outParameter" ) {
911 if ( fieldvalue[depth] != NULLSTRING )
912 return returnfalse( this , "depth5-1" , qName ) ;
913 fieldvalue[depth] = NULLSTRING ;
914 int size = aNode.theService.ServiceoutParameter.length() ;
915 aNode.theService.ServiceoutParameter.length( size+1 ) ;
916 aNode.theService.ServiceoutParameter[size] = aParameter ;
917 // One more aParameter Output
918 step[6] = 2 ; // Next one
921 return returnfalse( this , "depth5-1" , qName ) ;
924 if ( qName == "x" ) {
925 if ( fieldvalue[depth] == NULLSTRING )
926 return returnfalse( this , "depth5-2" , qName ) ;
927 sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
928 fieldvalue[depth] = NULLSTRING ;
932 return returnfalse( this , "depth5-2" , qName ) ;
935 if ( qName == "y" ) {
936 if ( fieldvalue[depth] == NULLSTRING )
937 return returnfalse( this , "depth5-3" , qName ) ;
938 sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
939 fieldvalue[depth] = NULLSTRING ;
942 return returnfalse( this , "depth5-3" , qName ) ;
945 if ( qName == "inParameter-type" ) {
946 if ( fieldvalue[depth] == NULLSTRING )
947 return returnfalse( this , "depth5-4" , qName ) ;
948 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
949 fieldvalue[depth] = NULLSTRING ;
952 //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
958 // return returnfalse( this , "depth5-4" , qName ) ;
961 if ( qName == "inParameter-name" ) {
962 if ( fieldvalue[depth] == NULLSTRING )
963 return returnfalse( this , "depth5-5" , qName ) ;
964 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
965 anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
968 anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
970 fieldvalue[depth] = NULLSTRING ;
972 //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
978 else if ( qName == "inParameter-dependency" ) {
979 if ( fieldvalue[depth] == NULLSTRING )
980 return returnfalse( this , "depth5-5" , qName ) ;
981 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
982 fieldvalue[depth] = NULLSTRING ;
984 //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
985 // << step[depth] << endl ;
991 else if ( qName == "inParameter-schema" ) {
992 if ( fieldvalue[depth] == NULLSTRING )
993 return returnfalse( this , "depth5-5" , qName ) ;
994 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
995 fieldvalue[depth] = NULLSTRING ;
997 //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
998 // << step[depth] << endl ;
1001 // step[depth] = 4 ;
1004 else if ( qName == "inParameter-interpolation" ) {
1005 if ( fieldvalue[depth] == NULLSTRING )
1006 return returnfalse( this , "depth5-5" , qName ) ;
1007 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
1008 fieldvalue[depth] = NULLSTRING ;
1010 //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
1011 // << step[depth] << endl ;
1014 // step[depth] = 4 ;
1017 else if ( qName == "inParameter-extrapolation" ) {
1018 if ( fieldvalue[depth] == NULLSTRING )
1019 return returnfalse( this , "depth5-5" , qName ) ;
1020 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
1021 fieldvalue[depth] = NULLSTRING ;
1025 //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
1026 // << step[depth] << endl ;
1031 // return returnfalse( this , "depth5-5" , qName ) ;
1034 if ( qName == "outParameter-type" ) {
1035 if ( fieldvalue[depth] == NULLSTRING )
1036 return returnfalse( this , "depth5-6" , qName ) ;
1037 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
1038 fieldvalue[depth] = NULLSTRING ;
1042 //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
1043 // << step[depth] << endl ;
1047 return returnfalse( this , "depth5-6" , qName ) ;
1050 if ( qName == "outParameter-name" ) {
1051 if ( fieldvalue[depth] == NULLSTRING )
1052 return returnfalse( this , "depth5-7" , qName ) ;
1053 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1054 anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
1057 anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
1059 fieldvalue[depth] = NULLSTRING ;
1061 //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
1062 // << step[depth] << endl ;
1065 // step[depth] = 6 ;
1067 else if ( qName == "outParameter-dependency" ) {
1068 if ( fieldvalue[depth] == NULLSTRING )
1069 return returnfalse( this , "depth5-7" , qName ) ;
1070 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
1071 fieldvalue[depth] = NULLSTRING ;
1073 //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
1074 // << step[depth] << endl ;
1077 // step[depth] = 6 ;
1079 else if ( qName == "outParameter-values" ) {
1080 if ( fieldvalue[depth] == NULLSTRING )
1081 return returnfalse( this , "depth5-7" , qName ) ;
1082 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
1083 fieldvalue[depth] = NULLSTRING ;
1087 //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
1088 // << step[depth] << endl ;
1092 return returnfalse( this , "depth5-7" , qName ) ;
1095 if ( qName == "FuncName" ) {
1096 if ( fieldvalue[depth] == NULLSTRING )
1097 return returnfalse( this , "depth5-8" , qName ) ;
1098 int l = aNode.theListOfFuncName.size() ;
1099 aNode.theListOfFuncName.resize( l+1 ) ;
1100 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1101 aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
1104 aNode.theListOfFuncName[ l ] = "" ;
1106 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1107 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
1109 MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
1112 fieldvalue[depth] = NULLSTRING ;
1116 return returnfalse( this , "depth5-8" , qName ) ;
1119 if ( qName == "PyFunc" ) {
1120 if ( fieldvalue[depth] == NULLSTRING )
1121 return returnfalse( this , "depth5-9" , qName ) ;
1122 int l = aNode.theListOfPythonFunctions.size() - 1 ;
1123 SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
1124 int ll = aPythonFunction.length() ;
1125 aPythonFunction.length( ll+1 ) ;
1126 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1127 aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
1130 aPythonFunction[ ll ] = NULLSTRING ;
1133 aNode.theListOfPythonFunctions.resize( l ) ;
1134 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1136 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
1138 MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
1139 << " [" << ll << "] = " << aPythonFunction[ ll ] )
1141 fieldvalue[depth] = NULLSTRING ;
1145 return returnfalse( this , "depth5-9" , qName ) ;
1148 return returnfalse( this , "depth5-d" , qName ) ;
1155 switch ( step[depth] ) {
1157 if ( qName == "inParameter-type" ) {
1158 if ( fieldvalue[depth] == NULLSTRING )
1159 return returnfalse( this , "depth6-0" , qName ) ;
1160 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1161 fieldvalue[depth] = NULLSTRING ;
1165 return returnfalse( this , "depth6-0" , qName ) ;
1168 if ( qName == "inParameter-name" ) {
1169 if ( fieldvalue[depth] == NULLSTRING )
1170 return returnfalse( this , "depth6-1" , qName ) ;
1171 aParameter.Parametername = fieldvalue[depth].c_str() ;
1172 fieldvalue[depth] = NULLSTRING ;
1176 return returnfalse( this , "depth6-1" , qName ) ;
1179 if ( qName == "outParameter-type" ) {
1180 if ( fieldvalue[depth] == NULLSTRING )
1181 return returnfalse( this , "depth6-2" , qName ) ;
1182 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1183 fieldvalue[depth] = NULLSTRING ;
1187 return returnfalse( this , "depth6-2" , qName ) ;
1190 if ( qName == "outParameter-name" ) {
1191 if ( fieldvalue[depth] == NULLSTRING )
1192 return returnfalse( this , "depth6-3" , qName ) ;
1193 aParameter.Parametername = fieldvalue[depth].c_str() ;
1194 fieldvalue[depth] = NULLSTRING ;
1198 return returnfalse( this , "depth6-3" , qName ) ;
1201 return returnfalse( this , "depth6-d" , qName ) ;
1209 //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
1215 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1216 // we are not interested in whitespaces
1217 QString ch_simplified = ch.simplifyWhiteSpace();
1218 if ( ch_simplified.isEmpty() ) {
1223 MESSAGE( "characters step[" << depth << "]=" << step[depth]
1224 << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
1226 if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1227 return returnfalse( this , "characters " , ch ) ;
1229 // fieldvalue[depth] = (const char * ) ch ;
1230 fieldvalue[depth] = ch.latin1() ;
1235 QString GraphBase::XmlHandler::errorString() {
1236 //cout << "the document is not in the quote file format" << endl ;
1237 return "the document is not in the quote file format";
1241 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1242 errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1243 .arg( exception.message() )
1244 .arg( exception.lineNumber() )
1245 .arg( exception.columnNumber() );
1246 //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1247 return QXmlDefaultHandler::fatalError( exception );
1251 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1253 SALOME_SuperVision::Date aDate;
1254 QString qstrDate(myStrDate);
1258 int iPos = qstrDate.find("/");
1259 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1260 aDate.Day = qstrTemp.toShort();
1261 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1262 iPos = qstrDate.find("/");
1263 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1264 aDate.Month = qstrTemp.toShort();
1265 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1266 iPos = qstrDate.find(" ");
1267 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1268 aDate.Year = qstrTemp.toShort();
1271 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1272 iPos = qstrDate.find(":");
1273 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1274 aDate.Hour = qstrTemp.toShort();
1275 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1276 iPos = qstrDate.find(":");
1277 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1278 aDate.Minute = qstrTemp.toShort();
1279 qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1280 aDate.Second = qstrDate.toShort();