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

Back to archive index

t-suw****@users***** t-suw****@users*****
2007年 10月 20日 (土) 12:14:29 JST


Index: AquaSKK/src/context/SKKCompletionBuffer.cpp
diff -u /dev/null AquaSKK/src/context/SKKCompletionBuffer.cpp:1.1.2.1
--- /dev/null	Sat Oct 20 12:14:29 2007
+++ AquaSKK/src/context/SKKCompletionBuffer.cpp	Sat Oct 20 12:14:29 2007
@@ -0,0 +1,44 @@
+/* -*- 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 "SKKCompletionBuffer.h"
+
+void SKKCompletionBuffer::Next() {
+    assert(!buffer_.empty());
+
+    if(++ iter_ == buffer_.end()) {
+	iter_ = buffer_.begin();
+    }
+}
+
+void SKKCompletionBuffer::Prev() {
+    assert(!buffer_.empty());
+
+    if(iter_ == buffer_.begin()) {
+	iter_ = buffer_.end();
+    }
+    -- iter_;
+}
+
+const std::string& SKKCompletionBuffer::CurrentString() const {
+    assert(!buffer_.empty());
+
+    return *iter_;
+}
Index: AquaSKK/src/context/SKKCompletionBuffer.h
diff -u /dev/null AquaSKK/src/context/SKKCompletionBuffer.h:1.1.2.1
--- /dev/null	Sat Oct 20 12:14:29 2007
+++ AquaSKK/src/context/SKKCompletionBuffer.h	Sat Oct 20 12:14:29 2007
@@ -0,0 +1,49 @@
+/* -*- 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__SKKCompletionBuffer__
+#define INC__SKKCompletionBuffer__
+
+#include <vector>
+#include <string>
+
+// 補完バッファ
+class SKKCompletionBuffer {
+    std::vector<std::string> buffer_;
+    std::vector<std::string>::iterator iter_;
+
+public:
+    template <typename CompletePolicy>
+    bool Complete(const CompletePolicy& policy) {
+	buffer_.clear();
+
+	policy(buffer_);
+	iter_ = buffer_.begin();
+
+	return !buffer_.empty();
+    }
+
+    void Next();
+    void Prev();
+
+    const std::string& CurrentString() const;
+};
+
+#endif
Index: AquaSKK/src/context/SKKContext.cpp
diff -u AquaSKK/src/context/SKKContext.cpp:1.1.2.5 AquaSKK/src/context/SKKContext.cpp:1.1.2.6
--- AquaSKK/src/context/SKKContext.cpp:1.1.2.5	Fri Oct  5 23:34:34 2007
+++ AquaSKK/src/context/SKKContext.cpp	Sat Oct 20 12:14:29 2007
@@ -1,5 +1,5 @@
 /* -*- C++ -*-
-   $Id: SKKContext.cpp,v 1.1.2.5 2007/10/05 14:34:34 t-suwa Exp $
+   $Id: SKKContext.cpp,v 1.1.2.6 2007/10/20 03:14:29 t-suwa Exp $
 
    MacOS X implementation of the SKK input method.
 
@@ -64,6 +64,10 @@
     return word_;
 }
 
+SKKCompletionBuffer& SKKContext::CompletionBuffer() {
+    return comp_;
+}
+
 SKKOutputPort& SKKContext::OutputPort() {
     return *port_;
 }
Index: AquaSKK/src/context/SKKContext.h
diff -u AquaSKK/src/context/SKKContext.h:1.1.2.5 AquaSKK/src/context/SKKContext.h:1.1.2.6
--- AquaSKK/src/context/SKKContext.h:1.1.2.5	Fri Oct  5 23:34:34 2007
+++ AquaSKK/src/context/SKKContext.h	Sat Oct 20 12:14:29 2007
@@ -25,6 +25,7 @@
 #include "SKKInputBuffer.h"
 #include "SKKEditBuffer.h"
 #include "SKKOkuriBuffer.h"
+#include "SKKCompletionBuffer.h"
 #include "SKKOutputPort.h"
 
 // 入力コンテキスト
@@ -34,6 +35,7 @@
     SKKEditBuffer entry_;	// 見出し語バッファ
     SKKOkuriBuffer okuri_;	// 送りバッファ
     SKKEditBuffer word_;	// 登録バッファ
+    SKKCompletionBuffer comp_;	// 補完バッファ
     SKKOutputPort* port_;	// 出力ポート
 
     void initialize();
@@ -51,6 +53,7 @@
     SKKEditBuffer& EditBuffer();
     SKKOkuriBuffer& OkuriBuffer();
     SKKEditBuffer& WordBuffer();
+    SKKCompletionBuffer& CompletionBuffer();
     SKKOutputPort& OutputPort();
 };
 


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