Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen/C++ : how to link to anonymous namespace variables

Tags:

c++

doxygen

I'm using Doxygen to document my code. Much of the code has anonymous namespaces in the cpp files where constants are defined. I have set:

EXTRACT_ANON_NSPACES = YES

in my Doxygen file and all anonymous namespaces are documented as desired.

My problem is that I want to reference a variable in an anonymous namespace. For example, suppose one of the namespaces is defined in my Doxygen document under MyClass::anonymous_namespace{MyFile.cpp}::kMyConstant. I figured that another comment block (say, for a function) could link to that constant like:

@see MyClass::anonymous_namespace{MyFile.cpp}::kMyConstant

Unfortunately the only link I get is to MyFile.cpp, but not through the anonymous namespace to the constant variable. Obviously I want to do this so that if the value of the constant changes, the documentation will reference the new value when Doxygen is rerun. Putting the explicit value of the constant in the documentation would be dangerous if the constant ever changes.

Is my format above incorrect? I've searched for an answer for this extensively but to no avail.

like image 215
user1949992 Avatar asked Jan 04 '13 23:01

user1949992


People also ask

When does the Doxygen modulestab show namespaces outside a namespace?

When declared outside of a namespace, the Doxygen Modulestab will show the namespace, as shown in Example 1 above. When the \addtogroupcommand is placed inside a namespace, the Doxygen Modulestab will not display the namespaces as shown in Example 2 above.

How do I use Doxygen with documentation?

Links to web pages and mail addresses Doxygen will automatically replace any URLs and mail addresses found in the documentation by links (in HTML). Links to classes. All words in the documentation that correspond to a documented class will automatically be replaced by a link to the page containing the documentation of the class.

Can Doxygen automatically group things together?

If a compound (e.g. a class or file) has many members, it is often desired to group them together. Doxygen already automatically groups things together on type and protection level, but maybe you feel that this is not enough or that that default grouping is wrong.

How do I use the Doxygen structural command to create a page?

The Doxygen structural command to use is “@mainpage” as shown in the example above. This tag on one of our markdown files will tell the Doxygen parser that a given markdown file is the main page for the project. This is the page shown when you click index.html from the HTML folder generated by Doxygen.


1 Answers

What you want hasn't been implemented yet, but I agree it is useful and the format you use is the right one and should work.

I'll implement this in the next release.

like image 52
doxygen Avatar answered Sep 22 '22 18:09

doxygen