1 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
4 * Smart Common Input Method
6 * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library 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 Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this program; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22 * Boston, MA 02111-1307 USA
24 * $Id: scim_imengine_module.cpp,v 1.3 2005/01/10 08:30:54 suzhe Exp $
28 #define Uses_SCIM_IMENGINE_MODULE
29 #define Uses_SCIM_MODULE
30 #include "scim_private.h"
35 IMEngineModule::IMEngineModule ()
36 : m_imengine_init (0),
37 m_imengine_create_factory (0),
38 m_number_of_factories (0)
42 IMEngineModule::IMEngineModule (const String &name, const ConfigPointer &config)
43 : m_imengine_init (0),
44 m_imengine_create_factory (0),
45 m_number_of_factories (0)
51 IMEngineModule::load (const String &name, const ConfigPointer &config)
55 if (!m_module.load (name, "IMEngine"))
59 (IMEngineModuleInitFunc) m_module.symbol ("scim_imengine_module_init");
61 m_imengine_create_factory =
62 (IMEngineModuleCreateFactoryFunc) m_module.symbol ("scim_imengine_module_create_factory");
64 if (!m_imengine_init || !m_imengine_create_factory) {
67 m_imengine_create_factory = 0;
68 m_number_of_factories = 0;
72 m_number_of_factories = m_imengine_init (config);
76 m_imengine_create_factory = 0;
77 m_number_of_factories = 0;
85 IMEngineModule::unload ()
87 return m_module.unload ();
91 IMEngineModule::valid () const
93 return (m_module.valid () && m_imengine_init &&
94 m_imengine_create_factory && m_number_of_factories > 0);
97 IMEngineFactoryPointer
98 IMEngineModule::create_factory (unsigned int engine) const
100 if (valid () && engine < m_number_of_factories )
101 return m_imengine_create_factory (engine);
103 return IMEngineFactoryPointer (0);
107 IMEngineModule::number_of_factories ()
109 if (m_module_name == "socket")
110 m_number_of_factories = m_imengine_init (NULL);
111 return m_number_of_factories ;
115 IMEngineModule::get_module_name () const
117 return m_module_name;
120 int scim_get_imengine_module_list (std::vector <String>& engine_list)
122 return scim_get_module_list (engine_list, "IMEngine");
129 vi:ts=4:nowrap:ai:expandtab