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" , (int * ) &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.Value = fieldvalue[depth].c_str() ;
763 aLink.aLinkValue = CORBA::Any() ; // ???
766 switch ( aLink.aLinkValue.type()->kind() ) {
767 case CORBA::tk_string: {
768 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
770 aLink.aLinkValue >>= t;
772 MESSAGE( t << " (string)" );
776 case CORBA::tk_double: {
778 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
779 aLink.aLinkValue <<= d;
781 MESSAGE( d << " (double)" );
785 case CORBA::tk_long: {
787 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
788 aLink.aLinkValue <<= l;
790 MESSAGE( l << " (long)" );
794 case CORBA::tk_objref: {
795 CORBA::Object_ptr ObjRef ;
796 const char * IORObjRef = fieldvalue[depth].c_str() ;
797 ObjRef = _Orb->string_to_object( IORObjRef ) ;
798 aLink.aLinkValue <<= ObjRef;
800 MESSAGE( IORObjRef << "(object reference)" );
805 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
806 MESSAGE( "(other ERROR)" );
810 fieldvalue[depth] = NULLSTRING ;
817 // return returnfalse( this , "depth4-4" , qName ) ;
820 if ( qName == "coord" ) {
821 if ( fieldvalue[depth] != NULLSTRING )
822 return returnfalse( this , "depth4-5" , qName ) ;
823 if ( VXSize == (int ) VX.size() ) {
824 VX.resize( VX.size() + 10 ) ;
825 VY.resize( VY.size() + 10 ) ;
833 return returnfalse( this , "depth4-5" , qName ) ;
836 if ( qName == "inParameter" ) {
837 if ( fieldvalue[depth] != NULLSTRING )
838 return returnfalse( this , "depth4-6" , qName ) ;
839 int size = aNode.theListOfInDataStreams.size() ;
840 aNode.theListOfInDataStreams.resize( size+1 ) ;
841 aNode.theListOfInDataStreams[ size ] = anInDataStreamParameter ;
843 // One more aParameter input
847 // return returnfalse( this , "depth4-6" , qName ) ;
850 if ( qName == "outParameter" ) {
851 if ( fieldvalue[depth] != NULLSTRING )
852 return returnfalse( this , "depth4-7" , qName ) ;
853 int size = aNode.theListOfOutDataStreams.size() ;
854 aNode.theListOfOutDataStreams.resize( size+1 ) ;
855 aNode.theListOfOutDataStreams[ size ] = anOutDataStreamParameter ;
856 // One more aParameter output
861 return returnfalse( this , "depth4-7" , qName ) ;
864 if ( qName == "PyFunction" ) {
865 if ( fieldvalue[depth] != NULLSTRING )
866 return returnfalse( this , "depth4-8" , qName ) ;
867 // One more PyFunction
872 return returnfalse( this , "depth4-8" , qName ) ;
875 return returnfalse( this , "depth4-d" , qName ) ;
883 switch ( step[depth] ) {
885 if ( qName == "inParameter" ) {
886 if ( fieldvalue[depth] != NULLSTRING )
887 return returnfalse( this , "depth5-0" , qName ) ;
888 fieldvalue[depth] = NULLSTRING ;
889 int size = aNode.theService.ServiceinParameter.length() ;
890 aNode.theService.ServiceinParameter.length( size+1 ) ;
891 aNode.theService.ServiceinParameter[size] = aParameter ;
892 // One more aParameter input
893 step[6] = 0 ; // Next one
896 return returnfalse( this , "depth5-0" , qName ) ;
899 if ( qName == "outParameter" ) {
900 if ( fieldvalue[depth] != NULLSTRING )
901 return returnfalse( this , "depth5-1" , qName ) ;
902 fieldvalue[depth] = NULLSTRING ;
903 int size = aNode.theService.ServiceoutParameter.length() ;
904 aNode.theService.ServiceoutParameter.length( size+1 ) ;
905 aNode.theService.ServiceoutParameter[size] = aParameter ;
906 // One more aParameter Output
907 step[6] = 2 ; // Next one
910 return returnfalse( this , "depth5-1" , qName ) ;
913 if ( qName == "x" ) {
914 if ( fieldvalue[depth] == NULLSTRING )
915 return returnfalse( this , "depth5-2" , qName ) ;
916 sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
917 fieldvalue[depth] = NULLSTRING ;
921 return returnfalse( this , "depth5-2" , qName ) ;
924 if ( qName == "y" ) {
925 if ( fieldvalue[depth] == NULLSTRING )
926 return returnfalse( this , "depth5-3" , qName ) ;
927 sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
928 fieldvalue[depth] = NULLSTRING ;
931 return returnfalse( this , "depth5-3" , qName ) ;
934 if ( qName == "inParameter-type" ) {
935 if ( fieldvalue[depth] == NULLSTRING )
936 return returnfalse( this , "depth5-4" , qName ) ;
937 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parametertype ) ;
938 fieldvalue[depth] = NULLSTRING ;
941 //cout << "InDataStreamParameter.inParameter-type " << anInDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]" << step[depth] << endl ;
947 // return returnfalse( this , "depth5-4" , qName ) ;
950 if ( qName == "inParameter-name" ) {
951 if ( fieldvalue[depth] == NULLSTRING )
952 return returnfalse( this , "depth5-5" , qName ) ;
953 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
954 anInDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
957 anInDataStreamParameter.theDataStreamParameter.Parametername = "" ;
959 fieldvalue[depth] = NULLSTRING ;
961 //cout << "InDataStreamParameter.inParameter-name " << anInDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]" << step[depth] << endl ;
967 else if ( qName == "inParameter-dependency" ) {
968 if ( fieldvalue[depth] == NULLSTRING )
969 return returnfalse( this , "depth5-5" , qName ) ;
970 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
971 fieldvalue[depth] = NULLSTRING ;
973 //cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
974 << step[depth] << endl ;
980 else if ( qName == "inParameter-schema" ) {
981 if ( fieldvalue[depth] == NULLSTRING )
982 return returnfalse( this , "depth5-5" , qName ) ;
983 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfSchema ) ;
984 fieldvalue[depth] = NULLSTRING ;
986 //cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
987 << step[depth] << endl ;
993 else if ( qName == "inParameter-interpolation" ) {
994 if ( fieldvalue[depth] == NULLSTRING )
995 return returnfalse( this , "depth5-5" , qName ) ;
996 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfInterpolation ) ;
997 fieldvalue[depth] = NULLSTRING ;
999 //cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
1000 << step[depth] << endl ;
1003 // step[depth] = 4 ;
1006 else if ( qName == "inParameter-extrapolation" ) {
1007 if ( fieldvalue[depth] == NULLSTRING )
1008 return returnfalse( this , "depth5-5" , qName ) ;
1009 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anInDataStreamParameter.theKindOfExtrapolation ) ;
1010 fieldvalue[depth] = NULLSTRING ;
1014 //cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
1015 << step[depth] << endl ;
1020 // return returnfalse( this , "depth5-5" , qName ) ;
1023 if ( qName == "outParameter-type" ) {
1024 if ( fieldvalue[depth] == NULLSTRING )
1025 return returnfalse( this , "depth5-6" , qName ) ;
1026 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parametertype ) ;
1027 fieldvalue[depth] = NULLSTRING ;
1031 //cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
1032 << step[depth] << endl ;
1036 return returnfalse( this , "depth5-6" , qName ) ;
1039 if ( qName == "outParameter-name" ) {
1040 if ( fieldvalue[depth] == NULLSTRING )
1041 return returnfalse( this , "depth5-7" , qName ) ;
1042 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1043 anOutDataStreamParameter.theDataStreamParameter.Parametername = fieldvalue[depth].c_str() ;
1046 anOutDataStreamParameter.theDataStreamParameter.Parametername = "" ;
1048 fieldvalue[depth] = NULLSTRING ;
1050 //cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
1051 << step[depth] << endl ;
1054 // step[depth] = 6 ;
1056 else if ( qName == "outParameter-dependency" ) {
1057 if ( fieldvalue[depth] == NULLSTRING )
1058 return returnfalse( this , "depth5-7" , qName ) ;
1059 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theDataStreamParameter.Parameterdependency ) ;
1060 fieldvalue[depth] = NULLSTRING ;
1062 //cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
1063 << step[depth] << endl ;
1066 // step[depth] = 6 ;
1068 else if ( qName == "outParameter-values" ) {
1069 if ( fieldvalue[depth] == NULLSTRING )
1070 return returnfalse( this , "depth5-7" , qName ) ;
1071 sscanf( fieldvalue[depth].c_str() , "%d" , (int * ) &anOutDataStreamParameter.theNumberOfValues ) ;
1072 fieldvalue[depth] = NULLSTRING ;
1076 //cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
1077 << step[depth] << endl ;
1081 return returnfalse( this , "depth5-7" , qName ) ;
1084 if ( qName == "FuncName" ) {
1085 if ( fieldvalue[depth] == NULLSTRING )
1086 return returnfalse( this , "depth5-8" , qName ) ;
1087 int l = aNode.theListOfFuncName.size() ;
1088 aNode.theListOfFuncName.resize( l+1 ) ;
1089 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1090 aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
1093 aNode.theListOfFuncName[ l ] = "" ;
1095 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1096 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
1098 MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
1101 fieldvalue[depth] = NULLSTRING ;
1105 return returnfalse( this , "depth5-8" , qName ) ;
1108 if ( qName == "PyFunc" ) {
1109 if ( fieldvalue[depth] == NULLSTRING )
1110 return returnfalse( this , "depth5-9" , qName ) ;
1111 int l = aNode.theListOfPythonFunctions.size() - 1 ;
1112 SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
1113 int ll = aPythonFunction.length() ;
1114 aPythonFunction.length( ll+1 ) ;
1115 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
1116 aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
1119 aPythonFunction[ ll ] = NULLSTRING ;
1122 aNode.theListOfPythonFunctions.resize( l ) ;
1123 aNode.theListOfPythonFunctions.resize( l+1 ) ;
1125 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
1127 MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
1128 << " [" << ll << "] = " << aPythonFunction[ ll ] )
1130 fieldvalue[depth] = NULLSTRING ;
1134 return returnfalse( this , "depth5-9" , qName ) ;
1137 return returnfalse( this , "depth5-d" , qName ) ;
1144 switch ( step[depth] ) {
1146 if ( qName == "inParameter-type" ) {
1147 if ( fieldvalue[depth] == NULLSTRING )
1148 return returnfalse( this , "depth6-0" , qName ) ;
1149 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1150 fieldvalue[depth] = NULLSTRING ;
1154 return returnfalse( this , "depth6-0" , qName ) ;
1157 if ( qName == "inParameter-name" ) {
1158 if ( fieldvalue[depth] == NULLSTRING )
1159 return returnfalse( this , "depth6-1" , qName ) ;
1160 aParameter.Parametername = fieldvalue[depth].c_str() ;
1161 fieldvalue[depth] = NULLSTRING ;
1165 return returnfalse( this , "depth6-1" , qName ) ;
1168 if ( qName == "outParameter-type" ) {
1169 if ( fieldvalue[depth] == NULLSTRING )
1170 return returnfalse( this , "depth6-2" , qName ) ;
1171 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1172 fieldvalue[depth] = NULLSTRING ;
1176 return returnfalse( this , "depth6-2" , qName ) ;
1179 if ( qName == "outParameter-name" ) {
1180 if ( fieldvalue[depth] == NULLSTRING )
1181 return returnfalse( this , "depth6-3" , qName ) ;
1182 aParameter.Parametername = fieldvalue[depth].c_str() ;
1183 fieldvalue[depth] = NULLSTRING ;
1187 return returnfalse( this , "depth6-3" , qName ) ;
1190 return returnfalse( this , "depth6-d" , qName ) ;
1198 //cout << "return from endElement " << qName << " step[" << depth << "]" << step[depth] << endl ;
1204 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1205 // we are not interested in whitespaces
1206 QString ch_simplified = ch.simplifyWhiteSpace();
1207 if ( ch_simplified.isEmpty() ) {
1212 MESSAGE( "characters step[" << depth << "]=" << step[depth]
1213 << " ch " << ch << " fieldvalue_must_be_NULL : '" << fieldvalue[depth] << "'" ) ;
1215 if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1216 return returnfalse( this , "characters " , ch ) ;
1218 // fieldvalue[depth] = (const char * ) ch ;
1219 fieldvalue[depth] = ch.latin1() ;
1224 QString GraphBase::XmlHandler::errorString() {
1225 //cout << "the document is not in the quote file format" << endl ;
1226 return "the document is not in the quote file format";
1230 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1231 errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1232 .arg( exception.message() )
1233 .arg( exception.lineNumber() )
1234 .arg( exception.columnNumber() );
1235 //cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1236 return QXmlDefaultHandler::fatalError( exception );
1240 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1242 SALOME_SuperVision::Date aDate;
1243 QString qstrDate(myStrDate);
1247 int iPos = qstrDate.find("/");
1248 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1249 aDate.Day = qstrTemp.toShort();
1250 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1251 iPos = qstrDate.find("/");
1252 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1253 aDate.Month = qstrTemp.toShort();
1254 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1255 iPos = qstrDate.find(" ");
1256 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1257 aDate.Year = qstrTemp.toShort();
1260 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1261 iPos = qstrDate.find(":");
1262 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1263 aDate.Hour = qstrTemp.toShort();
1264 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1265 iPos = qstrDate.find(":");
1266 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1267 aDate.Minute = qstrTemp.toShort();
1268 qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1269 aDate.Second = qstrDate.toShort();