drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
json_handler.h
1 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2011-2013 Stewart Smith, Henrik Ingo, Mohit Srivastava
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
23
24#include <config.h>
25
26#include <json/json.h>
27#include <evhttp.h>
28#include <event.h>
29#include <drizzled/session.h>
30#include <plugin/json_server/error.h>
31
32using namespace drizzled;
33namespace drizzle_plugin
34{
35namespace json_server
36{
37 /*
38 * a class.
39 * used to handle operations related to Json.
40 */
42 {
43 public:
44 /*
45 * Generate an input query from http request object.
46 *
47 * @param req_arg the http request object.
48 */
49 void generate_input_query(struct evhttp_request *req_arg);
50 /*
51 * Generate an input json from http request object.
52 *
53 * @param req_arg the http request object.
54 * @param _json_error_area the JsonErrorArea object to handle error.
55 */
56 void generate_input_json(struct evhttp_request *req_arg,JsonErrorArea &_json_error_area);
57 /*
58 * Generate an output query string.
59 *
60 * @param _json_error_area the JsonErrorArea object to handle error.
61 */
62 void generate_output_query(JsonErrorArea& _json_error_area);
63 /*
64 * Generate an output Json.
65 *
66 * @param _json_error_area the JsonErrorArea object to handle error.
67 */
68 void generate_output_json(JsonErrorArea& _json_error_area);
69 /*
70 * Get an output query string.
71 *
72 * @return a const output query string.
73 */
74 const std::string& get_output_query() const
75 {
76 return _output_query;
77 }
78 /*
79 * Get an input query string.
80 *
81 * @return a const input query string.
82 */
83 const std::string& get_input_query() const
84 {
85 return _input_query;
86 }
87 /*
88 * Get an output json object.
89 *
90 * @return a const json object.
91 */
92 const Json::Value get_output_json() const
93 {
94 return _json_out;
95 }
96 /*
97 * Get an input json object.
98 *
99 * @return a const json object.
100 */
101 const Json::Value get_input_json() const
102 {
103 return _json_in;
104 }
105
106 private:
107 /*
108 * Stores input json object.
109 */
110 Json::Value _json_in;
111 /*
112 * Stores output json object.
113 */
114 Json::Value _json_out;
115 /*
116 * Stores input string.
117 */
118 std::string _input_query;
119 /*
120 * Stores output string.
121 */
122 std::string _output_query;
123 };
124}
125}
Defines the event_t struct that encapsulates an event.
TODO: Rename this file - func.h is stupid.