11 #include <boost/concept_check.hpp>
15 const std::string NAMES[] = {
"unknown",
"floating point number",
"string",
"document",
"array",
16 "binary data",
"undefined",
"object ID",
"boolean",
"datetime",
17 "null value",
"regular expression",
"database pointer",
18 "javascript code",
"depreicated",
"scoped javascript",
"int 32",
19 "timestamp",
"int64"};
20 enum TypeInfo {_UNKNOWN=0, FLOATING=1, STRING, DOCUMENT, ARRAY, BINARY, UNDEF, OID, BOOL, DATETIME,
21 NIL, REGEX, DBPTR, JS, DEPRECATED, JS_SCOPE, INT32, TIMESTAMP, INT64,
22 MINKEY=0xFF, MAXKEY=0x7F
25 inline char to_char(
const TypeInfo & ti)
27 return static_cast<char>((int)ti);
32 std::string to_string();
34 inline std::string to_string(
const TypeInfo & ti)
36 return (ti == 0xFF?
"max key": (ti == 0x7F?
"min key": NAMES[ti]));
44 virtual const char* what()
const noexcept
46 std::string err =
"Invalid conversion from C++ type: " + to_string<T>() +
" to BSON type: " + to_string(m_ti);
56 virtual const char* what()
const noexcept
58 return "_UNKNOWN type not implemented";
Definition: typeinfo.h:40
Definition: typeinfo.h:53