From 3232ac1ec6f597cdfce202eeeec3ebd5cd7086ea Mon Sep 17 00:00:00 2001 From: klmp200 Date: Tue, 5 Jun 2018 00:34:30 +0200 Subject: [PATCH] Ajout de PRIVATE, PUBLIC et PROTECTED --- List/Element.h | 20 ++++++++++---------- List/List.h | 14 +++++++------- Objects.h | 3 +++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/List/Element.h b/List/Element.h index 3ce4888..6fc9044 100644 --- a/List/Element.h +++ b/List/Element.h @@ -10,19 +10,19 @@ typedef struct o_List List; #include "List.h" struct o_Element { - List *list; - void *data; - struct o_Element *next; - struct o_Element *previous; + PRIVATE List *list; + PRIVATE void *data; + PRIVATE struct o_Element *next; + PRIVATE struct o_Element *previous; - struct o_Element *(*get_next)(O_THIS(Element)); - struct o_Element *(*get_previous)(O_THIS(Element)); - void *(*get_data)(O_THIS(Element)); + PUBLIC struct o_Element *(*get_next)(O_THIS(Element)); + PUBLIC struct o_Element *(*get_previous)(O_THIS(Element)); + PUBLIC void *(*get_data)(O_THIS(Element)); - void (*set_previous)(O_THIS(Element), struct o_Element *previous); - void (*set_next)(O_THIS(Element), struct o_Element *next); + PUBLIC void (*set_previous)(O_THIS(Element), struct o_Element *previous); + 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); diff --git a/List/List.h b/List/List.h index a47851e..4058c2b 100644 --- a/List/List.h +++ b/List/List.h @@ -14,14 +14,14 @@ typedef struct o_Element Element; #define WRONG_ELEMENT CRASH("This element is not within the list\n") struct o_List { - Element *head; - Element *tail; - int size; + PRIVATE Element *head; + PRIVATE Element *tail; + PRIVATE int size; - Element *(*get_head)(O_THIS(List)); - Element *(*get_tail)(O_THIS(List)); - int (*get_size)(O_THIS(List)); - void (*$_free_)(O_THIS(List)); + PUBLIC Element *(*get_head)(O_THIS(List)); + PUBLIC Element *(*get_tail)(O_THIS(List)); + PUBLIC int (*get_size)(O_THIS(List)); + PUBLIC void (*$_free_)(O_THIS(List)); }; List *$_init_List(); diff --git a/Objects.h b/Objects.h index c502895..797efd1 100644 --- a/Objects.h +++ b/Objects.h @@ -15,6 +15,9 @@ #define CRASH(message) perror(message) #define SYNCHRONIZE +#define PRIVATE +#define PUBLIC +#define PROTECTED #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){\