-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdep.go
49 lines (39 loc) · 997 Bytes
/
dep.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package pkgcraft
// #cgo pkg-config: pkgcraft
// #include <pkgcraft.h>
import "C"
import (
"runtime"
)
type DependencyUnit int
const (
DependencyUnitDep DependencyUnit = iota
DependencyUnitString
DependencyUnitUri
)
type Dependency struct {
ptr *C.Dependency
}
func depFromPtr(ptr *C.Dependency) *Dependency {
obj := &Dependency{ptr}
runtime.SetFinalizer(obj, func(self *Dependency) { C.pkgcraft_dependency_free(self.ptr) })
return obj
}
func (self *Dependency) String() string {
s := C.pkgcraft_dependency_str(self.ptr)
defer C.pkgcraft_str_free(s)
return C.GoString(s)
}
type DependencySet struct {
ptr *C.DependencySet
}
func dependencySetFromPtr(ptr *C.DependencySet) *DependencySet {
obj := &DependencySet{ptr}
runtime.SetFinalizer(obj, func(self *DependencySet) { C.pkgcraft_dependency_set_free(self.ptr) })
return obj
}
func (self *DependencySet) String() string {
s := C.pkgcraft_dependency_set_str(self.ptr)
defer C.pkgcraft_str_free(s)
return C.GoString(s)
}