2
* option.h: Options handling functions
4
* This file is part of GTick
6
* Copyright (c) 1999, Alex Roberts
7
* Copyright (c) 2003, Roland Stigge <stigge@antcom.de>
9
* GTick is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* GTick is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with GTick; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
/* constructor: returns 0 on success, -1 otherwise */
29
typedef int (*option_new_t) (void* object);
31
typedef void (*option_delete_t) (void* object);
32
/* setter: returns 0 on success, -1 otherwise */
33
typedef int (*option_set_t) (void* object, const char* value);
34
/* getter: returns associated value for specified option */
35
typedef const char* (*option_get_t) (void* object);
37
typedef struct option_list_t option_list_t;
38
struct option_list_t {
40
option_delete_t destructor;
45
option_list_t* previous;
48
option_list_t* option_list_new(void);
49
void option_list_delete(option_list_t* list);
50
int option_register(option_list_t** list,
52
option_new_t constructor,
53
option_delete_t destructor,
57
int option_set(option_list_t* list, const char* name, const char* value);
58
const char* option_get(option_list_t* list, const char* name);
60
int option_restore_all(option_list_t* list);
61
int option_save_all(option_list_t* list);