用于 BSON 格式转换的库
./configure
make
sudo make install
sudo apt-get install lua5.2 liblua5.2 liblua5.2-dev
./configure --with-lua-wrapper=yes
make
bson = require("bson4lua");
bsonBytes = bson.to_bytes({
doubleValue = {
type = 0x01, --Double type
value = 3.141592653589793
},
intValue = {
type = 0x10, --Int32 Type
value = 360
},
stringValue = {
type = 0x02, --String type
value = "A string of characters"
}
});
print(bsonBytes:byte(1, string.len(bsonBytes)));
bsonTable = bson.to_table(string.char(0x05, 0x00, 0x00, 0x00, 0x00)); --Empty BSON document
print("Table: ");
for k, v in pairs(bsonTable) do
print(k, v);
end
iOS、MacOS、tvOS 和 watchOS 平台有 CocoaPod。添加到您的 podfile 文件中
pod 'BiSON'
Android 平台有 jCenter 工件。将以下内容添加到您的 build.gradle
文件中
dependencies {
api 'com.smartdevicelink:bson_java_port:1.2.5'
}
cd examples
gcc -o sample sample.c -lbson
./sample
运行单元测试需要安装带有 pkg-config 文件 (.pc) 的 check
框架。在 Ubuntu 上,请通过运行以下命令安装它
sudo apt-get install check
安装框架后,使用 --with-tests
选项调用 configure
,构建库,然后运行 make check
./configure --with-tests
make
make check