ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/include/prefs.h
Revision: 1.5
Committed: 2001-02-02T20:52:59Z (23 years, 6 months ago) by cebix
Content type: text/plain
Branch: MAIN
CVS Tags: snapshot-17022001
Changes since 1.4: +1 -1 lines
Log Message:
- bumped version number to 0.9
- updated copyright dates

File Contents

# Content
1 /*
2 * prefs.h - Preferences handling
3 *
4 * Basilisk II (C) 1997-2001 Christian Bauer
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef PREFS_H
22 #define PREFS_H
23
24 #include <stdio.h>
25
26 extern void PrefsInit(int argc, char **argv);
27 extern void PrefsExit(void);
28
29 extern void AddPrefsDefaults(void);
30 extern void AddPlatformPrefsDefaults(void);
31
32 // Preferences loading/saving
33 extern void LoadPrefs(void);
34 extern void SavePrefs(void);
35
36 extern void LoadPrefsFromStream(FILE *f);
37 extern void SavePrefsToStream(FILE *f);
38
39 // Public preferences access functions
40 extern void PrefsAddString(const char *name, const char *s);
41 extern void PrefsAddBool(const char *name, bool b);
42 extern void PrefsAddInt32(const char *name, int32 val);
43
44 extern void PrefsReplaceString(const char *name, const char *s, int index = 0);
45 extern void PrefsReplaceBool(const char *name, bool b);
46 extern void PrefsReplaceInt32(const char *name, int32 val);
47
48 extern const char *PrefsFindString(const char *name, int index = 0);
49 extern bool PrefsFindBool(const char *name);
50 extern int32 PrefsFindInt32(const char *name);
51
52 extern void PrefsRemoveItem(const char *name, int index = 0);
53
54
55 /*
56 * Definition of preferences items
57 */
58
59 // Item types
60 enum prefs_type {
61 TYPE_STRING, // char[]
62 TYPE_BOOLEAN, // bool
63 TYPE_INT32, // int32
64 TYPE_ANY, // Wildcard for find_node
65 TYPE_END = TYPE_ANY // Terminator for prefs_desc list
66 };
67
68 // Item descriptor
69 struct prefs_desc {
70 const char *name; // Name of keyword
71 prefs_type type; // Type (see above)
72 bool multiple; // Can this item occur multiple times (only for TYPE_STRING)?
73 };
74
75 // List of common preferences items (those which exist on all platforms)
76 extern prefs_desc common_prefs_items[];
77
78 // List of platform-specific preferences items
79 extern prefs_desc platform_prefs_items[];
80
81 #endif