/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef BSON_H
#define BSON_H
#define BSON_INSIDE
#include "bson/bson-compat.h"
#include <string.h>
#include <time.h>
#include "bson/bson-macros.h"
#include "bson/bson-config.h"
#include "bson/bson-atomic.h"
#include "bson/bson-context.h"
#include "bson/bson-clock.h"
#include "bson/bson-decimal128.h"
#include "bson/bson-error.h"
#include "bson/bson-iter.h"
#include "bson/bson-json.h"
#include "bson/bson-keys.h"
#include "bson/bson-md5.h"
#include "bson/bson-memory.h"
#include "bson/bson-oid.h"
#include "bson/bson-reader.h"
#include "bson/bson-string.h"
#include "bson/bson-types.h"
#include "bson/bson-utf8.h"
#include "bson/bson-value.h"
#include "bson/bson-version.h"
#include "bson/bson-version-functions.h"
#include "bson/bson-writer.h"
#include "bson/bcon.h"
#undef BSON_INSIDE
BSON_BEGIN_DECLS
/**
* bson_empty:
* @b: a bson_t.
*
* Checks to see if @b is an empty BSON document. An empty BSON document is
* a 5 byte document which contains the length (4 bytes) and a single NUL
* byte indicating end of fields.
*/
#define bson_empty(b) (((b)->len == 5) || !bson_get_data ((b))[4])
/**
* bson_empty0:
*
* Like bson_empty() but treats NULL the same as an empty bson_t document.
*/
#define bson_empty0(b) (!(b) || bson_empty (b))
/**
* bson_clear:
*
* Easily free a bson document and set it to NULL. Use like:
*
* bson_t *doc = bson_new();
* bson_clear (&doc);
* BSON_ASSERT (doc == NULL);
*/
#define bson_clear(bptr) \
do { \
if (*(bptr)) { \
bson_destroy (*(bptr)); \
*(bptr) = NULL; \
} \
} while (0)
/**
* BSON_MAX_SIZE:
*
* The maximum size in bytes of a BSON document.
*/
#define BSON_MAX_SIZE ((size_t) ((1U << 31) - 1))
#define BSON_APPEND_ARRAY(b, key, val) \
bson_append_array (b, key, (int) strlen (key), val)
#define BSON_APPEND_ARRAY_BEGIN(b, key, child) \
bson_append_array_begin (b, key, (int) strlen (key), child)
#define BSON_APPEND_BINARY(b, key, subtype, val, len) \
bson_append_binary (b, key, (int) strlen (key), subtype, val, len)
#define BSON_APPEND_BOOL(b, key, val) \
bson_append_bool (b, key, (int) strlen (key), val)
#define BSON_APPEND_CODE(b, key, val) \
bson_append_code (b, key, (int) strlen (key), val)
#define BSON_APPEND_CODE_WITH_SCOPE(b, key, val, scope) \
bson_append_code_with_scope (b, key, (int) strlen (key), val, scope)
#define BSON_APPEND_DBPOINTER(b, key, coll, oid) \
bson_append_dbpointer (b, key, (int) strlen (key), coll, oid)
#define BSON_APPEND_DOCUMENT_BEGIN(b, key, child) \
bson_append_document_begin (b, key, (int) strlen (key), child)
#define BSON_APPEND_DOUBLE(b, key, val) \
bson_append_double (b, key, (int) strlen (key), val)
#define BSON_APPEND_DOCUMENT(b, key, val) \
bson_append_document (b, key, (int) strlen (key), val)
#define BSON_APPEND_INT32(b, key, val) \
bson_append_int32 (b, key, (int) strlen (key), val)
#define BSON_APPEND_INT64(b, key, val) \
bson_append_int64 (b, key, (int) strlen (key), val)
#define BSON_APPEND_MINKEY(b, key) \
bson_append_minkey (b, key, (int) strlen (key))
#define BSON_APPEND_DECIMAL128(b, key, val) \
bson_append_decimal128 (b, key, (int) strlen (key), val)
#define BSON_APPEND_MAXKEY(b, key) \
bson_append_maxkey (b, key, (int) strlen (key))
#define BSON_APPEND_NULL(b, key) bson_append_null (b, key, (int) strlen (key))
#define BSON_APPEND_OID(b, key, val) \
bson_append_oid (b, key, (int) strlen (key), val)
#define BSON_APPEND_REGEX(b, key, val, opt) \
bson_append_regex (b, key, (int) strlen (key), val, opt)
#define BSON_APPEND_UTF8(b, key, val) \
bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val))
#define BSON_APPEND_SYMBOL(b, key, val) \
bson_append_symbol (b, key, (int) strlen (key), val, (int) strlen (val))
#define BSON_APPEND_TIME_T(b, key, val) \
bson_append_time_t (b, key, (int) strlen (key), val)
#define BSON_APPEND_TIMEVAL(b, key, val) \
bson_append_timeval (b, key, (int) strlen (key), val)
#define BSON_APPEND_DATE_TIME(b, key, val) \
bson_append_date_time (b, key, (int) strlen (key), val)
#define BSON_APPEND_TIMESTAMP(b, key, val, inc) \
bson_append_timestamp (b, key, (int) strlen (key), val, inc)
#define BSON_APPEND_UNDEFINED(b, key) \
bson_append_undefined (b, key, (int) strlen (key))
#define BSON_APPEND_VALUE(b, key, val) \
bson_append_value (b, key, (int) strlen (key), (val))
/**
* bson_new:
*
* Allocates a new bson_t structure. Call the various bson_append_*()
* functions to add fields to the bson. You can iterate the bson_t at any
* time using a bson_iter_t and bson_iter_init().
*
* Returns: A newly allocated bson_t that should be freed with bson_destroy().
*/
BSON_EXPORT (bson_t *)
bson_new (void);
BSON_EXPORT (bson_t *)
bson_new_from_json (const uint8_t *data, ssize_t len, bson_error_t *error);
BSON_EXPORT (bool)
bson_init_from_json (bson_t *bson,
const char *data,
ssize_t len,
bson_error_t *error);
/**
* bson_init_static:
* @b: A pointer to a bson_t.
* @data: The data buffer to use.
* @length: The length of @data.
*
* Initializes a bson_t using @data and @length. This is ideal if you would
* like to use a stack allocation for your bson and do not need to grow the
* buffer. @data must be valid for the life of @b.
*
* Returns: true if initialized successfully; otherwise false.
*/
BSON_EXPORT (bool)
bson_init_static (bson_t *b, const uint8_t *data, size_t length);
/**
* bson_init:
* @b: A pointer to a bson_t.
*
* Initializes a bson_t for use. This function is useful to those that want a
* stack allocated bson_t. The usefulness of a stack allocated bson_t is
* marginal as the target buffer for content will still require heap
* allocations. It can help reduce heap fragmentation on allocators that do
* not employ SLAB/magazine semantics.
*
* You must call bson_destroy() with @b to release resources when you are done
* using @b.
*/
BSON_EXPORT (void)
bson_init (bson_t *b);
/**
* bson_reinit:
* @b: (inout): A bson_t.
*
* This is equivalent to calling bson_destroy() and bson_init() on a #bson_t.
* However, it will try to persist the existing malloc'd buffer if one exists.
* This is useful in cases where you want to reduce malloc overhead while
* building many documents.
*/
BSON_EXPORT (void)
bson_reinit (bson_t *b);
/**
* bson_new_from_data:
* @data: A buffer containing a serialized bson document.
* @length: The length of the document in bytes.
*
* Creates a new bson_t structure using the data provided. @data should contain
* at least @length bytes that can be copied into the new bson_t structure.
*
* Returns: A newly allocated bson_t that should be freed with bson_destroy().
* If the first four bytes (little-endian) of data do not match @length,
* then NULL will be returned.
*/
BSON_EXPORT (bson_t *)
bson_new_from_data (const uint8_t *data, size_t length);
/**
* bson_new_from_buffer:
* @buf: A pointer to a buffer containing a serialized bson document.
* @buf_len: The length of the buffer in bytes.
* @realloc_fun: a realloc like function
* @realloc_fun_ctx: a context for the realloc function
*
* Creates a new bson_t structure using the data provided. @buf should contain
* a bson document, or null
没有合适的资源?快使用搜索试试~ 我知道了~
MongoDB C++ Driver 3.4.x release
共96个文件
h:73个
cmake:8个
pc:5个
需积分: 9 21 下载量 21 浏览量
2018-12-12
17:29:41
上传
评论
收藏 1.3MB RAR 举报
温馨提示
MongoDB C++ Driver 3.4.x 版,是目前最新版本。需要和MongoDBC驱动一起使用。
资源推荐
资源详情
资源评论
收起资源包目录
mongodb-cxx-driver-dll64-release.rar (96个子文件)
mongodb-cxx-driver-dll64-release
lib
bson-static-1.0.lib 737KB
mongoc-static-1.0.lib 2.06MB
bson-1.0.lib 46KB
cmake
libbson-1.0
libbson-1.0-config-version.cmake 1012B
libbson-1.0-config.cmake 2KB
libbson-static-1.0
libbson-static-1.0-config-version.cmake 1012B
libbson-static-1.0-config.cmake 2KB
libmongoc-1.0
libmongoc-1.0-config-version.cmake 1012B
libmongoc-1.0-config.cmake 3KB
libmongoc-static-1.0
libmongoc-static-1.0-config.cmake 3KB
libmongoc-static-1.0-config-version.cmake 1012B
pkgconfig
libbson-1.0.pc 265B
libmongoc-1.0.pc 292B
libmongoc-ssl-1.0.pc 248B
libmongoc-static-1.0.pc 415B
libbson-static-1.0.pc 309B
mongoc-1.0.lib 141KB
share
mongo-c-driver
uninstall.cmd 17KB
bin
libmongoc-1.0.dll 478KB
msvcp140.dll 611KB
concrt140.dll 322KB
libbson-1.0.dll 161KB
vcruntime140.dll 85KB
include
libbson-1.0
bson.h 689B
bson
bson-oid.h 6KB
bson-clock.h 1KB
bson-compat.h 4KB
bson.h 33KB
bson-md5.h 3KB
bson-iter.h 13KB
bson-json.h 2KB
bson-context.h 1KB
bson-config.h 3KB
bson-atomic.h 3KB
bson-utf8.h 1KB
bson-reader.h 3KB
bson-value.h 908B
bson-string.h 2KB
bson-writer.h 2KB
bson-keys.h 938B
bson-memory.h 2KB
bson-endian.h 6KB
bson-version-functions.h 1KB
bcon.h 11KB
bson-types.h 17KB
bson-error.h 1KB
bson-macros.h 7KB
bson-version.h 2KB
bson-decimal128.h 2KB
libmongoc-1.0
mongoc.h 699B
mongoc
mongoc-stream-tls-openssl.h 1KB
mongoc-macros.h 2KB
mongoc.h 2KB
mongoc-find-and-modify.h 3KB
mongoc-stream-tls-libressl.h 1KB
mongoc-stream-file.h 1KB
mongoc-socket.h 4KB
mongoc-init.h 976B
mongoc-gridfs.h 3KB
mongoc-bulk-operation.h 7KB
mongoc-index.h 2KB
mongoc-gridfs-file-list.h 1KB
mongoc-client-session.h 5KB
mongoc-gridfs-file.h 4KB
mongoc-config.h 9KB
mongoc-cursor.h 3KB
mongoc-error.h 3KB
mongoc-iovec.h 1KB
mongoc-stream-tls.h 2KB
mongoc-topology-description.h 1KB
mongoc-write-concern.h 3KB
mongoc-apm.h 13KB
mongoc-client.h 10KB
mongoc-matcher.h 1KB
mongoc-version-functions.h 1KB
mongoc-server-description.h 2KB
mongoc-rand.h 1KB
mongoc-read-concern.h 2KB
mongoc-handshake.h 3KB
mongoc-version.h 3KB
mongoc-gridfs-file-page.h 1KB
mongoc-change-stream.h 1KB
mongoc-uri.h 8KB
mongoc-stream-buffered.h 1KB
mongoc-stream.h 4KB
mongoc-client-pool.h 2KB
mongoc-ssl.h 1KB
mongoc-host-list.h 1KB
mongoc-stream-gridfs.h 1KB
mongoc-stream-socket.h 1KB
mongoc-database.h 7KB
mongoc-flags.h 5KB
mongoc-read-prefs.h 3KB
mongoc-opcode.h 1KB
mongoc-log.h 4KB
mongoc-collection.h 17KB
共 96 条
- 1
资源评论
abc381289080
- 粉丝: 0
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Arduino Nano的红外循迹小车源码(高分课设).zip
- 将MS SQL数据库表里的数据内容生成SQL执行语句
- 基于MATLAB的钢板表面缺陷检测系统
- MS SQL里生成行政区域县区信息表和相应数据
- delphi实现DBGrid全选和反选功能
- 25C11F41-2B2A-4D1A-AAA8-7C654526B129.pdf
- Android Studio Jellyfish(android-studio-2023.3.1.18-cros.deb)
- MVC+EF框架+EasyUI实现权限管理源码程序
- python第66-75天,Day66-75.rar
- python后端服务project-of-tornado.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功