diff --git a/doc/Doxyfile b/doc/Doxyfile index 33de3c3..f39241b 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -680,7 +680,7 @@ SHOW_FILES = YES # Folder Tree View (if specified). # The default value is: YES. -SHOW_NAMESPACES = YES +SHOW_NAMESPACES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from @@ -790,7 +790,8 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../include +INPUT = ../include \ + Index.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -983,7 +984,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = Index.md #--------------------------------------------------------------------------- # Configuration options related to source browsing diff --git a/doc/Index.md b/doc/Index.md new file mode 100644 index 0000000..9c32551 --- /dev/null +++ b/doc/Index.md @@ -0,0 +1,15 @@ +# Documentation of continuable + +This documentation covers the continuable library in detail + +## Content + +- Class cti::continuable_base - main class for continuation chaining + - \link cti::continuable_base::then then\endlink - adds a callback to the chain + - \link cti::continuable_base::operator && operator&&\endlink - connects another continuable with an *all* logic. + - \link cti::continuable_base::operator|| operator||\endlink - connects another continuable with an *any* logic. +- Helper functions + - \link cti::make_continuable make_continuable\endlink - creates a continuable_base from a callback tanking function. + - \link cti::all_of all_of\endlink - connects all given continuables with an *all* logic. + - \link cti::any_of any_of\endlink - connects all given continuables with an *any* logic. + diff --git a/include/continuable/continuable-base.hpp b/include/continuable/continuable-base.hpp index 06c1f1e..b06d734 100644 --- a/include/continuable/continuable-base.hpp +++ b/include/continuable/continuable-base.hpp @@ -34,7 +34,9 @@ #include namespace cti { +/// \cond false inline namespace abi_v1 { +/// \endcond /// A wrapper class to mark a functional class as continuation /// Such a wrapper class is required to decorate the result of a callback /// correctly. @@ -1405,6 +1407,8 @@ private: /// /// \returns A \ref continuable_base with unknown template parameters which /// wraps the given continuation. +/// In order to convert the \ref continuable_base to a known type +/// you need to apply type erasure. /// /// \note You should always turn the callback into a r-value if possible /// (`std::move` or `std::forward`) for qualifier correct invokation. @@ -1420,18 +1424,36 @@ auto make_continuable(Continuation&& continuation) { std::forward(continuation), hint); } -template -auto all_of(First&& first, Second&& second, Rest&&... rest) { - return detail::util::fold( - detail::util::and_folding(), std::forward(first), - std::forward(second), std::forward(rest)...); +/// Connects the given continuables with an *all* logic. +/// +/// \param continuables The \ref continuable_base objects to connect. +/// Requires at least 2 objects to connect. +/// +/// \see \ref continuable_base::operator && for details. +/// +/// \since version 1.0.0 +template +auto all_of(Continuables&&... continuables) { + static_assert(sizeof...(continuables) >= 2, + "Requires at least 2 continuables!"); + return detail::util::fold(detail::util::and_folding(), + std::forward(continuables)...); } -template -auto any_of(First&& first, Second&& second, Rest&&... rest) { - return detail::util::fold( - detail::util::or_folding(), std::forward(first), - std::forward(second), std::forward(rest)...); +/// Connects the given continuables with an *any* logic. +/// +/// \param continuables The \ref continuable_base objects to connect. +/// Requires at least 2 objects to connect. +/// +/// \see \ref continuable_base::operator|| for details. +/// +/// \since version 1.0.0 +template +auto any_of(Continuables&&... continuables) { + static_assert(sizeof...(continuables) >= 2, + "Requires at least 2 continuables!"); + return detail::util::fold(detail::util::or_folding(), + std::forward(continuables)...); } template