object.h
Go to the documentation of this file.
/*
* MessagePack for C dynamic typing routine
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef MSGPACK_OBJECT_H
#define MSGPACK_OBJECT_H
#include "zone.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
MSGPACK_OBJECT_NIL = 0x00,
MSGPACK_OBJECT_BOOLEAN = 0x01,
MSGPACK_OBJECT_POSITIVE_INTEGER = 0x02,
MSGPACK_OBJECT_NEGATIVE_INTEGER = 0x03,
MSGPACK_OBJECT_FLOAT32 = 0x0a,
MSGPACK_OBJECT_FLOAT64 = 0x04,
MSGPACK_OBJECT_FLOAT = 0x04,
#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
MSGPACK_OBJECT_DOUBLE = MSGPACK_OBJECT_FLOAT, /* obsolete */
#endif /* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */
MSGPACK_OBJECT_STR = 0x05,
MSGPACK_OBJECT_ARRAY = 0x06,
MSGPACK_OBJECT_MAP = 0x07,
MSGPACK_OBJECT_BIN = 0x08,
MSGPACK_OBJECT_EXT = 0x09
} msgpack_object_type;
struct msgpack_object;
struct msgpack_object_kv;
typedef struct {
uint32_t size;
struct msgpack_object* ptr;
} msgpack_object_array;
typedef struct {
uint32_t size;
struct msgpack_object_kv* ptr;
} msgpack_object_map;
typedef struct {
uint32_t size;
const char* ptr;
} msgpack_object_str;
typedef struct {
uint32_t size;
const char* ptr;
} msgpack_object_bin;
typedef struct {
int8_t type;
uint32_t size;
const char* ptr;
} msgpack_object_ext;
typedef union {
bool boolean;
uint64_t u64;
int64_t i64;
#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
double dec; /* obsolete*/
#endif /* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */
double f64;
msgpack_object_array array;
msgpack_object_map map;
msgpack_object_str str;
msgpack_object_bin bin;
msgpack_object_ext ext;
} msgpack_object_union;
typedef struct msgpack_object {
msgpack_object_type type;
msgpack_object_union via;
} msgpack_object;
typedef struct msgpack_object_kv {
msgpack_object key;
msgpack_object val;
} msgpack_object_kv;
MSGPACK_DLLEXPORT
void msgpack_object_print(FILE* out, msgpack_object o);
MSGPACK_DLLEXPORT
int msgpack_object_print_buffer(char *buffer, size_t buffer_size, msgpack_object o);
MSGPACK_DLLEXPORT
bool msgpack_object_equal(const msgpack_object x, const msgpack_object y);
#ifdef __cplusplus
}
#endif
#endif /* msgpack/object.h */
msgpack_object_union::i64
int64_t i64
Definition: object.h:78
msgpack_object_array::size
uint32_t size
Definition: object.h:50
msgpack_object_bin
Definition: object.h:64
msgpack_object_bin::size
uint32_t size
Definition: object.h:65
msgpack_object_union::bin
msgpack_object_bin bin
Definition: object.h:86
msgpack_object_type
msgpack_object_type
Definition: object.h:27
MSGPACK_DLLEXPORT
#define MSGPACK_DLLEXPORT
Definition: sysdep.h:42
msgpack_object
struct msgpack_object msgpack_object
MSGPACK_OBJECT_MAP
Definition: object.h:40
msgpack_object_kv
struct msgpack_object_kv msgpack_object_kv
MSGPACK_OBJECT_BOOLEAN
Definition: object.h:29
MSGPACK_OBJECT_NIL
Definition: object.h:28
MSGPACK_OBJECT_STR
Definition: object.h:38
msgpack_object_kv
Definition: object.h:95
MSGPACK_OBJECT_POSITIVE_INTEGER
Definition: object.h:30
msgpack_object::via
msgpack_object_union via
Definition: object.h:92
msgpack_object_union
Definition: object.h:75
msgpack_object_union::array
msgpack_object_array array
Definition: object.h:83
MSGPACK_OBJECT_BIN
Definition: object.h:41
MSGPACK_OBJECT_NEGATIVE_INTEGER
Definition: object.h:31
msgpack_object_kv::val
msgpack_object val
Definition: object.h:97
msgpack_object_array
Definition: object.h:49
MSGPACK_OBJECT_FLOAT32
Definition: object.h:32
msgpack_object_ext::type
int8_t type
Definition: object.h:70
msgpack_object_str::ptr
const char * ptr
Definition: object.h:61
MSGPACK_OBJECT_EXT
Definition: object.h:42
msgpack_object_map
Definition: object.h:54
msgpack_object_ext::ptr
const char * ptr
Definition: object.h:72
MSGPACK_OBJECT_FLOAT64
Definition: object.h:33
msgpack_object_union::u64
uint64_t u64
Definition: object.h:77
msgpack_object_union::map
msgpack_object_map map
Definition: object.h:84
msgpack_object_str
Definition: object.h:59
msgpack_object_union::f64
double f64
Definition: object.h:82
msgpack_object_ext::size
uint32_t size
Definition: object.h:71
msgpack_object
Definition: object.h:90
msgpack_object_union::str
msgpack_object_str str
Definition: object.h:85
msgpack_object_kv::key
msgpack_object key
Definition: object.h:96
zone.h
msgpack_object_union::ext
msgpack_object_ext ext
Definition: object.h:87
msgpack_object_ext
Definition: object.h:69
msgpack_object_str::size
uint32_t size
Definition: object.h:60
msgpack_object_print_buffer
MSGPACK_DLLEXPORT int msgpack_object_print_buffer(char *buffer, size_t buffer_size, msgpack_object o)
MSGPACK_OBJECT_ARRAY
Definition: object.h:39
MSGPACK_OBJECT_FLOAT
Definition: object.h:34
msgpack_object_array::ptr
struct msgpack_object * ptr
Definition: object.h:51
msgpack_object_map::ptr
struct msgpack_object_kv * ptr
Definition: object.h:56
msgpack_object_bin::ptr
const char * ptr
Definition: object.h:66
msgpack_object_map::size
uint32_t size
Definition: object.h:55
msgpack_object_union::boolean
bool boolean
Definition: object.h:76
msgpack_object::type
msgpack_object_type type
Definition: object.h:91
msgpack_object_print
MSGPACK_DLLEXPORT void msgpack_object_print(FILE *out, msgpack_object o)
msgpack_object_equal
MSGPACK_DLLEXPORT bool msgpack_object_equal(const msgpack_object x, const msgpack_object y)