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

scim_config_module.h

Go to the documentation of this file.
00001 /** @file scim_config_module.h 00002 * @brief Define scim::ConfigModule class for manipulating the config modules. 00003 * 00004 * Class scim::ConfigModule is a wrapper of class scim::Module, 00005 * which is for manipulating the configuration modules. 00006 */ 00007 00008 /* 00009 * Smart Common Input Method 00010 * 00011 * Copyright (c) 2004 James Su <suzhe@turbolinux.com.cn> 00012 * Copyright (c) 2003 James Su <suzhe@turbolinux.com.cn> 00013 * Copyright (c) 2002 James Su <suzhe@turbolinux.com.cn> 00014 * 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this program; if not, write to the 00028 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 00029 * Boston, MA 02111-1307 USA 00030 * 00031 * $Id: scim_config_module.h,v 1.12 2004/02/06 07:53:15 suzhe Exp $ 00032 */ 00033 00034 #ifndef __SCIM_CONFIG_MODULE_H 00035 #define __SCIM_CONFIG_MODULE_H 00036 00037 namespace scim { 00038 /** 00039 * @addtogroup Config 00040 * @{ 00041 */ 00042 00043 /** 00044 * @brief The prototype of initialization function in config modules. 00045 * 00046 * There must be a function called "scim_config_module_init" 00047 * which complies with this prototype. 00048 * This function name can have a prefix like simple_LTX_, 00049 * in which "simple" is the module's name. 00050 */ 00051 typedef void (*ConfigModuleInitFunc) (void); 00052 00053 /** 00054 * @brief The prototype of configure object creation function in config modules. 00055 * 00056 * There must be a function called "scim_config_module_create_config" 00057 * which complies with this prototype. 00058 * This function name can have a prefix like simple_LTX_, 00059 * in which "simple" is the module's name. 00060 */ 00061 typedef ConfigPointer (*ConfigModuleCreateConfigFunc) (const String & app_name); 00062 00063 /** 00064 * @brief The class to manipulate the config modules. 00065 * 00066 * This is a wrapper of scim::Module class, which is specially 00067 * for manipulating the config modules. 00068 */ 00069 class ConfigModule 00070 { 00071 Module m_module; 00072 00073 ConfigModuleInitFunc m_config_init; 00074 ConfigModuleCreateConfigFunc m_config_create_config; 00075 00076 ConfigModule (const ConfigModule &); 00077 ConfigModule & operator= (const ConfigModule &); 00078 00079 public: 00080 /** 00081 * @brief Default constructor. 00082 */ 00083 ConfigModule (); 00084 00085 /** 00086 * @brief Constructor. 00087 * @param name - the module's name, eg. "simple". 00088 */ 00089 ConfigModule (const String &name); 00090 00091 /** 00092 * @brief Load a module by its name. 00093 * 00094 * Load a module into memory. 00095 * If another module has been loaded into this object, 00096 * then the old module will be unloaded first. 00097 * If the old module is resident, false will be returned, 00098 * and the old module will be untouched. 00099 * 00100 * @param name - the module's name, eg. "simple". 00101 * @return true if success. 00102 */ 00103 bool load (const String &name); 00104 00105 /** 00106 * @brief Check if a module is loaded and initialized successfully. 00107 * @return true if a module is already loaded and initialized successfully. 00108 */ 00109 bool valid () const; 00110 00111 /** 00112 * @brief Create a configuration object from this module. 00113 * 00114 * The type of newly created configuration object 00115 * must be a derived class of scim::ConfigBase. 00116 * 00117 * @param app_name - the application's name. 00118 * @return a smart pointer points to the configuration object. 00119 */ 00120 ConfigPointer create_config (const String & app_name) const; 00121 }; 00122 00123 /** 00124 * @brief Get a name list of currently available configuration modules. 00125 * @param mod_list - the result list will be stored here. 00126 * @return the number of the modules, equal to mod_list.size (). 00127 */ 00128 int scim_get_config_module_list (std::vector <String>& mod_list); 00129 00130 /** @} */ 00131 00132 } // namespace scim 00133 00134 #endif //__SCIM_CONFIG_MODULE_H 00135 00136 /* 00137 vi:ts=4:ai:nowrap:expandtab 00138 */

Generated on Thu Dec 30 21:03:18 2004 for scim by doxygen 1.3.8