Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics

Dashboard
Notifications
Mark all as read
Q&A

List what file(s) an identifier was declared in?

+4
−0

I'm using Doxygen to help me figure out some library code. There's an enum I know I need to use, but I don't know which file it's declared in.

Searching for that identifier in Doxygen yields the page for the whole namespace in which it is declared. If I click on it in the summary at the top of the page, to go to the detailed info, I get only the signature and table of what's in the enum.

Doxygen entry for an enum

Is there any way to make it also show which file(s) the enum was declared in?

For classes that have their own page, there is indeed text at the bottom saying "The documentation for this class was generated from the following files:" and then a list of the relevant files, and that's very useful. enums and the like do not get their own page, however.

In this case I'll probably end up just using a tool like grep to find it, but if anyone knows a way to get this info to show up in the Doxygen output that would be super helpful.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comments

1 answer

+3
−1

I haven't used Doxygen that much, but after checking the documentation and looking around online, it looks like the reason this might be happening is because the SHOW_USED_FILES setting which (if I'm reading the documentation correctly) is used to show the list of files at the bottom of a page of documentation appears to be limited to the documentation of classes and structs.

In other words, if an enum is not particularly in a class, and if it's not somehow a struct, the outputted documentation page should not include this list of source files.

I tried out a test using C language files with an enum and a struct. When I tried just using an enum definition in my header file, I did not see the The documentation for this struct was generated from the following file: line from the bottom of the generated Doxygen page. When I included a struct definition in my header file, I finally noticed that the resulting page was under the Classes menu on the documentation generated by Doxygen. After clicking on the Classes menu and then clicking on the name of the struct I used, I was able to see the The documentation for this struct was generated from the following file: line at the bottom of the generated documentation.

Thus, from what I read in the documentation, it looks like a plain enum file is not meant to show the The documentation for this struct was generated from the following file: line. If your enum could somehow be a part of a class, however, like in this example from the documentation, it should work!

For reference, here are the C files I used for my tests:

q12.h

#include <stdio.h>
#include <string.h>

// ref: https://docs.microsoft.com/en-us/cpp/c-language
//   /c-enumeration-declarations?view=msvc-160
enum COLOR
{
    Red, /*!< Enum value red. */
    Blue, /*!< Enum value blue. */
    Yellow /*!< Enum value yellow. */
};

// ref: https://www.tutorialspoint.com/cprogramming/c_structures.htm
struct Colors {
    char name[30]; /*!< Struct name. */
};

q12.c

#include <stdio.h>
#include "q12.h"

int main()
{
    // ref: https://docs.microsoft.com/en-us/cpp/c-language
    //   /c-enumeration-declarations?view=msvc-160
    enum COLOR primary = Red;
    // ref: https://www.tutorialspoint.com/cprogramming/c_structures.htm
    struct Colors Color1;
    strcpy(Color1.name, "Red");
    printf("Hello, world!\n");
    printf("Printing color: %d\n", primary);
    return 0;
}
Why does this post require moderator attention?
You might want to add some details to your flag.

4 comments

Well... that's basically just duplicating my question, really. I did state that enums don't get their own pages, and that my classes have their own pages where it lists at the bottom what files they came from. Hyperlynx‭ about 2 months ago

Hi @Hyperlynx, Sorry if my post was not helpful! From taking another look at this example from the documentation, it still looks to me that if the enum is part of a class file, the source file should be able to appear at the bottom of the page. (Continued in next comment...) summea‭ about 2 months ago

@Hyperlynx, For the TouchEvent enum example from your question, was there any other surrounding information on that documentation page that might look similar to this example from the documentation? summea‭ about 2 months ago

The question is when it's in a namespace, not a class. Hyperlynx‭ about 1 month ago

Sign up to answer this question »