Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

scim_global_config.h

Go to the documentation of this file.
00001 /** @file scim_global_config.h
00002  *  @brief functions to read the global configurations.
00003  *
00004  *  The global configuration file (normally /etc/scim/global) is used to store
00005  *  the configurations for libscim itself and the system wide configurations which
00006  *  will be read before any Config module is loaded.
00007  */
00008 
00009 /*
00010  * Smart Common Input Method
00011  * 
00012  * Copyright (c) 2004 James Su <suzhe@tsinghua.org.cn>
00013  *
00014  *
00015  * This library is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU Lesser General Public
00017  * License as published by the Free Software Foundation; either
00018  * version 2 of the License, or (at your option) any later version.
00019  *
00020  * This library is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU Lesser General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU Lesser General Public
00026  * License along with this program; if not, write to the
00027  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00028  * Boston, MA  02111-1307  USA
00029  *
00030  * $Id: scim_global_config.h,v 1.2 2004/07/10 02:31:17 suzhe Exp $
00031  */
00032 
00033 #ifndef __SCIM_GLOBAL_CONFIG_H
00034 #define __SCIM_GLOBAL_CONFIG_H
00035 
00036 namespace scim {
00037 /**
00038  * @addtogroup Helper
00039  * @{
00040  */
00041 
00042 /**
00043  * @brief Read a string value from the global configuration file.
00044  *
00045  * @param key The key to be read, like /PanelProgram etc.
00046  * @param defVal The default value to be returned if there is no such key in the configuration file.
00047  *
00048  * @return the value string of the key.
00049  */
00050 String scim_global_config_read (const String &key, const String &defVal = String ());
00051 
00052 /**
00053  * @brief Read an int value from the global configuration file.
00054  *
00055  * @param key The key to be read, like /SocketTimeout etc.
00056  * @param defVal The default value to be returned if there is no such key in the configuration file.
00057  *
00058  * @return the value of the key.
00059  */
00060 int    scim_global_config_read (const String &key, int defVal);
00061 
00062 /**
00063  * @brief Read a bool value from the global configuration file.
00064  *
00065  * @param key The key to be read.
00066  * @param defVal The default value to be returned if there is no such key in the configuration file.
00067  *
00068  * @return the value of the key.
00069  */
00070 bool   scim_global_config_read (const String &key, bool defVal);
00071 
00072 /**
00073  * @brief Read a double value from the global configuration file.
00074  *
00075  * @param key The key to be read.
00076  * @param defVal The default value to be returned if there is no such key in the configuration file.
00077  *
00078  * @return the value of the key.
00079  */
00080 double scim_global_config_read (const String &key, double defVal);
00081 
00082 /**
00083  * @brief Read a string list from the global configuration file.
00084  *
00085  * @param key The key to be read.
00086  * @param defVal The default value to be returned if there is no such key in the configuration file.
00087  *
00088  * @return the value of the key.
00089  */
00090 std::vector <String> scim_global_config_read (const String &key, const std::vector <String> &defVal);
00091 
00092 /**
00093  * @brief Read an int list from the global configuration file.
00094  *
00095  * @param key The key to be read.
00096  * @param defVal The default value to be returned if there is no such key in the configuration file.
00097  *
00098  * @return the value of the key.
00099  */
00100 std::vector <int>    scim_global_config_read (const String &key, const std::vector <int> &defVal);
00101 
00102 /**
00103  * @brief Write a string value into the user global config.
00104  *
00105  * @param key The key to be associated.
00106  * @param val The string value to be written.
00107  */
00108 void scim_global_config_write (const String &key, const String &val);
00109 
00110 /**
00111  * @brief Write an int value into the user global config.
00112  *
00113  * @param key The key to be associated.
00114  * @param val The int value to be written.
00115  */
00116 void scim_global_config_write (const String &key, int val);
00117 
00118 /**
00119  * @brief Write a bool value into the user global config.
00120  *
00121  * @param key The key to be associated.
00122  * @param val The bool value to be written.
00123  */
00124 void scim_global_config_write (const String &key, bool val);
00125 
00126 /**
00127  * @brief Write a double value into the user global config.
00128  *
00129  * @param key The key to be associated.
00130  * @param val The double value to be written.
00131  */
00132 void scim_global_config_write (const String &key, double val);
00133 
00134 /**
00135  * @brief Write a string list into the user global config.
00136  *
00137  * @param key The key to be associated.
00138  * @param val The string list to be written.
00139  */
00140 void scim_global_config_write (const String &key, const std::vector <String> &val);
00141 
00142 /**
00143  * @brief Write an int list into the user global config.
00144  *
00145  * @param key The key to be associated.
00146  * @param val The int list to be written.
00147  */
00148 void scim_global_config_write (const String &key, const std::vector <int> &val);
00149 
00150 /**
00151  * @brief Reset the value associated to the specified key to its default value.
00152  *
00153  * @param key The key to be reset.
00154  */
00155 void scim_global_config_reset (const String &key);
00156 
00157 /**
00158  * @brief Flush the updated global config into user global config file.
00159  * @return true if success.
00160  */
00161 bool scim_global_config_flush ();
00162 
00163 /** @} */
00164 } // namespace scim
00165 
00166 #endif //__SCIM_GLOBAL_CONFIG_H
00167 /*
00168 vi:ts=4:nowrap:ai:expandtab
00169 */
00170 

Generated on Tue Apr 19 00:10:59 2005 for scim by  doxygen 1.4.1