]> SALOME platform Git repositories - modules/yacs.git/blobdiff - src/yacsloader/switchParsers.hxx
Salome HOME
updated copyright message
[modules/yacs.git] / src / yacsloader / switchParsers.hxx
index 79657322c5b3b7e8cec4ecbd7670ec537f2556e9..309831b3bd0102c6ed686fa84c27fffab6699a3d 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -65,7 +65,7 @@ struct casetypeParser:parser
   virtual void remote (ENGINE::InlineNode* const& n);
   virtual void node (ENGINE::InlineNode* const& n);
   virtual void forloop (ENGINE::ForLoop* const& n);
-  virtual void foreach (ENGINE::ForEachLoop* const& n);
+  virtual void foreach (ENGINE::ForEachLoopGen* const& n);
   virtual void optimizer (ENGINE::OptimizerLoop* const& n);
   virtual void while_ (ENGINE::WhileLoop* const& n);
   virtual void switch_ (ENGINE::Switch* const& n);
@@ -112,6 +112,8 @@ namespace YACS
 
   void casetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("id",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
@@ -189,7 +191,7 @@ namespace YACS
       std::string fullname=currentProc->names.back()+ n->getName();
       currentProc->nodeMap[fullname]=n;
     }
-  void casetypeParser::foreach (ENGINE::ForEachLoop* const& n)
+  void casetypeParser::foreach (ENGINE::ForEachLoopGen* const& n)
     {
       _cnode=n;
       std::string fullname=currentProc->names.back()+ n->getName();
@@ -237,6 +239,8 @@ namespace YACS
 
   void defaultcasetypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       for (int i = 0; attr[i]; i += 2) 
       {
         DEBTRACE( attr[i] << "=" << attr[i + 1] )             
@@ -256,6 +260,8 @@ namespace YACS
 
   void switchtypeParser::buildAttr(const XML_Char** attr)
     {
+      if (!attr)
+        return;
       this->required("name",attr);
       for (int i = 0; attr[i]; i += 2) 
         {
@@ -360,7 +366,8 @@ void casetypeParser::onStart(const XML_Char* el, const XML_Char** attr)
   else if(element == "remote")pp=&remotetypeParser<>::remoteParser;
   else if(element == "node")pp=&nodetypeParser<>::nodeParser;
   else if(element == "forloop")pp=&forlooptypeParser<>::forloopParser;
-  else if(element == "foreach")pp=&foreachlooptypeParser<>::foreachloopParser;
+  else if(element == "foreach")pp=&foreachlooptypeParser<ENGINE::ForEachLoop *>::foreachloopParser;
+  else if(element == "foreachdyn")pp=&foreachlooptypeParser<ENGINE::ForEachLoopDyn *>::foreachloopParser;
   else if(element == "optimizer")pp=&optimizerlooptypeParser<>::optimizerloopParser;
   else if(element == "while")pp=&whilelooptypeParser<>::whileloopParser;
   else if(element == "switch")pp=&switchtypeParser::switchParser;
@@ -383,7 +390,8 @@ void casetypeParser::onEnd(const char *el,parser* child)
   else if(element == "remote")remote(((remotetypeParser<>*)child)->post());
   else if(element == "node")node(((nodetypeParser<>*)child)->post());
   else if(element == "forloop")forloop(((forlooptypeParser<>*)child)->post());
-  else if(element == "foreach")foreach(((foreachlooptypeParser<>*)child)->post());
+  else if(element == "foreach")foreach(((foreachlooptypeParser<ENGINE::ForEachLoop *>*)child)->post());
+  else if(element == "foreachdyn")foreach(((foreachlooptypeParser<ENGINE::ForEachLoopDyn *>*)child)->post());
   else if(element == "optimizer")optimizer(((optimizerlooptypeParser<>*)child)->post());
   else if(element == "while")while_(((whilelooptypeParser<>*)child)->post());
   else if(element == "switch")switch_(((switchtypeParser*)child)->post());