문서의 이전 판입니다!
/**
* ... 문장 ...
*/
/*! * ... 문장 ... */
중간의 '*'문자는 선택사항입니다. 즉, 다음과 같이 해도 적법하게 처리합니다. (redpixel이 선호하는 방법)
/*! ... 문장 ... */
/
/</color> 다음에 <color red>/</color>나 <color red>!</color>문자를 하나 더 붙여주어야합니다. /// /// ... 문장 ... ///
또는
//! //!... 문장 ... //!
///////////////////////////////////////////////// /// ... 문장 ... /////////////////////////////////////////////////
/*! \brief 간략설명. * 계속된 간략설명. * * 세부설명 시작. */
/** 간략설명은 다음 마침표까지로 간주합니다. 상세 설명은 * 지금부터 처리됩니다. */
이 옵션은 여러줄의 C++ 주석에서도 같은 효과를 가집니다.
/// 간략설명은 다음 마침표까지로 간주합니다. 상세 설명은 /// 지금부터 처리됩니다.
/// Brief description. /** Detailed description. */
또는
//! 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 should also be set to NO for this case.
//! Brief description, which is //! really a detailed description since it spans multiple lines. /*! Oops, another detailed description! */
Furthermore, if there is one brief description before a declaration and one before a definition of a code item, only the one before the declaration will be used. If the same situation occurs for a detailed description, the one before the definition is preferred and the one before the declaration will be ignored.
Here is an example of a documented 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 included 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_DESC to NO in 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 tag to NO). 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 should 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 should put a backslash and a space after it. Here is an example: