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 #ifndef _XMLRPCPARSERS_HXX_
20 #define _XMLRPCPARSERS_HXX_
22 #include "parserBase.hxx"
23 #include "factory.hxx"
29 /*! \brief Class for XML-RPC value parser.
31 * This class is used to parse XML data that describes a sequence in XML-RPC format
35 <xsd:complexType name="ValueType">
37 <xsd:element name="int" type="IntType"/>
38 <xsd:element name="boolean" type="BooleanType"/>
39 <xsd:element name="double" type="DoubleType"/>
40 <xsd:element name="string" type="StringType"/>
41 <xsd:element name="objref" type="ObjrefType"/>
42 <xsd:element name="array" type="ArrayType"/>
43 <xsd:element name="struct" type="StructType"/>
48 struct valuetypeParser: parser
50 static valuetypeParser valueParser;
51 virtual void onStart(const XML_Char* el, const XML_Char** attr);
52 virtual void onEnd(const char *el,parser* child);
54 virtual void int_ (const int& d);
55 virtual void boolean (const bool& d);
56 virtual void double_ (const double& d);
57 virtual void string(const std::string& d);
58 virtual void objref(const std::string& d);
59 virtual void array (const std::string& d);
60 virtual void struct_ (const std::string& d);
61 virtual std::string post();
63 std::vector<std::string> _v;
66 /*! \brief Class for XML-RPC data parser.
68 * This class is used to parse XML data that describes a sequence in XML-RPC format
72 <xsd:complexType name="DataType">
73 <xsd:element name="value" type="ValueType"/>
77 struct datatypeParser: parser
79 static datatypeParser dataParser;
80 virtual void onStart(const XML_Char* el, const XML_Char** attr);
81 virtual void onEnd(const char *el,parser* child);
83 virtual void value (const std::string& v);
84 virtual std::string post();
86 std::vector<std::string> _datas;
89 /*! \brief Class for XML-RPC member parser.
91 * This class is used to parse XML data that describes a sequence in XML-RPC format
95 <xsd:complexType name="MemberDataType">
96 <xsd:element name="name" type="StringType"/>
97 <xsd:element name="value" type="ValueType"/>
101 struct memberdatatypeParser: parser
103 static memberdatatypeParser memberdataParser;
104 virtual void onStart(const XML_Char* el, const XML_Char** attr);
105 virtual void onEnd(const char *el,parser* child);
107 virtual void name (const std::string& v);
108 virtual void value (const std::string& v);
109 virtual std::string post();
111 std::vector<std::string> _datas;
114 /*! \brief Class for XML-RPC struct parser.
116 * This class is used to parse XML data that describes a sequence in XML-RPC format
120 <xsd:complexType name="StructDataType">
121 <xsd:element name="member" type="MemberDataType" minOccurs="1"/>
125 struct structdatatypeParser: parser
127 static structdatatypeParser structdataParser;
128 virtual void onStart(const XML_Char* el, const XML_Char** attr);
129 virtual void onEnd(const char *el,parser* child);
131 virtual void member (const std::string& d);
132 virtual std::string post();
133 std::string _members;
134 std::vector<std::string> _membersStack;
137 /*! \brief Class for XML-RPC array parser.
139 * This class is used to parse XML data that describes a sequence in XML-RPC format
143 <xsd:complexType name="ArrayType">
144 <xsd:element name="data" type="DataType" minOccurs="1" maxOccurs="1"/>
148 struct arraytypeParser: parser
150 static arraytypeParser arrayParser;
151 virtual void onStart(const XML_Char* el, const XML_Char** attr);
152 virtual void onEnd(const char *el,parser* child);
154 virtual void data (const std::string& d);
155 virtual std::string post();
156 std::vector<std::string> _arrays;
159 struct parametertypeParser: parser
161 static parametertypeParser parameterParser;
163 virtual void onStart(const XML_Char* el, const XML_Char** attr);
164 virtual void onEnd(const char *el,parser* child);
166 virtual void tonode (const std::string& name);
167 virtual void toport (const std::string& name);
168 virtual void value (const std::string& name);
169 virtual myparam& post();