Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 234
wip Avatar asked Mar 12 '12 03:03

wip


People also ask

How do I add a new line in doxygen?

Add \n followed by a space at the end of your line [1]. Especially recommended when editing with Emacs, which reacts in weird ways to the other suggested solution <br> . [1] As per @albert's comment. Works for me under Doxygen 1.8.

How do I exclude a file in doxygen?

How can I make doxygen ignore some code fragment? The new and easiest way is to add one comment block with a \cond command at the start and one comment block with a \endcond command at the end of the piece of code that should be ignored.

What is a doxygen tag?

Doxytag is a small command line based utility. It can generate tag files. These tag files can be used with doxygen to generate references to external documentation (i.e. documentation not contained in the input files that are used by doxygen).


1 Answers

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.

like image 155
Chris Avatar answered Jan 02 '23 19:01

Chris