【vc++精品源码栏目提醒】:网学会员vc++精品源码为您提供【精品】doxygen标准VC注释(转) - 网络与通信参考,解决您在【精品】doxygen标准VC注释(转) - 网络与通信学习中工作中的难题,参考学习。
C 程序文档生成器介绍doxygen程序文档,曾经是程序员的一个头痛问题。
写一个程序文档,比较花时间,但不是很难;麻烦的是当程序修改后,程序文档也要跟着同步更新,否则文档和程序就要脱节,文档也就变成没用的东西了。
好在有许多好用的文档生成器来解决这个问题。
目前比较流行的 C文档生成器是 doxygen。
本文就简单的介绍一下 doxygen 的文档注释方法,以供初学者参考:1. 模块定义(单独显示一页)/ defgroup 模块名 模块的说明文字 / ... 定义的内容 .../ / // 模块结尾2. 分组定义(在一页内分组显示)/ name 分组说明文字 / ... 定义的内容 .../ /3. 变量、宏定义、类型定义简要说明/ 简要说明文字 /define FLOAT float/ brief 简要说明文字(在前面加 brief 是标准格式) /define MIN_UINT 0/ 分行的简要说明 n 这是第二行的简要说明 /int b4. 函数说明/ 简要的函数说明文字 param in param1 参数 1 说明 param out param2 参数 2 说明 return 返回值说明 /int funcint param1 int param2/ 打开文件 n 文件打开成功后,必须使用 ::CloseFile 函数关闭。
paramin file_name 文件名字符串 paramin file_mode 文件打开模式字符串,可以由以下几个模块组合而成: - r 读取 - w 可写 - a 添加 - t 文本模式不能与 b 联用 - b 二进制模式不能与 t 联用 return 返回文件编号 - -1 表示打开文件失败 note 文件打开成功后,必须使用 ::CloseFile 函数关闭 par 示例: code // 用文本只读方式打开文件 int f OpenFilequotd:test.txtquot quotrtquot endcode see ::ReadFile ::WriteFile ::CloseFile deprecated 由于特殊的原因,这个函数可能会在将来的版本中取消。
/int OpenFileconst char file_name const char file_mode5. 枚举类型定义/ 枚举常量 /typedef enum TDayOfWeekSUN 0 /lt 星期天(注意,要以 “lt” 小于号开头) /MON 1 /lt 星期一 /TUE 2 /lt 星期二 /WED 3 /lt 星期三 /THU 4 /lt 星期四 /FRI 5 /lt 星期五 /SAT 6 /lt 星期六 // 定义类型 TEnumDayOfWeek /TEnumDayOfWeek6.类的注释说明(实例)----------------------------- Example Begin --------------------------------- 文件的注释格式 注释文件格式: ///file 文件名 文件的简短注释.///file socket_c.h head file of class socket_c. 文件的详细注释.///Define the interface of class socket_c. 普通注释不会生成在文档中.//Id: socket_c.h 287 2004-06-28 06:20:41Z horin 类的注释格式: ///brief 简短注释内容.///brief class of server socket.class socket_cprivate:public: 函数的注释格式 函数的注释格式: ///brief 函数的简短注释. ///brief handle the connections of clients. 参数注释格式: ///param 参数的简短注释. ///param server the server ip address. ///param serv_port the server port. 返回值注释格式: ///return 返回值的简短注释. ///return connected socketfd. 具体返回值的注释格式: ///retval 返回值 该返回值的注释. ///retval connfd on success. ///retval 0 on EINTR - system call. ///retval -1 on error. 参见...格式: ///see 参见的类/文件等. ///see main_ppc.cpp int accept_clientconst int listenfd 自定义类型的注释///brief structure of child process.struct child_proc_s 行尾的注释格式: ///lt 注释内容. pid_t child_pid ///ltchild process id. int child_pipefd ///ltparents stream pipe to/from child. 全局变量的注释也可以采用上面的行尾格式进行注释.///gloable variable for signal.pid_t g_pid 0----------------------------- Example End ---------------------------------7. 配置文件的生成与修改 Doxygen 的功能强大配置选项也十分多. 如果