I have recently started using doxygen for code documentation. I would like to know if it is possible to include code segments into documentation created by doxygen. If this question has already been discussed please refer me to that topic. Thanks in advance.
Regards,
Owais
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your response Martin Svensson. I have looked into the above commands, I want to use the snippet command but I am not sure how to use it into my code so for example:
// This is the code that I want to show in my documentation
REG_PIOA_OER = 0x100000;
So according to the snippet command description, I should do the following:
//! [Adding a resource]
REG_PIOA_OER = 0x100000;
//! [Adding a resource]
But what I don't understand is where to put the following and what about the path in it
\snippet snippets/example.cpp Adding a resource
How should I modify the above line and where should I place it in my code in order to generate the correct documentation. Thank in advance.
Regards,
Owais
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have recently started using doxygen for code documentation. I would like to know if it is possible to include code segments into documentation created by doxygen. If this question has already been discussed please refer me to that topic. Thanks in advance.
Regards,
Owais
There are many commands for this. Check out http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdsnippet or http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdcode or http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdinclude or several others. You can include whole or parts of files, custom snippets, and much else.
Kind regards,
Martin Svensson
Thanks for your response Martin Svensson. I have looked into the above commands, I want to use the snippet command but I am not sure how to use it into my code so for example:
// This is the code that I want to show in my documentation
REG_PIOA_OER = 0x100000;
So according to the snippet command description, I should do the following:
//! [Adding a resource]
REG_PIOA_OER = 0x100000;
//! [Adding a resource]
But what I don't understand is where to put the following and what about the path in it
\snippet snippets/example.cpp Adding a resource
How should I modify the above line and where should I place it in my code in order to generate the correct documentation. Thank in advance.
Regards,
Owais
I haven't tried myself, but here is an example:
http://stackoverflow.com/questions/8985033/doxygen-how-to-integrate-examples
Also, I guess you need to configure EXAMPLE_PATH.
Kind regards
Martin
Thanks, I am using \code ... \endcode and it works for me.