how to create a Doxygen link to the same file

I would like to write a Doxygen comment that names the file in which the comment occurs. Rather than write the filename explicitly, I would like Doxygen to supply me with it. Thus, if I change the name of the file, or move some of the content into a different file, I don't need to change hard-coded instances of the name.

For a concrete example, let's say I'm adding comments to functions in array.hpp, and I want the comment for certain functions to say "This function should only be used within array.hpp." I want to be able to write

/** * This function should only be used within @thisfile. */

where @thisfile is a Doxygen expression that translates into array.hpp within the file array.hpp.

I've looked at the Doxygen documentation, including "Automatic link generation/Links to files" and the entire "Special Commands" section, but I haven't found what I'm looking for. Does such functionality exist?

Note that essentially the same question was asked on the Doxygen mailing list a few weeks ago. It has not received any replies.



As far as I know such functionality does not exist out-of-the-box. But you can add it by configuring an INPUT_FILTER in your Doxyfile. The path to the file is passed as an argument to the filter by Doxygen. This can be used by the filter to replace your keyword (for example @thisfile) with the path to the file.

Below I give an example how to implement this with bash. A solution for other shells or Windows should be quite similar.

Example for bash

<ol> <li>

Write a short bash script infiltrate_filename.sh:

#!/bin/bash pathToScript=`pwd`"/" sed -e "s:@thisfile:${1/$pathToScript/}:g" $1

This script truncates the path to the file by the working directory. The resulting string is used to replace the keyword of your choice (here: @thisfile).

</li> <li>Make your script executable: chmod +x infiltrate_filename.sh</li> <li>Set the INPUT_FILTER in your Doxyfile to INPUT_FILTER = ./infiltrate_filename.sh</li> </ol>

That's it!


  • Scrolling News Ticker Jquery - Issues
  • Recursion Control flow
  • Does Context/Scoping of a SQLAlchemy Session Require Non-Automatic Object/Attribute Expiration?
  • Javascript unload page condition
  • How can I determine which routines MATLAB uses to solve a sparse matrix?
  • Recreate the Oracle DUAL table
  • Meteor.. accounts- password— Create account on client without login
  • (Play 2.5) How do you define json format for type alias of an Option?
  • Is it safe to drop the -webkit vendor prefix from the css3 border-radius yet?
  • Creating a C++ function that calls other Lua function
  • How dotnet build chooses the output name
  • Why isn't my “Fizz Buzz” test in R working?
  • Can you pass an array from javascript to asp.net mvc controller action without using a form?
  • Aptana 3 remove bundle (jquery)
  • Validate jQuery plugin, field not required
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • quiver not drawing arrows just lots of blue, matlab
  • Uncaught TypeError: $(…).select2 is not a function
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Suppressing passwd when calling sqlplus from shell script
  • as3-flash: any way to access all the instances placed in different frames from document class?
  • How to view images from protected folder with php?
  • Webgrid not refreshing after delete MVC
  • How to use carriage return with multiple line?
  • Xcode 4 NSLog Macro link in Xcode 3
  • How to Cache Real-time Data?
  • Jquery UI tool tip close icon
  • Cancel a live stream “fast motion” catch-up in Flash
  • Projection media query: browser support and workarounds?
  • QLineEdit password safety
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • SSO with signing and signature validation doesn't work
  • Validaiting emails with Net.Mail MailAddress
  • vba code to select only visible cells in specific column except heading
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • Javascript + PHP Encryption with pidCrypt
  • Traverse Array and Display in markup
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • File not found error Google Drive API
  • Qt: Run a script BEFORE make