I am trying to develop a tool that inserts comments in C/C++ source files in pre-defined formats.
The comments could be:
- file headers <-> file names required
- class comments <-> class name required
- function comments <-> function name required
Following points are required to be taken mind:
- If the comments are already there in right format then leave them intact.
- If the comments are broken them fix them and insert them.
Some desirable but non important features:
- Check and fix the indentation.
- Check if any breaks are missing in their respective cases.
Please suggest open-source / free libraries / logic to aid in this.
I guess you ‘ve got two choices:
Generate the whole c/c++ code and headers from a template or scripting language and use this one to insert the preformated comments. This is of course not an option if you still got a lot of code.
Or you need a tool to parse the code into sth. you can further use. You could try doxygen to generate html, xml or some other format. Problem would still be, how to get the generated documentation back into your sources…