waitui/library/list/include/waitui/list_generic_impl.h
Rick Barenthin d81aeb1782
All checks were successful
continuous-integration/drone/push Build is passing
style: align header and c file last line to be empty
2022-07-26 23:45:32 +02:00

80 lines
3.4 KiB
C

/**
* @file list_generic_impl.h
* @author rick
* @date 26.07.22
* @brief File for the generic List implementation
*/
#ifndef WAITUI_LIST_GENERIC_IMPL_H
#define WAITUI_LIST_GENERIC_IMPL_H
#include "waitui/list_generic.h"
#include "waitui/list.h"
// -----------------------------------------------------------------------------
// Public defines
// -----------------------------------------------------------------------------
#define IMPLEMENTATION_LIST_TYPEDEF(type)
#define IMPLEMENTATION_LIST_NEW(type) \
type##_list *type##_list_new() { \
return (type##_list *) waitui_list_new( \
(waitui_list_element_destroy) type##_destroy); \
}
#define IMPLEMENTATION_LIST_DESTROY(type) \
void type##_list_destroy(type##_list **this) { \
waitui_list_destroy((waitui_list **) this); \
}
#define IMPLEMENTATION_LIST_PUSH(type) \
int type##_list_push(type##_list *this, type *type##Element) { \
return waitui_list_push((waitui_list *) this, (void *) type##Element); \
}
#define IMPLEMENTATION_LIST_POP(type) \
type *type##_list_pop(type##_list *this) { \
return (type *) waitui_list_pop((waitui_list *) this); \
}
#define IMPLEMENTATION_LIST_UNSHIFT(type) \
int type##_list_unshift(type##_list *this, type *type##Element) { \
return waitui_list_unshift((waitui_list *) this, \
(void *) type##Element); \
}
#define IMPLEMENTATION_LIST_SHIFT(type) \
type *type##_list_shift(type##_list *this) { \
return (type *) waitui_list_shift((waitui_list *) this); \
}
#define IMPLEMENTATION_LIST_PEEK(type) \
type *type##_list_peek(type##_list *this) { \
return (type *) waitui_list_peek((waitui_list *) this); \
}
#define IMPLEMENTATION_LIST_GET_ITERATOR(type) \
type##_list_iter *type##_list_getIterator(type##_list *this) { \
return (type##_list_iter *) waitui_list_getIterator( \
(waitui_list *) this); \
}
#define IMPLEMENTATION_LIST_ITER_HAS_NEXT(type) \
bool type##_list_iter_hasNext(type##_list_iter *this) { \
return waitui_list_iter_hasNext((waitui_list_iter *) this); \
}
#define IMPLEMENTATION_LIST_ITER_NEXT(type) \
type *type##_list_iter_next(type##_list_iter *this) { \
return (type *) waitui_list_iter_next((waitui_list_iter *) this); \
}
#define IMPLEMENTATION_LIST_ITER_DESTROY(type) \
void type##_list_iter_destroy(type##_list_iter **this) { \
waitui_list_iter_destroy((waitui_list_iter **) this); \
}
#endif//WAITUI_LIST_GENERIC_IMPL_H