forked from argandas/ardubson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ardubsonObjBuilder.h
49 lines (38 loc) · 1.38 KB
/
ardubsonObjBuilder.h
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
/*
ardubson.h - Library for the BSON (Binary-JSON) format.
Created by Hugo Arganda (argandas), April 6, 2016.
Released into the public domain.
*/
/*
Check BSON specification at:
http://bsonspec.org/spec.html
*/
#ifndef ardubson_obj_builder_h
#define ardubson_obj_builder_h
#include "Arduino.h"
#include "ardubsonDocument.h"
#include "ardubsonElement.h"
#include "ardubsonObject.h"
class BSONObjBuilder: public BSONDocument
{
public:
/* Void constructor, create an empty BSON Object Builder */
BSONObjBuilder(void);
/* Constructor, create an BSON Object Builder from a byte buffer */
BSONObjBuilder(char *data, int len);
/* TODO: Append BSON elements */
BSONObjBuilder& append(BSONElement element);
/* Append C-string (Must be null terminated ) */
BSONObjBuilder& append(const char *key, char *value);
/* Append Buffer as C-string */
BSONObjBuilder& append(const char *key, char *value, int size);
/* Append bool */
BSONObjBuilder& append(const char *key, bool value);
/* Append numbers */
BSONObjBuilder& append(const char *key, int16_t value);
BSONObjBuilder& append(const char *key, int32_t value);
BSONObjBuilder& append(const char *key, int64_t value);
/* Create BSON Object */
BSONObject obj(void);
};
#endif /* ardubson_obj_builder_h */