-
Notifications
You must be signed in to change notification settings - Fork 0
/
bson2v8.h
48 lines (32 loc) · 901 Bytes
/
bson2v8.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
#ifndef Included_BSON2V8_H
#define Included_BSON2V8_H
#include <node.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "mongo/src/mongo.h"
using namespace v8;
using namespace std;
// Handle legacy V8 API
namespace bson2v8 {
class Utilities {
private:
public:
/*
* convert v8string to char* type
*/
static char* GetCStringFromV8String (Local<v8::Value> value, const char* fallback);
/*
* parse and convert the bson to v8 object
*/
static Local<Object> ParseBSON (const char* buffer);
static Local<Object> ParseBSON (const char* buffer, int array_flag);
static Local<Object> ParseBSON (const bson* buffer);
static Local<Object> ParseBSON (const bson* buffer, int array_flag);
/*
* conver a v8 obj to bson for inserting
*/
static void ToBSON(Local<Value> in, bson* out);
};
}
#endif