如何在 Xcode 中使用 Doxygen?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2554307/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 19:14:58  来源:igfitidea点击:

How to use Doxygen with Xcode?

objective-cxcodecore-datadoxygen

提问by wal

I'm trying to use Doxygen with Xcode. I followed the Apple tutorial. After several mistakes, I builded the project and generated the docs. I discovered that if you save the doxygen.config from Doxygen and you use space " " in the directory name you will have problem and others things.

我正在尝试将 Doxygen 与 Xcode 一起使用。我跟着苹果教程。在几次错误之后,我构建了项目并生成了文档。我发现如果你从 Doxygen 保存 doxygen.config 并且在目录名中使用空格“”,你会遇到问题和其他事情。

But there is one last problem:

但是还有最后一个问题:

./search/search.png
./tab_b.gif
./tab_l.gif
./tab_r.gif
./tabs.css
/Developer/usr/bin/docsetutil index com.mycompany.DoxygenExample.docset
2010-03-31 12:30:53.847 docsetutil[46338:807] Error converting XML to CoreData: Error Domain=NSXMLParserErrorDomain Code=76 UserInfo=0x1247d0 "Line 8: Opening and ending tag mismatch: Subnodes line 0 and Node
"
Failed to create docset indexer object
make: *** [docset] Error 1
load documentation set with path "/Users/WB/Library/Developer/Shared/Documentation/DocSets/"

I don't know what is the problem?? Any idea?

不知道是什么问题??任何的想法?

I'm using Core Data - sqlite.

我正在使用核心数据 - sqlite。

回答by Jano

The parser is telling you XML is not well formed, but that error usually shows because nothing has been generated BEFORE running docsetutil.

解析器告诉您 XML 格式不正确,但通常会显示该错误,因为在运行 docsetutil 之前没有生成任何内容。

First thing should be to go over the many lines of console output and look for warnings, probably is there. Also look for the docset you generated and right click > Show Contents. If you don't see a lot of html files with the documentation, same thing: you failed at generating documentation and docsetutil has nothing to do. And btw, it's docsetutil who is using CoreData, doesn't matter if you use it on your project or not.

第一件事应该是检查控制台输出的多行并查找警告,可能在那里。还要查找您生成的文档集,然后右键单击 > 显示内容。如果您没有看到很多带有文档的 html 文件,同样的事情:您未能生成文档,而 docsetutil 与此无关。顺便说一句,使用 CoreData 的是 docsetutil,不管您是否在项目中使用它。

I don't get why Apple doesn't provide a doxygen-like tool more tightly integrated. Or a better code formatter than Crustify. Just take the damn tools and improve them a little bit. Argh!

我不明白为什么 Apple 不提供更紧密集成的类似 doxygen 的工具。或者比 Crustify 更好的代码格式化程序。只需使用该死的工具并稍微改进它们即可。啊!

回答by John SnakeOil

There is a know bug from generation of Nodes.xml by Doxygen. It is referenced here https://bugzilla.gnome.org/show_bug.cgi?id=671591and should be corrected in the next doxygen Version (Post V 1.8.0) :

Doxygen 生成 Nodes.xml 有一个已知错误。它在此处引用https://bugzilla.gnome.org/show_bug.cgi?id=671591并且应该在下一个 doxygen 版本(Post V 1.8.0)中更正:

At the end of the Nodes.xml there is an additional

在 Nodes.xml 的末尾有一个额外的

the -silence option is workaround to suppress error, but this param does not allow dosetgeneration to work properly.

-silence 选项是抑制错误的变通方法,但此参数不允许 dosetgeneration 正常工作。

$DOXYGEN_PATH $TEMP_DIR/doxygen.config

make -C $TEMP_DIR/DoxygenDocs.docset/html install

Insert following code

插入以下代码

Note : The script works in $TEMP_DIR and not in SOURCE_ROOT as AppleScript

注意:脚本在 $TEMP_DIR 中工作,而不是在 SOURCE_ROOT 中作为 AppleScript

$DOXYGEN_PATH $TEMP_DIR/doxygen.config

#  make will invoke docsetutil. Take a look at the Makefile to see how this is done.


LINE=`xmllint  --c14n $TEMP_DIR/DoxygenDocs.docset/html/Nodes.xml 2>&1  |  awk 'NR == 1 {print }' | cut -d':' -f 2`

ECHO $LINE

if [ $LINE -gt 0 ]
then 
echo "XML Cleaning "
sed  -i.bak $LINE'd'  $TEMP_DIR/DoxygenDocs.docset/html/Nodes.xml

fi 

make -C $TEMP_DIR/DoxygenDocs.docset/html install

NB: awk and sed may certainly be combined in one line.

注意:awk 和 sed 肯定可以组合在一行中。

回答by Fred

So the long story short is that the script creates a Doxyfile on the fly, and it does not recursively scan all subdirectories.

所以长话短说,脚本会动态创建一个 Doxyfile,它不会递归扫描所有子目录。

Take a look at this post:

看看这个帖子:

http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/

http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/

There's a script included on the second post that is based on Apple's script that shouldn't have this issue.

第二篇文章中包含一个基于 Apple 脚本的脚本,该脚本不应该存在此问题。

回答by JJD

I use an extended version of the above script but based on the same priniciples. Although everything works fine on another project this time my script fails. The generation of the docset works fine but the make command produces the following error.

我使用上述脚本的扩展版本,但基于相同的原则。虽然这次在另一个项目上一切正常,但我的脚本失败了。文档集的生成工作正常,但 make 命令产生以下错误。

x ./search/search_r.png
2010-07-26 17:36:01.815 docsetutil[8441:903] 
Error converting XML to CoreData: 
Error Domain=NSXMLParserErrorDomain 
Code=76 
UserInfo=0x1006105e0 
"Line 8: Opening and ending tag mismatch: Subnodes line 0 and Node"
Failed to create docset indexer object
make: *** [docset] Error 1

The make command I use is: make --silent -C "$DOCSET_OUTPUT/html" install. I added line breaks to the error message for readability.

我使用的 make 命令是:make --silent -C "$DOCSET_OUTPUT/html" install. 为了便于阅读,我在错误消息中添加了换行符。