[aquaskk-changes 398] CVS update: AquaSKK/src/context

Back to archive index

t-suw****@users***** t-suw****@users*****
2007年 10月 5日 (金) 23:34:34 JST


Index: AquaSKK/src/context/SKKContext.cpp
diff -u AquaSKK/src/context/SKKContext.cpp:1.1.2.4 AquaSKK/src/context/SKKContext.cpp:1.1.2.5
--- AquaSKK/src/context/SKKContext.cpp:1.1.2.4	Mon Sep 24 10:51:05 2007
+++ AquaSKK/src/context/SKKContext.cpp	Fri Oct  5 23:34:34 2007
@@ -1,5 +1,5 @@
 /* -*- C++ -*-
-   $Id: SKKContext.cpp,v 1.1.2.4 2007/09/24 01:51:05 t-suwa Exp $
+   $Id: SKKContext.cpp,v 1.1.2.5 2007/10/05 14:34:34 t-suwa Exp $
 
    MacOS X implementation of the SKK input method.
 
@@ -32,7 +32,7 @@
 }
 
 SKKContext::SKKContext(const SKKContext& src)
-    : prompt_(src.prompt_), input_(src.input_), entry_(src.entry_), word_(src.word_) {
+    : prompt_(src.prompt_), input_(src.input_), entry_(src.entry_), okuri_(src.okuri_), word_(src.word_) {
     initialize();
 }
 
@@ -56,6 +56,10 @@
     return entry_;
 }
 
+SKKOkuriBuffer& SKKContext::OkuriBuffer() {
+    return okuri_;
+}
+
 SKKEditBuffer& SKKContext::WordBuffer() {
     return word_;
 }
Index: AquaSKK/src/context/SKKContext.h
diff -u AquaSKK/src/context/SKKContext.h:1.1.2.4 AquaSKK/src/context/SKKContext.h:1.1.2.5
--- AquaSKK/src/context/SKKContext.h:1.1.2.4	Mon Sep 24 10:51:05 2007
+++ AquaSKK/src/context/SKKContext.h	Fri Oct  5 23:34:34 2007
@@ -24,6 +24,7 @@
 #include <string>
 #include "SKKInputBuffer.h"
 #include "SKKEditBuffer.h"
+#include "SKKOkuriBuffer.h"
 #include "SKKOutputPort.h"
 
 // 入力コンテキスト
@@ -31,6 +32,7 @@
     std::string prompt_;	// 登録用見出し語
     SKKInputBuffer input_;	// 入力バッファ
     SKKEditBuffer entry_;	// 見出し語バッファ
+    SKKOkuriBuffer okuri_;	// 送りバッファ
     SKKEditBuffer word_;	// 登録バッファ
     SKKOutputPort* port_;	// 出力ポート
 
@@ -47,6 +49,7 @@
 
     SKKInputBuffer& InputBuffer();
     SKKEditBuffer& EditBuffer();
+    SKKOkuriBuffer& OkuriBuffer();
     SKKEditBuffer& WordBuffer();
     SKKOutputPort& OutputPort();
 };
Index: AquaSKK/src/context/SKKOkuriBuffer.cpp
diff -u /dev/null AquaSKK/src/context/SKKOkuriBuffer.cpp:1.1.2.1
--- /dev/null	Fri Oct  5 23:34:34 2007
+++ AquaSKK/src/context/SKKOkuriBuffer.cpp	Fri Oct  5 23:34:34 2007
@@ -0,0 +1,64 @@
+/* -*- C++ -*-
+   MacOS X implementation of the SKK input method.
+
+   Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "SKKOkuriBuffer.h"
+
+SKKOkuriBuffer::SKKOkuriBuffer() {
+}
+
+void SKKOkuriBuffer::Initialize(char okuri) {
+    Clear();
+    okuri_ += okuri;
+}
+
+bool SKKOkuriBuffer::Input(char ch) {
+    if(buffer_.Input(ch)) {
+	kana_ = buffer_.FixedString();
+	return true;
+    }
+
+    return false;
+}
+
+void SKKOkuriBuffer::BackSpace() {
+    buffer_.BackSpace();
+}
+
+void SKKOkuriBuffer::Clear() {
+    buffer_.Clear();
+    okuri_.clear();
+    kana_.clear();
+}
+
+bool SKKOkuriBuffer::IsEmpty() const {
+    return buffer_.IsEmpty();
+}
+
+void SKKOkuriBuffer::SelectInputMode(SKK::InputMode mode) {
+    buffer_.SelectInputMode(mode);
+}
+
+const std::string& SKKOkuriBuffer::OkuriString() const {
+    return okuri_;
+}
+
+const std::string& SKKOkuriBuffer::KanaString() const {
+    return kana_;
+}
Index: AquaSKK/src/context/SKKOkuriBuffer.h
diff -u /dev/null AquaSKK/src/context/SKKOkuriBuffer.h:1.1.2.1
--- /dev/null	Fri Oct  5 23:34:34 2007
+++ AquaSKK/src/context/SKKOkuriBuffer.h	Fri Oct  5 23:34:34 2007
@@ -0,0 +1,50 @@
+/* -*- C++ -*-
+   MacOS X implementation of the SKK input method.
+
+   Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef INC__SKKOkuriBuffer__
+#define INC__SKKOkuriBuffer__
+
+#include <string>
+#include "SKKInputBuffer.h"
+
+// 送りバッファ
+class SKKOkuriBuffer {
+    SKKInputBuffer buffer_;
+    std::string okuri_;
+    std::string kana_;
+
+public:
+    SKKOkuriBuffer();
+
+    void Initialize(char okuri);
+
+    bool Input(char ch);
+    void BackSpace();
+    void Clear();
+
+    bool IsEmpty() const;
+
+    void SelectInputMode(SKK::InputMode mode);
+
+    const std::string& OkuriString() const;
+    const std::string& KanaString() const;
+};
+
+#endif
Index: AquaSKK/src/context/SKKOutputPort.cpp
diff -u AquaSKK/src/context/SKKOutputPort.cpp:1.1.2.1 AquaSKK/src/context/SKKOutputPort.cpp:1.1.2.2
--- AquaSKK/src/context/SKKOutputPort.cpp:1.1.2.1	Mon Sep 24 07:58:10 2007
+++ AquaSKK/src/context/SKKOutputPort.cpp	Fri Oct  5 23:34:34 2007
@@ -74,24 +74,3 @@
     active.Terminate();
 #endif
 }
-
-void SKKOutputPort::Ignore(char) {
-}
-
-void SKKOutputPort::BackSpace() {
-}
-
-void SKKOutputPort::Delete() {
-}
-
-void SKKOutputPort::CursorLeft() {
-}
-
-void SKKOutputPort::CursorRight() {
-}
-
-void SKKOutputPort::CursorUp() {
-}
-
-void SKKOutputPort::CursorDown() {
-}
Index: AquaSKK/src/context/SKKOutputPort.h
diff -u AquaSKK/src/context/SKKOutputPort.h:1.1.2.1 AquaSKK/src/context/SKKOutputPort.h:1.1.2.2
--- AquaSKK/src/context/SKKOutputPort.h:1.1.2.1	Mon Sep 24 07:58:10 2007
+++ AquaSKK/src/context/SKKOutputPort.h	Fri Oct  5 23:34:34 2007
@@ -38,14 +38,6 @@
     virtual void DisplayString(const std::string& str, int cursorPosition);
     virtual void FixString(const std::string& str);
     virtual void Terminate();
-
-    virtual void Ignore(char ch);
-    virtual void BackSpace();
-    virtual void Delete();
-    virtual void CursorLeft();
-    virtual void CursorRight();
-    virtual void CursorUp();
-    virtual void CursorDown();
 };
 
 #endif
Index: AquaSKK/src/context/SKKRegistrationOutputPort.cpp
diff -u AquaSKK/src/context/SKKRegistrationOutputPort.cpp:1.1.2.1 AquaSKK/src/context/SKKRegistrationOutputPort.cpp:1.1.2.2
--- AquaSKK/src/context/SKKRegistrationOutputPort.cpp:1.1.2.1	Mon Sep 24 07:58:10 2007
+++ AquaSKK/src/context/SKKRegistrationOutputPort.cpp	Fri Oct  5 23:34:34 2007
@@ -53,51 +53,6 @@
     SKKOutputPort::DisplayString(result, utf8::length(prompt_) + word.CursorPosition());
 }
 
-void SKKRegistrationOutputPort::Ignore(char ch) {
-    DisplayString(std::string(1, ch));
-}
-
-void SKKRegistrationOutputPort::BackSpace() {
-    context_.WordBuffer().BackSpace();
-
-    display();
-}
-
-void SKKRegistrationOutputPort::Delete() {
-    context_.WordBuffer().Delete();
-
-    display();
-}
-
-void SKKRegistrationOutputPort::CursorLeft() {
-    context_.WordBuffer().CursorLeft();
-
-    display();
-}
-
-void SKKRegistrationOutputPort::CursorRight() {
-    context_.WordBuffer().CursorRight();
-
-    display();
-}
-
-void SKKRegistrationOutputPort::CursorUp() {
-    context_.WordBuffer().CursorUp();
-
-    display();
-}
-
-void SKKRegistrationOutputPort::CursorDown() {
-    context_.WordBuffer().CursorDown();
-
-    display();
-}
-
-// ======================================================================
-// private method
-// ======================================================================
-void SKKRegistrationOutputPort::display() {
-    SKKEditBuffer& word = context_.WordBuffer();
-
-    DisplayString(prompt_ + word.EditString(), word.CursorPosition());
+void SKKRegistrationOutputPort::Terminate() {
+    std::cerr << "[reg:terminate]" << std::endl;
 }
Index: AquaSKK/src/context/SKKRegistrationOutputPort.h
diff -u AquaSKK/src/context/SKKRegistrationOutputPort.h:1.1.2.1 AquaSKK/src/context/SKKRegistrationOutputPort.h:1.1.2.2
--- AquaSKK/src/context/SKKRegistrationOutputPort.h:1.1.2.1	Mon Sep 24 07:58:10 2007
+++ AquaSKK/src/context/SKKRegistrationOutputPort.h	Fri Oct  5 23:34:34 2007
@@ -27,22 +27,13 @@
 class SKKRegistrationOutputPort : public SKKOutputPort {
     const std::string prompt_;
 
-    void display();
-
 public:
     SKKRegistrationOutputPort(SKKContext& context);
 
     virtual void DisplayString(const std::string& str);
     virtual void DisplayString(const std::string& str, int cursorPosition);
     virtual void FixString(const std::string& str);
-
-    virtual void Ignore(char ch);
-    virtual void BackSpace();
-    virtual void Delete();
-    virtual void CursorLeft();
-    virtual void CursorRight();
-    virtual void CursorUp();
-    virtual void CursorDown();
+    virtual void Terminate();
 };
 
 #endif


aquaskk-changes メーリングリストの案内
Back to archive index