How to give description for directory in Doxygen - doxygen

I am working with Doxygen to document my project. I know, by using the below Doxygen commands, we can give a description for source files.
/**
* \file example.cpp
* \brief Implementation of example functions
*/
Is there any way to give a description for a directory/folder in Doxygen?

Use the \dir doxygen command. I asked a similar question how to link to documentation of directory in which I show
/// \dir cpp/vtutil
///
/// \brief Brief description of the dir cpp/vtutil goes here
///
/// \details A more detailed description goes here.
This works to provide documentation of the directory. In my original question, I was having trouble using \ref to link to the directory documentation. After more digging and experimenting I was able to get it to work. I commented in my answer that
Doxygen is pretty forgiving or flexible with the path used when documenting a directory with the \dir command, but it is rather picky when referencing it with the \ref command.

Related

Doxygen: how to include a markdown page to document a group

I have a rather complex project and I want to document it using doxygen.
I have no problem documenting the code and I also managed to have a nice front-page using a custom README.md file coupled with "USE_MDFILE_AS_MAINPAGE = README.md" directive in Doxyfile.
I defined several groups (#defgroup) which show up as "Modules" in my documentation.
I would like to add a "main page" to each of the group giving general information, beside the customary function/variable/type documentation.
I tried adding custom MODULENAME.md files coupled with matching #includedoc MODULENAME.md entries in group definition, it seem to work (I see several lines like: "Generating docs for page md_mcu_noitr_coro_README..."), but I cannot find if and where the page is linked (I expected to see it in the "Detailed Description" for the module, as it happens if I put some documentation inline where I put the "#includedoc" directive.
a snippet of one of my modules is:
/**
* #file coro.h
* #brief definition of coroutine implementing functions.
*
* #date: Feb 8, 2018
* #author: myself
*
* #defgroup coro "Coroutine implementation in plain 'C'."
*
* #includedoc mcu_noitr/coro/README.md
* #{
*
*/
What am I doing wrong?
Note: it is also a bit surprising I need to put the whole path from where my Doxyfile is, otherwise doxygen won't find it even if it's right beside the file containing the #includedoc command.
I also came across the problem that included files with Markdown formatted text via \includedoc or \include{doc} does not result in correctly interpreted Markdown. Note that I included Markdown files from other Markdown files. My work-around was to use the C pre-processor (cpp) - which is widely available - on Markdown files and use it's #include directive. You could of course use a true general text processor such as M4 as suggested in the cpp man page. Set FILTER_PATTERNS in Doxyfile as:
FILTER_PATTERNS = *.md="cpp -P -traditional-cpp"
You'll need the -P option to avoid it outputting line markers, which confuses Doxygen. -traditional-cpp was needed to avoid cpp eating white space that is important for the correct interpretation of Markdown. Don't use single quotes as this results in an error when Doxygen calls cpp via sh.
Then in my Markdown main page:
Main Page {#mainpage}
==========
Blah blah blah.
#include "other.md"
Using FILTER_PATTERNS instead of INPUT_FILTER avoids the problem about not being allowed to add or remove lines.
I have my markdown files in the same directory, I would guess that if they are located in different places you could tell cpp about it via -I, which would address your expectations about include paths on the issue you filed.
At the moment doxygen does not consider the fact that commands like \includedoc can contain markdown code. At the moment the only possibility would be to write a filter, see configuration parateter INPUT_FILTER in the doxygen configuration file, (not tested!) to replace the \includedoc` with the code of that file.

keep source documentation line breaks in doxygen

I am looking for a global parameter that will tell doxygen HTML to keep line breaks in paragraphs as they are in the source. For example, my source documentation is:
/// \par Description.
/// a description.
/// a description.
/// a description.
The documentation generated is:
Description.
a description. a description. a description.
and I want the line breaks to be kept as in the source. I am using doxywizard so please tell me the section and the parameter.

Doxygen How to general documention for folder

I would like to add descriptions for each folder as noted in the picture:
Is this possible?
You can document folders with the \dir or #dir command
http://www.doxygen.nl/manual/commands.html#cmddir
The documentation on this is not great. But I did already go through the time to figure out how it works. In any source file you want you can add the documentation for the folder (or even create a specific file for the folder's documentation).
In your case
/** \dir workspace
* \brief "Folder description that shows up where you want"
* \details More details to be displayed on the folder's page.
*/
/** \dir workspace/SWTtutotial
* \brief "Folder description that shows up where you want"
* \details More details to be displayed on the folder's page.
*/
Note... watch your spelling of "tutorial" ;)
A side note: I noticed a bug related to folders names having a common suffix. I get the following warning:
file.cpp:180: warning: \dir command matches multiple directories.
Applying the command for directory /sources/
Ignoring the command for directory /testsources/
The comment at line 180 causing this warning
/**
* \dir "sources"
* \details Adding details later 3...
*/ //works but complains about also matching "testsources". Doxygen Bug?
I fixed it by using \dir /sources instead of the quotes. This is ok if the path does not have spaces in it... otherwise we need a bug fix.

Output Full File Path to HTML with Doxygen

I am creating a test list in Doxygen using the \test special command. I understand that I can click on the class name for that section and get taken through to the page that this test is in reference too.
What I would like however is in the test description for it to have a line which is the full file path.
Is there a special command to do this? or do I have to physically type it out into every comment block. below I have shown an example of what I want.
Class myTest
Perform a set of tests to verify foo & bar.
located in C:\MyFile
but I would like to write out my Doxygen comment like this:
/** \test
* Perform a set of tests to verify foo & bar.
* located in:
* \fullFilePath
*/
Is this possible?
Having scoured the special commands I've come to the conclusion that there is no Doxygen special command to give the result as in the question.
Doxygen does provide automatic hyperlinking for pages/files that it knows exist. Therefore in order to "solve" this problem[1] I have added the minimal amount of path name that is required in order to create a navigatable link. This solution looks like:
/** \test
* Perform a set of tests to verify foo & bar.
* located in:
* someFolder/myFile.cpp
*/
This would work for a file path like: C:/parentFolder/childFolder/someFolder/myFile.cpp
[1] The original question was focused around not having to type out the filepath into every comment block. This solution is a compromise between not having a special command and not having to write out the complete file path (which sometimes could be very long)

Doxygen won't process main.cpp

So I'm new to using Doxygen and I was able to get it to work smoothly. I was able to document my classes and structs and it generates the HTML files perfectly. The issue I'm running into is it won't parse my main.cpp file. All the classes and structs have their own .h and .cpp files and they process fine. How do I get Doxygen to make the documentation for main.cpp? It doesn't have a .h file as this is where the program starts and ends. I wouldn't even know what to put in the .h file for main. I'm using Doxywizard in Windows.
Edit:
I put this in main and it generates a main page:
/**
#mainpage
This is a test application.
#author Alex
#date 10/21/2010
#version 1.0
*/
But then farther down the file where the function prototypes are I have this and it doesn't get parsed:
/**
#brief Error handler for the PDF writer.
It does nothing. It just has to exist.
*/
void error_handler (HPDF_STATUS error_no,
HPDF_STATUS detail_no,
void *user_data)
{
}
I put this at the top of main.cpp and it worked. Go figure.
/**
#file main.cpp
*/
If INPUT and FILE_PATTERNS are empty, it should search for *.cpp files (and many other patterns) in the current directory. (This from the doxygen manual.)
Since yours are empty, I expect one of two things is going on if you're not getting main.cpp documentation:
main.cpp is not in the current directory. To rule this out, make sure you're running doxygen from the same directory as both your config file and main.cpp.
There is a syntax error in your main.cpp documentation. These can be tricky to spot, as doxygen doesn't generally abort when it encounters an error - instead it just skips ahead. If this is the problem, comb through doxygen's output when you generate your docs line by line.
If neither of these ideas solve your problem, we might need more information. Output of ls -R, output of the doxygen run, etc. Good luck!
I did some research on this... From the doxygen manual :
Important: The documentation of global functions, variables, typedefs,
and enums will only be included in the
output if the file they are in is
documented as well.
There you go !