genbindings: parse typedefs (don't do anything with them yet)

This commit is contained in:
mappu 2024-08-14 18:26:42 +12:00
parent 944e04bf5d
commit d7a7ae9bcf
2 changed files with 24 additions and 2 deletions

View File

@ -61,6 +61,22 @@ func parseHeader(inner []interface{}) (*CppParsedHeader, error) {
case "FunctionDecl":
// TODO
case "TypedefDecl":
// Must have a name
nodename, ok := node["name"].(string)
if !ok {
return nil, errors.New("node has no name")
}
if typ, ok := node["type"].(map[string]interface{}); ok {
if qualType, ok := typ["qualType"].(string); ok {
ret.Typedefs = append(ret.Typedefs, CppTypedef{
Name: nodename,
Typedef: qualType,
})
}
}
case "CXXMethodDecl":
// A C++ class method implementation directly in the header
// Skip over these

View File

@ -84,6 +84,12 @@ type CppClass struct {
Props []CppProperty
}
type CppParsedHeader struct {
Classes []CppClass
type CppTypedef struct {
Name string
Typedef string
}
type CppParsedHeader struct {
Typedefs []CppTypedef
Classes []CppClass
}