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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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: {
730 #ifdef REDHAT // mkr : debug for PAL12255
731 aLink.aLinkValue <<= (double ) 0. ;
733 aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
735 aLink.aLinkValue >>= d;
737 MESSAGE( d << " (double)" );
741 case CORBA::tk_long: {
742 aLink.aLinkValue <<= (long ) 0 ;
744 aLink.aLinkValue >>= l;
746 MESSAGE( l << " (long)" );
750 case CORBA::tk_objref: {
751 // aLink.aLinkValue.replace(CORBA::_tc_Object, NULL);
752 aLink.aLinkValue <<= CORBA::Object::_nil() ;
754 MESSAGE( " (object reference)" );
759 MESSAGE( "(other ERROR)" );
761 fieldvalue[depth] = NULLSTRING ;
767 // return returnfalse( this , "depth4-3" , qName ) ;
770 if ( qName == "value" ) {
771 if ( fieldvalue[depth] == NULLSTRING )
772 return returnfalse( this , "depth4-4" , qName ) ;
773 if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
774 aLink.aLinkValue <<= "" ;
777 switch ( aLink.aLinkValue.type()->kind() ) {
778 case CORBA::tk_string: {
779 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
781 aLink.aLinkValue >>= t;
783 MESSAGE( t << " (string)" );
787 case CORBA::tk_double: {
789 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
790 #ifdef REDHAT // mkr : debug for PAL12255
791 aLink.aLinkValue <<= d;
794 aLink.aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
795 aLinkValue.replace(CORBA::TypeCode::PR_double_tc(), (void*)(&d));
797 aLinkDoubleValue = new CORBA::Any( aLinkValue );
799 MESSAGE( d << " (double)" );
803 case CORBA::tk_long: {
805 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
806 aLink.aLinkValue <<= l;
808 MESSAGE( l << " (long)" );
812 case CORBA::tk_objref: {
813 CORBA::Object_ptr ObjRef ;
814 const char * IORObjRef = fieldvalue[depth].c_str() ;
815 ObjRef = _Orb->string_to_object( IORObjRef ) ;
816 aLink.aLinkValue <<= ObjRef;
818 MESSAGE( IORObjRef << "(object reference)" );
823 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
824 MESSAGE( "(other ERROR)" );
828 fieldvalue[depth] = NULLSTRING ;
835 // return returnfalse( this , "depth4-4" , qName ) ;
838 if ( qName == "coord" ) {
839 if ( fieldvalue[depth] != NULLSTRING )
840 return returnfalse( this , "depth4-5" , qName ) ;
841 if ( VXSize == (int ) VX.size() ) {
842 VX.resize( VX.size() + 10 ) ;
843 VY.resize( VY.size() + 10 ) ;
851 return returnfalse( this , "depth4-5" , qName ) ;
854 if ( qName == "inParameter" ) {
855 if ( fieldvalue[depth] != NULLSTRING )
856 return returnfalse( this , "depth4-6" , qName ) ;
857 int size = aNode.theListOfInDataStreams.size() ;
858 aNode.theListOfInDataStreams.resize( size+1 ) ;
859 aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
861 // One more aParameter input
865 // return returnfalse( this , "depth4-6" , qName ) ;
868 if ( qName == "outParameter" ) {
869 if ( fieldvalue[depth] != NULLSTRING )
870 return returnfalse( this , "depth4-7" , qName ) ;
871 int size = aNode.theListOfOutDataStreams.size() ;
872 aNode.theListOfOutDataStreams.resize( size+1 ) ;
873 aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
874 // One more aParameter output
879 return returnfalse( this , "depth4-7" , qName ) ;
882 if ( qName == "PyFunction" ) {
883 if ( fieldvalue[depth] != NULLSTRING )
884 return returnfalse( this , "depth4-8" , qName ) ;
885 // One more PyFunction
890 return returnfalse( this , "depth4-8" , qName ) ;
893 return returnfalse( this , "depth4-d" , qName ) ;
901 switch ( step[depth] ) {
903 if ( qName == "inParameter" ) {
904 if ( fieldvalue[depth] != NULLSTRING )
905 return returnfalse( this , "depth5-0" , qName ) ;
906 fieldvalue[depth] = NULLSTRING ;
907 int size = aNode.theService.ServiceinParameter.length() ;
908 aNode.theService.ServiceinParameter.length( size+1 ) ;
909 aNode.theService.ServiceinParameter[size] = aParameter ;
910 // One more aParameter input
911 step[6] = 0 ; // Next one
914 return returnfalse( this , "depth5-0" , qName ) ;
917 if ( qName == "outParameter" ) {
918 if ( fieldvalue[depth] != NULLSTRING )
919 return returnfalse( this , "depth5-1" , qName ) ;
920 fieldvalue[depth] = NULLSTRING ;
921 int size = aNode.theService.ServiceoutParameter.length() ;
922 aNode.theService.ServiceoutParameter.length( size+1 ) ;
923 aNode.theService.ServiceoutParameter[size] = aParameter ;
924 // One more aParameter Output
925 step[6] = 2 ; // Next one
928 return returnfalse( this , "depth5-1" , qName ) ;
931 if ( qName == "x" ) {
932 if ( fieldvalue[depth] == NULLSTRING )
933 return returnfalse( this , "depth5-2" , qName ) ;
934 sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
935 fieldvalue[depth] = NULLSTRING ;
939 return returnfalse( this , "depth5-2" , qName ) ;
942 if ( qName == "y" ) {
943 if ( fieldvalue[depth] == NULLSTRING )
944 return returnfalse( this , "depth5-3" , qName ) ;
945 sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
946 fieldvalue[depth] = NULLSTRING ;
949 return returnfalse( this , "depth5-3" , qName ) ;
952 if ( qName == "inParameter-type" ) {
953 if ( fieldvalue[depth] == NULLSTRING )
954 return returnfalse( this , "depth5-4" , qName ) ;
955 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
956 fieldvalue[depth] = NULLSTRING ;
959 //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
965 // return returnfalse( this , "depth5-4" , qName ) ;
968 if ( qName == "inParameter-name" ) {
969 if ( fieldvalue[depth] == NULLSTRING )
970 return returnfalse( this , "depth5-5" , qName ) ;
971 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
972 anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
975 anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
977 fieldvalue[depth] = NULLSTRING ;
979 //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
985 else if ( qName == "inParameter-dependency" ) {
986 if ( fieldvalue[depth] == NULLSTRING )
987 return returnfalse( this , "depth5-5" , qName ) ;
988 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
989 fieldvalue[depth] = NULLSTRING ;
991 //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
992 // << step[depth] << endl ;
998 else if ( qName == "inParameter-schema" ) {
999 if ( fieldvalue[depth] == NULLSTRING )
1000 return returnfalse( this , "depth5-5" , qName ) ;
1001 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
1002 fieldvalue[depth] = NULLSTRING ;
1004 //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
1005 // << step[depth] << endl ;
1008 // step[depth] = 4 ;
1011 else if ( qName == "inParameter-interpolation" ) {
1012 if ( fieldvalue[depth] == NULLSTRING )
1013 return returnfalse( this , "depth5-5" , qName ) ;
1014 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
1015 fieldvalue[depth] = NULLSTRING ;
1017 //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
1018 // << step[depth] << endl ;
1021 // step[depth] = 4 ;
1024 else if ( qName == "inParameter-extrapolation" ) {
1025 if ( fieldvalue[depth] == NULLSTRING )
1026 return returnfalse( this , "depth5-5" , qName ) ;
1027 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
1028 fieldvalue[depth] = NULLSTRING ;
1032 //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
1033 // << step[depth] << endl ;
1038 // return returnfalse( this , "depth5-5" , qName ) ;
1041 if ( qName == "outParameter-type" ) {
1042 if ( fieldvalue[depth] == NULLSTRING )
1043 return returnfalse( this , "depth5-6" , qName ) ;
1044 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
1045 fieldvalue[depth] = NULLSTRING ;
1049 //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
1050 // << step[depth] << endl ;
1054 return returnfalse( this , "depth5-6" , qName ) ;
1057 if ( qName == "outParameter-name" ) {
1058 if ( fieldvalue[depth] == NULLSTRING )
1059 return returnfalse( this , "depth5-7" , qName ) ;
1060 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1061 anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
1064 anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
1066 fieldvalue[depth] = NULLSTRING ;
1068 //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
1069 // << step[depth] << endl ;
1072 // step[depth] = 6 ;
1074 else if ( qName == "outParameter-dependency" ) {
1075 if ( fieldvalue[depth] == NULLSTRING )
1076 return returnfalse( this , "depth5-7" , qName ) ;
1077 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
1078 fieldvalue[depth] = NULLSTRING ;
1080 //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
1081 // << step[depth] << endl ;
1084 // step[depth] = 6 ;
1086 else if ( qName == "outParameter-values" ) {
1087 if ( fieldvalue[depth] == NULLSTRING )
1088 return returnfalse( this , "depth5-7" , qName ) ;
1089 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
1090 fieldvalue[depth] = NULLSTRING ;
1094 //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
1095 // << step[depth] << endl ;
1099 return returnfalse( this , "depth5-7" , qName ) ;
1102 if ( qName == "FuncName" ) {
1103 if ( fieldvalue[depth] == NULLSTRING )
1104 return returnfalse( this , "depth5-8" , qName ) ;
1105 int l = aNode.theListOfFuncName.size() ;
1106 aNode.theListOfFuncName.resize( l+1 ) ;
1107 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1108 aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
1111 aNode.theListOfFuncName[ l ] = "" ;
1113 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1114 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
1116 MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
1119 fieldvalue[depth] = NULLSTRING ;
1123 return returnfalse( this , "depth5-8" , qName ) ;
1126 if ( qName == "PyFunc" ) {
1127 // mkr : commented for PAL12309 (the function body can contains spaces, tabs, etc.)
1128 //if ( fieldvalue[depth] == NULLSTRING )
1129 // return returnfalse( this , "depth5-9" , qName ) ;
1130 int l = aNode.theListOfPythonFunctions.size() - 1 ;
1131 SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
1132 int ll = aPythonFunction.length() ;
1133 aPythonFunction.length( ll+1 ) ;
1134 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1135 aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
1138 aPythonFunction[ ll ] = NULLSTRING ;
1141 aNode.theListOfPythonFunctions.resize( l ) ;
1142 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1144 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
1146 MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
1147 << " [" << ll << "] = " << aPythonFunction[ ll ] )
1149 fieldvalue[depth] = NULLSTRING ;
1153 return returnfalse( this , "depth5-9" , qName ) ;
1156 return returnfalse( this , "depth5-d" , qName ) ;
1163 switch ( step[depth] ) {
1165 if ( qName == "inParameter-type" ) {
1166 if ( fieldvalue[depth] == NULLSTRING )
1167 return returnfalse( this , "depth6-0" , qName ) ;
1168 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1169 fieldvalue[depth] = NULLSTRING ;
1173 return returnfalse( this , "depth6-0" , qName ) ;
1176 if ( qName == "inParameter-name" ) {
1177 if ( fieldvalue[depth] == NULLSTRING )
1178 return returnfalse( this , "depth6-1" , qName ) ;
1179 aParameter.Parametername = fieldvalue[depth].c_str() ;
1180 fieldvalue[depth] = NULLSTRING ;
1184 return returnfalse( this , "depth6-1" , qName ) ;
1187 if ( qName == "outParameter-type" ) {
1188 if ( fieldvalue[depth] == NULLSTRING )
1189 return returnfalse( this , "depth6-2" , qName ) ;
1190 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1191 fieldvalue[depth] = NULLSTRING ;
1195 return returnfalse( this , "depth6-2" , qName ) ;
1198 if ( qName == "outParameter-name" ) {
1199 if ( fieldvalue[depth] == NULLSTRING )
1200 return returnfalse( this , "depth6-3" , qName ) ;
1201 aParameter.Parametername = fieldvalue[depth].c_str() ;
1202 fieldvalue[depth] = NULLSTRING ;
1206 return returnfalse( this , "depth6-3" , qName ) ;
1209 return returnfalse( this , "depth6-d" , qName ) ;
1217 //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
1223 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1224 // we are not interested in whitespaces
1225 QString ch_simplified = ch.simplifyWhiteSpace();
1226 if ( ch_simplified.isEmpty() ) {
1231 MESSAGE( "characters step[" << depth << "]=" << step[depth]
1232 << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
1234 if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1235 return returnfalse( this , "characters " , ch ) ;
1237 // fieldvalue[depth] = (const char * ) ch ;
1238 fieldvalue[depth] = ch.latin1() ;
1243 QString GraphBase::XmlHandler::errorString() {
1244 //cout << "the document is not in the quote file format" << endl ;
1245 return "the document is not in the quote file format";
1249 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1250 errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1251 .arg( exception.message() )
1252 .arg( exception.lineNumber() )
1253 .arg( exception.columnNumber() );
1254 //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1255 return QXmlDefaultHandler::fatalError( exception );
1259 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1261 SALOME_SuperVision::Date aDate;
1262 QString qstrDate(myStrDate);
1266 int iPos = qstrDate.find("/");
1267 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1268 aDate.Day = qstrTemp.toShort();
1269 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1270 iPos = qstrDate.find("/");
1271 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1272 aDate.Month = qstrTemp.toShort();
1273 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1274 iPos = qstrDate.find(" ");
1275 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1276 aDate.Year = qstrTemp.toShort();
1279 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1280 iPos = qstrDate.find(":");
1281 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1282 aDate.Hour = qstrTemp.toShort();
1283 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1284 iPos = qstrDate.find(":");
1285 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1286 aDate.Minute = qstrTemp.toShort();
1287 qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1288 aDate.Second = qstrDate.toShort();