Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen and License/Copyright informations

I have a simple question which I could not find digging Google.

I'm moving my project's documentation from phpDoc to Doxygen, but I don't know how to write @license and @copyright together.

In my conception, @copyright is designed for my "company" (not real yet :P) name and @license the way of what I'm developing can be used: one of many CreativeCommons combinations, GNU, MIT, BSD, "under license"...

like image 580
Bruno Augusto Avatar asked Sep 10 '12 14:09

Bruno Augusto


People also ask

Is doxygen free for commercial use?

So the answer is yes, you are free to do what you want with the documentation generated by doxygen (provided you respect the license of your source code, of course). Be warned however, that (at least for me) the default configuration file settings include links to the source code within the documentation.

Is doxygen open source?

Comments don't take the place of documentation, but there is a way to use your comments to produce documentation easily. Meet Doxygen, an open source tool for generating HTML or LaTeX documentation based on comments in the code.

How do I show code in doxygen?

You can put example source code in a special path defined in the doxygen config under EXAMPLE_PATH , and then insert examples with the @example tag. Doxygen will then generate an extra page containing the source of the example. It will also set a link to it from the class documentation containing the example tag.


2 Answers

Building on Chris' answer, you can use the \par command to create a block similar to the built in \copyright command. For example, an alias like:

ALIASES += "license=@par License:\n"

Will allow this comment:

/** My main function.

    \copyright Copyright 2012 Chris Enterprises. All rights reserved.
    \license This project is released under the GNU Public License.
*/
int main(void){
    return 0;
}

to produce this output:

enter image description here

Note that with this solution, a blank line is not required before \license, and that the {} syntax is not required. This is also less likely to cause problems if you attempt to generate documentation for formats other than HTML.

like image 155
DRH Avatar answered Oct 05 '22 12:10

DRH


Whilst I agree with your distinction between copyright and license information, it seems that doxygen doesn't offer separate commands for these. In fact, from the documentation of the \author command the command \copyright is used to indicate license information.

There are (at least) two possible things you can do here:

  1. Simply combine the copyright and license information into the argument of the \copyright command:

    /** My main function.
    
        \copyright Copyright 2012 Chris Enterprises. All rights reserved.
        This project is released under the GNU Public License.
    */
    int main(void){
        return 0;
    }
    

    This generates the HTML

    Screenshot of the documentation generated by doxygen using first solution

    This is almost certainly the easiest thing you can do.

  2. Alternatively, the HTML which is written to produce the above image is

    <dl class="section copyright"><dt>Copyright</dt><dd>Copyright 2012 Chris Enterprises. All rights reserved. This project is released under the GNU Public License. </dd></dl>
    

    We can make use of this to define a new command called, say, license, which behaves in a similar way to the copyright command. Placing the following into the ALIASES field of the doxygen configuration file

    ALIASES += license{1}="<dl class=\"section copyright\"><dt>License</dt><dd>\1 </dd></dl>"
    

    and changing the above documentation block to

    /** My main function.
    
        \copyright Copyright 2012 Chris Enterprises. All rights reserved.
    
        \license{This project is released under the GNU Public License.}
    */
    

    we get the doxygen generated output

    Screenshot of the documentation generated by doxygen using second solution

    Note that there are a couple of quirks in this second solution: there must be a blank line preceding the \license{...} command and the \license command must wrap it's argument in curly braces. You can optionally do this with the \copyright command, but the commands with arguments defined via ALIASES these must have braces.

like image 45
Chris Avatar answered Oct 05 '22 10:10

Chris