ds: uuid: convert to new object system
This commit is contained in:
@@ -1,25 +1,30 @@
|
||||
#ifndef BLUELIB_UUID_H_
|
||||
#define BLUELIB_UUID_H_
|
||||
#ifndef BLUE_DS_UUID_H_
|
||||
#define BLUE_DS_UUID_H_
|
||||
|
||||
#include <blue/core/macros.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <blue/ds/object.h>
|
||||
#include <blue/ds/type.h>
|
||||
|
||||
#define B_UUID(p) ((b_uuid *)(p))
|
||||
#include <blue/ds/string.h>
|
||||
|
||||
#define B_UUID_NBYTES 16
|
||||
#define B_UUID_STRING_MAX 37
|
||||
|
||||
struct b_string;
|
||||
struct b_stringstream;
|
||||
B_DECLS_BEGIN;
|
||||
|
||||
typedef struct b_uuid b_uuid;
|
||||
#define B_TYPE_UUID (b_uuid_get_type())
|
||||
|
||||
B_DECLARE_TYPE(b_uuid);
|
||||
|
||||
B_TYPE_CLASS_DECLARATION_BEGIN(b_uuid)
|
||||
B_TYPE_CLASS_DECLARATION_END(b_uuid)
|
||||
|
||||
typedef struct b_uuid_bytes {
|
||||
unsigned char uuid_bytes[B_UUID_NBYTES];
|
||||
} b_uuid_bytes;
|
||||
|
||||
BLUE_API b_uuid *b_uuid_create(void);
|
||||
BLUE_API b_type b_uuid_get_type(void);
|
||||
|
||||
B_TYPE_DEFAULT_CONSTRUCTOR(b_uuid, B_TYPE_UUID);
|
||||
|
||||
BLUE_API b_uuid *b_uuid_create_from_bytes(
|
||||
unsigned char u00, unsigned char u01, unsigned char u02,
|
||||
unsigned char u03, unsigned char u04, unsigned char u05,
|
||||
@@ -28,19 +33,10 @@ BLUE_API b_uuid *b_uuid_create_from_bytes(
|
||||
unsigned char u13, unsigned char u14, unsigned char u15);
|
||||
BLUE_API b_uuid *b_uuid_create_from_bytev(const unsigned char bytes[B_UUID_NBYTES]);
|
||||
BLUE_API b_uuid *b_uuid_create_from_uuid_bytes(const b_uuid_bytes *bytes);
|
||||
BLUE_API b_uuid *b_uuid_create_from_string(const struct b_string *string);
|
||||
BLUE_API b_uuid *b_uuid_create_from_string(const b_string *string);
|
||||
BLUE_API b_uuid *b_uuid_create_from_cstr(const char *s);
|
||||
|
||||
static inline b_uuid *b_uuid_retain(b_uuid *uuid)
|
||||
{
|
||||
return B_UUID(b_retain(B_DSREF(uuid)));
|
||||
}
|
||||
static inline void b_uuid_release(b_uuid *uuid)
|
||||
{
|
||||
b_release(B_DSREF(uuid));
|
||||
}
|
||||
|
||||
BLUE_API b_status b_uuid_to_string(const b_uuid *uuid, struct b_string *out);
|
||||
BLUE_API b_status b_uuid_to_string(const b_uuid *uuid, b_string *out);
|
||||
BLUE_API b_status b_uuid_to_cstr(const b_uuid *uuid, char out[B_UUID_STRING_MAX]);
|
||||
BLUE_API b_status b_uuid_to_stringstream(
|
||||
const b_uuid *uuid, struct b_stringstream *out);
|
||||
@@ -49,4 +45,6 @@ BLUE_API void b_uuid_get_bytes(
|
||||
BLUE_API void b_uuid_get_uuid_bytes(const b_uuid *uuid, b_uuid_bytes *bytes);
|
||||
BLUE_API b_uuid_bytes *b_uuid_ptr(b_uuid *uuid);
|
||||
|
||||
B_DECLS_END;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user