Tizen 2.1 base
[framework/uifw/ise-engine-anthy.git] / src / scim_anthy_key2kana.h
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  *  Copyright (C) 2004 Hiroyuki Ikezoe
4  *  Copyright (C) 2004 Takuro Ashie
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __SCIM_ANTHY_KEY2KANA_H__
22 #define __SCIM_ANTHY_KEY2KANA_H__
23
24 #define Uses_SCIM_EVENT
25 #include <scim.h>
26
27 #include "scim_anthy_key2kana_base.h"
28 #include "scim_anthy_default_tables.h"
29 #include "scim_anthy_key2kana_table.h"
30
31 using namespace scim;
32
33 class AnthyInstance;
34
35 namespace scim_anthy {
36
37 class Key2KanaConvertor : public Key2KanaConvertorBase
38 {
39 public:
40     Key2KanaConvertor                        (AnthyInstance    & anthy,
41                                               Key2KanaTableSet & tables);
42     virtual ~Key2KanaConvertor               ();
43
44     bool       can_append                    (const KeyEvent   & key,
45                                               bool               ignore_space = false);
46     bool       append                        (const KeyEvent   & key,
47                                               WideString       & result,
48                                               WideString       & pending,
49                                               String           & raw);
50     void       clear                         (void);
51
52     bool       is_pending                    (void);
53     WideString get_pending                   (void);
54     WideString flush_pending                 (void);
55     void       reset_pending                 (const WideString & result,
56                                               const String     & raw);
57     void       set_pseudo_ascii_mode         (int                mode)
58         { m_pseudo_ascii_mode = mode; }
59     bool       is_pseudo_ascii_mode          (void)
60         { return m_is_in_pseudo_ascii_mode; }
61     bool       process_pseudo_ascii_mode     (const WideString & wstr);
62     void       reset_pseudo_ascii_mode       (void);
63
64 private:
65     bool       append             (const String     & str,
66                                    WideString       & result,
67                                    WideString       & pending);
68
69 private:
70     AnthyInstance     &m_anthy;
71     Key2KanaTableSet  &m_tables;
72
73     // state
74     KeyEvent           m_last_key;
75     WideString         m_pending;
76     Key2KanaRule       m_exact_match;
77     int                m_pseudo_ascii_mode;
78     bool               m_is_in_pseudo_ascii_mode;
79     bool               m_reset_pseudo_ascii_mode;
80 };
81
82 }
83 #endif /* __SCIM_ANTHY_KEY2KANA_H__ */
84 /*
85 vi:ts=4:nowrap:ai:expandtab
86 */