Adds documentation to all_of and any_of.

This commit is contained in:
Denis Blank 2017-02-27 00:37:30 +01:00
parent 6edce3bcaa
commit 7ae1aedfbb
4 changed files with 57 additions and 13 deletions

View File

@ -680,7 +680,7 @@ SHOW_FILES = YES
# Folder Tree View (if specified). # Folder Tree View (if specified).
# The default value is: YES. # 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 # 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 # 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 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # 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 # 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 # 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 # (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. # 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 # Configuration options related to source browsing

15
doc/Index.md Normal file
View File

@ -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.

View File

@ -34,7 +34,9 @@
#include <utility> #include <utility>
namespace cti { namespace cti {
/// \cond false
inline namespace abi_v1 { inline namespace abi_v1 {
/// \endcond
/// A wrapper class to mark a functional class as continuation /// A wrapper class to mark a functional class as continuation
/// Such a wrapper class is required to decorate the result of a callback /// Such a wrapper class is required to decorate the result of a callback
/// correctly. /// correctly.
@ -1405,6 +1407,8 @@ private:
/// ///
/// \returns A \ref continuable_base with unknown template parameters which /// \returns A \ref continuable_base with unknown template parameters which
/// wraps the given continuation. /// 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 /// \note You should always turn the callback into a r-value if possible
/// (`std::move` or `std::forward`) for qualifier correct invokation. /// (`std::move` or `std::forward`) for qualifier correct invokation.
@ -1420,18 +1424,36 @@ auto make_continuable(Continuation&& continuation) {
std::forward<Continuation>(continuation), hint); std::forward<Continuation>(continuation), hint);
} }
template <typename First, typename Second, typename... Rest> /// Connects the given continuables with an *all* logic.
auto all_of(First&& first, Second&& second, Rest&&... rest) { ///
return detail::util::fold( /// \param continuables The \ref continuable_base objects to connect.
detail::util::and_folding(), std::forward<First>(first), /// Requires at least 2 objects to connect.
std::forward<Second>(second), std::forward<Rest>(rest)...); ///
/// \see \ref continuable_base::operator && for details.
///
/// \since version 1.0.0
template <typename... Continuables>
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>(continuables)...);
} }
template <typename First, typename Second, typename... Rest> /// Connects the given continuables with an *any* logic.
auto any_of(First&& first, Second&& second, Rest&&... rest) { ///
return detail::util::fold( /// \param continuables The \ref continuable_base objects to connect.
detail::util::or_folding(), std::forward<First>(first), /// Requires at least 2 objects to connect.
std::forward<Second>(second), std::forward<Rest>(rest)...); ///
/// \see \ref continuable_base::operator|| for details.
///
/// \since version 1.0.0
template <typename... Continuables>
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>(continuables)...);
} }
template <template <typename> class CallbackWrapper, template <template <typename> class CallbackWrapper,
@ -1452,7 +1474,9 @@ using continuable_of_t =
* cti::through * cti::through
*/ */
/// \cond false
} // end inline namespace abi_... } // end inline namespace abi_...
/// \endcond
} // end namespace cti } // end namespace cti
#endif // CONTINUABLE_BASE_HPP_INCLUDED__ #endif // CONTINUABLE_BASE_HPP_INCLUDED__

View File

@ -29,7 +29,9 @@
#include "continuable/continuable-base.hpp" #include "continuable/continuable-base.hpp"
namespace cti { namespace cti {
/// \cond false
inline namespace abi_v1 { inline namespace abi_v1 {
/// \endcond
namespace detail { namespace detail {
namespace testing { namespace testing {
template <typename C> void expect_async_completion(C&& continuable) { template <typename C> void expect_async_completion(C&& continuable) {
@ -107,7 +109,9 @@ void expect_async_types(C&& continuable, util::identity<Args...> expected) {
} }
} // end namespace testing } // end namespace testing
} // end namespace detail } // end namespace detail
/// \cond false
} // end inline namespace abi_... } // end inline namespace abi_...
/// \endcond
} // end namespace cti } // end namespace cti
/// Expects the final callback of the given continuable to be called /// Expects the final callback of the given continuable to be called