Git init
[framework/uifw/isf.git] / ism / src / scim_global_config.h
1 /** @file scim_global_config.h
2  *  @brief functions to read the global configurations.
3  *
4  *  The global configuration file (normally /etc/scim/global) is used to store
5  *  the configurations for libscim itself and the system wide configurations which
6  *  will be read before any Config module is loaded.
7  */
8
9 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
10
11 /*
12  * Smart Common Input Method
13  *
14  * Copyright (c) 2004-2005 James Su <suzhe@tsinghua.org.cn>
15  *
16  *
17  * This library is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU Lesser General Public
19  * License as published by the Free Software Foundation; either
20  * version 2 of the License, or (at your option) any later version.
21  *
22  * This library is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU Lesser General Public License for more details.
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this program; if not, write to the
29  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
30  * Boston, MA  02111-1307  USA
31  *
32  * $Id: scim_global_config.h,v 1.4 2005/01/10 08:30:54 suzhe Exp $
33  */
34
35 #ifndef __SCIM_GLOBAL_CONFIG_H
36 #define __SCIM_GLOBAL_CONFIG_H
37
38 namespace scim {
39 /**
40  * @addtogroup Accessories
41  * @ingroup InputServiceFramework
42  * @{
43  */
44
45 /**
46  * @brief Read a string value from the global configuration file.
47  *
48  * @param key The key to be read, like /PanelProgram etc.
49  * @param defVal The default value to be returned if there is no such key in the configuration file.
50  *
51  * @return the value string of the key.
52  */
53 String scim_global_config_read (const String &key, const String &defVal = String ());
54
55 /**
56  * @brief Read an int value from the global configuration file.
57  *
58  * @param key The key to be read, like /SocketTimeout etc.
59  * @param defVal The default value to be returned if there is no such key in the configuration file.
60  *
61  * @return the value of the key.
62  */
63 int    scim_global_config_read (const String &key, int defVal);
64
65 /**
66  * @brief Read a bool value from the global configuration file.
67  *
68  * @param key The key to be read.
69  * @param defVal The default value to be returned if there is no such key in the configuration file.
70  *
71  * @return the value of the key.
72  */
73 bool   scim_global_config_read (const String &key, bool defVal);
74
75 /**
76  * @brief Read a double value from the global configuration file.
77  *
78  * @param key The key to be read.
79  * @param defVal The default value to be returned if there is no such key in the configuration file.
80  *
81  * @return the value of the key.
82  */
83 double scim_global_config_read (const String &key, double defVal);
84
85 /**
86  * @brief Read a string list from the global configuration file.
87  *
88  * @param key The key to be read.
89  * @param defVal The default value to be returned if there is no such key in the configuration file.
90  *
91  * @return the value of the key.
92  */
93 std::vector <String> scim_global_config_read (const String &key, const std::vector <String> &defVal);
94
95 /**
96  * @brief Read an int list from the global configuration file.
97  *
98  * @param key The key to be read.
99  * @param defVal The default value to be returned if there is no such key in the configuration file.
100  *
101  * @return the value of the key.
102  */
103 std::vector <int>    scim_global_config_read (const String &key, const std::vector <int> &defVal);
104
105 /**
106  * @brief Write a string value into the user global config.
107  *
108  * @param key The key to be associated.
109  * @param val The string value to be written.
110  */
111 void scim_global_config_write (const String &key, const String &val);
112
113 /**
114  * @brief Write an int value into the user global config.
115  *
116  * @param key The key to be associated.
117  * @param val The int value to be written.
118  */
119 void scim_global_config_write (const String &key, int val);
120
121 /**
122  * @brief Write a bool value into the user global config.
123  *
124  * @param key The key to be associated.
125  * @param val The bool value to be written.
126  */
127 void scim_global_config_write (const String &key, bool val);
128
129 /**
130  * @brief Write a double value into the user global config.
131  *
132  * @param key The key to be associated.
133  * @param val The double value to be written.
134  */
135 void scim_global_config_write (const String &key, double val);
136
137 /**
138  * @brief Write a string list into the user global config.
139  *
140  * @param key The key to be associated.
141  * @param val The string list to be written.
142  */
143 void scim_global_config_write (const String &key, const std::vector <String> &val);
144
145 /**
146  * @brief Write an int list into the user global config.
147  *
148  * @param key The key to be associated.
149  * @param val The int list to be written.
150  */
151 void scim_global_config_write (const String &key, const std::vector <int> &val);
152
153 /**
154  * @brief Reset the value associated to the specified key to its default value.
155  *
156  * @param key The key to be reset.
157  */
158 void scim_global_config_reset (const String &key);
159
160 /**
161 * @brief update the global config
162 */
163 void scim_global_config_update();
164 /**
165  * @brief Flush the updated global config into user global config file.
166  * @return true if success.
167  */
168 bool scim_global_config_flush ();
169
170 /** @} */
171 } // namespace scim
172
173 #endif //__SCIM_GLOBAL_CONFIG_H
174 /*
175 vi:ts=4:nowrap:ai:expandtab
176 */
177