简体   繁体   English

需要输入以制作在 C/C++ 源/头文件中插入预格式化注释的工具

[英]Need inputs for making a tool to insert preformatted comments in C/C++ source/header file

I am trying to develop a tool that inserts comments in C/C++ source files in pre-defined formats.我正在尝试开发一种工具,以预定义格式在 C/C++ 源文件中插入注释。

The comments could be:评论可能是:

  1. file headers <-> file names required文件头 <-> 需要的文件名
  2. class comments <-> class name required class 注释 <-> class 需要名称
  3. function comments <-> function name required function 注释 <-> function 需要名称

Following points are required to be taken mind:需要注意以下几点:

  1. If the comments are already there in right format then leave them intact.如果评论已经以正确的格式存在,则保持原样。
  2. If the comments are broken them fix them and insert them.如果评论被破坏,他们修复它们并插入它们。

Some desirable but non important features:一些可取但不重要的特性:

  1. Check and fix the indentation.检查并修复压痕。
  2. 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.从模板或脚本语言生成整个 c/c++ 代码和标头,并使用它来插入预先格式化的注释。 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.您可以尝试使用 doxygen 生成 html、xml 或其他格式。 Problem would still be, how to get the generated documentation back into your sources...问题仍然是,如何将生成的文档返回到您的源中......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM