v0.2.2 9100209

interface.go RawHistoryFolder

1package types
2
3import (
4	"strings"
5
6	"github.com/bnema/puregotk/internal/gir/util"
7)
8
9func ConvertInterface(currns string, ins string, inter Interface, implemented map[string]bool, kinds KindMap) InterfaceTemplate {
10	var methods []InterfaceFuncTemplate
11
12	for _, m := range inter.Methods {
13		name := util.SnakeToCamel(m.Name)
14		if implemented != nil {
15			v, ok := implemented[name]
16			if v && ok {
17				continue
18			}
19		}
20		var newns string
21		if ins != "" {
22			newns = ins + "."
23		}
24		methods = append(methods, InterfaceFuncTemplate{
25			Namespace: newns,
26			FullName:  util.SnakeToCamel(m.CIdentifier),
27			FuncTemplate: FuncTemplate{
28				Doc:   m.Doc.StringSafe(),
29				CName: m.CIdentifier,
30				Name:  name,
31				Args:  m.Parameters.Template(currns, ins, kinds, m.Throws, ArgsFromGoToC),
32				Ret:   m.ReturnValue.Template(currns, ins, kinds, m.Throws),
33			},
34		})
35	}
36
37	properties := make([]PropertyTemplate, 0, len(inter.Properties))
38	for _, prop := range inter.Properties {
39		propTemp := prop.Template(currns, kinds)
40
41		// TODO: Implement non-primitive types, then remove this
42		if propTemp.GValueType != "" {
43			properties = append(properties, propTemp)
44		}
45	}
46
47	name := util.SnakeToCamel(inter.Name)
48	return InterfaceTemplate{
49		Name:       name,
50		Doc:        inter.Doc.StringSafe(),
51		Methods:    methods,
52		Properties: properties,
53		TypeGetter: inter.GLibGetType,
54	}
55}
56
57func GetInterfaceFuncs(ns string, name string, implemented map[string]bool, kinds KindMap) InterfaceTemplate {
58	inter := kinds.MustInterface(ns, name)
59	parts := strings.Split(name, ".")
60	var ins string
61	if len(parts) > 1 {
62		ins = strings.ToLower(parts[0])
63	}
64	return ConvertInterface(ns, ins, inter, implemented, kinds)
65}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close