pygccxml
pygccxml copied to clipboard
Loop over declarations inside a template
Is there a way to loop over the types defined inside a template? I'm currently testing the library with the following code:
namespace A {
struct B {
struct D { bool d; };
};
struct D {};
template <typename T1, typename T2>
struct T {
struct E { int e; };
};
T<B::D, bool> fun();
}
Starting with namespace A
, I'm able to go to the template declaration but then I'm stuck.
>>> decls = pgx.parser.parse_string(cppsource, pgx_config)
>>> globalNamespace = pgx.declarations.get_global_namespace(decls)
>>> aNamespace = globalNamespace.namespace("A")
>>> x = aNamespace.declarations[2]
>>> x.decl_string
'::A::T<A::B::D, bool>'
>>> x.declarations
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'class_declaration_t' object has no attribute 'declarations'
Is there somewhere a link from class_declaration_t
to the scope so that I can recurse into the template?