ds: list: convert to new object system
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
#ifndef BLUE_OBJECT_LIST_H_
|
||||
#define BLUE_OBJECT_LIST_H_
|
||||
#ifndef BLUE_DS_LIST_H_
|
||||
#define BLUE_DS_LIST_H_
|
||||
|
||||
#include <blue/core/macros.h>
|
||||
#include <blue/core/status.h>
|
||||
#include <blue/ds/object.h>
|
||||
|
||||
#define B_LIST(p) ((b_list *)(p))
|
||||
B_DECLS_BEGIN;
|
||||
|
||||
#define B_TYPE_LIST (b_list_get_type())
|
||||
|
||||
struct b_list_p;
|
||||
|
||||
B_DECLARE_TYPE(b_list);
|
||||
|
||||
B_TYPE_CLASS_DECLARATION_BEGIN(b_list)
|
||||
B_TYPE_CLASS_DECLARATION_END(b_list)
|
||||
|
||||
typedef struct b_list b_list;
|
||||
typedef struct b_list_entry b_list_entry;
|
||||
|
||||
#define b_list_foreach(it, q) \
|
||||
@@ -16,21 +24,16 @@ typedef struct b_list_entry b_list_entry;
|
||||
typedef struct b_list_iterator {
|
||||
b_queue_iterator _base;
|
||||
const b_list *_q;
|
||||
const struct b_list_p *_q_p;
|
||||
|
||||
size_t i;
|
||||
void *item;
|
||||
b_list_entry *entry;
|
||||
} b_list_iterator;
|
||||
|
||||
BLUE_API b_list *b_list_create(void);
|
||||
BLUE_API b_type b_list_get_type(void);
|
||||
|
||||
static inline b_list *b_list_retain(b_list *str)
|
||||
{
|
||||
return B_LIST(b_retain(B_DSREF(str)));
|
||||
}
|
||||
static inline void b_list_release(b_list *str)
|
||||
{
|
||||
b_release(B_DSREF(str));
|
||||
}
|
||||
B_TYPE_DEFAULT_CONSTRUCTOR(b_list, B_TYPE_LIST);
|
||||
|
||||
BLUE_API bool b_list_empty(b_list *q);
|
||||
BLUE_API void *b_list_first_item(const b_list *q);
|
||||
@@ -64,4 +67,6 @@ BLUE_API bool b_list_iterator_is_valid(const b_list_iterator *it);
|
||||
|
||||
BLUE_API void *b_list_entry_value(const b_list_entry *entry);
|
||||
|
||||
B_DECLS_END;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user