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 GraphBase::XmlHandler::XmlHandler() {}
54 GraphBase::XmlHandler::~XmlHandler() {}
56 QString GraphBase::XmlHandler::errorProtocol()
61 bool GraphBase::XmlHandler::startDocument()
63 // at the beginning of parsing: do some initialization
68 bool GraphBase::XmlHandler::startElement( const QString&, const QString&,
70 const QXmlAttributes& atts ) {
71 // do different actions depending on the name of the tag and the
75 MESSAGE( "====================startElement " << depth << " " << qName)
78 if ( qName == "dataflow" && depth == 0 ) {
83 fieldname[depth++] = (const char * ) qName ;
85 if ( depth == maxlevel+1 )
91 static bool returnfalse( GraphBase::XmlHandler *myXmlHandler ,
93 const QString& qName ) {
94 MESSAGE( "returnfalse ERROR qName " << qName << " " << msg
95 << " fieldname " << myXmlHandler->getfieldname(myXmlHandler->getdepth())
97 << myXmlHandler->getfieldvalue(myXmlHandler->getdepth()) << "'" )
101 bool GraphBase::XmlHandler::endElement( const QString&,
103 const QString& qName) {
106 ( qName != QString( fieldname[depth].c_str() ) &&
107 fieldvalue[depth] != NULLSTRING ) ) {
108 MESSAGE( "endElement ERROR " << dataflowxml << " qName " << qName
109 << " fieldname" << fieldname[depth] << " fieldvalue "
110 << fieldvalue[depth] )
111 return returnfalse( this , "top" , qName ) ;
113 if ( fieldvalue[depth] == NULLSTRING )
117 MESSAGE( " ==========endElement step[" << depth << "]="
118 << step[depth] << " qName " << qName << " fieldvalue '"
119 << fieldvalue[depth] << "'")
123 if ( step[depth] == 0 && qName == "dataflow" ) {
124 dataflowxml = false ;
127 return returnfalse( this , "depth0" , qName ) ;
132 switch ( step[depth] ) {
134 if ( qName == "info-list" ) {
135 // aDataFlow.Info = aNode ;
139 return returnfalse( this , "depth1-0" , qName ) ;
142 if ( qName == "node-list" ) {
149 return returnfalse( this , "depth1-1" , qName ) ;
152 if ( qName == "link-list" ) {
156 return returnfalse( this , "depth1-2" , qName ) ;
159 if ( qName == "data-list" ) {
163 return returnfalse( this , "depth1-3" , qName ) ;
166 return returnfalse( this , "depth1-d" , qName ) ;
173 switch ( step[depth] ) {
175 if ( qName == "node" ) {
177 if ( step[1] == 0 ) {
178 aDataFlow.Info = aNode ;
180 else if ( step[1] == 1 ) {
181 int sizenode = aDataFlow.Nodes.size() ;
182 aDataFlow.Nodes.resize( sizenode+1 ) ;
183 aDataFlow.Nodes[ sizenode ] = aNode ;
186 aNode.theService.ServiceinParameter.length( 0 ) ;
187 aNode.theService.ServiceoutParameter.length( 0 ) ;
188 aNode.theListOfParameters.resize( 0 ) ;
189 aNode.theListOfFuncName.resize( 0 ) ;
190 aNode.theListOfPythonFunctions.resize( 0 ) ;
193 else if ( qName == "link" || qName == "data" ) {
197 return returnfalse( this , "depth2-0" , qName ) ;
201 if ( qName == "link" ) {
202 int sizelink = aDataFlow.Links.size() ;
203 aDataFlow.Links.resize( sizelink+1 ) ;
204 aDataFlow.Links[ sizelink ] = aLink ;
206 aDataFlow.Links[ sizelink ].aListOfCoords.resize( VXSize ) ;
208 for ( ic = 0 ; ic < VXSize ; ic++ ) {
209 aDataFlow.Links[ sizelink ].aListOfCoords[ ic ].theX = VX[ic] ;
210 aDataFlow.Links[ sizelink ].aListOfCoords[ ic ].theY = VY[ic] ;
217 else if ( qName == "data" ) {
221 return returnfalse( this , "depth2-1" , qName ) ;
225 if ( qName == "data" ) {
228 int sizedata = aDataFlow.Datas.size() ;
229 aDataFlow.Datas.resize( sizedata+1 ) ;
230 aDataFlow.Datas[ sizedata ] = aLink ;
232 aDataFlow.Datas[ sizedata ].aListOfCoords.resize( VXSize ) ;
234 for ( ic = 0 ; ic < VXSize ; ic++ ) {
235 aDataFlow.Datas[ sizedata ].aListOfCoords[ ic ].theX = VX[ic] ;
236 aDataFlow.Datas[ sizedata ].aListOfCoords[ ic ].theY = VY[ic] ;
244 return returnfalse( this , "depth2-2" , qName ) ;
247 return returnfalse( this , "depth2-d" , qName ) ;
254 switch ( step[depth] ) {
256 if ( qName == "component-name" ) {
257 if ( fieldvalue[depth] == NULLSTRING )
258 return returnfalse( this , "depth3-0" , qName ) ;
259 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
260 aNode.theComponentName = fieldvalue[depth].c_str() ;
262 aNode.theComponentName = "" ;
263 fieldvalue[depth] = NULLSTRING ;
267 return returnfalse( this , "depth3-0" , qName ) ;
270 if ( qName == "interface-name" ) {
271 if ( fieldvalue[depth] == NULLSTRING )
272 return returnfalse( this , "depth3-1" , qName ) ;
273 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
274 aNode.theInterfaceName = fieldvalue[depth].c_str() ;
276 aNode.theInterfaceName = "" ;
277 fieldvalue[depth] = NULLSTRING ;
281 return returnfalse( this , "depth3-1" , qName ) ;
284 if ( qName == "node-name" ) {
285 if ( fieldvalue[depth] == NULLSTRING )
286 return returnfalse( this , "depth3-2" , qName ) ;
287 aNode.theName = fieldvalue[depth].c_str() ;
288 fieldvalue[depth] = NULLSTRING ;
292 return returnfalse( this , "depth3-2" , qName ) ;
295 if ( qName == "kind" ) {
296 if ( fieldvalue[depth] == NULLSTRING )
297 return returnfalse( this , "depth3-3" , qName ) ;
299 sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
300 fieldvalue[depth] = NULLSTRING ;
305 return returnfalse( this , "depth3-3" , qName ) ;
308 if ( qName == "coupled-node" ) {
309 if ( fieldvalue[depth] == NULLSTRING )
310 return returnfalse( this , "depth3-4" , qName ) ;
311 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
312 aNode.theCoupledNode = fieldvalue[depth].c_str() ;
314 aNode.theCoupledNode = "" ;
315 fieldvalue[depth] = NULLSTRING ;
321 // return returnfalse( this , "depth3-4" , qName ) ;
324 if ( qName == "service" ) {
325 if ( fieldvalue[depth] != NULLSTRING )
326 return returnfalse( this , "depth3-5" , qName ) ;
327 fieldvalue[depth] = NULLSTRING ;
334 return returnfalse( this , "depth3-5" , qName ) ;
337 if ( qName == "Parameter-list" ) {
338 if ( fieldvalue[depth] != NULLSTRING )
339 return returnfalse( this , "depth3-6" , qName ) ;
340 fieldvalue[depth] = NULLSTRING ;
352 // return returnfalse( this , "depth3-6" , qName ) ;
355 if ( qName == "PyFunction-list" ) {
356 if ( fieldvalue[depth] != NULLSTRING )
357 return returnfalse( this , "depth3-7" , qName ) ;
358 fieldvalue[depth] = NULLSTRING ;
369 // NO PyFunction-list
370 // return returnfalse( this , "depth3-7" , qName ) ;
373 if ( qName == "creation-date" ) {
376 strcpy( Date , fieldvalue[depth].c_str() ) ;
378 for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
379 if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
382 // MESSAGE( "Date(" << Date << ")" );
383 int Day , Month , Year , Hour , Minute , Second ;
384 sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
396 aNode.theFirstCreation = D ;
397 fieldvalue[depth] = NULLSTRING ;
401 return returnfalse( this , "depth3-8" , qName ) ;
404 if ( qName == "lastmodification-date" ) {
407 strcpy( Date , fieldvalue[depth].c_str() ) ;
409 for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
410 if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
413 // MESSAGE( "Date(" << Date << ")" );
414 int Day , Month , Year , Hour , Minute , Second ;
415 sscanf( Date ,"%d%d%d%d%d%d" , &Day ,
427 aNode.theLastModification = D ;
428 fieldvalue[depth] = NULLSTRING ;
432 return returnfalse( this , "depth3-9" , qName ) ;
435 if ( qName == "editor-release" ) {
436 aNode.theEditorRelease = fieldvalue[depth].c_str() ;
437 fieldvalue[depth] = NULLSTRING ;
441 return returnfalse( this , "depth3-10" , qName ) ;
444 if ( qName == "author" ) {
445 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
446 aNode.theAuthor = fieldvalue[depth].c_str() ;
448 aNode.theAuthor = "" ;
449 fieldvalue[depth] = NULLSTRING ;
453 return returnfalse( this , "depth3-11" , qName ) ;
456 if ( qName == "container" ) {
457 if ( fieldvalue[depth] == NULLSTRING )
458 return returnfalse( this , "depth3-12" , qName ) ;
460 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
461 aNode.theContainer = fieldvalue[depth].c_str() ;
463 aNode.theContainer = "" ;
464 fieldvalue[depth] = NULLSTRING ;
468 return returnfalse( this , "depth3-12" , qName ) ;
471 if ( qName == "comment" ) {
472 if ( fieldvalue[depth] == NULLSTRING )
473 return returnfalse( this , "depth3-13" , qName ) ;
475 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
476 aNode.theComment = fieldvalue[depth].c_str() ;
478 aNode.theComment = "" ;
479 fieldvalue[depth] = NULLSTRING ;
483 return returnfalse( this , "depth3-13" , qName ) ;
486 if ( qName == "x-position" ) {
487 if ( fieldvalue[depth] == NULLSTRING )
488 return returnfalse( this , "depth3-14" , qName ) ;
489 sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theX ) ;
490 fieldvalue[depth] = NULLSTRING ;
495 return returnfalse( this , "depth3-14" , qName ) ;
498 if ( qName == "y-position" ) {
499 if ( fieldvalue[depth] == NULLSTRING )
500 return returnfalse( this , "depth3-15" , qName ) ;
501 sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theY ) ;
502 fieldvalue[depth] = NULLSTRING ;
507 return returnfalse( this , "depth3-15" , qName ) ;
510 if ( qName == "fromnode-name" ) {
511 if ( fieldvalue[depth] == NULLSTRING )
512 return returnfalse( this , "depth3-16" , qName ) ;
513 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
514 aLink.FromNodeName = fieldvalue[depth].c_str() ;
516 aLink.FromNodeName = "" ;
517 fieldvalue[depth] = NULLSTRING ;
522 return returnfalse( this , "depth3-16" , qName ) ;
525 if ( qName == "fromserviceparameter-name" ) {
526 if ( fieldvalue[depth] == NULLSTRING )
527 return returnfalse( this , "depth3-17" , qName ) ;
528 aLink.FromServiceParameterName = fieldvalue[depth].c_str() ;
529 fieldvalue[depth] = NULLSTRING ;
533 return returnfalse( this , "depth3-17" , qName ) ;
536 if ( qName == "tonode-name" ) {
537 if ( fieldvalue[depth] == NULLSTRING )
538 return returnfalse( this , "depth3-18" , qName ) ;
539 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
540 aLink.ToNodeName = fieldvalue[depth].c_str() ;
542 aLink.ToNodeName = "" ;
543 fieldvalue[depth] = NULLSTRING ;
547 return returnfalse( this , "depth3-18" , qName ) ;
550 if ( qName == "toserviceparameter-name" ) {
551 if ( fieldvalue[depth] == NULLSTRING )
552 return returnfalse( this , "depth3-19" , qName ) ;
553 aLink.ToServiceParameterName = fieldvalue[depth].c_str() ;
554 fieldvalue[depth] = NULLSTRING ;
558 return returnfalse( this , "depth3-19" , qName ) ;
562 if ( qName == "data-value" ) {
563 if ( fieldvalue[depth] != NULLSTRING )
564 return returnfalse( this , "depth3-20" , qName ) ;
572 // return returnfalse( this , "depth3-20" , qName ) ;
575 if ( qName == "coord-list" ) {
576 if ( fieldvalue[depth] != NULLSTRING )
577 return returnfalse( this , "depth3-21" , qName ) ;
583 return returnfalse( this , "depth3-21" , qName ) ;
586 return returnfalse( this , "depth3-d" , qName ) ;
594 switch ( step[depth] ) {
596 if ( qName == "service-name" ) {
597 if ( fieldvalue[depth] == NULLSTRING )
598 return returnfalse( this , "depth4-0" , qName ) ;
599 if ( strcmp( fieldvalue[depth].c_str() , "?" ) )
600 aNode.theService.ServiceName = fieldvalue[depth].c_str() ;
602 aNode.theService.ServiceName = "" ;
603 aNode.theService.ServiceinParameter.length( 0 ) ;
604 aNode.theService.ServiceoutParameter.length( 0 ) ;
605 fieldvalue[depth] = NULLSTRING ;
609 return returnfalse( this , "depth4-0" , qName ) ;
612 if ( qName == "inParameter-list" ) {
613 if ( fieldvalue[depth] != NULLSTRING )
614 return returnfalse( this , "depth4-1" , qName ) ;
615 fieldvalue[depth] = NULLSTRING ;
618 step[6] = 2 ; // First outParameter
619 // inParameterlist ok
622 return returnfalse( this , "depth4-1" , qName ) ;
625 if ( qName == "outParameter-list" ) {
626 if ( fieldvalue[depth] != NULLSTRING )
627 return returnfalse( this , "depth4-2" , qName ) ;
628 fieldvalue[depth] = NULLSTRING ;
630 // outParameterlist ok
635 return returnfalse( this , "depth4-2" , qName ) ;
638 if ( qName == "value-type" ) {
639 if ( fieldvalue[depth] == NULLSTRING )
640 return returnfalse( this , "depth4-3" , qName ) ;
642 sscanf( fieldvalue[depth].c_str() , "%d" , &Kind ) ;
643 // switch ( D.Value.type()->kind() ) {
644 aLink.aLinkValue = CORBA::Any() ;
646 case CORBA::tk_string: {
647 aLink.aLinkValue <<= (char *) NULL ;
649 aLink.aLinkValue >>= t;
651 MESSAGE( t << " (string)" );
655 case CORBA::tk_double: {
656 aLink.aLinkValue <<= (double ) 0. ;
658 aLink.aLinkValue >>= d;
660 MESSAGE( d << " (double)" );
664 case CORBA::tk_long: {
665 aLink.aLinkValue <<= (long ) 0 ;
667 aLink.aLinkValue >>= l;
669 MESSAGE( l << " (long)" );
673 case CORBA::tk_objref: {
674 // aLink.aLinkValue.replace(CORBA::_tc_Object, NULL);
675 aLink.aLinkValue <<= CORBA::Object::_nil() ;
677 MESSAGE( " (object reference)" );
682 MESSAGE( "(other ERROR)" );
684 fieldvalue[depth] = NULLSTRING ;
690 // return returnfalse( this , "depth4-3" , qName ) ;
693 if ( qName == "value" ) {
694 if ( fieldvalue[depth] == NULLSTRING )
695 return returnfalse( this , "depth4-4" , qName ) ;
696 if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
697 // aLink.aLinkValue.Value = fieldvalue[depth].c_str() ;
698 aLink.aLinkValue = CORBA::Any() ; // ???
701 switch ( aLink.aLinkValue.type()->kind() ) {
702 case CORBA::tk_string: {
703 aLink.aLinkValue <<= fieldvalue[depth].c_str() ;
705 aLink.aLinkValue >>= t;
707 MESSAGE( t << " (string)" );
711 case CORBA::tk_double: {
713 sscanf( fieldvalue[depth].c_str() , "%lf" , &d ) ;
714 aLink.aLinkValue <<= d;
716 MESSAGE( d << " (double)" );
720 case CORBA::tk_long: {
722 sscanf( fieldvalue[depth].c_str() , "%ld" , &l ) ;
723 aLink.aLinkValue <<= l;
725 MESSAGE( l << " (long)" );
729 case CORBA::tk_objref: {
730 CORBA::Object_ptr ObjRef ;
731 const char * IORObjRef = fieldvalue[depth].c_str() ;
732 ObjRef = _Orb->string_to_object( IORObjRef ) ;
733 aLink.aLinkValue <<= ObjRef;
735 MESSAGE( IORObjRef << "(object reference)" );
740 aLink.aLinkValue <<= _Orb->string_to_object( fieldvalue[depth].c_str() ) ;
741 MESSAGE( "(other ERROR)" );
745 fieldvalue[depth] = NULLSTRING ;
752 // return returnfalse( this , "depth4-4" , qName ) ;
755 if ( qName == "coord" ) {
756 if ( fieldvalue[depth] != NULLSTRING )
757 return returnfalse( this , "depth4-5" , qName ) ;
758 if ( VXSize == (int ) VX.size() ) {
759 VX.resize( VX.size() + 10 ) ;
760 VY.resize( VY.size() + 10 ) ;
768 return returnfalse( this , "depth4-5" , qName ) ;
771 if ( qName == "inParameter" ) {
772 if ( fieldvalue[depth] != NULLSTRING )
773 return returnfalse( this , "depth4-6" , qName ) ;
774 int size = aNode.theListOfParameters.size() ;
775 aNode.theListOfParameters.resize( size+1 ) ;
776 aNode.theListOfParameters[size].theInParameter = aParameter ;
778 // One more aParameter input
781 return returnfalse( this , "depth4-6" , qName ) ;
784 if ( qName == "outParameter" ) {
785 if ( fieldvalue[depth] != NULLSTRING )
786 return returnfalse( this , "depth4-7" , qName ) ;
787 int size = aNode.theListOfParameters.size() ;
788 aNode.theListOfParameters[size-1].theOutParameter = aParameter ;
789 // One more aParameter output
794 return returnfalse( this , "depth4-7" , qName ) ;
797 if ( qName == "PyFunction" ) {
798 if ( fieldvalue[depth] != NULLSTRING )
799 return returnfalse( this , "depth4-8" , qName ) ;
800 // One more PyFunction
805 return returnfalse( this , "depth4-8" , qName ) ;
808 return returnfalse( this , "depth4-d" , qName ) ;
816 switch ( step[depth] ) {
818 if ( qName == "inParameter" ) {
819 if ( fieldvalue[depth] != NULLSTRING )
820 return returnfalse( this , "depth5-0" , qName ) ;
821 fieldvalue[depth] = NULLSTRING ;
822 int size = aNode.theService.ServiceinParameter.length() ;
823 aNode.theService.ServiceinParameter.length( size+1 ) ;
824 aNode.theService.ServiceinParameter[size] = aParameter ;
825 // One more aParameter input
826 step[6] = 0 ; // Next one
829 return returnfalse( this , "depth5-0" , qName ) ;
832 if ( qName == "outParameter" ) {
833 if ( fieldvalue[depth] != NULLSTRING )
834 return returnfalse( this , "depth5-1" , qName ) ;
835 fieldvalue[depth] = NULLSTRING ;
836 int size = aNode.theService.ServiceoutParameter.length() ;
837 aNode.theService.ServiceoutParameter.length( size+1 ) ;
838 aNode.theService.ServiceoutParameter[size] = aParameter ;
839 // One more aParameter Output
840 step[6] = 2 ; // Next one
843 return returnfalse( this , "depth5-1" , qName ) ;
846 if ( qName == "x" ) {
847 if ( fieldvalue[depth] == NULLSTRING )
848 return returnfalse( this , "depth5-2" , qName ) ;
849 sscanf( fieldvalue[depth].c_str() , "%d" , &X ) ;
850 fieldvalue[depth] = NULLSTRING ;
854 return returnfalse( this , "depth5-2" , qName ) ;
857 if ( qName == "y" ) {
858 if ( fieldvalue[depth] == NULLSTRING )
859 return returnfalse( this , "depth5-3" , qName ) ;
860 sscanf( fieldvalue[depth].c_str() , "%d" , &Y ) ;
861 fieldvalue[depth] = NULLSTRING ;
864 return returnfalse( this , "depth5-3" , qName ) ;
867 if ( qName == "inParameter-type" ) {
868 if ( fieldvalue[depth] == NULLSTRING )
869 return returnfalse( this , "depth5-4" , qName ) ;
870 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
871 aParameter.Parametertype = fieldvalue[depth].c_str() ;
874 aParameter.Parametertype = "" ;
876 fieldvalue[depth] = NULLSTRING ;
880 return returnfalse( this , "depth5-4" , qName ) ;
883 if ( qName == "inParameter-name" ) {
884 if ( fieldvalue[depth] == NULLSTRING )
885 return returnfalse( this , "depth5-5" , qName ) ;
886 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
887 aParameter.Parametername = fieldvalue[depth].c_str() ;
890 aParameter.Parametername = "" ;
892 fieldvalue[depth] = NULLSTRING ;
896 return returnfalse( this , "depth5-5" , qName ) ;
899 if ( qName == "outParameter-type" ) {
900 if ( fieldvalue[depth] == NULLSTRING )
901 return returnfalse( this , "depth5-6" , qName ) ;
902 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
903 aParameter.Parametertype = fieldvalue[depth].c_str() ;
906 aParameter.Parametertype = "" ;
908 fieldvalue[depth] = NULLSTRING ;
912 return returnfalse( this , "depth5-6" , qName ) ;
915 if ( qName == "outParameter-name" ) {
916 if ( fieldvalue[depth] == NULLSTRING )
917 return returnfalse( this , "depth5-7" , qName ) ;
918 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
919 aParameter.Parametername = fieldvalue[depth].c_str() ;
922 aParameter.Parametername = "" ;
924 fieldvalue[depth] = NULLSTRING ;
928 return returnfalse( this , "depth5-7" , qName ) ;
931 if ( qName == "FuncName" ) {
932 if ( fieldvalue[depth] == NULLSTRING )
933 return returnfalse( this , "depth5-8" , qName ) ;
934 int l = aNode.theListOfFuncName.size() ;
935 aNode.theListOfFuncName.resize( l+1 ) ;
936 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
937 aNode.theListOfFuncName[ l ] = fieldvalue[depth].c_str() ;
940 aNode.theListOfFuncName[ l ] = "" ;
942 aNode.theListOfPythonFunctions.resize( l+1 ) ;
943 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings() ;
945 MESSAGE( " ==========theListOfFuncName/theListOfPythonFunctions size "
948 fieldvalue[depth] = NULLSTRING ;
952 return returnfalse( this , "depth5-8" , qName ) ;
955 if ( qName == "PyFunc" ) {
956 if ( fieldvalue[depth] == NULLSTRING )
957 return returnfalse( this , "depth5-9" , qName ) ;
958 int l = aNode.theListOfPythonFunctions.size() - 1 ;
959 SUPERV::ListOfStrings aPythonFunction = *aNode.theListOfPythonFunctions[ l ] ;
960 int ll = aPythonFunction.length() ;
961 aPythonFunction.length( ll+1 ) ;
962 if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
963 aPythonFunction[ ll ] = fieldvalue[depth].c_str() ;
966 aPythonFunction[ ll ] = NULLSTRING ;
969 aNode.theListOfPythonFunctions.resize( l ) ;
970 aNode.theListOfPythonFunctions.resize( l+1 ) ;
972 aNode.theListOfPythonFunctions[ l ] = new SUPERV::ListOfStrings( aPythonFunction ) ;
974 MESSAGE( " ==========theListOfPythonFunctions[" << l << "] size " << ll+1
975 << " [" << ll << "] = " << aPythonFunction[ ll ] )
977 fieldvalue[depth] = NULLSTRING ;
981 return returnfalse( this , "depth5-9" , qName ) ;
984 return returnfalse( this , "depth5-d" , qName ) ;
991 switch ( step[depth] ) {
993 if ( qName == "inParameter-type" ) {
994 if ( fieldvalue[depth] == NULLSTRING )
995 return returnfalse( this , "depth6-0" , qName ) ;
996 aParameter.Parametertype = fieldvalue[depth].c_str() ;
997 fieldvalue[depth] = NULLSTRING ;
1001 return returnfalse( this , "depth6-0" , qName ) ;
1004 if ( qName == "inParameter-name" ) {
1005 if ( fieldvalue[depth] == NULLSTRING )
1006 return returnfalse( this , "depth6-1" , qName ) ;
1007 aParameter.Parametername = fieldvalue[depth].c_str() ;
1008 fieldvalue[depth] = NULLSTRING ;
1012 return returnfalse( this , "depth6-1" , qName ) ;
1015 if ( qName == "outParameter-type" ) {
1016 if ( fieldvalue[depth] == NULLSTRING )
1017 return returnfalse( this , "depth6-2" , qName ) ;
1018 aParameter.Parametertype = fieldvalue[depth].c_str() ;
1019 fieldvalue[depth] = NULLSTRING ;
1023 return returnfalse( this , "depth6-2" , qName ) ;
1026 if ( qName == "outParameter-name" ) {
1027 if ( fieldvalue[depth] == NULLSTRING )
1028 return returnfalse( this , "depth6-3" , qName ) ;
1029 aParameter.Parametername = fieldvalue[depth].c_str() ;
1030 fieldvalue[depth] = NULLSTRING ;
1034 return returnfalse( this , "depth6-3" , qName ) ;
1037 return returnfalse( this , "depth6-d" , qName ) ;
1048 bool GraphBase::XmlHandler::characters( const QString& ch ) {
1049 // we are not interested in whitespaces
1050 QString ch_simplified = ch.simplifyWhiteSpace();
1051 if ( ch_simplified.isEmpty() ) {
1056 MESSAGE( "characters step[" << depth << "]=" << step[depth]
1057 << " ch " << ch << " fieldvalue_must_be_NULL " << fieldvalue[depth] )
1059 if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
1060 return returnfalse( this , "characters " , ch ) ;
1062 fieldvalue[depth] = (const char * ) ch ;
1067 QString GraphBase::XmlHandler::errorString() {
1068 cout << "the document is not in the quote file format" << endl ;
1069 return "the document is not in the quote file format";
1073 bool GraphBase::XmlHandler::fatalError( const QXmlParseException& exception ) {
1074 errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
1075 .arg( exception.message() )
1076 .arg( exception.lineNumber() )
1077 .arg( exception.columnNumber() );
1078 cout << "GraphBase::XmlHandler::fatalError " << errorProt.latin1() << endl ;
1079 return QXmlDefaultHandler::fatalError( exception );
1083 SALOME_SuperVision::Date GraphBase::XmlHandler::StringToDate( QString& myStrDate) const
1085 SALOME_SuperVision::Date aDate;
1086 QString qstrDate(myStrDate);
1090 int iPos = qstrDate.find("/");
1091 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1092 aDate.Day = qstrTemp.toShort();
1093 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1094 iPos = qstrDate.find("/");
1095 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1096 aDate.Month = qstrTemp.toShort();
1097 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1098 iPos = qstrDate.find(" ");
1099 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1100 aDate.Year = qstrTemp.toShort();
1103 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1104 iPos = qstrDate.find(":");
1105 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1106 aDate.Hour = qstrTemp.toShort();
1107 qstrDate = qstrDate.right(qstrDate.length()-iPos);
1108 iPos = qstrDate.find(":");
1109 qstrTemp = qstrDate.left(iPos).stripWhiteSpace();
1110 aDate.Minute = qstrTemp.toShort();
1111 qstrDate = qstrDate.right(qstrDate.length()-iPos).stripWhiteSpace();
1112 aDate.Second = qstrDate.toShort();