MessagePack for C
Toggle main menu visibility
Loading...
Searching...
No Matches
msgpack
object.h
Go to the documentation of this file.
1
/*
2
* MessagePack for C dynamic typing routine
3
*
4
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
5
*
6
* Distributed under the Boost Software License, Version 1.0.
7
* (See accompanying file LICENSE_1_0.txt or copy at
8
* http://www.boost.org/LICENSE_1_0.txt)
9
*/
10
#ifndef MSGPACK_OBJECT_H
11
#define MSGPACK_OBJECT_H
12
13
#include "
zone.h
"
14
#include <stdio.h>
15
16
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
20
26
27
typedef
enum
{
28
MSGPACK_OBJECT_NIL
= 0x00,
29
MSGPACK_OBJECT_BOOLEAN
= 0x01,
30
MSGPACK_OBJECT_POSITIVE_INTEGER
= 0x02,
31
MSGPACK_OBJECT_NEGATIVE_INTEGER
= 0x03,
32
MSGPACK_OBJECT_FLOAT32
= 0x0a,
33
MSGPACK_OBJECT_FLOAT64
= 0x04,
34
MSGPACK_OBJECT_FLOAT
= 0x04,
35
#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
36
MSGPACK_OBJECT_DOUBLE =
MSGPACK_OBJECT_FLOAT
,
/* obsolete */
37
#endif
/* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */
38
MSGPACK_OBJECT_STR
= 0x05,
39
MSGPACK_OBJECT_ARRAY
= 0x06,
40
MSGPACK_OBJECT_MAP
= 0x07,
41
MSGPACK_OBJECT_BIN
= 0x08,
42
MSGPACK_OBJECT_EXT
= 0x09
43
}
msgpack_object_type
;
44
45
46
struct
msgpack_object
;
47
struct
msgpack_object_kv
;
48
49
typedef
struct
{
50
uint32_t
size
;
51
struct
msgpack_object
*
ptr
;
52
}
msgpack_object_array
;
53
54
typedef
struct
{
55
uint32_t
size
;
56
struct
msgpack_object_kv
*
ptr
;
57
}
msgpack_object_map
;
58
59
typedef
struct
{
60
uint32_t
size
;
61
const
char
*
ptr
;
62
}
msgpack_object_str
;
63
64
typedef
struct
{
65
uint32_t
size
;
66
const
char
*
ptr
;
67
}
msgpack_object_bin
;
68
69
typedef
struct
{
70
int8_t
type
;
71
uint32_t
size
;
72
const
char
*
ptr
;
73
}
msgpack_object_ext
;
74
75
typedef
union
{
76
bool
boolean
;
77
uint64_t
u64
;
78
int64_t
i64
;
79
#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
80
double
dec;
/* obsolete*/
81
#endif
/* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */
82
double
f64
;
83
msgpack_object_array
array
;
84
msgpack_object_map
map
;
85
msgpack_object_str
str
;
86
msgpack_object_bin
bin
;
87
msgpack_object_ext
ext
;
88
}
msgpack_object_union
;
89
90
typedef
struct
msgpack_object
{
91
msgpack_object_type
type
;
92
msgpack_object_union
via
;
93
}
msgpack_object
;
94
95
typedef
struct
msgpack_object_kv
{
96
msgpack_object
key
;
97
msgpack_object
val
;
98
}
msgpack_object_kv
;
99
100
MSGPACK_DLLEXPORT
101
void
msgpack_object_init_nil
(
msgpack_object
* d);
102
103
MSGPACK_DLLEXPORT
104
void
msgpack_object_init_boolean
(
msgpack_object
* d,
bool
v);
105
106
MSGPACK_DLLEXPORT
107
void
msgpack_object_init_unsigned_integer
(
msgpack_object
* d, uint64_t v);
108
109
MSGPACK_DLLEXPORT
110
void
msgpack_object_init_signed_integer
(
msgpack_object
* d, int64_t v);
111
112
MSGPACK_DLLEXPORT
113
void
msgpack_object_init_float32
(
msgpack_object
* d,
float
v);
114
115
MSGPACK_DLLEXPORT
116
void
msgpack_object_init_float64
(
msgpack_object
* d,
double
v);
117
118
MSGPACK_DLLEXPORT
119
void
msgpack_object_init_str
(
msgpack_object
* d,
const
char
*
data
, uint32_t size);
120
121
MSGPACK_DLLEXPORT
122
void
msgpack_object_init_bin
(
msgpack_object
* d,
const
char
*
data
, uint32_t size);
123
124
MSGPACK_DLLEXPORT
125
void
msgpack_object_init_ext
(
msgpack_object
* d, int8_t type,
const
char
*
data
, uint32_t size);
126
127
MSGPACK_DLLEXPORT
128
void
msgpack_object_init_array
(
msgpack_object
* d,
msgpack_object
*
data
, uint32_t size);
129
130
MSGPACK_DLLEXPORT
131
void
msgpack_object_init_map
(
msgpack_object
* d,
msgpack_object_kv
*
data
, uint32_t size);
132
133
#if !defined(_KERNEL_MODE)
134
MSGPACK_DLLEXPORT
135
void
msgpack_object_print
(FILE* out,
msgpack_object
o);
136
#endif
137
138
MSGPACK_DLLEXPORT
139
int
msgpack_object_print_buffer
(
char
*buffer,
size_t
buffer_size,
msgpack_object
o);
140
141
MSGPACK_DLLEXPORT
142
bool
msgpack_object_equal
(
const
msgpack_object
x,
const
msgpack_object
y);
143
145
146
147
#ifdef __cplusplus
148
}
149
#endif
150
151
#endif
/* msgpack/object.h */
msgpack_object_init_unsigned_integer
MSGPACK_DLLEXPORT void msgpack_object_init_unsigned_integer(msgpack_object *d, uint64_t v)
msgpack_object_init_bin
MSGPACK_DLLEXPORT void msgpack_object_init_bin(msgpack_object *d, const char *data, uint32_t size)
msgpack_object_init_signed_integer
MSGPACK_DLLEXPORT void msgpack_object_init_signed_integer(msgpack_object *d, int64_t v)
msgpack_object_init_nil
MSGPACK_DLLEXPORT void msgpack_object_init_nil(msgpack_object *d)
msgpack_object_print
MSGPACK_DLLEXPORT void msgpack_object_print(FILE *out, msgpack_object o)
msgpack_object_init_float64
MSGPACK_DLLEXPORT void msgpack_object_init_float64(msgpack_object *d, double v)
msgpack_object_type
msgpack_object_type
Definition
object.h:27
msgpack_object_init_str
MSGPACK_DLLEXPORT void msgpack_object_init_str(msgpack_object *d, const char *data, uint32_t size)
msgpack_object_init_array
MSGPACK_DLLEXPORT void msgpack_object_init_array(msgpack_object *d, msgpack_object *data, uint32_t size)
msgpack_object_init_boolean
MSGPACK_DLLEXPORT void msgpack_object_init_boolean(msgpack_object *d, bool v)
msgpack_object_init_ext
MSGPACK_DLLEXPORT void msgpack_object_init_ext(msgpack_object *d, int8_t type, const char *data, uint32_t size)
msgpack_object_print_buffer
MSGPACK_DLLEXPORT int msgpack_object_print_buffer(char *buffer, size_t buffer_size, msgpack_object o)
msgpack_object_equal
MSGPACK_DLLEXPORT bool msgpack_object_equal(const msgpack_object x, const msgpack_object y)
msgpack_object_init_map
MSGPACK_DLLEXPORT void msgpack_object_init_map(msgpack_object *d, msgpack_object_kv *data, uint32_t size)
msgpack_object_init_float32
MSGPACK_DLLEXPORT void msgpack_object_init_float32(msgpack_object *d, float v)
MSGPACK_OBJECT_STR
@ MSGPACK_OBJECT_STR
Definition
object.h:38
MSGPACK_OBJECT_BIN
@ MSGPACK_OBJECT_BIN
Definition
object.h:41
MSGPACK_OBJECT_FLOAT64
@ MSGPACK_OBJECT_FLOAT64
Definition
object.h:33
MSGPACK_OBJECT_FLOAT
@ MSGPACK_OBJECT_FLOAT
Definition
object.h:34
MSGPACK_OBJECT_BOOLEAN
@ MSGPACK_OBJECT_BOOLEAN
Definition
object.h:29
MSGPACK_OBJECT_NEGATIVE_INTEGER
@ MSGPACK_OBJECT_NEGATIVE_INTEGER
Definition
object.h:31
MSGPACK_OBJECT_FLOAT32
@ MSGPACK_OBJECT_FLOAT32
Definition
object.h:32
MSGPACK_OBJECT_NIL
@ MSGPACK_OBJECT_NIL
Definition
object.h:28
MSGPACK_OBJECT_POSITIVE_INTEGER
@ MSGPACK_OBJECT_POSITIVE_INTEGER
Definition
object.h:30
MSGPACK_OBJECT_ARRAY
@ MSGPACK_OBJECT_ARRAY
Definition
object.h:39
MSGPACK_OBJECT_EXT
@ MSGPACK_OBJECT_EXT
Definition
object.h:42
MSGPACK_OBJECT_MAP
@ MSGPACK_OBJECT_MAP
Definition
object.h:40
msgpack_object_array
Definition
object.h:49
msgpack_object_array::size
uint32_t size
Definition
object.h:50
msgpack_object_array::ptr
struct msgpack_object * ptr
Definition
object.h:51
msgpack_object_bin
Definition
object.h:64
msgpack_object_bin::ptr
const char * ptr
Definition
object.h:66
msgpack_object_bin::size
uint32_t size
Definition
object.h:65
msgpack_object_ext
Definition
object.h:69
msgpack_object_ext::ptr
const char * ptr
Definition
object.h:72
msgpack_object_ext::type
int8_t type
Definition
object.h:70
msgpack_object_ext::size
uint32_t size
Definition
object.h:71
msgpack_object_kv
Definition
object.h:95
msgpack_object_kv::val
msgpack_object val
Definition
object.h:97
msgpack_object_kv::key
msgpack_object key
Definition
object.h:96
msgpack_object_map
Definition
object.h:54
msgpack_object_map::ptr
struct msgpack_object_kv * ptr
Definition
object.h:56
msgpack_object_map::size
uint32_t size
Definition
object.h:55
msgpack_object_str
Definition
object.h:59
msgpack_object_str::ptr
const char * ptr
Definition
object.h:61
msgpack_object_str::size
uint32_t size
Definition
object.h:60
msgpack_object
Definition
object.h:90
msgpack_object::type
msgpack_object_type type
Definition
object.h:91
msgpack_object::via
msgpack_object_union via
Definition
object.h:92
msgpack_object_union
Definition
object.h:75
msgpack_object_union::str
msgpack_object_str str
Definition
object.h:85
msgpack_object_union::u64
uint64_t u64
Definition
object.h:77
msgpack_object_union::ext
msgpack_object_ext ext
Definition
object.h:87
msgpack_object_union::map
msgpack_object_map map
Definition
object.h:84
msgpack_object_union::array
msgpack_object_array array
Definition
object.h:83
msgpack_object_union::boolean
bool boolean
Definition
object.h:76
msgpack_object_union::bin
msgpack_object_bin bin
Definition
object.h:86
msgpack_object_union::f64
double f64
Definition
object.h:82
msgpack_object_union::i64
int64_t i64
Definition
object.h:78
data
const char * data
Definition
unpack_template.h:94
zone.h
Generated by
1.17.0