diff options
author | Vladimír Vondruš <mosra@centrum.cz> | 2019-01-01 17:01:22 (GMT) |
---|---|---|
committer | Vladimír Vondruš <mosra@centrum.cz> | 2019-01-03 10:32:17 (GMT) |
commit | d18b3eaf3486e224fa9de7e77b536883952b40b9 (patch) | |
tree | 045620bc9c59d68e2fb32bf035f0147e164a360b /testing/081_extract_private_virtual.cpp | |
parent | 3b2198babbaf8edafe03e5298e7c194763a1f9fa (diff) | |
download | Doxygen-d18b3eaf3486e224fa9de7e77b536883952b40b9.zip Doxygen-d18b3eaf3486e224fa9de7e77b536883952b40b9.tar.gz Doxygen-d18b3eaf3486e224fa9de7e77b536883952b40b9.tar.bz2 |
Implement a new EXTRACT_PRIVATE_VIRTUAL option.
The classic article about virtuality from Herb Sutter [1] suggests that
virtual functions are always private and public class interface is never
virtual. Until now, it was not really possible to document these
functions in Doxygen:
* Enabling EXTRACT_PRIVATE would show all internals, not just virtual
functions, which is not wanted.
* Enabling HIDE_UNDOC_MEMBERS and HIDE_UNDOC_CLASSES would effectively
disable warnings about *all* undocumented members, which is not wanted.
The usual workaround was to put the members into protected scope just
for Doxygen:
#ifdef DOXYGEN_GENERATING_OUTPUT
protected:
#else
private:
#endif
/** @brief Documented private virtual function */
virtual doStuff();
The new EXTRACT_PRIVATE_VIRTUAL option makes these visible (and able to
be linked to), but shows them *only* if they are documented.
[1] http://www.gotw.ca/publications/mill18.htm
Diffstat (limited to 'testing/081_extract_private_virtual.cpp')
-rw-r--r-- | testing/081_extract_private_virtual.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/081_extract_private_virtual.cpp b/testing/081_extract_private_virtual.cpp new file mode 100644 index 0000000..ce4ed30 --- /dev/null +++ b/testing/081_extract_private_virtual.cpp @@ -0,0 +1,35 @@ +// objective: allow linking to private virtual functions +// check: class_interface.xml +// config: EXTRACT_PRIVATE_VIRTUAL = YES + +/** @brief An interface */ +class Interface { + public: + /** + * @brief Load things. + * + * Calls @ref doLoad(). + */ + void load(); + + private: + /** + * @brief Pure virtual implementation for @ref load() + * + * Details. + */ + virtual void doLoad() = 0; + + /** + * @brief Non-pure virtual function + * + * Details. + */ + virtual void doOtherStuff(); + + /* Undocumented, should not appear in the docs */ + virtual void doSomethingUndocumented(); + + /** @brief A non-virtual private function, not extracted */ + void someUtility(); +}; |