mirror of
https://gitlab.com/klmp200/LO41.git
synced 2024-11-25 18:44:20 +00:00
Ajout de PRIVATE, PUBLIC et PROTECTED
This commit is contained in:
parent
551bf2cd51
commit
3232ac1ec6
@ -10,19 +10,19 @@ typedef struct o_List List;
|
|||||||
#include "List.h"
|
#include "List.h"
|
||||||
|
|
||||||
struct o_Element {
|
struct o_Element {
|
||||||
List *list;
|
PRIVATE List *list;
|
||||||
void *data;
|
PRIVATE void *data;
|
||||||
struct o_Element *next;
|
PRIVATE struct o_Element *next;
|
||||||
struct o_Element *previous;
|
PRIVATE struct o_Element *previous;
|
||||||
|
|
||||||
struct o_Element *(*get_next)(O_THIS(Element));
|
PUBLIC struct o_Element *(*get_next)(O_THIS(Element));
|
||||||
struct o_Element *(*get_previous)(O_THIS(Element));
|
PUBLIC struct o_Element *(*get_previous)(O_THIS(Element));
|
||||||
void *(*get_data)(O_THIS(Element));
|
PUBLIC void *(*get_data)(O_THIS(Element));
|
||||||
|
|
||||||
void (*set_previous)(O_THIS(Element), struct o_Element *previous);
|
PUBLIC void (*set_previous)(O_THIS(Element), struct o_Element *previous);
|
||||||
void (*set_next)(O_THIS(Element), struct o_Element *next);
|
PUBLIC void (*set_next)(O_THIS(Element), struct o_Element *next);
|
||||||
|
|
||||||
void (*$_free_)(O_THIS(Element));
|
PUBLIC void (*$_free_)(O_THIS(Element));
|
||||||
};
|
};
|
||||||
|
|
||||||
Element *$_init_Element(void *data, size_t size, List *list);
|
Element *$_init_Element(void *data, size_t size, List *list);
|
||||||
|
14
List/List.h
14
List/List.h
@ -14,14 +14,14 @@ typedef struct o_Element Element;
|
|||||||
#define WRONG_ELEMENT CRASH("This element is not within the list\n")
|
#define WRONG_ELEMENT CRASH("This element is not within the list\n")
|
||||||
|
|
||||||
struct o_List {
|
struct o_List {
|
||||||
Element *head;
|
PRIVATE Element *head;
|
||||||
Element *tail;
|
PRIVATE Element *tail;
|
||||||
int size;
|
PRIVATE int size;
|
||||||
|
|
||||||
Element *(*get_head)(O_THIS(List));
|
PUBLIC Element *(*get_head)(O_THIS(List));
|
||||||
Element *(*get_tail)(O_THIS(List));
|
PUBLIC Element *(*get_tail)(O_THIS(List));
|
||||||
int (*get_size)(O_THIS(List));
|
PUBLIC int (*get_size)(O_THIS(List));
|
||||||
void (*$_free_)(O_THIS(List));
|
PUBLIC void (*$_free_)(O_THIS(List));
|
||||||
};
|
};
|
||||||
|
|
||||||
List *$_init_List();
|
List *$_init_List();
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
#define CRASH(message) perror(message)
|
#define CRASH(message) perror(message)
|
||||||
|
|
||||||
#define SYNCHRONIZE
|
#define SYNCHRONIZE
|
||||||
|
#define PRIVATE
|
||||||
|
#define PUBLIC
|
||||||
|
#define PROTECTED
|
||||||
|
|
||||||
#define LINK(type, obj, method) obj->method = method##_##type;
|
#define LINK(type, obj, method) obj->method = method##_##type;
|
||||||
#define GETTER(obj_type, variable_type, variable) variable_type get_##variable##_##obj_type(obj_type *this){\
|
#define GETTER(obj_type, variable_type, variable) variable_type get_##variable##_##obj_type(obj_type *this){\
|
||||||
|
Loading…
Reference in New Issue
Block a user