I'm looking for a way to parse c++ code to retrieve some basic information about classes. I don't actually need much information from the code itself, but I do need it to handle things like macros and templates. In short, I want to extract the "structure" of the code, what you would show in a UML diagram.
For each class/struct/union/enum/typedef in the code base, all I need (after templates & macros have been handled) is:
- Their name
- The namespace in which they live
- The fields contained within (name of type, name of field and access restrictions, such as private/mutable/etc)
- Functions contained within (return type, name, parameters)
- The declaring file
- Line/column numbers (or byte offset in file) where the definition of this data begins
The actual instructions in the code are irrelevant for my purposes.
I'm anticipating a lot of people saying I should just use a regex for this (or even Flex & Bison), but these aren't really valid, as I do need the preprocessor and template stuff handled properly.