~ubuntu-branches/ubuntu/breezy/gtick/breezy

« back to all changes in this revision

Viewing changes to src/option.h

  • Committer: Bazaar Package Importer
  • Author(s): Roland Stigge
  • Date: 2005-02-20 13:24:57 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050220132457-akn7xjaplb1ev1cd
Tags: 0.3.5-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * option.h: Options handling functions
 
3
 *
 
4
 * This file is part of GTick
 
5
 *
 
6
 * Copyright (c) 1999, Alex Roberts
 
7
 * Copyright (c) 2003, Roland Stigge <stigge@antcom.de>
 
8
 *
 
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.
 
13
 *
 
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.
 
18
 *
 
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
 
22
 * 
 
23
 */
 
24
 
 
25
#ifndef OPTION_H
 
26
#define OPTION_H
 
27
 
 
28
/* constructor: returns 0 on success, -1 otherwise */
 
29
typedef int (*option_new_t) (void* object);
 
30
/* destructor */
 
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);
 
36
 
 
37
typedef struct option_list_t option_list_t;
 
38
struct option_list_t {
 
39
  const char* name;
 
40
  option_delete_t destructor;
 
41
  option_set_t setter;
 
42
  option_get_t getter;
 
43
  void* object;
 
44
  option_list_t* next;
 
45
  option_list_t* previous;
 
46
};
 
47
 
 
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,
 
51
                    const char* name,
 
52
                    option_new_t constructor,
 
53
                    option_delete_t destructor,
 
54
                    option_set_t setter,
 
55
                    option_get_t getter,
 
56
                    void* object);
 
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);
 
59
 
 
60
int option_restore_all(option_list_t* list);
 
61
int option_save_all(option_list_t* list);
 
62
 
 
63
#endif /* OPTION_H */