#9334·doxygen

Add a way to "rename" a headerfile in the output

Author: jwakelyCreated May 13, 2022Updated Sep 19, 2026
Labelsenhancement

This is an enhancement request.

It's common for header-only (or mostly header-only) libraries like Boost and libstdc++ to be structured in terms of a public header file that is the documented API, which includes other headers that contain the actual code:

cpp
#ifndef PUBLIC_API_H
#define PUBLIC_API_H
#include "detail/foo.h"
#include "detail/bar.h"
#endif

Within detail/foo.h there might be dozens of classes. When using the SHOW_HEADERFILE=YES option, those classes will show this by default in their docs:

#include <foo.h>

That's wrong though, so every class has to have an explicit \headerfile public_api.h so that the docs show the right header that users should include:

#include <public_api.h>

It would be helpful if you could put something in detail/foo.h once that would apply to every class within that header. Maybe change the \file command to take an optional second argument:

\file [<name>] [<header-file>]

Or alternatively, allow the \headerfile command to be used with \file like so:

cpp
/** \file foo.h
 *  \headerfile public_api.h
 * Implementation details. Do not include this directly, use <public_api.h> instead.
 */

This would then imply \headerfile public_api.h for every class in the file.