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"...
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.
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.
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.
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:
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.
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:
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
This is almost certainly the easiest thing you can do.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With