How to parse through a C/C++/C# project and write all packages/classes/methods into a database? [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this questionFor my new application I would like to parse another C, C++ or C# project, so that i can later display the graphical representation of all the classes in this project.
So I thought that its a good approach to use a database with the following tables to store the necessary information:
TablePackages:
id | name | parentID
TableClasses:
id | name | packageID | sourceCodeID
TableSourceCode:
id | members | constructors | methods | classID
But now, how can I parse in my C# application the source files of other projects? Are there any libraries available or where should I start?
Should I even rethink my approach and choose a completely different one?
For C#, you can compile it and use reflection to get the list of all classes/properties/methods. For C/C++, you would perhaps need to implement a parser in some form yourself.
精彩评论