mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18: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
|
// Parse all methods
|
||||||
|
|
||||||
nextMethod:
|
nextMethod:
|
||||||
@ -190,6 +192,15 @@ nextMethod:
|
|||||||
panic("unexpected access visibility '" + access + "'")
|
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":
|
case "FriendDecl":
|
||||||
// Safe to ignore
|
// Safe to ignore
|
||||||
|
|
||||||
@ -270,6 +281,8 @@ nextMethod:
|
|||||||
return CppClass{}, err
|
return CppClass{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject`
|
||||||
|
|
||||||
ret.Methods = append(ret.Methods, mm)
|
ret.Methods = append(ret.Methods, mm)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -67,6 +67,7 @@ type CppMethod struct {
|
|||||||
ReturnType CppParameter // Name not used
|
ReturnType CppParameter // Name not used
|
||||||
Parameters []CppParameter
|
Parameters []CppParameter
|
||||||
IsStatic bool
|
IsStatic bool
|
||||||
|
IsSignal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsArgcArgv(params []CppParameter) bool {
|
func IsArgcArgv(params []CppParameter) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user