-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.h
45 lines (36 loc) · 903 Bytes
/
list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef LIST_H
#define LIST_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdlib.h>
#include "object.h"
#include "def.h"
#include "array.h"
typedef struct {
void* (*get)(void* obj, size_t index);
void (*set)(void* obj, void* data, size_t index);
void (*append)(void* obj, void* data);
void (*clear)(void* obj);
void (*insert)(void* obj, void* data, size_t index);
void (*delete)(void* obj, size_t index);
size_t (*find)(void* obj, void* toFind);
void (*addAll)(void* obj, void* listToAdd);
boolean (*isEmpty)(void* obj);
size_t (*size)(void* obj);
struct _List* (*subList)(void* obj, size_t start, size_t end);
Array* (*toArray)(void* obj);
}ListIF;
typedef struct _List {
void* super; // must be first
void* self;
ObjectIF* o_IF;
ListIF* _ListIF;
}List;
/* public functions */
List* List_ctor(size_t data_type);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // !LIST_H