libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
XmlrpcEncoder.h
Go to the documentation of this file.
1 /* Copyright 2013-2019 Homegear GmbH
2  *
3  * libhomegear-base is free software: you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation, either version 3 of the
6  * License, or (at your option) any later version.
7  *
8  * libhomegear-base 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
11  * GNU 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 libhomegear-base. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  * In addition, as a special exception, the copyright holders give
18  * permission to link the code of portions of this program with the
19  * OpenSSL library under certain conditions as described in each
20  * individual source file, and distribute linked combinations
21  * including the two.
22  * You must obey the GNU Lesser General Public License in all respects
23  * for all of the code used other than OpenSSL. If you modify
24  * file(s) with this exception, you may extend this exception to your
25  * version of the file(s), but you are not obligated to do so. If you
26  * do not wish to do so, delete this exception statement from your
27  * version. If you delete this exception statement from all source
28  * files in the program, then also delete it here.
29 */
30 
31 #ifndef XMLRPCENCODER_H_
32 #define XMLRPCENCODER_H_
33 
34 #include <memory>
35 #include <list>
36 
37 #include "../Exception.h"
38 #include "../Output/Output.h"
39 #include "../Variable.h"
40 
41 using namespace rapidxml;
42 
43 namespace BaseLib
44 {
45 
46 class SharedObjects;
47 
48 namespace Rpc
49 {
50 
52 {
53 public:
55  virtual ~XmlrpcEncoder() {}
56 
57  virtual void encodeResponse(std::shared_ptr<Variable> variable, std::vector<char>& encodedData);
58  virtual void encodeResponse(std::shared_ptr<Variable> variable, std::vector<uint8_t>& encodedData);
59  virtual void encodeRequest(std::string methodName, std::shared_ptr<std::vector<std::shared_ptr<Variable>>> parameters, std::vector<char>& encodedData);
60  virtual void encodeRequest(std::string methodName, std::shared_ptr<std::list<std::shared_ptr<Variable>>> parameters, std::vector<char>& encodedData);
61 private:
62  BaseLib::SharedObjects* _bl = nullptr;
63 
64  void encodeVariable(xml_document* doc, xml_node* node, std::shared_ptr<Variable> variable);
65  void encodeStruct(xml_document* doc, xml_node* node, std::shared_ptr<Variable> variable);
66  void encodeArray(xml_document* doc, xml_node* node, std::shared_ptr<Variable> variable);
67 };
68 
69 }
70 }
71 #endif
This is the base library main class.
Definition: BaseLib.h:95
Definition: BaseLib.cpp:34
virtual ~XmlrpcEncoder()
Definition: XmlrpcEncoder.h:55
Definition: XmlrpcEncoder.h:51
This class represents root of the DOM hierarchy.
Definition: rapidxml.h:729
Class representing a node of XML document.
Definition: rapidxml.h:539
Definition: BinaryPayload.h:38