/*** \mainpage libtest** \section intro_sec oFono telephony client APIs.** This library provides easy to use APIs to use by hiding all details.** \section install_sec Installation** \subsection Download the RPM package** Go to download page to download the RPM package.** \subsection Install** Run the following command in terminal to install:* \code* $rpm -ivh libtest-api.rpm* \endcode** \section usage_sec How to use this library** \subsection source Include in file** To use this library, you must include the headers in your source file:* \code* #include <test.h>* \endcode* If you use other interfaces, you must include it too, like message:* \code* #include <test.h>* #include <test-helper.h>* \endcode** \subsection compile How to compile** To build with this library you can use pkg-config to get link options:* \code* $pkg-config --cflags --libs test-api* \endcode*//*** \file test.h* \brief API interface test is in charge of path management** It provides APIs to query path list and to query properties for a specific path.** \note* This interface requirs to run in main loop thread because some GLib dependency.** Besides, you should keep main loop idle for most of times in order to get callbacks and make sure* libtest-api process signals successfully. This means you should put business logic into a separate* thread.*/
#ifndef _TEST_H
#define _TEST_H/*** \enum API_RESULT_CODE Indicating whether API operation succeed or fail.*/enum API_RESULT_CODE {API_SUCCESS, /**< API call is successfully */API_FAILED, /**< API call is failed */
};/*** \brief Initialize libtest-api.** This function should be the first one to call when using libtest-api. It does essential initializations.* This function is synchronous.** \return #API_RESULT_CODE indicating whether this call success or failed.** \see test_deinit** \par Sample code:* \code* if (test_init() != OFONO_API_SUCCESS) {* printf("error occurred, failed to init test\n");* return;* }* // operations goes here* if (test_deinit() != OFONO_API_SUCCESS) {* printf("failed to deinit \n");* return;* }* \endcode*/int test_init();/*** \brief Finalize libtest-api** This function is designated to be called when no longer needs libtest-api to release resources in libtest* and do some finalization.** \note* It is an error to call any APIs after calling test_deinit()** \return #API_RESULT_CODE indicating whether this call success or failed.** \see test_init*/int test_deinit();/*** \brief Obtain current list of path ** \param [out] paths a pointer to an array of strings* \param [out] count indicating the count of path.** \note* This function will allocate memory for path array. So caller must free the array, but should not free each item.** \return #API_RESULT_CODE indicating whether this call success or failed.** \par Sample code:* \code* char **path = NULL;* int count = 0;* test_get_paths(&path, &count);* // use the path* free(path);* path = NULL;* \endcode*/int test_get_paths(char ***paths, int *count);#endif
/*! \mainpage My Personal Index Page** \section intro_sec Introduction** This is the introduction.** \section install_sec Installation** \subsection step1 Step 1: Opening the box** etc...*/
查看效果。 效果與上一模一樣的(JavaDoc風格)的代碼如下:
/** \mainpage My Personal Index Page** \section intro_sec Introduction** This is the introduction.** \section install_sec Installation** \subsection step1 Step 1: Opening the box** etc...*/
/*! \page page1 A documentation page\tableofcontentsLeading text.\section sec An example sectionThis page containsthe subsections \ref subsection1 and \ref subsection2.For more info see page \ref page2.\subsection subsection1 The first subsectionText.\subsection subsection2 The second subsectionMore text.
*//*! \page page2 Another pageEven more info.
*/
/** Brief description which ends at this dot. Details follow* here.*/
類的注釋
如下為使用Qt風格的C++代碼注釋。
//! 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,constchar *s);//! A pure virtual member./*!\sa testMe()\param c1 the first argument.\param c2 the second argument.*/virtualvoid testMeToo(char c1,char c2) = 0;//! A public variable./*!Details.*/int publicVar;//! A function variable./*!Details.*/int (*handler)(int a,int b);
};