jbson
C++11/1y BSON library
|
View on GitHub
The jbson namespace contains the main classes and functions for viewing, creating and manipulating BSON data. More...
Namespaces | |
detail | |
namespace detail contains internal functions and classes | |
Classes | |
struct | array_builder |
array_builder provides a simple interface for array construction More... | |
class | basic_array |
BSON array. More... | |
class | basic_document |
BSON document. More... | |
struct | basic_element |
BSON element. More... | |
struct | builder |
builder provides a simple interface for document construction. More... | |
struct | incompatible_element_conversion |
Exception type thrown when a call to get<element_type>() has an incorrect type parameter. More... | |
struct | incompatible_type_conversion |
Exception thrown when an element has a value not convertible to that requested. More... | |
struct | invalid_document_size |
Exception thrown when an document's data size differs from that reported. More... | |
struct | invalid_element_size |
Exception thrown when an element's data size differs from that reported. More... | |
struct | invalid_element_type |
Exception type thrown when an element has a type value not represented by element_type. More... | |
struct | jbson_error |
Exception type. Base class of all exceptions thrown directly by jbson. More... | |
struct | json_parse_error |
struct | json_reader |
Typedefs | |
using | array = basic_array< std::vector< char >> |
Default basic_array type alias for owned BSON data. | |
template<typename Container > | |
using | basic_document_set = std::multiset< basic_element< Container >, detail::elem_compare > |
BSON document in the form of a std::set for ease of manipulation. | |
using | current_line_string = boost::error_info< struct line_, std::string > |
using | document = basic_document< std::vector< char >> |
Default basic_document type alias for owned BSON data. | |
using | document_set = basic_document_set< std::vector< char >> |
Default basic_document_set type alias. | |
using | element = basic_element< std::vector< char >> |
Default basic_element type alias for owned BSON data. | |
using | expected_token = boost::error_info< struct token_, std::string > |
using | line_number = boost::error_info< struct line_num_, size_t > |
using | line_position = boost::error_info< struct line_pos_, size_t > |
using | parse_error = boost::error_info< struct err_val_, json_error_num > |
Functions | |
std::string | error_message (json_parse_error &err) |
template<element_type EType, typename Container > | |
auto | get (const basic_element< Container > &elem) -> detail::ElementTypeMap< EType, Container > |
Access element value of specific element_type. More... | |
template<typename ReturnT , typename Container > | |
ReturnT | get (const basic_element< Container > &elem) |
Get value of specific type from a basic_element. More... | |
validity_level | operator& (validity_level a, validity_level b) |
Allow bitwise-and (&) for validity_level. | |
bool | operator< (validity_level a, validity_level b) |
Allow less than (<) comparison for validity_level. | |
template<typename CharT , typename TraitsT > | |
std::basic_ostream< CharT, TraitsT > & | operator<< (std::basic_ostream< CharT, TraitsT > &os, json_error_num err) |
template<typename CharT , typename TraitsT > | |
std::basic_ostream< CharT, TraitsT > & | operator<< (std::basic_ostream< CharT, TraitsT > &os, element_type e) |
Stream operator for getting a string representation of an element_type. | |
bool | operator> (validity_level a, validity_level b) |
Allow more than (>) comparison for validity_level. | |
validity_level | operator| (validity_level a, validity_level b) |
Allow bitwise-or (|) for validity_level. | |
template<typename Container , typename EContainer , typename StrRngT > | |
auto | path_select (basic_document< Container, EContainer > &&doc, StrRngT &&path_rng) |
template<typename ElemRangeT , typename StrRngT > | |
auto | path_select (ElemRangeT &&doc, StrRngT &&path_rng, std::enable_if_t< detail::is_range_of_value< ElemRangeT, boost::mpl::quote1< detail::is_element >>::value > *=nullptr) |
template<typename DocRangeT , typename StrRngT > | |
auto | path_select (DocRangeT &&docs, StrRngT &&path_rng, std::enable_if_t< detail::is_range_of_value< DocRangeT, boost::mpl::bind< boost::mpl::quote2< detail::is_range_of_value >, boost::mpl::arg< 1 >, boost::mpl::quote1< detail::is_element >>>::value > *=nullptr) |
template<typename Container > | |
void | swap (basic_element< Container > &a, basic_element< Container > &b) noexcept(noexcept(a.swap(b))) |
Non-member swap. Calls member swap. | |
template<typename Container , typename EContainer > | |
void | swap (basic_document< Container, EContainer > &a, basic_document< Container, EContainer > &b) noexcept(noexcept(a.swap(b))) |
Non-member swap for basic_document. Calls basic_document::swap. | |
template<typename Container , typename EContainer > | |
void | swap (basic_array< Container, EContainer > &a, basic_array< Container, EContainer > &b) noexcept(noexcept(a.swap(b))) |
Non-member swap for basic_document. Calls basic_document::swap. | |
std::string | to_string (const json_parse_error &) |
template<typename Container > | |
void | value_get (const basic_element< Container > &,...) |
template<typename Container > | |
void | value_get (const basic_element< Container > &elem, std::string &str) |
template<typename Container > | |
void | value_set (basic_element< Container > &,...) |
template<typename Container > | |
void | value_set (basic_element< Container > &c, builder val) |
template<typename Container , typename IteratorT > | |
void | value_set (basic_element< Container > &c, array_builder val) |
template<typename Container , typename SetContainer > | |
void | value_set (basic_element< Container > &c, const basic_document_set< SetContainer > &val) |
template<typename OutputIterator , typename Container > | |
std::decay_t< OutputIterator > | write_json (const basic_array< Container > &, OutputIterator) |
template<typename OutputIterator , typename Container > | |
std::decay_t< OutputIterator > | write_json (const basic_document< Container > &, OutputIterator) |
The jbson namespace contains the main classes and functions for viewing, creating and manipulating BSON data.
The jbson projects defines nothing outside of this namespace
|
strong |
The element_type enum represents a BSON data type.
Enumerator | |
---|---|
double_element |
double |
string_element |
std::string or boost::string_ref (string_type) |
document_element |
basic_document<boost::iterator_range<...>> (document_type) |
array_element |
basic_array<boost::iterator_range<...>> |
binary_element |
|
undefined_element |
void
|
oid_element |
std::array<char, 12> |
boolean_element |
bool |
date_element |
int64_t |
null_element |
void |
regex_element |
std::tuple<string_type, string_type> |
db_pointer_element |
std::tuple<string_type, std::array<char, 12>>
|
javascript_element |
string_type |
symbol_element |
string_type
|
scoped_javascript_element |
std::tuple<string_type, document_type> |
int32_element |
int32_t |
timestamp_element |
int64_t |
int64_element |
int64_t |
min_key |
void |
max_key |
void |
Definition at line 36 of file element_fwd.hpp.
|
strong |
Level of validity to test for with basic_document::valid.
Enumerator | |
---|---|
data_size |
Basic test for the size of the data. |
bson_size |
Basic test for the equality of the data size with that reported by the data. Includes above. |
element_construct |
Tests that each element can be constructed without error. Includes above. |
unicode_valid |
Tests for valid unicode in elements with type element_type::string_element. Includes above. |
array_indices |
Tests that array elements are integers named consecutively from 0 (zero). Includes above except unicode_valid. |
Definition at line 153 of file document.hpp.
auto jbson::get | ( | const basic_element< Container > & | elem | ) | -> detail::ElementTypeMap<EType, Container> |
Access element value of specific element_type.
elem | basic_element to fetch value from. |
EType | element_type which maps to the type to fetch. |
incompatible_element_conversion | When EType does not match the element_type of elem . |
invalid_element_size | When the size of the element's data is invalid for the return type. |
Definition at line 875 of file element.hpp.
ReturnT jbson::get | ( | const basic_element< Container > & | elem | ) |
Get value of specific type from a basic_element.
ReturnT | Specified return type. |
invalid_element_size | When the size of the element's data is invalid for the chosen type ReturnT . |
Definition at line 890 of file element.hpp.