Skip to content

Commit d3f36f5

Browse files
committed
Bind BsonValue
* Add bindings for bson_value_t. Highly experimental
1 parent a03af40 commit d3f36f5

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

partials/libbson/BsonValue.vapi

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
2+
//FIXME
3+
4+
/**
5+
* bson_value_t
6+
*/
7+
8+
[CCode (cname = "bson_value_t", free_function = "bson_value_destroy", copy_function = "bson_value_copy", has_type_id = false)]
9+
[Compact]
10+
public struct BsonValue {
11+
12+
public BsonType value_type;
13+
14+
//Union
15+
[CCode (cname = "value.v_oid")]
16+
public unowned BsonOid v_oid;
17+
18+
[CCode (cname = "value.v_int64")]
19+
public unowned int64 v_int64;
20+
21+
[CCode (cname = "value.v_int32")]
22+
public unowned int32 v_int32;
23+
24+
[CCode (cname = "value.v_int8")]
25+
public unowned int8 v_int8;
26+
27+
[CCode (cname = "value.v_double")]
28+
public unowned double v_double;
29+
30+
[CCode (cname = "value.v_bool")]
31+
public unowned bool v_bool;
32+
33+
[CCode (cname = "value.v_datetime")]
34+
public unowned int64 v_datetime;
35+
36+
[CCode (cname = "value.v_timestamp")]
37+
public unowned BsonValueTimeStamp v_timestamp;
38+
39+
[CCode (cname = "value.v_utf8")]
40+
public unowned BsonValueUtf8 v_utf8;
41+
42+
[CCode (cname = "value.v_doc")]
43+
public unowned BsonValueDoc v_doc;
44+
45+
[CCode (cname = "value.v_binary")]
46+
public unowned BsonValueBinary v_binary;
47+
48+
[CCode (cname = "value.v_regex")]
49+
public unowned BsonValueRegex v_regex;
50+
51+
[CCode (cname = "value.v_dbpointer")]
52+
public unowned BsonValueDbpointer v_dbpointer;
53+
54+
[CCode (cname = "value.v_code")]
55+
public unowned BsonValueCode v_code;
56+
57+
[CCode (cname = "value.v_codewscope")]
58+
public unowned BsonValueCodewscope v_codewscope;
59+
60+
[CCode (cname = "value.v_symbol")]
61+
public unowned BsonValueSymbol v_symbol;
62+
63+
}
64+
65+
66+
public struct BsonValueTimeStamp {
67+
public unowned uint32 timestamp;
68+
public unowned uint32 increment;
69+
}
70+
71+
72+
public struct BsonValueUtf8 {
73+
public unowned uint32 len;
74+
public unowned string str;
75+
}
76+
77+
public struct BsonValueDoc {
78+
public unowned uint32 data_len;
79+
public unowned uint8[] data;
80+
}
81+
82+
public struct BsonValueBinary {
83+
public unowned uint32 data_len;
84+
public unowned uint8[] data;
85+
public unowned BsonSubtype subtype;
86+
}
87+
88+
public struct BsonValueRegex {
89+
public unowned string regex;
90+
public unowned string options;
91+
}
92+
93+
public struct BsonValueDbpointer {
94+
public unowned string collection;
95+
public unowned uint32 collection_len;
96+
public unowned BsonOid oid;
97+
}
98+
99+
public struct BsonValueCode {
100+
public unowned uint32 code_len;
101+
public unowned string code;
102+
}
103+
104+
public struct BsonValueCodewscope {
105+
public unowned uint32 code_len;
106+
public unowned string code;
107+
public unowned uint32 scope_len;
108+
public unowned uint8[] scope_data;
109+
}
110+
111+
public struct BsonValueSymbol {
112+
public unowned uint32 len;
113+
public unowned string symbol;
114+
}

0 commit comments

Comments
 (0)