BiSON 1.2.5

BiSON 1.2.5

测试已测试
语言语言 CC
许可证 BSD-3-Clause
发布最后发布2021年6月

Joel Fischer 维护。



BiSON 1.2.5

  • SmartDeviceLink 团队

README

BSON 转换库

构建库

./configure
make

安装库

sudo make install

构建 Lua 封装器

安装依赖项

sudo apt-get install lua5.2 liblua5.2 liblua5.2-dev

构建库

./configure --with-lua-wrapper=yes
make

使用Lua库

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

Apple平台

有适用于iOS、MacOS、tvOS和watchOS的CocoaPod。将其添加到您的podfile文件中

pod 'BiSON'

Android平台

有适用于Android的jCenter构件。将其添加到您的 build.gradle 文件中

dependencies {
    compile ('com.smartdevicelink:bson_java_port:1.2.2')
}

构建和运行示例程序

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