diff --git a/test/cpp/namespace.cpp b/test/cpp/namespace.cpp new file mode 100644 index 00000000..3e4e7645 --- /dev/null +++ b/test/cpp/namespace.cpp @@ -0,0 +1,99 @@ +namespace A { + namespace B { + + /** + * Test fct A + */ + int testa(int a) { return a; } + + /** + * Test cls B + */ + class TestB { + public: + /** + * Test fct B + */ + int testb(int b) { return b; } + + private: + /** Not constant */ + double b; + }; + + + /** Some constant */ + constexpr double CONSTANT = 5.; + + } // namespace B + + /** + * Test cls D + */ + class TestD : public B::TestB { + public: + /** + * Test fct D + */ + int testd() const { return d; } + private: + static double d; + }; + + /** + * Test fct C + */ + template + int testc(int c) { return c; } + + /** + * Test enum E + */ + enum class TestE { + /** enum member A */ + A, + /** enum member B */ + B, + }; + +} // namespace A + + +namespace foo { + /** + * foo_class + */ + class foo_class { + /** member */ + int m; + }; + + /** + * foo_struct + */ + struct foo_struct { + /** member */ + int m; + }; + + /** + * foo_union + */ + union foo_union { + /** member1 */ + int m1; + /** member2 */ + int m2; + }; + + /** + * Const. + */ + const int GLOBAL = 5; + + /** enum */ + enum foo_enum { + /** enumerator */ + FOO_ENUMERATOR, + }; +}; diff --git a/test/cpp/namespace.rst b/test/cpp/namespace.rst new file mode 100644 index 00000000..63d700cf --- /dev/null +++ b/test/cpp/namespace.rst @@ -0,0 +1,105 @@ + +.. cpp:function:: int A::B::testa(int a) + + Test fct A + + +.. cpp:class:: A::B::TestB + + Test cls B + + + .. cpp:function:: public int testb(int b) + + Test fct B + + + .. cpp:member:: private double b + + Not constant + + +.. cpp:var:: constexpr double CONSTANT + + Some constant + + +.. cpp:class:: A::TestD: public A::B::TestB + + Test cls D + + + .. cpp:function:: public int testd(void) const + + Test fct D + + +.. cpp:function:: template int A::testc(int c) + + Test fct C + + +.. cpp:enum-class:: A::TestE + + Test enum E + + + .. cpp:enumerator:: A + + enum member A + + + .. cpp:enumerator:: B + + enum member B + + +.. cpp:class:: foo::foo_class + + foo_class + + + .. cpp:member:: private int m + + member + + +.. cpp:struct:: foo::foo_struct + + foo_struct + + + .. cpp:member:: public int m + + member + + +.. cpp:union:: foo::foo_union + + foo_union + + + .. cpp:member:: int m1 + + member1 + + + .. cpp:member:: int m2 + + member2 + + +.. cpp:var:: const int GLOBAL + + Const. + + +.. cpp:enum:: foo::foo_enum + + enum + + + .. cpp:enumerator:: FOO_ENUMERATOR + + enumerator + diff --git a/test/cpp/namespace.yaml b/test/cpp/namespace.yaml new file mode 100644 index 00000000..dc53e8bc --- /dev/null +++ b/test/cpp/namespace.yaml @@ -0,0 +1,6 @@ +directives: +- domain: cpp + directive: autodoc + arguments: + - namespace.cpp +expected: namespace.rst