struct.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef _DOXYGEN_EXAMPLE_STRUCT_H_
  2. #define _DOXYGEN_EXAMPLE_STRUCT_H_
  3. /**
  4. * @page page_howto_struct How to write doxygen documentation for structure.
  5. *
  6. * We recommend the following approach:
  7. *
  8. * A comment block before the structure definition is recommended to
  9. * describe the general information of the structure type. In the
  10. * comment block, a `@brief` is required, other commands (such as `@note`)
  11. * are optional.
  12. *
  13. * If you feel that the description of `@brief` is not enough, you
  14. * can add a detailed description part, which is also optional.
  15. *
  16. * Put member comments inside the structure definition and after every member.
  17. * See `struct dogygen_example_struct` for example.
  18. *
  19. * If the structure member is too long (this often happens when the structure
  20. * member is a callback function), when the comment is written after the member,
  21. * it will make the code line too long. In this case, we can also put the comment
  22. * before the member. See `struct dogygen_example_struct_another` for example.
  23. *
  24. * Going a step further, for this kind of structure whose members are callback
  25. * functions, we can describe the members in style for functions, it is more
  26. * complicated and contains more content. It is useful when we want to describe
  27. * the parameters and return values ​​of the callback function in more detail.
  28. * See `struct dogygen_example_struct_another2` for example.
  29. *
  30. * See
  31. * <a href="https://github.com/RT-Thread/rt-thread/blob/master/documentation/0.doxygen/example/include/struct.h">documentation/0.doxygen/example/include/struct.h</a>
  32. * for code example.
  33. *
  34. * See @ref group_doxygen_example_struct for html output.
  35. */
  36. /**
  37. * @defgroup group_doxygen_example_struct Doxygen Example of Structure
  38. *
  39. * @ingroup group_doxygen_example
  40. *
  41. * @brief Doxygen Example of Structure.
  42. *
  43. * @{
  44. */
  45. /**
  46. * @brief Brief description this structure
  47. *
  48. * Detailed description starts here, one line or multiple lines.
  49. * Blah blah blah...
  50. *
  51. * @note This is a note for this structure, blah blah blah...
  52. */
  53. struct dogygen_example_struct
  54. {
  55. int m1; /**< Some documentation for member 'm1'...
  56. * Multiple lines ... Note the "multi-line" here refers
  57. * to the code. Whether it is displayed in multiple lines
  58. * on the specific HTML page depends on the browser rendering.
  59. *
  60. * @note We can also embed note for member 'm1'...
  61. */
  62. int m2; /**< Some documentation for member 'm2'... */
  63. int m3; /**< Some documentation for member 'm3'... */
  64. int m4; /**< Some documentation for member 'm4'... */
  65. int m5; /**< Some documentation for member 'm5'... */
  66. };
  67. /**
  68. * @brief Brief description this structure
  69. *
  70. * Detailed description starts here, one line or multiple lines.
  71. * Blah blah blah...
  72. *
  73. * @note This is a note for this structure, blah blah blah...
  74. */
  75. struct dogygen_example_struct_another
  76. {
  77. /** Some documentation for member 'm1'... */
  78. int (*m1)(int *param1, int param2, int param3, int param4);
  79. /** Some documentation for member 'm2'... */
  80. int (*m2)(int *param1, int param2, int param3, int param4);
  81. };
  82. /**
  83. * @brief Brief description this structure
  84. *
  85. * Detailed description starts here, one line or multiple lines.
  86. * Blah blah blah...
  87. *
  88. * @note This is a note for this structure, blah blah blah...
  89. */
  90. struct dogygen_example_struct_another2
  91. {
  92. /**
  93. * @brief Brief description of m1
  94. * @param param1 The first param.
  95. * @param param2 The second param.
  96. * @param param3 The third param.
  97. * @param param4 The fourth param.
  98. * @return the operation status, 0 on successful
  99. */
  100. int (*m1)(int *param1, int param2, int param3, int param4);
  101. /**
  102. * @brief Brief description of m2
  103. * @param param1 The first param.
  104. * @param param2 The second param.
  105. * @param param3 The third param.
  106. * @param param4 The fourth param.
  107. * @return the operation status, 0 on successful
  108. */
  109. int (*m2)(int *param1, int param2, int param3, int param4);
  110. };
  111. /** @} */
  112. #endif /* _DOXYGEN_EXAMPLE_STRUCT_H_ */