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_AUTOMATON_H__ 22 #define __SCIM_ANTHY_AUTOMATON_H__ 23 24 #define Uses_SCIM_ICONV 25 #include <scim.h> 26 using namespace scim; 27 28 namespace scim_skk { 29 30 typedef struct _ConvRule 31 { 32 const char *string; 33 const char *result; 34 const char *cont; 35 } ConvRule; 36 37 typedef struct _HiraganaKatakanaRule 38 { 39 const char *hiragana; 40 const char *katakana; 41 const char *half_katakana; 42 } HiraganaKatakanaRule; 43 44 typedef struct _WideRule 45 { 46 const char *code; 47 const char *wide; 48 } WideRule; 49 50 #if 0 51 class ConvRule 52 { 53 WideString *m_string; 54 WideString *m_result; 55 WideString *m_continue; 56 57 public: 58 ConvRule (); 59 virtual ~ConvRule(); 60 }; 61 #endif 62 63 class SKKAutomaton 64 { 65 WideString m_pending; 66 ConvRule *m_table; 67 unsigned int m_table_len; 68 ConvRule *m_exact_match; 69 std::vector<ConvRule*> m_tables; 70 71 public: 72 enum { 73 HAS_PARSHAL_MATCH, 74 HAS_EXACT_MATCH, 75 COMMIT_PREV_PENDING, 76 }; 77 78 SKKAutomaton (); 79 virtual ~SKKAutomaton (); 80 81 virtual bool append (const String & str, 82 WideString & result, 83 WideString & pending); 84 virtual void clear (void); 85 86 virtual bool is_pending (void); 87 virtual WideString get_pending (void); 88 virtual WideString flush_pending (void); 89 virtual void set_pending (WideString &pending); 90 91 virtual void set_table (ConvRule *table); 92 virtual void append_table (ConvRule *table); 93 virtual void remove_table (ConvRule *table); 94 }; 95 96 } /* namespace scim_skk */ 97 #endif /* __SCIM_ANTHY_AUTOMATON_H__ */ 98 /* 99 vi:ts=4:nowrap:ai:expandtab 100 */ 101