# list2.h File Reference

This file contains some macros concerning lists. More...

`#include <gwenhywfar/gwenhywfarapi.h>`
`#include <gwenhywfar/types.h>`
`#include <gwenhywfar/misc.h>`
`#include <gwenhywfar/list.h>`
`#include <gwenhywfar/refptr.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <assert.h>`

Go to the source code of this file.

## Defines

#define | GWEN_CONSTLIST2_FUNCTION_DEFS(t, pr) GWEN_CONSTLIST2_FUNCTION_LIB_DEFS(t, pr, GWEN_DUMMY_EMPTY_ARG)
#define | GWEN_CONSTLIST2_FUNCTION_LIB_DEFS(t, pr, decl)
#define | GWEN_CONSTLIST2_FUNCTIONS(t, pr)
#define | GWEN_LIST2_FUNCTION_DEFS(t, pr) GWEN_LIST2_FUNCTION_LIB_DEFS(t, pr, GWEN_DUMMY_EMPTY_ARG)
#define | GWEN_LIST2_FUNCTION_LIB_DEFS(t, pr, decl)
#define | GWEN_LIST2_FUNCTIONS(t, pr)

## Detailed Description

This file contains some macros concerning lists.

## Define Documentation

#define GWEN_CONSTLIST2_FUNCTION_DEFS | ( | t,
|  | pr |  | ) | GWEN_CONSTLIST2_FUNCTION_LIB_DEFS(t, pr, GWEN_DUMMY_EMPTY_ARG)

#define GWEN_CONSTLIST2_FUNCTION_LIB_DEFS | ( | t,
|  | pr,
|  | decl |  | ) |

Value:

    typedef struct t##_CONSTLIST2 t##_CONSTLIST2; \
      typedef struct t##_CONSTLIST2_ITERATOR t##_CONSTLIST2_ITERATOR; \
      typedef const t* (t##_CONSTLIST2_FOREACH)(const t *element, void *user_data); \
      \
      decl t##_CONSTLIST2 *pr##_ConstList2_new(); \
      decl void pr##_ConstList2_free(t##_CONSTLIST2 *l); \
      decl void pr##_ConstList2_PushBack(t##_CONSTLIST2 *l, const t *p); \
      decl void pr##_ConstList2_PushFront(t##_CONSTLIST2 *l, const t *p); \
      decl const t *pr##_ConstList2_GetFront(t##_CONSTLIST2 *l); \
      decl const t *pr##_ConstList2_GetBack(t##_CONSTLIST2 *l); \
      decl unsigned int pr##_ConstList2_GetSize(t##_CONSTLIST2 *l); \
      decl void pr##_ConstList2_PopBack(t##_CONSTLIST2 *l); \
      decl void pr##_ConstList2_PopFront(t##_CONSTLIST2 *l); \
      decl void pr##_ConstList2_Clear(t##_CONSTLIST2 *l); \
      decl t##_CONSTLIST2_ITERATOR *pr##_ConstList2_First(const t##_CONSTLIST2 *l); \
      decl t##_CONSTLIST2_ITERATOR *pr##_ConstList2_Last(const t##_CONSTLIST2 *l); \
      decl t##_CONSTLIST2_ITERATOR *pr##_ConstList2Iterator_new(t##_CONSTLIST2 *l); \
      decl void pr##_ConstList2Iterator_free(t##_CONSTLIST2_ITERATOR *li); \
      decl const t *pr##_ConstList2Iterator_Previous(t##_CONSTLIST2_ITERATOR *li); \
      decl const t *pr##_ConstList2Iterator_Next(t##_CONSTLIST2_ITERATOR *li); \
      decl const t *pr##_ConstList2Iterator_Data(t##_CONSTLIST2_ITERATOR *li); \
      decl const t *pr##_ConstList2_ForEach(t##_CONSTLIST2 *l, t##_CONSTLIST2_FOREACH, void *user_data);

#define GWEN_CONSTLIST2_FUNCTIONS | ( | t,
|  | pr |  | ) |

#define GWEN_LIST2_FUNCTION_DEFS | ( | t,
|  | pr |  | ) | GWEN_LIST2_FUNCTION_LIB_DEFS(t, pr, GWEN_DUMMY_EMPTY_ARG)

| This macro should be used in applications, not in libraries. In libraries please use the macro GWEN_LIST2_FUNCTION_LIB_DEFS.

#define GWEN_LIST2_FUNCTION_LIB_DEFS | ( | t,
|  | pr,
|  | decl |  | ) |

Value:

    typedef struct t##_LIST2 t##_LIST2; \
      typedef struct t##_LIST2_ITERATOR t##_LIST2_ITERATOR; \
      typedef t* (t##_LIST2_FOREACH)(t *element, void *user_data); \
      \
      decl t##_LIST2 *pr##_List2_new(); \
      decl void pr##_List2_free(t##_LIST2 *l); \
      decl t##_LIST2 *pr##_List2_dup(const t##_LIST2 *l); \
      decl void pr##_List2_Unshare(t##_LIST2 *l); \
      decl void pr##_List2_Dump(t##_LIST2 *l, FILE *f, unsigned int indent); \
      decl void pr##_List2_PushBack(t##_LIST2 *l, t *p); \
      decl void pr##_List2_PushFront(t##_LIST2 *l, t *p); \
      decl t *pr##_List2_GetFront(t##_LIST2 *l); \
      decl t *pr##_List2_GetBack(t##_LIST2 *l); \
      decl void pr##_List2_Erase(t##_LIST2 *l, t##_LIST2_ITERATOR *it); \
      decl unsigned int pr##_List2_GetSize(t##_LIST2 *l); \
      decl void pr##_List2_PopBack(t##_LIST2 *l); \
      decl void pr##_List2_PopFront(t##_LIST2 *l); \
      decl void pr##_List2_Clear(t##_LIST2 *l); \
      decl t##_LIST2_ITERATOR *pr##_List2_First(const t##_LIST2 *l); \
      decl t##_LIST2_ITERATOR *pr##_List2_Last(const t##_LIST2 *l); \
      decl t##_LIST2_ITERATOR *pr##_List2Iterator_new(t##_LIST2 *l); \
      decl void pr##_List2Iterator_free(t##_LIST2_ITERATOR *li); \
      decl t *pr##_List2Iterator_Previous(t##_LIST2_ITERATOR *li); \
      decl t *pr##_List2Iterator_Next(t##_LIST2_ITERATOR *li); \
      decl t *pr##_List2Iterator_Data(t##_LIST2_ITERATOR *li); \
      decl void pr##_List2Iterator_IncLinkCount(t##_LIST2_ITERATOR *li); \
      decl t *pr##_List2_ForEach(t##_LIST2 *l, t##_LIST2_FOREACH, void *user_data);

#define GWEN_LIST2_FUNCTIONS | ( | t,
|  | pr |  | ) |

| This macro actually implements the functions. Please use it in your source file (*.c) after the includes.