Giter Site home page Giter Site logo

dboltovskyi / bson_c_lib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smartdevicelink/bson_c_lib

0.0 1.0 0.0 644 KB

Library for converting a map to and from BSON format

License: BSD 3-Clause "New" or "Revised" License

Makefile 21.34% Shell 57.69% M4 0.27% C 18.71% Java 1.45% Ruby 0.53%

bson_c_lib's Introduction

README

Library for converting to and from BSON

Build library

./configure
make

Install library

sudo make install

Build Lua wrapper

Install Dependencies

sudo apt-get install liblua5.2-dev

Build Library

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

Using the Lua Library

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 Platforms

There is a CocoaPod for iOS, MacOS, tvOS, and watchOS. Add to your podfile:

pod 'BiSON'

Android Platforms

There is a jCenter artifact for Android. Add the following to your build.gradle:

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

Build and run sample program

cd examples
gcc -o sample sample.c -lbson
./sample

Build and run unit tests

Running unit tests requires check framework installed with pkg-config file (.pc). On Ubuntu, please install it by running:

sudo apt-get install check

Once the framework is installed, invoke configure with --with-tests option, build the library then run make check:

./configure --with-tests
make
make check

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.