| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
dpp::detail Namespace Reference

Implementation details for internal use only. More...

## Namespaces

namespace | async
namespace | coroutine
namespace | event_router
| Internal cogwheels for dpp::event_router_t.
namespace | job
namespace | promise
namespace | std_coroutine
| Alias for either std or std::experimental depending on compiler and library. Used by coroutine implementation.
namespace | task
namespace | when_any
| Internal cogwheels for dpp::when_any.

## Classes

struct | wrapped_ssl_ctx
| This class wraps a raw SSL_CTX pointer, managing moving, creation, and RAII destruction. More...

## Typedefs

template<typename T>
using | awaitable_result = decltype(co_await_resolve(std::declval<T>()).await_resume())
| Convenience alias for the result of a certain awaitable's await_resume.

## Functions

decltype(auto) | co_await_resolve (auto &&expr)
| Mimics the compiler's behavior of using co_await. That is, it returns whichever works first, in order : expr.operator co_await(); > operator co_await(expr) > expr.
DPP_EXPORT wrapped_ssl_ctx * | generate_ssl_context (uint16_t port=0, const std::string &private_key="", const std::string &public_key="")

Generate a new wrapped SSL context. If an SSL context already exists for the given port number, it will be returned, else a new one will be generated and cached. Contexts with port = 0 will be considered client contexts. There can only be one client context at a time and it covers all SSL client connections. There can be many SSL server contexts, individual ones can be cached per-port, each with their own loaded SSL private and public key PEM certificate.

DPP_EXPORT void | release_ssl_context (uint16_t port=0)
| Release an SSL context.

## Variables

template<typename T>
constexpr bool | awaitable_type
| Concept to check if a type can be used with co_await.
template<typename T>
constexpr bool | has_await_members
| Concept to check if a type has useable await_ready(), await_suspend() and await_resume() member functions.
template<typename T>
constexpr bool | has_co_await_member
| Concept to check if a type has a useable operator co_await() member.
template<typename T>
constexpr bool | has_free_co_await
| Concept to check if a type has a useable overload of the free function operator co_await(expr).

## Detailed Description

Implementation details for internal use only.

Attention
  This is only meant to be used by D++ internally. Support will not be given regarding the facilities in this namespace.

## Typedef Documentation

## ◆ awaitable_result

template<typename T>

using dpp::detail::awaitable_result = decltype(co_await_resolve(std::declval<T>()).await_resume())

Convenience alias for the result of a certain awaitable's await_resume.

## Function Documentation

## ◆ co_await_resolve()

decltype(auto) dpp::detail::co_await_resolve | ( | auto && | expr | ) |

Mimics the compiler's behavior of using co_await. That is, it returns whichever works first, in order : expr.operator co_await(); > operator co_await(expr) > expr.

This function is conditionally noexcept, if the returned expression also is.

## ◆ generate_ssl_context()

DPP_EXPORT wrapped_ssl_ctx * dpp::detail::generate_ssl_context | ( | uint16_t | port = 0,
|  | const std::string & | private_key = "",
|  | const std::string & | public_key = "" )

Generate a new wrapped SSL context. If an SSL context already exists for the given port number, it will be returned, else a new one will be generated and cached. Contexts with port = 0 will be considered client contexts. There can only be one client context at a time and it covers all SSL client connections. There can be many SSL server contexts, individual ones can be cached per-port, each with their own loaded SSL private and public key PEM certificate.

Parameters

  port | Port number. Pass zero to create or get the client context.
  private_key | Private key PEM pathname for server contexts
  public_key | Public key PEM pathname for server contexts

Returns
  wrapped SSL context

## ◆ release_ssl_context()

DPP_EXPORT void dpp::detail::release_ssl_context | ( | uint16_t | port = 0 | ) |

Release an SSL context.

Warning
  Only do this if you are certain no SSL connections remain that use this context. As OpenSSL is a C library it is impossible for us to track this on its behalf. Be careful!

Parameters

  port | port number to release

## Variable Documentation

## ◆ awaitable_type

template<typename T>

bool dpp::detail::awaitable_type

inline constexpr

Concept to check if a type can be used with co_await.

Note
  This is actually a C++20 concept but Doxygen doesn't do well with them

## ◆ has_await_members

template<typename T>

bool dpp::detail::has_await_members

inline constexpr

Concept to check if a type has useable await_ready(), await_suspend() and await_resume() member functions.

Note
  This is actually a C++20 concept but Doxygen doesn't do well with them

## ◆ has_co_await_member

template<typename T>

bool dpp::detail::has_co_await_member

inline constexpr

Concept to check if a type has a useable operator co_await() member.

Note
  This is actually a C++20 concept but Doxygen doesn't do well with them

## ◆ has_free_co_await

template<typename T>

bool dpp::detail::has_free_co_await

inline constexpr

Concept to check if a type has a useable overload of the free function operator co_await(expr).

Note
  This is actually a C++20 concept but Doxygen doesn't do well with them

D++ Library version 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0