Code documentation (Doxygen)

General

Always document large software projects, so other programmers can understand your code. Consider using tools like Javadoc or Doxygen that generate documentation from special code comments.


Positioning

Before the item After the item
Usually single line
/// Documentation
///< Documentation
Usually multiple lines
/**
* Documentation
*/
/**<
* Documentation
*/

Commands

Command Description
@brief Brief/Short description
@param Parameter description
@return Return value description

Example

struct Path;
struct Items;

/// The browser is used to browse a file system
class Browser
{
public:
   /**
    * @brief Creates a browser
    *
    * @param[in] maxPath The maximum path length
    */
   Browser(const size_t maxPath);

   /**
    * @brief Browses the items of a path
    *
    * @param[in] path The path to browse
    * @param[out] items The browsed items
    *
    * @return true if path exists, else false
    */
   bool browse(Path& path, Items& items);

private:
   const size_t m_MaxPath; ///< The maximum path length
};