| 1 | // |
|---|
| 2 | // MessagePack for C++ deserializing routine |
|---|
| 3 | // |
|---|
| 4 | // Copyright (C) 2008 FURUHASHI Sadayuki |
|---|
| 5 | // |
|---|
| 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 7 | // you may not use this file except in compliance with the License. |
|---|
| 8 | // You may obtain a copy of the License at |
|---|
| 9 | // |
|---|
| 10 | // http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 11 | // |
|---|
| 12 | // Unless required by applicable law or agreed to in writing, software |
|---|
| 13 | // distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 15 | // See the License for the specific language governing permissions and |
|---|
| 16 | // limitations under the License. |
|---|
| 17 | // |
|---|
| 18 | #include "unpack_context.hpp" |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | extern "C" { |
|---|
| 22 | using namespace msgpack; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | static inline object_class* msgpack_unpack_init(zone** z) |
|---|
| 26 | { return NULL; } |
|---|
| 27 | |
|---|
| 28 | static inline object_class* msgpack_unpack_unsigned_int_8(zone** z, uint8_t d) |
|---|
| 29 | { return (*z)->nu8(d); } |
|---|
| 30 | |
|---|
| 31 | static inline object_class* msgpack_unpack_unsigned_int_16(zone** z, uint16_t d) |
|---|
| 32 | { return (*z)->nu16(d); } |
|---|
| 33 | |
|---|
| 34 | static inline object_class* msgpack_unpack_unsigned_int_32(zone** z, uint32_t d) |
|---|
| 35 | { return (*z)->nu32(d); } |
|---|
| 36 | |
|---|
| 37 | static inline object_class* msgpack_unpack_unsigned_int_64(zone** z, uint64_t d) |
|---|
| 38 | { return (*z)->nu64(d); } |
|---|
| 39 | |
|---|
| 40 | static inline object_class* msgpack_unpack_signed_int_8(zone** z, int8_t d) |
|---|
| 41 | { return (*z)->ni8(d); } |
|---|
| 42 | |
|---|
| 43 | static inline object_class* msgpack_unpack_signed_int_16(zone** z, int16_t d) |
|---|
| 44 | { return (*z)->ni16(d); } |
|---|
| 45 | |
|---|
| 46 | static inline object_class* msgpack_unpack_signed_int_32(zone** z, int32_t d) |
|---|
| 47 | { return (*z)->ni32(d); } |
|---|
| 48 | |
|---|
| 49 | static inline object_class* msgpack_unpack_signed_int_64(zone** z, int64_t d) |
|---|
| 50 | { return (*z)->ni64(d); } |
|---|
| 51 | |
|---|
| 52 | static inline object_class* msgpack_unpack_float(zone** z, float d) |
|---|
| 53 | { return (*z)->nfloat(d); } |
|---|
| 54 | |
|---|
| 55 | static inline object_class* msgpack_unpack_double(zone** z, double d) |
|---|
| 56 | { return (*z)->ndouble(d); } |
|---|
| 57 | |
|---|
| 58 | static inline object_class* msgpack_unpack_nil(zone** z) |
|---|
| 59 | { return (*z)->nnil(); } |
|---|
| 60 | |
|---|
| 61 | static inline object_class* msgpack_unpack_true(zone** z) |
|---|
| 62 | { return (*z)->ntrue(); } |
|---|
| 63 | |
|---|
| 64 | static inline object_class* msgpack_unpack_false(zone** z) |
|---|
| 65 | { return (*z)->nfalse(); } |
|---|
| 66 | |
|---|
| 67 | static inline object_class* msgpack_unpack_array_start(zone** z, unsigned int n) |
|---|
| 68 | { return (*z)->narray(n); } |
|---|
| 69 | |
|---|
| 70 | static inline void msgpack_unpack_array_item(zone** z, object_class* c, object_class* o) |
|---|
| 71 | { reinterpret_cast<object_array*>(c)->push_back(o); } |
|---|
| 72 | |
|---|
| 73 | static inline object_class* msgpack_unpack_map_start(zone** z, unsigned int n) |
|---|
| 74 | { return (*z)->narray(); } |
|---|
| 75 | |
|---|
| 76 | static inline void msgpack_unpack_map_item(zone** z, object_class* c, object_class* k, object_class* v) |
|---|
| 77 | { reinterpret_cast<object_map*>(c)->store(k, v); } |
|---|
| 78 | |
|---|
| 79 | static inline object_class* msgpack_unpack_raw(zone** z, const void* b, const void* p, size_t l) |
|---|
| 80 | { return (*z)->nraw_ref(p, l); } |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | } // extern "C" |
|---|
| 84 | |
|---|
| 85 | #include "msgpack/unpack/inline_impl.h" |
|---|
| 86 | |
|---|