Doxygen-Based C/C ++ principles and doxygen principles

Source: Internet
Author: User
Tags doxygen

Doxygen-Based C/C ++ principles and doxygen principles

Doxygen-Based C/C ++ annotation principles annotation Overview 1. file Header annotation 2. namespace annotation 3. class, structure, and enumeration annotation 4. function annotation principle 5. variable comment 6. module labeling 7. group annotation specifies the gorgeous separation line // samples // Platform Defines // define enum {OST_PLATFORM_WIN32 = 1, OST_PLATFORM_LINUX_X86 = 2, encoding = 3, OST_PLATFORM_ANDROID = 4, encoding = 5 ,};/ /Export // API Export/Import Macros // ---------------------------------------------------------------------------/** Indicates an exported and imported shared library function. */# define OST_API_EXPORT _ declspec (dllexport) # define OST_API_IMPORT _ declspec (dllimport) // configure )//--------------------------------------------------------------- ------------ // Digital Image Macros // watermark # define OST_PI 3.141592653589793f # define OST_RGB2GRAY (r, g, B) (B) * 117 + (g) * 601 + (r) * 306)> 10) // date and time at compile time //--------------------------------------------------------------------- ------ # Define OST_TIMESTAMP _ DATE _ "" _ time1_1. file Header tagging /************************************ **************************************** ** OpenST Basic tool library ** Copyright (C) 2014 Henry. renhuabest@163.com Wen. * *** This file is part of OST. * *** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License version 3 as ** publi Shed by the Free Software Foundation. * *** You shoshould have got Ed a copy of the GNU General Public License ** along with OST. if not, see 

Debugging Bug description
Bug description, @ bug
Warning description (warning)
Define some things that must be known about this function, @ warning
Remarks (remarks)
Define some remarks about this function, @ remarks
Work to be completed (todo)
Describe what will be done soon, @ todo
Example)
Example, @ example. cpp

/*** @ Brief after opening the file \ n *, you must use the: CloseFile function to disable * @ param [in] fileName file name * @ param [in] fileMode file mode, it can be combined by the following modules: *-r read *-w write *-a add *-t text mode (cannot be used with B) *-B binary mode (cannot be used with t) * @ return returns the file number * -- 1 indicates that the file fails to be opened (when generated :. -1) * @ note after the file is successfully opened, you must use: CloseFile function to close * @ par example: * @ code * // open the file in the read-only mode of text * int ret = OpenFile ("test.txt", "a"); * @ endcode * @ see function: ReadFile :: closeFile (":" indicates a connection function. You can check the CloseFile variable in the document. Green. Click it to jump to CloseFile .) * @ deprecated due to special reasons, this function may cancel */int OpenFile (const char * fileName, const char * fileMode) in future versions ); /*** @ brief close the file * @ param [in] file ** @ retval 0 successful * @ retval-1 failed * @ pre file must use the OpenFile return value */int closeFile (int file ); -: generate a black circle. -#: Specify the tag in order.: Specifies the function of the connection function. (Note: space and ":" Have connection functions, but we recommend that you use "::". It is only useful for functions .) They are in the following format: (-And: As shown in the preceding example, we will introduce the-# example .) -Brief description-# Brief Description: function name example:/*** @ param [in] person can only enter the following parameters: *-# a: represents John. // generate 1. a: represents John *-# B: represents Li Si // generate 2. b: represents Li Si *-# c: represents Wang 'er // generate 3. c: represents Wang 2 */void GetPerson (int p); 5. variable comments // brief description/** detailed description. * // or //! Brief description //! Detailed description //! Int m_variable_1; // <The member variable m_variable_1 indicates int m_variable_2; /// <description of member variable m_variable_1/*** @ brief member variable m_c brief description ** detailed description of member variable m_variable_3. Here we can perform * Detailed description and description of the variable, the specific method and function annotation are the same */bool m_variable_3. If the variable needs to be described in detail, it can be written in m_varibale_3. Note that there must be blank lines between m_variable_2 and m_variable_3, otherwise, the description of m_variable_2 will disappear. 6. module annotation module Definition Format:/*** @ defgroup Module name the title of the module name page (the module name can only be in English and can be obtained at will. cannot be the same in a source file) * @ {(same as the C language {scope function )*/... Defined content... /** @} */Example:/*** @ defgroup HenryWen Example. cpp *@{*/... Defined content... /** @} */7. Group annotation Group Definition Format:/*** @ name group description text *@{*/... Defined content... /** @} */Example: /*** @ name PI constant * @ {*/# define PI 3.1415926737/*** @} * // *** @ name array fixed length constant * @ {*/const int g_array_max= 1024; /**@}*/

Can the annotation software doxygen directly display the annotation of struct variables on the right? Instead of clicking to jump to the comment

Use a // <annotator instead of A/** <annotator. /// <The comments behind the struct variables are displayed directly after the struct variables.

What shortcut keys can be used in xcode4 to add function comments? Preferably in the doxygen Style

The younger brother did not dare to boast that he was a master, but he had little experience. In fact, the Doxygen tool is very good. In fact, it can extract comments from the cpp file.
The specific method is to add comments that comply with Doxygen in the cpp Code, for example:
/** @ Defgroup FileUtils... Function
*@{
*/

/** Function name: Test \ n
* @ Param none
* @ Return
* @ Note if the trial period is exceeded, the system should prompt and exit \ n
* 1
* 2
* 3
*......
* Modify logs:
* 1 V1.0.0
* 2 V2.0.0
*......
* @ Par example:
* @ Code
// Call example
Bool blnRet = Test ();
* @ Endcode
* @ See
* @ Deprecated
*/
Bool CMapApp: Test ()
{
/**
* 1
*-1.1
*-1.2
*-1.3
*/
C ++ code ......

/**
* 2
*/
C ++ code ......

......
/**
* 6
*/
......
}

/**@}*/
/**@}*/


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.