1 // Copyright (C) 2006-2013 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "containerParsers.hxx"
21 #include "propertyParsers.hxx"
24 #include "YacsTrace.hxx"
28 containertypeParser containertypeParser::containerParser;
29 machinetypeParser machinetypeParser::machineParser;
30 loadtypeParser loadtypeParser::loadParser;
32 void machinetypeParser::buildAttr(const XML_Char** attr)
34 required("name",attr);
35 for (int i = 0; attr[i]; i += 2)
37 if(std::string(attr[i]) == "name")name(attr[i+1]);
40 void machinetypeParser::pre (){_mach._name="";}
41 void machinetypeParser::name(const std::string& name){ _mach._name=name; }
42 machine machinetypeParser::post()
47 void containertypeParser::buildAttr(const XML_Char** attr)
49 required("name",attr);
50 for (int i = 0; attr[i]; i += 2)
52 if(std::string(attr[i]) == "name")name(attr[i+1]);
55 void containertypeParser::onStart(const XML_Char* el, const XML_Char** attr)
57 std::string element(el);
58 parser* pp=&parser::main_parser;
59 if(element == "machine")pp=&machinetypeParser::machineParser;
60 if(element == "property")pp=&propertytypeParser::propertyParser;
61 SetUserDataAndPush(pp);
66 void containertypeParser::onEnd(const char *el,parser* child)
68 std::string element(el);
69 if(element == "machine")machine_(((machinetypeParser*)child)->post());
70 if(element == "property")property(((propertytypeParser*)child)->post());
72 void containertypeParser::pre ()
74 _container._machs.clear();
75 _container._props.clear();
77 void containertypeParser::name(const std::string& name){ _container._name=name; }
78 void containertypeParser::machine_(const machine& m)
80 DEBTRACE( "machine: " << m._name )
81 _container._machs.push_back(m);
83 void containertypeParser::property (const myprop& prop)
85 DEBTRACE( "property_set: " << prop._name << " " << prop._value );
86 _container._props[prop._name]=prop._value;
88 mycontainer containertypeParser::post()
90 //mincount("machine",1);
94 void loadtypeParser::buildAttr(const XML_Char** attr)
96 required("container",attr);
97 for (int i = 0; attr[i]; i += 2)
99 if(std::string(attr[i]) == "container")container(attr[i+1]);
102 void loadtypeParser::pre (){_loadon._container="";}
103 void loadtypeParser::container(const std::string& name){ _loadon._container=name; }
104 loadon loadtypeParser::post()