Use of Doxygen (ii) Add Javadoc-style annotations to your code

Source: Internet
Author: User
Tags doxygen

Original articles, welcome to read, Forbidden reprint.

This article notes the notation of Javadoc style annotations, which are called tags in special-format annotations. Comments written in accordance with this specification can be generated into the document.


notation for block annotations

/** *, label can write multiple lines */ 

How to annotate a single line

int var /// < "///<" is a single-line comment  ///< commonly used for global variables, member variables, struct members, enumeration values, etc.

(tags with ' @ ' and ' \ ' start with Yes)
Common tags for C + + are:
@file the file to be documented, this must be written , otherwise all the files in the file are ignored
@author author
@date Date
@brief function or behavior description, can be multiple lines
@param parameters
@param [out] output parameters
@param [in] input parameters
@return Return Instructions
@retval return Value Specific description
@note notes
@see Related items (function pointers that do not seem to write typedef)
@todo to-dos

Some high-level labels
@mainpage logo This article appears on the manual home page, where you write various HTML code to

Here is an example of a comment I wrote (export.h)

/** * @file export.h * @author zhaojk * @brief annotation annotations, try to automatically generate the effect of the document * @version 0.1 * @note where the file tag must be written * @todo see the Help manual, give me the manual to Do A homepage*//** * @brief callback parameter prototype*/typedefvoid(eventcallback*) (int Event,void*param);/** * @brief Event ID type*/typedefintEVENTID;/** * @struct user Information*/typedefstruct  {    Charip[ -];///< IP addressint port; ///< port number}adddess;/** * @enum*/enumemdevicetype{device_28181=0,///< 28181 equipmentDevice_sip,///< SIP devicesDevice_onvif,///< ONVIF equipmentDevice_other//Does not appear in the manual as per the specification note};void* G_instance;///< Global instances/** * @brief Set Event callback * @param Cbfun Event callback function * @param cbparam user parameter * @return return operation result * @retval true succeeded, False failed * @see EVENTC Allback*/BOOLSetcallback (Eventcallback Cbfun,void*cbparam);/** * @brief Get the version number * @param [out] version returns the revision number*/voidGetVersion (Charversion[ -]);/** * @brief Open database * @param dbname database name * @param username user name * @param passwd password * @return return error code * @see Closedb*/intOPENDB (Char* dbname,Char* Username,Char*passwd);/** * @brief Close database * @return void * @see Emdevicetype*/voidClosedb ();

Another example of a manual home page (mainpage.h)

/**/

Learn More
Use of commonly used tags, please see the Doxygen Reference manual, you can also look at the Open Source Library.
For more advanced labels, see the reference manual
It seems to support HTML format and MD format.

Original articles, welcome to read, Forbidden reprint.

Use of Doxygen (ii) Add Javadoc-style annotations to your code

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.