mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings: detect signals
This commit is contained in:
parent
feb7b1d5f4
commit
2a93cbf2d3
@ -159,6 +159,8 @@ func processClassType(node map[string]interface{}, className string) (CppClass,
|
||||
}
|
||||
}
|
||||
|
||||
isSignal := false
|
||||
|
||||
// Parse all methods
|
||||
|
||||
nextMethod:
|
||||
@ -190,6 +192,15 @@ nextMethod:
|
||||
panic("unexpected access visibility '" + access + "'")
|
||||
}
|
||||
|
||||
// Clang sees Q_SIGNALS/signals as being a macro for `public`
|
||||
// If this AccessSpecDecl was imported from a macro, assume it's signals
|
||||
isSignal = false
|
||||
if loc, ok := node["loc"].(map[string]interface{}); ok {
|
||||
if _, ok := loc["expansionLoc"].(map[string]interface{}); ok {
|
||||
isSignal = true
|
||||
}
|
||||
}
|
||||
|
||||
case "FriendDecl":
|
||||
// Safe to ignore
|
||||
|
||||
@ -270,6 +281,8 @@ nextMethod:
|
||||
return CppClass{}, err
|
||||
}
|
||||
|
||||
mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject`
|
||||
|
||||
ret.Methods = append(ret.Methods, mm)
|
||||
|
||||
default:
|
||||
|
@ -67,6 +67,7 @@ type CppMethod struct {
|
||||
ReturnType CppParameter // Name not used
|
||||
Parameters []CppParameter
|
||||
IsStatic bool
|
||||
IsSignal bool
|
||||
}
|
||||
|
||||
func IsArgcArgv(params []CppParameter) bool {
|
||||
|
Loading…
Reference in New Issue
Block a user