Back to index

im-sdk  12.3.91
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
LEBase Class Reference

#include <LE.hh>

Collaboration diagram for LEBase:
Collaboration graph
[legend]

List of all members.

Public Types

enum  BUILTIN_OPTION { SUNIM_DEFAULT }

Public Member Functions

const IMLangListget_langlist ()
const IMImeInfoListget_imeinfolist ()
const IMDescriptorListget_imdesclist ()
const bool update_imdesclist (IMLEName *LEname, IMLocale *Locales, int nLocales, iml_desktop_t **desktop, IMLangList &ull, IMImeInfoList &uil, IMDescriptorList &udl)
const void set_nsmap_config (IMNsMapStruct *nsms, int num_nsm_entries)
const IMObjectWithDescListget_objectdesclist ()
IMHotkeyManagerStructget_hotkey_manager ()
LEContextcreate_lecontext (IMInputContext *pic, const char *real_locale)
void remove_lecontext (LEContext *lec)
iml_desktop_tget_imldesktop ()
iml_if_tget_iml_if ()
iml_methods_tget_iml_methods ()
bool errorp ()
bool reloadp ()
bool need_thread_lock_p ()
bool reload ()
bool xsunim_p ()
bool open_iml_desktop (IMDesktop *pdesk, iml_desktop_t *piml_desk)
bool close_iml_desktop (iml_desktop_t *piml_desk)
 LEBase (const string &dirname, const string &filename)
 LEBase (enum BUILTIN_OPTION option)
 ~LEBase ()

Private Types

typedef map< iml_desktop_t
*, IMLangList
LEDesktopLangMap
typedef map< iml_desktop_t
*, IMDescriptorList
LEDesktopDescMap

Private Member Functions

IMSyncObjectget_leif_sync_object ()
string get_lename (string &filename)
void add_imobjectdesc (IMObjectDescriptorStruct *pol)
bool loadif ()
iml_if_topenif (const char *real_locale)
bool closeif ()

Private Attributes

bool error
string dirname
string filename
string lename
u16string lename_hrn
IMLangList langlist
IMImeInfoList imeinfolist
IMDescriptorList imdesclist
IMObjectWithDescList imobjectdesclist
iml_desktop_timd
LEDesktopLangMap le_dlmap
LEDesktopDescMap le_ddmap
bool sunim_default
if_methods_tifm
iml_if_timl_if
iml_if_timl_if_context
int iml_if_context_ref_count
bool need_thread_lock
bool need_reload
IMSyncObject leif_sync

Friends

class LEContext

Detailed Description

Definition at line 16 of file LE.hh.


Member Typedef Documentation

Definition at line 30 of file LE.hh.

Definition at line 28 of file LE.hh.


Member Enumeration Documentation

Enumerator:
SUNIM_DEFAULT 

Definition at line 110 of file LE.hh.


Constructor & Destructor Documentation

LEBase::LEBase ( const string &  dirname,
const string &  filename 
)

Definition at line 367 of file LE.cpp.

  : error(false), dirname(x_dirname), filename(x_filename), sunim_default(false), need_reload(false), need_thread_lock(false)
{
    iml_if = NULL;
    iml_if_context = NULL;
    iml_if_context_ref_count = 0;
    imd = NULL;
    
    if (!loadif()) error = true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

LEBase::LEBase ( enum BUILTIN_OPTION  option)

Definition at line 380 of file LE.cpp.

{
    error = false;
    iml_if = NULL;
    iml_if_context = NULL;
    iml_if_context_ref_count = 0;

    if (option == SUNIM_DEFAULT) {
       dirname = "/";
       filename = "sunim_default";
       langlist.push_back(IMLang("C", "C"));
       sunim_default = true;
    } else {
       ERROR_INTERNAL("Invalid LEBase option");
    }
    if (!loadif()) error = true;
}

Here is the call graph for this function:

Definition at line 400 of file LE.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 71 of file LE.cpp.

{
    int i;
    if (!pol) return; /* empty! */
    for (i = 0; pol->leid; i++, pol++) {
       IMObjectWithDesc *pobj = new IMObjectWithDesc(*pol);
       pobj->log_obj();
       // TODO! we have to throw exception!
       if (!pobj) break;
       imobjectdesclist.push_back(pobj);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 345 of file LE.cpp.

{
    LOG_DEBUG("Close desktop (%s).",
             lename.c_str());
    IMLock lock(get_leif_sync_object());
    if (iml_if->ifm->if_CloseDesktop(piml_desk) == False)
       return false;
    LEDesktopLangMap::iterator itdl;
    for (itdl = le_dlmap.begin(); itdl != le_dlmap.end(); ++itdl) {
      if (itdl->first == piml_desk)
        le_dlmap.erase(itdl);
    }
    LEDesktopDescMap::iterator itdd;
    for (itdd = le_ddmap.begin(); itdd != le_ddmap.end(); ++itdd) {
      if (itdd->first == piml_desk)
        le_ddmap.erase(itdd);
    }
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEBase::closeif ( ) [private]

Definition at line 193 of file LE.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

LEContext * LEBase::create_lecontext ( IMInputContext pic,
const char *  real_locale 
)

Definition at line 292 of file LE.cpp.

{
    iml_if_t *iml_if_ctx = openif(real_locale);
    if (!iml_if_ctx) return NULL;
    LEContext* plec = new LEContext(pic, this, iml_if_ctx);
    if (!plec) return NULL;
    if (plec->errorp()) {
       delete plec;
       return NULL;
    }
    return plec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEBase::errorp ( ) [inline]

Definition at line 88 of file LE.hh.

{ return error; }

Here is the caller graph for this function:

Definition at line 286 of file LE.cpp.

{
  return iml_if->hkm;
}

Here is the caller graph for this function:

Definition at line 221 of file LE.cpp.

{
    return &imdesclist;
}

Here is the caller graph for this function:

Definition at line 215 of file LE.cpp.

{
    return &imeinfolist;
}

Here is the caller graph for this function:

Definition at line 84 of file LE.hh.

    { return iml_if; }

Here is the caller graph for this function:

Definition at line 86 of file LE.hh.

    { return iml_if->m; }

Definition at line 82 of file LE.hh.

    { return imd; }

Here is the caller graph for this function:

Definition at line 209 of file LE.cpp.

{
    return &langlist;
}

Here is the caller graph for this function:

Definition at line 42 of file LE.hh.

    { return leif_sync; }

Here is the caller graph for this function:

string LEBase::get_lename ( string &  filename) [private]

Definition at line 16 of file LE.cpp.

{
    string::size_type spos, epos;
#ifdef WIN32
    epos = test_filename.rfind(".dll");
#else
    epos = test_filename.rfind(".so");
#endif
    if (epos == string::npos) {
       return string();
    }
#ifdef WIN32
    spos = test_filename.rfind("\\");
    if (epos == string::npos) {
       epos = test_filename.rfind("/");
    }
#else
    spos = test_filename.rfind("/");
#endif
    if (epos == string::npos) {
       spos = 0;
    } else {
       spos++;
    }
    if (epos - spos <= 0) return string();

    return test_filename.substr(spos, epos - spos);
}

Here is the caller graph for this function:

Definition at line 280 of file LE.cpp.

{
    return &imobjectdesclist;
}

Here is the caller graph for this function:

bool LEBase::loadif ( ) [private]

Definition at line 87 of file LE.cpp.

{
    string try_lename;

    if (sunim_default)
       try_lename = filename;
    else
       try_lename = get_lename(filename);
    
    if (try_lename.empty()) return false;

    {
       IMLock lock(get_leif_sync_object());
       iml_if = if_OpenIF(dirname.c_str(), try_lename.c_str(), "", False);
    }

    if (!iml_if) return false;
    if (!iml_if->lename) {
       if (sunim_default) {
           lename = try_lename;
           lename_hrn = "Default IM";
       } else {
           return false;
       }
    } else {
       lename = string(iml_if->lename->id);
       lename_hrn = u16string(iml_if->lename->name);
    }
    need_thread_lock = iml_if->need_thread_lock;

    LOG_DEBUG("LE(%s) is loading.", lename.c_str());
    LOG_DEBUG("    Path=%s\n"
             "    version=%s\n"
             "    locale=%s\n"
             "    need_thread_lock=%s",
             iml_if->ifpath_name ? iml_if->ifpath_name : "(NULL)",
             iml_if->if_version ? iml_if->if_version : "(NULL)",
             iml_if->locale ? iml_if->locale : "(NULL)",
             need_thread_lock ? "true" : "false");

    if (iml_if->locale_list) {
       IMLocale *piml;
       string l;
       for (piml = iml_if->locale_list; piml->id; piml++) {
           langlist.push_back(IMLang(piml->id, u16string(piml->name)));
           l = l.append(piml->id).append(", ");
       }
       LOG_DEBUG("    langs=%s", l.c_str());
    }
    if (langlist.empty()) {
       LOG_ERROR("LE:%s support no language. Skip it.", lename.c_str());
       return false;
    }

    if (iml_if->imeinfo_list) {
        IMEInfo *piml;
        string l;
        for (piml = iml_if->imeinfo_list; piml->ime_id; piml++) {
            imeinfolist.push_back(IMImeInfo(piml->enable, 
                                   string (piml->ime_id),
                                   u16string (piml->imename), 
                                   piml->version ? u16string (piml->version) : u16string (strdup ("")), 
                                   piml->description ? u16string (piml->description) : u16string (strdup ("")), 
                                   piml->author ? u16string (piml->author) : u16string (strdup ("")), 
                                   piml->copyright ? u16string (piml->copyright) : u16string (strdup ("")), 
                                   u16string (strdup ("")),
                                   u16string (strdup (""))));
        }
    }

    imdesclist.push_back(IMDescriptor(u16string(lename.c_str()),    // IMNAME
                                  lename_hrn,                   // HRN
                                  "domainname-should-be-set.",  // domainanme
                                  langlist,                     // Supporting langs
                                  imeinfolist,
                                  iml_if->hkm ? iml_if->hkm->hkps : 0));
    // LE's profile ID.
    le_dlmap.insert(make_pair((iml_desktop_t *)NULL, langlist));
    le_ddmap.insert(make_pair((iml_desktop_t *)NULL, imdesclist));

    add_imobjectdesc(iml_if->object_list);

    ifm = iml_if->ifm;

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEBase::need_thread_lock_p ( ) [inline]

Definition at line 90 of file LE.hh.

{ return need_thread_lock; }

Here is the caller graph for this function:

bool LEBase::open_iml_desktop ( IMDesktop pdesk,
iml_desktop_t piml_desk 
)

Definition at line 327 of file LE.cpp.

{
    vector<IMArg> args;
    pdesk->get_iml_desktop_args(args);
    imd = piml_desk;
    LOG_DEBUG("Open desktop (%s, %s).",
             pdesk->get_desktop_display_name().c_str(),
             lename.c_str());
    IMLock lock(get_leif_sync_object());
    if (iml_if->ifm->if_OpenDesktop(piml_desk, &args[0], args.size()) == False)
       return false;
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

iml_if_t * LEBase::openif ( const char *  real_locale) [private]

Definition at line 175 of file LE.cpp.

{
    if (iml_if_context) {
       iml_if_context_ref_count++;
       return iml_if_context;
    }

    if (!real_locale) {
       real_locale = langlist.begin()->get_id();
    }
    IMLock lock(get_leif_sync_object());
    
    iml_if_context = if_OpenIF(dirname.c_str(), lename.c_str(), real_locale, True);
    iml_if_context_ref_count = 1;
    return iml_if_context;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEBase::reload ( )

Definition at line 48 of file LE.cpp.

{
    if (sunim_default)
        return true;
    /* some one use this LE */
    if(iml_if_context_ref_count > 0) {
        need_reload = true;
       return false;
    }
    /* clear */
    delete_all (imobjectdesclist);
    imobjectdesclist.clear();
    imdesclist.clear();
    langlist.clear();
    imeinfolist.clear();
    closeif();
    if (!loadif()) error = true;
    need_reload = false;
    LOG_DEBUG("Reloading LE(%s) is done", lename.c_str());
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool LEBase::reloadp ( ) [inline]

Definition at line 89 of file LE.hh.

{ return need_reload; }

Here is the caller graph for this function:

Definition at line 309 of file LE.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const void LEBase::set_nsmap_config ( IMNsMapStruct nsms,
int  num_nsm_entries 
)

Definition at line 270 of file LE.cpp.

{
    iml_if->ns_map = nsms;
    iml_if->num_nsm_entries = num_nsm_entries;
}

Here is the caller graph for this function:

const bool LEBase::update_imdesclist ( IMLEName LEname,
IMLocale Locales,
int  nLocales,
iml_desktop_t **  desktop,
IMLangList ull,
IMImeInfoList uil,
IMDescriptorList udl 
)

Definition at line 227 of file LE.cpp.

{
    lename = string(LEname->id);
    lename_hrn = u16string(LEname->name);

    if (Locales) {
       IMLocale *piml;
       string l;

       for (piml=Locales; piml->id; piml++) {
           ull.push_back(IMLang(piml->id, u16string(piml->name)));
           l = l.append(piml->id).append(", ");
       }
       LOG_DEBUG("LEBase::update_imdesclist: langs=%s",l.c_str());
    }
    if (ull.empty()) {
       LOG_ERROR("LE:%s support no language. Skip it.", lename.c_str());
       return false;
    }
    
    udl.push_back(IMDescriptor(u16string(lename.c_str()),          // IMNAME
                            lename_hrn,                   // HRN
                            "domainname-should-be-set.",  // domainanme
                            ull,                         // Supporting langs.
                            uil,
                            iml_if->hkm ? iml_if->hkm->hkps : 0
                            ));
    *desktop = imd; 
    le_dlmap.insert(make_pair(imd, ull));
    le_ddmap.insert(make_pair(imd, udl));

    return true;
}

Here is the caller graph for this function:

bool LEBase::xsunim_p ( ) [inline]

Definition at line 94 of file LE.hh.

    { return (iml_if->xsunim == True); }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class LEContext [friend]

Definition at line 118 of file LE.hh.


Member Data Documentation

string LEBase::dirname [private]

Definition at line 19 of file LE.hh.

bool LEBase::error [private]

Definition at line 18 of file LE.hh.

string LEBase::filename [private]

Definition at line 20 of file LE.hh.

Definition at line 34 of file LE.hh.

Definition at line 27 of file LE.hh.

Definition at line 25 of file LE.hh.

Definition at line 24 of file LE.hh.

Definition at line 35 of file LE.hh.

Definition at line 36 of file LE.hh.

Definition at line 37 of file LE.hh.

Definition at line 26 of file LE.hh.

Definition at line 23 of file LE.hh.

Definition at line 31 of file LE.hh.

Definition at line 29 of file LE.hh.

Definition at line 40 of file LE.hh.

string LEBase::lename [private]

Definition at line 21 of file LE.hh.

Definition at line 22 of file LE.hh.

bool LEBase::need_reload [private]

Definition at line 39 of file LE.hh.

bool LEBase::need_thread_lock [private]

Definition at line 38 of file LE.hh.

bool LEBase::sunim_default [private]

Definition at line 33 of file LE.hh.


The documentation for this class was generated from the following files: