summaryrefslogtreecommitdiff
path: root/cpp/unpack_inline.cpp
blob: 37e0b666bee66c76f125c9e3381c396b1a01d4d9 (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// MessagePack for C++ deserializing routine
//
// Copyright (C) 2008 FURUHASHI Sadayuki
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
#include "unpack_context.hpp"


extern "C" {
using namespace msgpack;


static inline object_class* msgpack_unpack_init(zone** z)
{ return NULL; }

static inline object_class* msgpack_unpack_unsigned_int_8(zone** z, uint8_t d)
{ return (*z)->nu8(d); }

static inline object_class* msgpack_unpack_unsigned_int_16(zone** z, uint16_t d)
{ return (*z)->nu16(d); }

static inline object_class* msgpack_unpack_unsigned_int_32(zone** z, uint32_t d)
{ return (*z)->nu32(d); }

static inline object_class* msgpack_unpack_unsigned_int_64(zone** z, uint64_t d)
{ return (*z)->nu64(d); }

static inline object_class* msgpack_unpack_signed_int_8(zone** z, int8_t d)
{ return (*z)->ni8(d); }

static inline object_class* msgpack_unpack_signed_int_16(zone** z, int16_t d)
{ return (*z)->ni16(d); }

static inline object_class* msgpack_unpack_signed_int_32(zone** z, int32_t d)
{ return (*z)->ni32(d); }

static inline object_class* msgpack_unpack_signed_int_64(zone** z, int64_t d)
{ return (*z)->ni64(d); }

static inline object_class* msgpack_unpack_float(zone** z, float d)
{ return (*z)->nfloat(d); }

static inline object_class* msgpack_unpack_double(zone** z, double d)
{ return (*z)->ndouble(d); }

static inline object_class* msgpack_unpack_nil(zone** z)
{ return (*z)->nnil(); }

static inline object_class* msgpack_unpack_true(zone** z)
{ return (*z)->ntrue(); }

static inline object_class* msgpack_unpack_false(zone** z)
{ return (*z)->nfalse(); }

static inline object_class* msgpack_unpack_array_start(zone** z, unsigned int n)
{ return (*z)->narray(n); }

static inline void msgpack_unpack_array_item(zone** z, object_class* c, object_class* o)
{ reinterpret_cast<object_array*>(c)->push_back(o); }

static inline object_class* msgpack_unpack_map_start(zone** z, unsigned int n)
{ return (*z)->narray(); }

static inline void msgpack_unpack_map_item(zone** z, object_class* c, object_class* k, object_class* v)
{ reinterpret_cast<object_map*>(c)->store(k, v); }

static inline object_class* msgpack_unpack_raw(zone** z, const void* b, const void* p, size_t l)
{ return (*z)->nraw_ref(p, l); }


}  // extern "C"

#include "msgpack/unpack/inline_impl.h"