handler_base.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) 2006, 2007 Julio M. Merino Vidal
  2. // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
  3. // Copyright (c) 2009 Boris Schaeling
  4. // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
  5. // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
  6. // Copyright (c) 2016 Klemens D. Morgenstern
  7. //
  8. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  9. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_PROCESS_DETAIL_HANDLER_BASE_HPP
  11. #define BOOST_PROCESS_DETAIL_HANDLER_BASE_HPP
  12. #include <system_error>
  13. namespace boost { namespace process { namespace detail {
  14. template<template <class> class Template>
  15. struct make_handler_t
  16. {
  17. constexpr make_handler_t() {}
  18. template<typename Handler>
  19. constexpr Template<Handler> operator()(Handler handler) const {return Template<Handler>(handler);}
  20. template<typename Handler>
  21. constexpr Template<Handler> operator= (Handler handler) const {return Template<Handler>(handler);}
  22. template<typename Handler>
  23. constexpr Template<Handler> operator+=(Handler handler) const {return Template<Handler>(handler);}
  24. };
  25. struct handler_base
  26. {
  27. using resource_type = void;
  28. template <class Executor>
  29. void on_setup(Executor&) const {}
  30. template <class Executor>
  31. void on_error(Executor&, const std::error_code &) const {}
  32. template <class Executor>
  33. void on_success(Executor&) const {}
  34. };
  35. }}}
  36. #endif