ds: convert (stub) bitbuffer implementation to (stub) b_object sub-class
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#include <blue/ds/bitbuffer.h>
|
||||
|
||||
/*** PRIVATE DATA *************************************************************/
|
||||
|
||||
struct b_bitbuffer_p {
|
||||
int x;
|
||||
};
|
||||
|
||||
/*** PRIVATE FUNCTIONS ********************************************************/
|
||||
/*** PUBLIC FUNCTIONS *********************************************************/
|
||||
/*** PUBLIC ALIAS FUNCTIONS ***************************************************/
|
||||
/*** VIRTUAL FUNCTIONS ********************************************************/
|
||||
|
||||
static void bitbuffer_init(b_object *obj, void *priv)
|
||||
{
|
||||
struct b_bitbuffer_p *bitbuffer = priv;
|
||||
}
|
||||
|
||||
static void bitbuffer_fini(b_object *obj, void *priv)
|
||||
{
|
||||
struct b_bitbuffer_p *bitbuffer = priv;
|
||||
}
|
||||
|
||||
/*** CLASS DEFINITION *********************************************************/
|
||||
|
||||
B_TYPE_CLASS_DEFINITION_BEGIN(b_bitbuffer)
|
||||
B_TYPE_CLASS_INTERFACE_BEGIN(b_object, B_TYPE_OBJECT)
|
||||
B_INTERFACE_ENTRY(to_string) = NULL;
|
||||
B_TYPE_CLASS_INTERFACE_END(b_object, B_TYPE_OBJECT)
|
||||
B_TYPE_CLASS_DEFINITION_END(b_bitbuffer)
|
||||
|
||||
B_TYPE_DEFINITION_BEGIN(b_bitbuffer)
|
||||
B_TYPE_ID(0x628e33da, 0x3109, 0x4a5d, 0x98d5, 0xb0e4cb3ccb65);
|
||||
B_TYPE_CLASS(b_bitbuffer_class);
|
||||
B_TYPE_INSTANCE_PRIVATE(struct b_bitbuffer_p);
|
||||
B_TYPE_INSTANCE_INIT(bitbuffer_init);
|
||||
B_TYPE_INSTANCE_FINI(bitbuffer_fini);
|
||||
B_TYPE_DEFINITION_END(b_bitbuffer)
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
#ifndef BLUE_OBJECT_BITBUFFER_H_
|
||||
#define BLUE_OBJECT_BITBUFFER_H_
|
||||
#ifndef BLUE_DS_BITBUFFER_H_
|
||||
#define BLUE_DS_BITBUFFER_H_
|
||||
|
||||
#include <blue/ds/object.h>
|
||||
#include <blue/core/macros.h>
|
||||
|
||||
#define B_BITBUFFER(p) ((b_bitbuffer *)(p))
|
||||
B_DECLS_BEGIN;
|
||||
|
||||
typedef struct b_bitbuffer b_bitbuffer;
|
||||
B_DECLARE_TYPE(b_bitbuffer);
|
||||
|
||||
BLUE_API b_bitbuffer *b_bitbuffer_create(void);
|
||||
|
||||
static inline b_bitbuffer *b_bitbuffer_retain(b_bitbuffer *buf)
|
||||
{
|
||||
return B_BITBUFFER(b_retain(B_DSREF(buf)));
|
||||
}
|
||||
static inline void b_bitbuffer_release(b_bitbuffer *buf)
|
||||
{
|
||||
b_release(B_DSREF(buf));
|
||||
}
|
||||
B_TYPE_CLASS_DECLARATION_BEGIN(b_bitbuffer)
|
||||
;
|
||||
B_TYPE_CLASS_DECLARATION_END(b_bitbuffer);
|
||||
|
||||
BLUE_API b_status b_bitbuffer_put_bit(b_bitbuffer *buf, int bit);
|
||||
BLUE_API b_status b_bitbuffer_put_bool(b_bitbuffer *buf, bool b);
|
||||
@@ -27,4 +20,6 @@ BLUE_API b_status b_bitbuffer_put_bytes(
|
||||
BLUE_API b_status b_bitbuffer_put_string(
|
||||
b_bitbuffer *buf, const char *p, size_t len, size_t bits_per_char);
|
||||
|
||||
B_DECLS_END;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user