mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-05-29 23:42:40 +02:00
cpp: alias pack(Stream* s, const T& v) -> pack(Stream& const T& v)
This commit is contained in:
parent
1b1433a664
commit
72e3f98213
@ -22,13 +22,14 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef MSGPACK_SBUFFER_INIT_SIZE
|
#ifndef MSGPACK_SBUFFER_INIT_SIZE
|
||||||
#define MSGPACK_SBUFFER_INIT_SIZE 2048
|
#define MSGPACK_SBUFFER_INIT_SIZE 8192
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct msgpack_sbuffer {
|
typedef struct msgpack_sbuffer {
|
||||||
size_t size;
|
size_t size;
|
||||||
char* data;
|
char* data;
|
||||||
|
@ -29,12 +29,6 @@ struct iovec {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef MSGPACK_VREFBUFFER_REF_SIZE
|
#ifndef MSGPACK_VREFBUFFER_REF_SIZE
|
||||||
#define MSGPACK_VREFBUFFER_REF_SIZE 32
|
#define MSGPACK_VREFBUFFER_REF_SIZE 32
|
||||||
#endif
|
#endif
|
||||||
@ -43,6 +37,11 @@ extern "C" {
|
|||||||
#define MSGPACK_VREFBUFFER_CHUNK_SIZE 8192
|
#define MSGPACK_VREFBUFFER_CHUNK_SIZE 8192
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct msgpack_vrefbuffer_chunk;
|
struct msgpack_vrefbuffer_chunk;
|
||||||
typedef struct msgpack_vrefbuffer_chunk msgpack_vrefbuffer_chunk;
|
typedef struct msgpack_vrefbuffer_chunk msgpack_vrefbuffer_chunk;
|
||||||
|
|
||||||
@ -102,6 +101,7 @@ size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref)
|
|||||||
return vref->tail - vref->array;
|
return vref->tail - vref->array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,6 +28,7 @@ namespace msgpack {
|
|||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
class packer {
|
class packer {
|
||||||
public:
|
public:
|
||||||
|
packer(Stream* s);
|
||||||
packer(Stream& s);
|
packer(Stream& s);
|
||||||
~packer();
|
~packer();
|
||||||
|
|
||||||
@ -111,6 +112,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <typename Stream, typename T>
|
||||||
|
inline void pack(Stream* s, const T& v)
|
||||||
|
{
|
||||||
|
packer<Stream>(s).pack(v);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Stream, typename T>
|
template <typename Stream, typename T>
|
||||||
inline void pack(Stream& s, const T& v)
|
inline void pack(Stream& s, const T& v)
|
||||||
{
|
{
|
||||||
@ -133,6 +140,9 @@ inline void pack(Stream& s, const T& v)
|
|||||||
#include "msgpack/pack_template.h"
|
#include "msgpack/pack_template.h"
|
||||||
|
|
||||||
|
|
||||||
|
template <typename Stream>
|
||||||
|
packer<Stream>::packer(Stream* s) : m_stream(*s) { }
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
packer<Stream>::packer(Stream& s) : m_stream(s) { }
|
packer<Stream>::packer(Stream& s) : m_stream(s) { }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user