Menu

commenting struct fields

ogi
2007-11-02
2013-06-11
  • ogi

    ogi - 2007-11-02

    Hi,

    To document a typedef struct it can be done as follows:

    /*!
    \brief a struct definition
    \details more documentation about foo..
    */
    typedef struct {
    unsigned char bar; /*!< \brief lol \details hello world.. */
    unsigned char baz; /*!< \brief bla \details thank you.. */
    } foo;

    If the \details for a field member of the struct will become bigger (some lines) the typedef will look like not very nice so it would be helpful to write the detailed text somwhere after the declaration. But nothing I've tried works in doxygen.

    This doesn't work:

    typedef struct {
    unsigned char bar; /*!< \brief lol  */
    unsigned char baz; /*!< \brief bla  */
    } foo;
    /*!
    \struct foo
    \brief a struct definition
    \details more documentation about foo..
    some lines
    of text
    \var foo::bar \details hello world..
    some lines
    of text
    \var foo::baz \details thank you..
    some lines
    of text
    */

    I'd found a posting, that the \param command will work after the \struct, but it produces a "parameters" section. There is also the possibility to produce a struct documentation for a struct that is not declarated in the real code by using the \struct command, but it seems no way to add Fields to this struct.
    Does anyone has an idea ?
    Ogi

     
    • Anonymous

      Anonymous - 2007-11-06

      I tried a few things (using 1.5.4):
      1. Moving the \details below the \var line to a separate line seems to work (see below)
      2. The \struct comment seems to allow 1 \var in the same block but with 2 gives an undefined reference warning - example below has separate blocks for both variables

      Tom
      _________________________________________________
      typedef struct {
      unsigned char bar; /*!< \brief lol */
      unsigned char baz; /*!< \brief bla */
      } foo;

      /*!
      \struct foo
      \brief a struct definition
      \details more documentation about foo..
      some lines 
      of text
      */

      /*!
      \var foo::bar
      \details details_bar
      more_details_bar
      and more_details_bar
      */

      /*!
      \var foo::baz
      \details details_baz
      more_details_baz
      and more_details_baz 
      */

       

Log in to post a comment.