cppheaderparser is a very useful module that you can use to parse C/C++ headers with Python.
The module allows you to walk through the classes, functions, parameters etc... I've been using this for a while now to generate bindings for a C shared library. This is an example of how you can use it:
#!/usr/bin/python
import CppHeaderParser
header = CppHeaderParser.CppHeader('MyClass.h')
for c in cpp_header.classes: #iterate over classes
for f in cls['methods']['public']: #iterate over public functions
print 'static:', f['static'], ' return type:', f['rtnType'],
       ' parameters:', f['parameters']
No comments:
Post a Comment