Version: 8.3.0
componentinstanceParsers.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
21 #include "containerParsers.hxx"
22 #include "dataParsers.hxx"
23 #include "propertyParsers.hxx"
24 
25 //#define _DEVDEBUG_
26 #include "YacsTrace.hxx"
27 
28 namespace YACS
29 {
30  componentinstancetypeParser componentinstancetypeParser::componentinstanceParser;
31 
33  {
34  if (!attr)
35  return;
36  required("name",attr);
37  for (int i = 0; attr[i]; i += 2)
38  {
39  if(std::string(attr[i]) == "name")name(attr[i+1]);
40  if(std::string(attr[i]) == "kind")kind(attr[i+1]);
41  }
42  }
44  {
45  std::string element(el);
47  this->maxcount("component",1,element);
48  this->maxcount("load",1,element);
49  if(element == "property")pp=&propertytypeParser::propertyParser;
50  else if(element == "component")pp=&stringtypeParser::stringParser;
51  else if(element == "load")pp=&loadtypeParser::loadParser;
53  pp->init();
54  pp->pre();
55  pp->buildAttr(attr);
56  }
57  void componentinstancetypeParser::onEnd(const char *el,parser* child)
58  {
59  std::string element(el);
60  if(element == "property")property(((propertytypeParser*)child)->post());
61  else if(element == "component") component(((stringtypeParser*)child)->post());
62  else if(element == "load") load(((loadtypeParser*)child)->post());
63  }
64 
66  {
67  _componentinstance._props.clear();
68  }
69 
70  void componentinstancetypeParser::name(const std::string& name)
72 
73  void componentinstancetypeParser::kind(const std::string& kind)
75 
77  {
78  DEBTRACE("property_set: "<<prop._name<<" "<<prop._value);
80  }
81 
82  void componentinstancetypeParser::component (const std::string& name)
83  {
84  DEBTRACE( "component_set: " << name )
86  }
87 
89  {
90  DEBTRACE( "load: " )
92  }
93 
95  {
96  this->mincount("component",1);
97  return _componentinstance;
98  }
99 }