You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/11/17 18:33:38 UTC
[6/8] lucy git commit: Go stubs for Analyzer and EasyAnalyzer.
Go stubs for Analyzer and EasyAnalyzer.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3d2b0fd1
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3d2b0fd1
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3d2b0fd1
Branch: refs/heads/go_bindings_1
Commit: 3d2b0fd16302c0c8f7c9e88a24e8d84bc7ffa0d3
Parents: 3866bbb
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sun Nov 16 21:25:08 2014 -0800
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Mon Nov 17 09:28:25 2014 -0800
----------------------------------------------------------------------
go/lucy/analysis.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/3d2b0fd1/go/lucy/analysis.go
----------------------------------------------------------------------
diff --git a/go/lucy/analysis.go b/go/lucy/analysis.go
new file mode 100644
index 0000000..4ee58d1
--- /dev/null
+++ b/go/lucy/analysis.go
@@ -0,0 +1,58 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package lucy
+
+/*
+#include "Lucy/Analysis/Analyzer.h"
+#include "Lucy/Analysis/EasyAnalyzer.h"
+*/
+import "C"
+import "runtime"
+import "unsafe"
+
+import "git-wip-us.apache.org/repos/asf/lucy-clownfish.git/runtime/go/clownfish"
+
+type Analyzer interface {
+ clownfish.Obj
+ ToAnalyzerPtr() unsafe.Pointer
+}
+
+type EasyAnalyzer struct {
+ ref *C.lucy_EasyAnalyzer
+}
+
+func NewEasyAnalyzer(language string) *EasyAnalyzer {
+ lang := clownfish.NewString(language)
+ obj := &EasyAnalyzer{
+ C.lucy_EasyAnalyzer_new((*C.cfish_String)(lang.ToPtr())),
+ }
+ runtime.SetFinalizer(obj, (*EasyAnalyzer).finalize)
+ return obj
+}
+
+func (obj *EasyAnalyzer) finalize() {
+ C.LUCY_EasyAnalyzer_Dec_RefCount(obj.ref)
+ obj.ref = nil
+}
+
+func (obj *EasyAnalyzer) ToPtr() unsafe.Pointer {
+ return unsafe.Pointer(obj.ref)
+}
+
+func (obj *EasyAnalyzer) ToAnalyzerPtr() unsafe.Pointer {
+ return obj.ToPtr()
+}