25 #ifndef AOSSL_MONGO_INCLUDE_MONGO_BUFFER_INTERFACE_H_ 26 #define AOSSL_MONGO_INCLUDE_MONGO_BUFFER_INTERFACE_H_ 32 #include <unordered_map> 34 #include "aossl/core/include/buffers.h" 38 const int MONGO_STRING_UTF8 = 0;
44 const char * what_str;
48 int_msg =
"Error in Bson Document: " + msg;
49 what_str = int_msg.c_str();
56 const char *
what()
const throw() {
70 virtual bool successful() = 0;
72 virtual std::string get_error_message() = 0;
74 virtual bson_t* get_bson() = 0;
76 virtual void add_oid(std::string value) = 0;
78 virtual void get_oid(std::string key, std::string &value) = 0;
80 virtual void add_string(std::string key, std::string value) = 0;
82 virtual void add_string(std::string value,
int encoding) = 0;
84 virtual void add_string(std::string value) = 0;
86 virtual void add_string(std::string key, std::string value,
int encoding) = 0;
88 virtual void get_string(std::string key, std::string &value) = 0;
90 virtual void add_bool(std::string key,
bool value) = 0;
92 virtual void add_bool(
bool value) = 0;
94 virtual bool get_bool(std::string key) = 0;
96 virtual void add_int(std::string key,
int value) = 0;
98 virtual void add_int(
int value) = 0;
100 virtual int get_int(std::string key) = 0;
102 virtual void add_double(std::string key,
double value) = 0;
104 virtual void add_double(
double value) = 0;
106 virtual double get_double(std::string key) = 0;
108 virtual void add_date(std::string key,
int value) = 0;
110 virtual void add_date(
int value) = 0;
112 virtual int get_date(std::string key) = 0;
114 virtual void start_array(std::string key) = 0;
116 virtual void end_array() = 0;
118 virtual void start_object(std::string key) = 0;
120 virtual void end_object() = 0;
122 virtual int count_keys() = 0;
124 virtual bool has_field(std::string key) = 0;
129 virtual std::string to_json() = 0;
134 virtual std::string to_json(
int string_length) = 0;
138 #endif // AOSSL_MONGO_INCLUDE_MONGO_BUFFER_INTERFACE_H_ BSON Exception, used to store document-related errors.
Definition: mongo_buffer_interface.h:41
BsonException(std::string msg)
Create a Mongo Exception, and store the given error message.
Definition: mongo_buffer_interface.h:47
A Structure for holding a BSON Document.
Definition: mongo_buffer_interface.h:66
std::string int_msg
An error message passed on initialization.
Definition: mongo_buffer_interface.h:43
const char * what() const
Show the error message in readable format.
Definition: mongo_buffer_interface.h:56
Definition: mongo_buffer_interface.h:36