Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > C/C++ > Doxygen-C/C++ java文档生成器入门心得
【标  题】:Doxygen-C/C++ java文档生成器入门心得
【关键字】:Doxygen-C/C++,java
【来  源】:http://www.cppblog.com/dyj057/archive/2007/01/16/17684.html

Doxygen-C/C++ java文档生成器入门心得

Your Ad Here C++博客 - 天下无双 - Doxygen-C/C++ java文档生成器入门心得
天下无双
我最鄙视2种人:1是黑人,2是种族歧视者,3是不识数的
posts - 8,comments - 16,trackbacks - 0

最近在为文档的书写苦恼,本来想自己写一个文档解析程序,名字都想好了。后来竟然在找资料的过程中发现了一个很好的C/C++ java文档生成器Doxygen,真是无心插柳柳成行,我的原则是不要重复发明车轮,所以就是用这个开源的项目。给大家一些学习的链接看看,很容易入门的。
http://www.cppblog.com/richardzeng/archive/2006/03/23/4508.html
http://www.chinaitpower.com/A/2003-01-19/47536.html
如果你要看全面的介绍文档,可以在它的主页去看:http://www.stack.nl/~dimitri/doxygen/,不过都是英文的。
问题:我的一个C文档的注释在Eclipse里面是中文写的,所以编码格式为utf-8。无论我Doxygen改成english或者chinese都没有办法正确显示。我查看了生成的html的编码竟然不是utf-8编码,我想解决的办法就是要自己来定义生成的html文档。
高兴,Show我生成的文档。下面是C语言写得一个函数

/* *
*@brief?read?string?in?initialization?file
*
*retrieves?a?string?from?the?specified?section?in?an?initialization?file
*@param?section?[name?of?the?section?containing?the?key?name]
*@param?key?[name?of?the?section?containing?the?key?name]
*@param?value?[pointer?to?the?buffer?that?receives?the?retrieved?string]
*@param?size?[size?of?value?buffer]
*@param?file?[name?of?the?initialization?file]
*@return?[1?:?read?success;?0?:?read?fail]
*/
int ?read_profile_string(? const ? char ? * section,? const ? char ? * key, char ? * value,?? int ?size,? const ? char ? * file)
{
????
char ?buf[MAX_FILE_SIZE] = { 0 };
????
int ?file_size;
????
int ?sec_s,sec_e,key_s,key_e,?value_s,?value_e;

????
// check?parameters
????assert(section? != ?NULL? && ?strlen(section));
????assert(key?
!= ?NULL? && ?strlen(key));
????assert(value?
!= ?NULL);
????assert(size?
> ? 0 );
????assert(file?
!= NULL? && strlen(key));

????
if (? ! load_ini_file(file,buf, & file_size))
????????
return ? 0 ;

????
if ( ! parse_file(section,key,buf, & sec_s, & sec_e, & key_s, & key_e, & value_s, & value_e))
????{
????????
return ? 0 ;? // not?find?the?key
????}
????
else
????{
????????
int ?cpcount? = ?value_e? - value_s;

????????
if (?size - 1 ? < ?cpcount)
????????{
????????????cpcount?
= ??size - 1 ;
????????}
????
????????memset(value,?
0 ,?size);
????????memcpy(value,buf
+ value_s,?cpcount?);
????????value[cpcount]?
= ? ' \0 ' ;

????????
return ? 1 ;
????}
}

生成的HTML文档如下:

函数文档

int read_profile_string (const char *?section,
const char *?key,
char *?value,
int?size,
const char *?file?
)

read string in initialization file

retrieves a string from the specified section in an initialization file

参数:
section?[name of the section containing the key name]
key?[name of the section containing the key name]
value?[pointer to the buffer that receives the retrieved string]
size?[size of value buffer]
file?[name of the initialization file]
返回:
[1 : read success; 0 : read fail]
posted on 2007-01-16 13:41 天下无双 阅读(23) 评论(1)  编辑 收藏 收藏至365Key 所属分类: C/C++
[摘录]C++ GUI库大全:【上一篇】
讨厌的 Socket TIME_WAIT 问题:【下一篇】
【相关评论】
没有相关评论
【发表评论】
姓名:
邮件:
随机码*
评论*
      
|  首 页  |  版权声明  |  联系我们   |  网站地图  |
CopyRight © 2004-2007 软讯网络 All Rigths Reserved.