C ++ Doxygen implementation function sharing

Source: Internet
Author: User

C ++ is widely used and plays an important role in many fields. Programmers can use it to greatly improve the efficiency of program development. Here we will first take a look at the application methods of C ++ Doxygen for your convenience.

  • Skills related to C ++ identifier naming rules
  • Basic concepts of C ++ function templates
  • C ++ constant reference correct application method
  • Interpretation of c ++ stack template application code
  • Common application skills of C ++ clipboard

Use C ++ Doxygen to automatically document code comments, and extract comments from the code to generate help documents.

Install the following software when using Doxygen:

1. Install Doxygen1.4.7. We recommend that you install it in "D: \ Program Files \ doxygen"

2. Install the Graphviz-2.13 for C ++ Doxygen to generate graphics such as class diagrams and relationship diagrams. It is recommended to install it in D: \ Program Files \ ATT.

3. Install HtmlHelp1.3 to generate the CHM help file. skip this step if other versions of HtmlHelp have been installed.

The following are examples of three common forms.

A. file Header comment, \ file, \ brief

B. Define comments for classes/struct, first write the name, and then write the summary description.

C. Define the function. First, write the name, and then the brief description. Then, write the parameter description, return value, precautions, and Reference Links.

In Function Definition, 1) parameter param2) return value return 3) See see4) note

The in/out parameter can be specified, for example, @ param [out] dest, @ param [in, out] buffer

D. Comments of member variables. If the comments are written on the right of the variables, add "<", for example //! <......

For more in-depth marking, see "Documenting the code" in the C ++ Doxygen help. the usage of Doxygen is described later.

 
 
  1. //! \ File Ix_Observer.h A. file Header comment, used to list the file list in the Help file
  2. //! \ Brief defines the publisher and observer interfaces Ix_Subject, Ix_Observer
  3. # Pragma once
  4. Struct Ix_Subject;
  5. Struct Ix_Observer;
  6. //! Definition comments of the publisher's interface B. Class/struct
  7. /*! The publisher is the object to be observed.
  8. \ Interface Ix_Subject
  9. */
  10. Struct Ix_Subject
  11. {
  12. //! Add observer C. Function Definition comments
  13. /*!
  14. \ Param observer: the observer to be added
  15. \ See Ix_Observer
  16. */
  17. Virtual void Attach (Ix_Observer * observer) = 0;
  18. //! Remove observer
  19. /*!
  20. \ Param observer: the observer to be removed
  21. \ See Ix_Observer
  22. */
  23. Virtual bool Detach (Ix_Observer * observer) = 0;
  24. //! Notify all observers when changing
  25. /*!
  26. \ Param data notification parameter, which can be NULL
  27. */
  28. Virtual void Notify (void * data) = 0;
  29. };
  30. //! Two-dimensional point structure
  31. Struct POINT2D
  32. {
  33. Double x ;//! <X coordinate component D. Enumeration/struct/class member variable watching
  34. Double y ;//! <Y coordinate component adds "<" to the right of the definition item, and does not add "<" to the line above it.
  35. };
  36. //! Observer Interface
  37. /*! \ Interface Ix_Observer
  38. */
  39. Struct Ix_Observer
  40. {
  41. //! Change Notification
  42. /*!
  43. \ Param data notification parameters
  44. \ Param subject: publisher of the publication change notice; others
  45. Others others
  46. */
  47. Virtual void Update (void * data, const Ix_Subject * subject) = 0;
  48. };

First, we will introduce the operations related to C ++ Doxygen.

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.