Extended Module/Group Documentation in external file - c

I have a maybe simple problem, but my Google-Fu produced no results.
I have a doxygen documented header file like this:
/**
* #file filename.h
*
* #date today
* #author me
*
* #defgroup mygroup grouptitle
* #brief my nice functions
*
* Here is a medium sized description, 4-5 lines, which outline the
* functions and the way these functions work together, what is init,
* what is the main function of this module and maybe additional
* information on used hardware (as it is mainly embedded software).
*
* Here starts another description block, typical length around 20-50
* lines. Detailed Hardware description, code snippets as examples and
* so on. I want to remove this section from the header file and
* replace it by something like
* /special_doyxgen_command_to_insert extended_doc_mygroup.md
*
* \addtogroup mygroup
* #{
*/
here are function definitions, enums, defines and what else
/** #} */
I have no idea if this is possible but I have an additional mygroup.md in which some examples are given and and the general usage is shown. Depending on the file it has 10 - 50 lines, mostly 1 or 2 code examples.
In the past I inserted the examples in the header/sourcefiles, but I don't like that approach, so I created a markdown file and linked to this via the doxygen ref functions.
What I would like is a 'insert' tag that inserts the .md contend in the 'Detailed Description' Section of my Group Documentation (the HTML and Latex files).
Is there such a command (or a set of commands to get my approach?)

There are many commands existing to include external code examples in your documentation. Have a look at configuration tag EXAMPLE_PATH and the special commands #include and #snippet. You could create a directory called "examples" where you put your example files into and tell doxygen by entering this directory in the EXAMPLE_PATH tag:
EXAMPLE_PATH = ./examples
Then you create some example files, e.g: examples_1.c
/// [Example1]
/// Here some more text to explain the example which is not shown by the \#snippet command.
// But normal comments are shown as a part of the code
for(;;)
{
doSomething();
}
/// [Example1]
/// [Example2]
while(1)
{
doSomething2();
}
/// [Example2]
Now you can add these code snippets using the #snippet command in your group documentation:
/**
* #defgroup ...
* ...
* #snippet examples_1.c Example1
* ...
* #snippet examples_1.c Example2
*/
Alternatively you can include the code of a whole source file:
/**
* ...
* #include examples_2.c
* ...
*/
Another aprroach you should look at is the usage of the #copydoc and #copydetails command.
Hope this answers your question.

Related

Updating /** autocomplete in Eclipse

When using /** in Eclipse (or in my case OnSemi IDE -- based on Eclipse), it will autocomplete when pressing enter to create a comment that (with Doxygen and Javadocs enabled) fills in the Javadoc tags to look something like:
/**
* #brief
*
* #param a
* #param b
*/
void foo(int a, bool b)
What I have been unable to figure out is how to update this autocomplete to add "border" to the comment. The goal would look like:
/******************************************************************************
* #brief
*
* #param a
* #param b
******************************************************************************/
void foo(int a, bool b)
Note: I would hope these "borders" would ONLY occur when applied to method comments, rather than internal comments within code (when adding a large, multi-line comment, we use /** for this occasionally).
I've tried going to Window->Preferences->C/C++->Code Style->Code Templates and adjusting the comments templates without success.

How to keep sourcecode folder structure on Jsdoc

I have created the source code document with Jsdoc, but all the source code files are currently in parity.
As shown below.
How to keep sourcecode folder structure on Jsdoc
I am implementing the following in all source code files , but all the source code files are currently in parity.
Util.js
/**
* #module src~common~Util
* #description 共通メソッド(ストリング処理など)
*/
BootstrapModal.js
/**
* #module src~components~common~BootstrapModal
* #description BootstrapModalでカスタマイズしたエラー画面
*/
JSDocs doesn't understand folder structure. If you want to mirror your folder structure I believe you could implement namespaces to achieve a similar structure.
/**
* My namespace.
* #namespace
*/
var MyNamespace = {
/** documented as MyNamespace.foo */
foo: function() {},
/** documented as MyNamespace.bar */
bar: 1
};
-- via Jsdoc.app

Doxygen custom tag with a placeholder

Is it somehow possible in Doxygen to create a custom tag, which creates a documentation using a placeholder tag as its input?
What I want to accomplish is to create a custom tag for requirements. As our DOORS Urls are quite long, and diverge from SW-component to SW-component, I want to create something similar to this:
#file somefile.c
#doorsdocurl <URL to DOORS document> -> this is going to be my placeholder
...
...
...
/**
* #brief somedescription
* #req{doorsdocurl: <reqID1, reqID2,...> } -> this is going to be the second custom tag
*/
void jambo()
{
}
Is this somehow achievable with Doxygen? From what I have read, one has to put his custom tags within the ALIASES variable
In your Doxyfile you would need something like:
ALIASES = "doorsdocurl_sw_1=<URL to DOORS document>" \
"req{2}=\1 \2<br>"
and the code would look like:
/**
* #brief somedescription
*
* #req{#doorsdocurl_sw_1,reqID1}
* #req{#doorsdocurl_sw_1,reqID2}
*/
void jambo()
{
}
The \req command can of course be extended with other commands, in this respect the command xrefitem might be useful, see the manual (http://www.doxygen.nl/manual/commands.html#cmdxrefitem)

doxygen in c: grouping of defines

I'm documenting C code with doxygen. To make the documentation more readable I want to at least add code in every .c/.h file pair to one group using #defgroup and #ingroup. Inside these groups I want to group some defines together using #name blocks.
The result in the "file" pages looks closely to what I expected: Everything that's documented in the file is listed there and more or less nicely grouped.
In the "module" pages on the other hand only functions and variables are listed and the defines before the first #name block are listed under "variables". All other defines and enums are missing.
Removing the #name blocks lists all defines/typedefs/enums under "variables". No own sections for macros or enums and no further grouping on these pages.
How do I get all defines and enums in a group listed on the module/group page like on the file pages where the defines/functions etc. are documented?
I use doxygen 1.8.9.1 windows binarires.
My code looks similar to this:
.h file:
/** #file
* blabla
* #author bla
*/
/// #ingroup MY_GRP
/// #{
#define SOMEDEF1 1
/// #name Special defs
/// #{
#define SOMEDEF2 2
/// #}
enum someenum {
foo,
bar
};
extern int some_variables;
extern void some_proc(int baz);
/// #}
.c file looks like this:
/** #file
* blabla
* #author bla
*/
/** #defgroup MY_GRP A test group.
* Description
*/
/// #{
#include "my.h"
/// Important variable.
int some_variable;
/** Important proc
* Description
* #param baz need this
*/
void some_proc(int baz) {
// code
}
/// #}
I let doxygen wizzard generate a doxyfile and also generated a DoxygenLayout.xml file.
When playing arround with the layout file I found that the "defines" tags on the group pages are empty (they apparently do nothing) while the "defines" in the variables section are generated by a "membergroups" tag... Don't know what to make of this.
Any help is much appreciated. If you need the doxyfile or anything else let me know.
Adding all members of a file to a group can be accomplished using the #addtogroup tag.
The same question is already answered here:
Doxygen: Can file members inherit a module grouping if they are in a file that is grouped?

doxygen index C functions

How can I index the C functions for the search engine? E.g. I have the following piece of code documented.
/**
....
* #defgroup MyGroup
*
* #{
*/
/**
* Initialize TCN.
...
*/
int myfunction(void);
...
The myfunction is documented on the HTML under MyGroup. With the search engine I get only the structures not the functions. I'm using the client search engine.
Thanks
Based upon your comment style, you could try to use JAVADOC_AUTOBRIEF = YES to have doxygen interpret the first line within a comment header as a brief description.
You can also set EXTRACT_ALL = YES to have doxygen behave as if all functions are documented even if no documentation is available. It will extract all functions except private class members.
To also include private class members include EXTRACT_PRIVATE = YES
Good luck.

Resources