Special documentation blocks for doxygen

Source: Internet
Author: User
Tags doxygen italic font

A special documentation block is a C or C ++ style comment block with some additional markings, so doxygen knows it is a piece of documentation that needs to end up in the generated documentation. for Python and VHDL code there are a different comment conventions, which can be found in section special documentation blocks in Python and special documentation blocks in VHDL respectively.

For each code item there are two (or in some cases three) Types of descriptions, which together form the documentation:BriefDescription andDetailedDescription, both are optional. for methods and functions there is also a third type of description, the so called "in Body" description, which consists of the concatenation of all comment blocks found within the body of the method or function.

Having more than one brief or detailed description is allowed (but not recommended, as the order in which the descriptions will appear is not specified ).

As the name suggest, a brief description is a short one-liner, whereas the detailed description provides longer, more detailed documentation. an "in Body" description can also act as a detailed description or can describe a collection of implementation details. for the HTML output brief descriptions are also use to provide tooltips at places where an item is referenced.

There are several ways to mark a comment block as a detailed description:

  1. You can use the javadoc style, which consist of a C-style comment block starting with two *'s, like this:

    /** * ... text ... */

     

  2. Or you can use the QT style and add an exclamation mark (!) After the opening of a C-style comment block, as shown in this example:

    /*! * ... text ... */

    In both cases the intermediate *'s are optional, so

    /*! ... text ...*/

    Is also valid.

     

  3. A third alternative is to use a blockAt least twoC ++ comment lines, where each line starts with an additional slash or an exclamation mark. Here are examples of the two cases:

    ////// ... text ...///

    Or

    //!//!... text ...//!

    Note that a blank line ends a documentation block in this case.

     

  4.  

    Some people like to make their comment blocks more visible in the documentation. For this purpose you can use the following:

    /********************************************//** *  ... text ***********************************************/

    (Note the 2 slashes to end the normal comment block and start a special comment block ).

    Or

    //////////////////////////////////////////////////// ... text .../////////////////////////////////////////////////

     

For the brief description there are also several posibilities:

  1. One cocould use the/brief command with one of the above comment blocks. This command ends at the end of a paragraph, so the detailed description follows after an empty line.

    Here is an example:

    /*! /brief Brief description. *         Brief description continued. * *  Detailed description starts here. */

     

  2. If javadoc_autobrief is setYESIn the configuration file, then using javadoc style comment blocks will automatically start a brief description which ends at the first dot followed by a space or new line. Here is an example:

    /** Brief description which ends at this dot. Details follow *  here. */

    The option has the same effect for multi-line special C ++ comments:

    /// Brief description which ends at this dot. Details follow/// here.

     

  3. A third option is to use a special C ++ style comment which does not span more than one line. Here are two examples:

    /// Brief description./** Detailed description. */

    Or

    //! Brief descripion.//! Detailed description //! starts here.

    Note the blank line in the last example, which is required to separate the brief description from the block containing the detailed description. The javadoc_autobrief shoshould also be setNOFor this case.

     

As you can see doxygen is quite flexible. If you have multiple detailed descriptions, like in the following example:

//! Brief description, which is//! really a detailed description since it spans multiple lines./*! Another detailed description! */

They will be joined. Note that this is also the case if the descriptions are at different places in the code! In this case the order will depend on the order in which doxygen parses the code.

Here is an example of a specified ented piece of C ++ code using the QT style:

//!  A test class. /*!  A more elaborate class description.*/class Test{  public:    //! An enum.    /*! More detailed enum description. */    enum TEnum {                  TVal1, /*!< Enum value TVal1. */                   TVal2, /*!< Enum value TVal2. */                   TVal3  /*!< Enum value TVal3. */                 }          //! Enum pointer.         /*! Details. */         *enumPtr,          //! Enum variable.         /*! Details. */         enumVar;          //! A constructor.    /*!      A more elaborate description of the constructor.    */    Test();    //! A destructor.    /*!      A more elaborate description of the destructor.    */   ~Test();        //! A normal member taking two arguments and returning an integer value.    /*!      /param a an integer argument.      /param s a constant character pointer.      /return The test results      /sa Test(), ~Test(), testMeToo() and publicVar()    */    int testMe(int a,const char *s);           //! A pure virtual member.    /*!      /sa testMe()      /param c1 the first argument.      /param c2 the second argument.    */    virtual void testMeToo(char c1,char c2) = 0;       //! A public variable.    /*!      Details.    */    int publicVar;           //! A function variable.    /*!      Details.    */    int (*handler)(int a,int b);};

Click here for the corresponding HTML documentation that is generated by doxygen.

The one-line comments contain a brief description, whereas the multi-line comment blocks contain a more detailed description.

The brief descriptions are stored in the member overview of a class, namespace or file and are printed using a small italic font (this description can be hidden by setting brief_member_descNOIn the config file). By default the brief descriptions become the first sentence of the detailed descriptions (but this can be changed by setting the repeat_brief tagNO). Both the brief and the detailed descriptions are optional for the QT style.

By default a javadoc style documentation block behaves the same way as a QT style documentation block. this is not according the javadoc specification however, where the first sentence of the documentation block is automatically treated as a brief description. to enable this behaviour you shoshould set javadoc_autobrief to yes in the configuration file. if you enable this option and want to put a dot in the middle of a sentence without ending it, You shocould put a backslash and a space after it. here is an example:

  /** Brief description (e.g./ using only a few words). Details follow. */

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.