C++ 使用doxygen记录枚举值

C++ 使用doxygen记录枚举值,c++,c++11,enums,doxygen,C++,C++11,Enums,Doxygen,鉴于: 使用doxygen-g创建的默认Doxyfile,我得到如下结果: 如何记录枚举值?我尝试使用Doxygen 1.8.2中的/将注释放在成员之前/之后,这两项工作对我来说都很有用: 使用// namespace Foo { class Foo { public: /// Foo enum, possible ways to foo enum class Foo { /// Foo it with an A

鉴于:

使用
doxygen-g
创建的默认Doxyfile,我得到如下结果:


如何记录枚举值?我尝试使用Doxygen 1.8.2中的
/将注释放在成员之前/之后,这两项工作对我来说都很有用:

使用
//

namespace Foo {
    class Foo {
    public:
        /// Foo enum, possible ways to foo
        enum class Foo {
            /// Foo it with an A
            A,
            /// Foo it with a B
            B,
            /// Foo it with a C
            C
        }
    }
}
/// This is an enum class
enum class fooenum {
    FOO, ///< this is foo
    BAR, ///< this is bar
};

说明Doxygen 1.8.2支持
enum类
,因此我怀疑您的命令中可能存在一些小的语法问题。请您将您的命令与上述两个代码片段进行比较,好吗

新功能

增加了对C++11的支持:

/*! This is an enum class */
enum class fooenum {
    FOO, /*!< this is foo */
    BAR, /*!< this is bar */
};

以下样式适合我:

strongly typed enums, e.g.:
enum class E

请注意,我个人不喜欢头文件太长(因为文档化意味着至少要写2或3行文档,而不是一个单词,所以我通常没有足够的简短内容),所以我更喜欢在.cpp文件中进行文档化

为此,请使用Doxygen的
\var
功能

因此,标题是裸露的:

enum class Foo {
  /**Foo it with A*/
  A,
  /**Foo it with B*/
  B
}
而.cpp文件具有:

namespace Foo {
    class Foo {
    public:
        enum class Foo {
            A,
            B,
            C
        };
    };
}

这样,我就可以详细记录我经常遇到的情况。

我删除了我的答案,因为它不适用于C++11。enum类{}此问题或答案中的任何一种样式都适用于Doxygen 1.8.2。另一方面,它们都不能在我同事的机器上工作,也不能在Doxygen 1.8.2上工作,也不能在源代码管理的相同输入上工作。这里发生了一些可怕的事情。(啊,一点也不可怕。事实证明我同时安装了1.8.2和1.8.3.1,1.8.2在我的路径中是第一个,而构建脚本使用了1.8.3.1安装的完整路径)。我遇到了一些奇怪的问题,有时它们会被记录下来,或者没有记录下来。我得到了。当它是类的成员时,结果相同。你从中得到了什么?它有什么区别?当我也给枚举成员赋值时,我对这个解决方案有一个问题。例如:枚举类位置:std::int8_t{UNDEFINED=-1,/*!namespace Foo { /** \enum Foo::Foo * \brief Foo enum, possible ways to foo * * All the necessary details about this enumeration. */ /** \var Foo::A * \brief Foo it with an A * * When you use A... etc. */ /** \var Foo::B * \brief Foo it with a B * * When you use B... etc. */ /** \var Foo::C * \brief Foo it with a C * * When you use C... etc. */ }