1 // Copyright (C) 2006-2016 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, or (at your option) any later version.
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 #ifndef _XMLRPCPARSERS_HXX_
21 #define _XMLRPCPARSERS_HXX_
23 #include "parserBase.hxx"
24 #include "factory.hxx"
30 /*! \brief Class for XML-RPC value parser.
32 * This class is used to parse XML data that describes a sequence in XML-RPC format
36 <xsd:complexType name="ValueType">
38 <xsd:element name="int" type="IntType"/>
39 <xsd:element name="boolean" type="BooleanType"/>
40 <xsd:element name="double" type="DoubleType"/>
41 <xsd:element name="string" type="StringType"/>
42 <xsd:element name="objref" type="ObjrefType"/>
43 <xsd:element name="array" type="ArrayType"/>
44 <xsd:element name="struct" type="StructType"/>
49 struct valuetypeParser: parser
51 static valuetypeParser valueParser;
52 virtual void onStart(const XML_Char* el, const XML_Char** attr);
53 virtual void onEnd(const char *el,parser* child);
55 virtual void int_ (const int& d);
56 virtual void boolean (const bool& d);
57 virtual void double_ (const double& d);
58 virtual void string(const std::string& d);
59 virtual void objref(const std::string& d);
60 virtual void array (const std::string& d);
61 virtual void struct_ (const std::string& d);
62 virtual std::string post();
64 std::vector<std::string> _v;
67 /*! \brief Class for XML-RPC data parser.
69 * This class is used to parse XML data that describes a sequence in XML-RPC format
73 <xsd:complexType name="DataType">
74 <xsd:element name="value" type="ValueType"/>
78 struct datatypeParser: parser
80 static datatypeParser dataParser;
81 virtual void onStart(const XML_Char* el, const XML_Char** attr);
82 virtual void onEnd(const char *el,parser* child);
84 virtual void value (const std::string& v);
85 virtual std::string post();
87 std::vector<std::string> _datas;
90 /*! \brief Class for XML-RPC member parser.
92 * This class is used to parse XML data that describes a sequence in XML-RPC format
96 <xsd:complexType name="MemberDataType">
97 <xsd:element name="name" type="StringType"/>
98 <xsd:element name="value" type="ValueType"/>
102 struct memberdatatypeParser: parser
104 static memberdatatypeParser memberdataParser;
105 virtual void onStart(const XML_Char* el, const XML_Char** attr);
106 virtual void onEnd(const char *el,parser* child);
108 virtual void name (const std::string& v);
109 virtual void value (const std::string& v);
110 virtual std::string post();
112 std::vector<std::string> _datas;
115 /*! \brief Class for XML-RPC struct parser.
117 * This class is used to parse XML data that describes a sequence in XML-RPC format
121 <xsd:complexType name="StructDataType">
122 <xsd:element name="member" type="MemberDataType" minOccurs="1"/>
126 struct structdatatypeParser: parser
128 static structdatatypeParser structdataParser;
129 virtual void onStart(const XML_Char* el, const XML_Char** attr);
130 virtual void onEnd(const char *el,parser* child);
132 virtual void member (const std::string& d);
133 virtual std::string post();
134 std::string _members;
135 std::vector<std::string> _membersStack;
138 /*! \brief Class for XML-RPC array parser.
140 * This class is used to parse XML data that describes a sequence in XML-RPC format
144 <xsd:complexType name="ArrayType">
145 <xsd:element name="data" type="DataType" minOccurs="1" maxOccurs="1"/>
149 struct arraytypeParser: parser
151 static arraytypeParser arrayParser;
152 virtual void onStart(const XML_Char* el, const XML_Char** attr);
153 virtual void onEnd(const char *el,parser* child);
155 virtual void data (const std::string& d);
156 virtual std::string post();
157 std::vector<std::string> _arrays;
160 struct parametertypeParser: parser
162 static parametertypeParser parameterParser;
164 virtual void onStart(const XML_Char* el, const XML_Char** attr);
165 virtual void onEnd(const char *el,parser* child);
167 virtual void tonode (const std::string& name);
168 virtual void toport (const std::string& name);
169 virtual void value (const std::string& name);
170 virtual myparam& post();