| 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 |
* Copyright (C) 2012 CSSlayer |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2, or (at your option) |
| 10 |
* any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef __FCITX_ANTHY_KEY2KANA_H__ |
| 23 |
#define __FCITX_ANTHY_KEY2KANA_H__ |
| 24 |
|
| 25 |
#include "key2kana_base.h" |
| 26 |
#include "default_tables.h" |
| 27 |
#include "key2kana_table.h" |
| 28 |
|
| 29 |
class AnthyInstance; |
| 30 |
|
| 31 |
class Key2KanaConvertor : public Key2KanaConvertorBase |
| 32 |
{ |
| 33 |
public: |
| 34 |
Key2KanaConvertor (AnthyInstance & anthy, |
| 35 |
Key2KanaTableSet & tables); |
| 36 |
virtual ~Key2KanaConvertor (); |
| 37 |
|
| 38 |
bool can_append (const KeyEvent & key, |
| 39 |
bool ignore_space = false); |
| 40 |
bool append (const KeyEvent & key, |
| 41 |
std::string & result, |
| 42 |
std::string & pending, |
| 43 |
std::string & raw); |
| 44 |
void clear (void); |
| 45 |
|
| 46 |
bool is_pending (void); |
| 47 |
std::string get_pending (void); |
| 48 |
std::string flush_pending (void); |
| 49 |
void reset_pending (const std::string & result, |
| 50 |
const std::string & raw); |
| 51 |
void set_pseudo_ascii_mode (int mode) |
| 52 |
{ m_pseudo_ascii_mode = mode; } |
| 53 |
bool is_pseudo_ascii_mode (void) |
| 54 |
{ return m_is_in_pseudo_ascii_mode; } |
| 55 |
bool process_pseudo_ascii_mode (const std::string & wstr); |
| 56 |
void reset_pseudo_ascii_mode (void); |
| 57 |
|
| 58 |
private: |
| 59 |
bool append (const std::string & str, |
| 60 |
std::string & result, |
| 61 |
std::string & pending); |
| 62 |
|
| 63 |
private: |
| 64 |
AnthyInstance &m_anthy; |
| 65 |
Key2KanaTableSet &m_tables; |
| 66 |
|
| 67 |
// state |
| 68 |
KeyEvent m_last_key; |
| 69 |
std::string m_pending; |
| 70 |
Key2KanaRule m_exact_match; |
| 71 |
int m_pseudo_ascii_mode; |
| 72 |
bool m_is_in_pseudo_ascii_mode; |
| 73 |
bool m_reset_pseudo_ascii_mode; |
| 74 |
}; |
| 75 |
|
| 76 |
#endif /* __FCITX_ANTHY_KEY2KANA_H__ */ |
| 77 |
/* |
| 78 |
vi:ts=4:nowrap:ai:expandtab |
| 79 |
*/ |