1 // Copyright (C) 2006-2008 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
19 #include "containerParsers.hxx"
20 #include "propertyParsers.hxx"
24 containertypeParser containertypeParser::containerParser;
25 machinetypeParser machinetypeParser::machineParser;
26 loadtypeParser loadtypeParser::loadParser;
28 void machinetypeParser::buildAttr(const XML_Char** attr)
30 required("name",attr);
31 for (int i = 0; attr[i]; i += 2)
33 if(std::string(attr[i]) == "name")name(attr[i+1]);
36 void machinetypeParser::pre (){_mach._name="";}
37 void machinetypeParser::name(const std::string& name){ _mach._name=name; }
38 machine machinetypeParser::post()
43 void containertypeParser::buildAttr(const XML_Char** attr)
45 required("name",attr);
46 for (int i = 0; attr[i]; i += 2)
48 if(std::string(attr[i]) == "name")name(attr[i+1]);
51 void containertypeParser::onStart(const XML_Char* el, const XML_Char** attr)
53 std::string element(el);
54 parser* pp=&parser::main_parser;
55 if(element == "machine")pp=&machinetypeParser::machineParser;
56 if(element == "property")pp=&propertytypeParser::propertyParser;
57 SetUserDataAndPush(pp);
62 void containertypeParser::onEnd(const char *el,parser* child)
64 std::string element(el);
65 if(element == "machine")machine_(((machinetypeParser*)child)->post());
66 if(element == "property")property(((propertytypeParser*)child)->post());
68 void containertypeParser::pre ()
70 _container._machs.clear();
71 _container._props.clear();
73 void containertypeParser::name(const std::string& name){ _container._name=name; }
74 void containertypeParser::machine_(const machine& m)
76 DEBTRACE( "machine: " << m._name )
77 _container._machs.push_back(m);
79 void containertypeParser::property (const myprop& prop)
81 DEBTRACE( "property_set: " << prop._name << " " << prop._value );
82 _container._props[prop._name]=prop._value;
84 mycontainer containertypeParser::post()
86 //mincount("machine",1);
90 void loadtypeParser::buildAttr(const XML_Char** attr)
92 required("container",attr);
93 for (int i = 0; attr[i]; i += 2)
95 if(std::string(attr[i]) == "container")container(attr[i+1]);
98 void loadtypeParser::pre (){_loadon._container="";}
99 void loadtypeParser::container(const std::string& name){ _loadon._container=name; }
100 loadon loadtypeParser::post()