In doxygen documentation how to create a link to a specific line of a file

匆匆过客 提交于 2021-01-26 08:05:12

问题


There are several doxygen commands whose purpose is to create links in the documentation (@link, @ref).
I am currently using the @ref command to create a link to a custom file, written in a language not supported by doxygen (xml).
I would like to alter this link so that it points to a precise line in the file.
Is there a doxygen command that allows to do that ?


回答1:


I'm not sure that \ref or \link can do this. However, if they could, one problem of adopting this approach is that the links will become invalid if you change the contents of the file you are linking to without changing the link. This is one of the problems of separating source code and documentation.

Rather than linking to a particular line in another file why don't you include the particular part of the file you are interested in in the documentation? You could either:

  • include the whole file with \include (there is also \includelineno) and just reference relevant parts of it in the text (e.g. "function xxx in the code below"), or
  • include snippets of the file where you need to refer to them in the documentation using \snippet.

Edit: Alternatively, you could use the \dontinclude command which, together with the \line, \skip, \skipline, and \until commands allows you to include specific lines/blocks of a particular file. See the example in the \dontinclude documentation.



来源:https://stackoverflow.com/questions/9661243/in-doxygen-documentation-how-to-create-a-link-to-a-specific-line-of-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!