-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbson_test.cpp
More file actions
65 lines (60 loc) · 1.05 KB
/
Copy pathbson_test.cpp
File metadata and controls
65 lines (60 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include "zero/util.h"
#include "zero/custom_intrin.h"
enum BsonType : int8_t {
BsonEnd = 0,
BsonDouble = 1,
BsonUTF8 = 2,
BsonObject = 3,
BsonArray = 4,
BsonBlob = 5,
BsonUndefined = 6,
BsonObjectID = 7,
BsonBool = 8,
BsonTime = 9,
BsonRegex = 10,
BsonDBPointer = 11,
BsonJS = 12,
BsonSymbol = 13,
BsonJSScoped = 14,
BsonInt32 = 15,
BsonTimestamp = 16,
BsonInt64 = 17,
BsonDecimal128 = 18,
BsonMinKey = -1,
BsonMaxKey = INT8_MAX
};
enum BsonBlobType : int8_t {
BsonBlobBinary = 0,
BsonBlobFunc = 1,
BsonBlobBinaryOld = 2,
BsonBlobUUIDOld = 3,
BsonBlobUUID = 4,
BsonBlobMD5 = 5,
BsonBlobEncrypted = 6,
BsonBlobCompressed = 7,
BsonBlobUser = INT8_MIN,
BsonBlobUserEnd = -1
};
struct BsonPString {
uint32_t buffer_size;
char8_t data[];
};
struct BsonCString {
char8_t data[];
};
struct BsonBlob {
uint32_t buffer_size;
BsonBlobType type;
uint8_t data[];
};
struct BsonValue {
BsonType type;
char8_t name[];
};
struct BsonFile {
uint32_t file_size;
};