Jump to content
  • Advertisement
Sign in to follow this  
Genjix

Doxygen code blocks

This topic is 5033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my pseudo code blocks in comments ive been using <code> blocks and <br> for newlines. Is there any type of block I can use to preserve formatting (i.e tabs and newlines?). Google and Doxygen FAQ doesn't seem to have anything.

Share this post


Link to post
Share on other sites
Advertisement
IIRC, you can prefix every line with | or > and it'll work.

edit: my mistake, that's not available in Doxygen, I was thinking NaturalDocs, I don't know if Doxygen supports this, I'd say it seems that using HTML is the only way

Share this post


Link to post
Share on other sites
The Doxygen tags are @code/@endcode, e.g.

@code
//This will appear in Doxygen documentation as a block of code
class foo
{
};
@endcode


There are also @verbatim/@endverbatim that give the text, including tabs and spaces verbatim, w/o code highlighting.

Share this post


Link to post
Share on other sites
Quote:
Original post by Couvillion
The Doxygen tags are @code/@endcode, e.g.

@code
//This will appear in Doxygen documentation as a block of code
class foo
{
};
@endcode


There are also @verbatim/@endverbatim that give the text, including tabs and spaces verbatim, w/o code highlighting.


namespace Xml
{
/**\brief Xml Element

@code Xml::Element child = root("Child");<br>
Xml::Element child = root();

for( ; child ; child = child.Sibling("Child"))<br>
//...

string name = child["name"];<br>
int age = child.Int("age");<br>
bool dead = child.Bool("isdead");@endcode*/

class Element
{
public:
//...
private:
//...
};

/**\brief Xml Document

<code> Xml::Document doc = "mydoc.xml";

Xml::Element root = doc();<br>
Xml::Element root = doc("Root");</code>*/

class Document
{
public:
//...
private:
//...
};
}


this is confusing. If I replace <code> with @code, like above it stops the whole namespace being parsed, and as such the class doesn't show up in the documentation. I think maybe I've done something wrong (it isn't used for this?). Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post by Genjix
Quote:
Original post by Couvillion
The Doxygen tags are @code/@endcode, e.g.

@code
//This will appear in Doxygen documentation as a block of code
class foo
{
};
@endcode


There are also @verbatim/@endverbatim that give the text, including tabs and spaces verbatim, w/o code highlighting.

*** Source Snippet Removed ***
this is confusing. If I replace <code> with @code, like above it stops the whole namespace being parsed, and as such the class doesn't show up in the documentation. I think maybe I've done something wrong (it isn't used for this?). Thanks.


@code and @endcode have to be on separate lines. To make a single word appear as code in Doxygen, use something like this:


/**
The word @c class is shown as code, or at least in a typewriter font.
*/


Also, you can use a "\" instead of "@".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!