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/1981c821
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/1981c821
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/1981c821

Branch: refs/heads/master
Commit: 1981c8214dbf224a6e0f5d9626481139c554d41e
Parents: 52121a1
Author: Marvin Humphrey <[email protected]>
Authored: Sun Nov 16 21:25:08 2014 -0800
Committer: Marvin Humphrey <[email protected]>
Committed: Sun Mar 15 18:48:11 2015 -0700

----------------------------------------------------------------------
 go/lucy/analysis.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/1981c821/go/lucy/analysis.go
----------------------------------------------------------------------
diff --git a/go/lucy/analysis.go b/go/lucy/analysis.go
new file mode 100644
index 0000000..d538a86
--- /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.cfish_dec_refcount(unsafe.Pointer(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()
+}

Reply via email to