libiqxmlrpc  0.12.12
response.h
1 // Libiqxmlrpc - an object-oriented XML-RPC solution.
2 // Copyright (C) 2011 Anton Dedov
3 
4 #ifndef _iqxmlrpc_response_h_
5 #define _iqxmlrpc_response_h_
6 
7 #include <boost/shared_ptr.hpp>
8 #include <string>
9 #include "api_export.h"
10 
11 namespace iqxmlrpc {
12 
13 class Response;
14 class Value;
15 
16 #ifdef _MSC_VER
17 #pragma warning(push)
18 #pragma warning(disable: 4251)
19 #endif
20 
22 LIBIQXMLRPC_API Response parse_response( const std::string& );
23 
25 LIBIQXMLRPC_API std::string dump_response( const Response& );
26 
28 class LIBIQXMLRPC_API Response {
29 public:
30  Response( Value* );
31  Response( int fault_code, const std::string& fault_string );
32 
34  const Value& value() const;
35 
37  bool is_fault() const { return !value_; }
39  int fault_code() const { return fault_code_; }
41  const std::string& fault_string() const { return fault_string_; }
42 
43 private:
44  boost::shared_ptr<Value> value_;
45  int fault_code_;
46  std::string fault_string_;
47 };
48 
49 #ifdef _MSC_VER
50 #pragma warning(pop)
51 #endif
52 
53 } // namespace iqxmlrpc
54 
55 #endif
Proxy class to access XML-RPC values by library users.
Definition: value.h:19
std::string dump_response(const Response &response)
Dump response to XML.
Definition: response.cc:26
XML-RPC response.
Definition: response.h:28
XML-RPC library.
Definition: auth_plugin.cc:6
int fault_code() const
Returns fault code of Fault Response.
Definition: response.h:39
bool is_fault() const
Check whether response is an XML-RPC Fault Reponse.
Definition: response.h:37
Response parse_response(const std::string &response_string)
Build response object from XML-formed string.
Definition: response.cc:17
const std::string & fault_string() const
Returns fault string of Fault Response.
Definition: response.h:41