Xfce Generics: libxfce4util Reference Manual

## Xfce Generics Xfce Generics — Generic data types and related functions. |

## Stability Level

Stable, unless otherwise indicated

## Functions

#define | XFCE_GENERIC_STACK()
#define | xfce_stack_new()
#define | xfce_stack_free()
#define | xfce_stack_top()
#define | xfce_stack_pop()
#define | xfce_stack_push()

## Includes

    #include <libxfce4util/libxfce4util.h>

## Description

Xfce-dialogs are a collection of helper dialogs to display the help dialog with link to the docs website, warning, info, and error dialogs and more.

Using a generic stack

    1
    2
    3
    4
    5
    6
    7
    8
    typedef XFCE_GENERIC_STACK(int) IntStack;
    IntStack *stack = xfce_stack_new (IntStack);
    xfce_stack_push (stack, 0);
    xfce_stack_push (stack, 1);
    printf ("Top is %d\n", xfce_stack_top (stack));
    xfce_stack_pop (stack);
    printf ("Top is %d\n", xfce_stack_top (stack));
    xfce_stack_free (stack);

## Functions

### XFCE_GENERIC_STACK()

    #define             XFCE_GENERIC_STACK(Type)

This macro is used to create a new stack data type which elements are of `Type` . For example, to create a stack type that handles elements of type `double`, you'd write the following

    1
    typedef XFCE_GENERIC_STACK(double) MyDoubleStack;

and furtheron refer to your stack type as `MyDoubleStack`.

#### Parameters

Type | Data type of the elements that should be handled by the stack. Can be any valid data type from simple int's to complex structures. |

### xfce_stack_new()

    #define             xfce_stack_new(StackType)

Creates a new instance of `StackType` and returns a pointer to the newly created instance. For example, imagine you declared a type `MyDoubleStack` as shown above, you can instantiate this type with

    1
    MyDoubleStack *my_stack = xfce_stack_new (MyDoubleStack);

#### Parameters

StackType | Type of stack declared with XFCE_GENERIC_STACK. |

### xfce_stack_free()

    #define             xfce_stack_free(stack)

Frees a stack, that was allocated using xfce_stack_new.

#### Parameters

stack | A stack object. |

### xfce_stack_top()

    #define             xfce_stack_top(stack)

Removes the top element from `stack` .

#### Parameters

stack | A stack object. |

### xfce_stack_pop()

    #define             xfce_stack_pop(stack)

Removes the top element from `stack` .

#### Parameters

stack | A stack object. |

### xfce_stack_push()

    #define             xfce_stack_push(stack, value)

Pushes a new `value` on top of `stack` .

#### Parameters

stack | A stack object. |
value | the value to push |