DiscordCoreAPI
A Discord bot library written in C++, with custom asynchronous coroutines.
Loading...
Searching...
No Matches
Utilities

For utility classes/functions. More...

Classes and Structures

struct  discord_core_api::base_function
 Base class for the command classes. More...
 
struct  discord_core_api::base_function_arguments
 Base arguments for the command classes. More...
 
class  discord_core_api::button_collector
 Button_collector, for collecting button input from one or more users. More...
 
struct  discord_core_api::button_response_data
 Button response data. More...
 
class  discord_core_api::co_routine< return_type, timeOut >
 A co_routine - representing a potentially asynchronous operation/function. More...
 
class  discord_core_api::co_routine< return_type_new, timeOut >
 A co_routine - representing a potentially asynchronous operation/function. More...
 
struct  discord_core_api::co_routine_error
 An error type for co_routines. More...
 
class  discord_core_api::command_data
 Command data, for functions executed by the command_controller. More...
 
struct  discord_core_api::dca_exception
 An exception class derived from std::runtime_error for dca-related exceptions. More...
 
class  discord_core_api::discord_core_internal::event< return_type, arg_types >
 Template class representing an event that executes event functions. More...
 
class  discord_core_api::discord_core_internal::event_delegate< return_type, arg_types >
 Event-delegate, representing an event function to be executed. More...
 
struct  discord_core_api::discord_core_internal::event_delegate_token
 Struct representing an event delegate token, associated with an event. More...
 
class  discord_core_api::discord_core_internal::trigger_event< return_type, arg_types >
 A trigger event that fires based on the result of trigger-function return value. More...
 
class  discord_core_api::discord_core_internal::trigger_event_delegate< return_type, arg_types >
 Event-delegate, for representing an event-function to be executed conditionally. More...
 
class  discord_core_api::message_printer
 Class for printing different types of messages to output and error streams. More...
 
class  discord_core_api::modal_collector
 Modal_collector, for collecting modal text input from one or more users. More...
 
struct  discord_core_api::modal_response_data
 Button response data. More...
 
class  discord_core_api::new_thread_awaiter< return_type, timeOut >
 An awaitable that can be used to launch the co_routine onto a new thread - as well as return the handle for stoppping its execution. More...
 
class  discord_core_api::select_menu_collector
 Select_menu_collector, for collecting select-menu input from one or more users. More...
 
struct  discord_core_api::select_menu_response_data
 Select menu response data. More...
 
class  discord_core_api::snowflake
 A class representing a snowflake identifier with various operations. More...
 
class  discord_core_api::time_stamp
 A class that extends time_stamp_base to provide additional functionality. More...
 
class  discord_core_api::time_stamp_base< value_type >
 A base class for handling time stamps and conversions. More...
 
class  discord_core_api::to_entity< value_type >
 A class for converting snowflake id's into the data structures they represent. More...
 
class  discord_core_api::unique_ptr< value_type, deleter >
 A smart pointer class that provides unique ownership semantics. More...
 
class  discord_core_api::unique_ptr< value_type[], deleter >
 Specialization of unique_ptr for arrays. More...
 

Enumerations

enum class  discord_core_api::co_routine_status { discord_core_api::co_routine_status::idle = 0 , discord_core_api::co_routine_status::running = 1 , discord_core_api::co_routine_status::complete = 2 , discord_core_api::co_routine_status::cancelled = 3 }
 The current status of the associated co_routine. More...
 
enum class  discord_core_api::time_format : char {
  discord_core_api::time_format::long_date = 'D' , discord_core_api::time_format::long_date_time = 'F' , discord_core_api::time_format::long_time = 'T' , discord_core_api::time_format::short_date = 'd' ,
  discord_core_api::time_format::short_date_time = 'f' , discord_core_api::time_format::short_time = 't'
}
 Time formatting methods. More...
 

Functions

DCA_INLINE discord_core_api::discord_core_internal::event_delegate_token::event_delegate_token ()=default
 Default constructor for event_delegate_token.
 
template<typename value_type , typename deleter = std::default_delete<value_type>, typename... arg_types, std::enable_if_t<!std::is_array_v< value_type >, int32_t > = 0>
DCA_INLINE unique_ptr< value_type, deleter > discord_core_api::makeUnique (arg_types &&... args)
 Helper function to create a unique_ptr for a non-array object.
 
template<typename value_type , typename... arg_types, std::enable_if_t< std::extent_v< value_type > !=0, int32_t > = 0>
DCA_INLINE void discord_core_api::makeUnique (arg_types &&...)=delete
 Deleted overload for creating unique_ptr for static arrays.
 
template<typename value_type , typename deleter = std::default_delete<value_type>, std::enable_if_t< std::is_array_v< value_type > &&std::extent_v< value_type >==0, int32_t > = 0>
DCA_INLINE unique_ptr< value_type, deleter > discord_core_api::makeUnique (const uint64_t size)
 Helper function to create a unique_ptr for a dynamic array.
 
template<typename return_type , bool timeOut = true>
DCA_INLINE auto discord_core_api::newThreadAwaitable ()
 An awaitable that can be used to launch the co_routine onto a new thread - as well as return the handle for stoppping its execution.
 
DCA_INLINE bool discord_core_api::discord_core_internal::event_delegate_token::operator< (const event_delegate_token &rhs) const
 Less-than operator for comparing event_delegate_token instances.
 
DCA_INLINE bool discord_core_api::discord_core_internal::event_delegate_token::operator== (const event_delegate_token &rhs) const
 Equality operator for comparing event_delegate_token instances.
 

Variables

uint64_t discord_core_api::discord_core_internal::event_delegate_token::eventId {}
 Identifier for the event.
 
uint64_t discord_core_api::discord_core_internal::event_delegate_token::handlerId {}
 Identifier for the handler.
 

Enumeration Type Documentation

◆ co_routine_status

Enumerator
idle 

Idle.

running 

Running.

complete 

complete.

cancelled 

cancelled.

Definition at line 44 of file CoRoutine.hpp.

◆ time_format

enum class discord_core_api::time_format : char
strong
Enumerator
long_date 

"20 April 2021" - Long Date

long_date_time 

"Tuesday, 20 April 2021 16:20" - Long Date/Time

long_time 

"16:20:30" - Long Time

short_date 

"20/04/2021" - Short Date

short_date_time 

"20 April 2021 16:20" - Short Date/Time

short_time 

"16:20" - Short Time

Definition at line 334 of file Base.hpp.

Function Documentation

◆ makeUnique() [1/2]

template<typename value_type , typename deleter = std::default_delete<value_type>, typename... arg_types, std::enable_if_t<!std::is_array_v< value_type >, int32_t > = 0>
DCA_INLINE unique_ptr< value_type, deleter > discord_core_api::makeUnique ( arg_types &&... args)
Parameters
argsthe arguments to construct the new object from.
Template Parameters
value_typethe type of value to store in the unique_ptr.
deleterthe type of deleter to use for the stored object.
arg_typesthe types of arguments for constructing the object.
Returns
unique_ptr<value_type, deleter> the managed object.

Definition at line 321 of file UniquePtr.hpp.

Here is the caller graph for this function:

◆ makeUnique() [2/2]

template<typename value_type , typename deleter = std::default_delete<value_type>, std::enable_if_t< std::is_array_v< value_type > &&std::extent_v< value_type >==0, int32_t > = 0>
DCA_INLINE unique_ptr< value_type, deleter > discord_core_api::makeUnique ( const uint64_t size)
Parameters
sizethe size to allocate for the array.
Template Parameters
value_typethe type of value to store in the unique_ptr.
deleterthe type of deleter to use for the stored object.
Returns
unique_ptr<value_type, deleter> the managed object.

Definition at line 331 of file UniquePtr.hpp.

◆ newThreadAwaitable()

template<typename return_type , bool timeOut = true>
DCA_INLINE auto discord_core_api::newThreadAwaitable ( )
Template Parameters
return_typethe type of value returned by the containing co_routine.
timeOutwhether or not to time out the co_routine's execution after a period of time.
Returns
new_thread_awaiter<return_type, timeOut> a new_thread_awaiter for suspendint the current co_routine's execution.

Definition at line 902 of file Utilities.hpp.

◆ operator<()

DCA_INLINE bool discord_core_api::discord_core_internal::event_delegate_token::operator< ( const event_delegate_token & rhs) const
inline
Parameters
rhsthe right-hand side event_delegate_token to compare against.
Returns
bool true if this event_delegate_token is less than rhs, otherwise false.

Definition at line 55 of file EventEntities.hpp.

Here is the call graph for this function:

◆ operator==()

DCA_INLINE bool discord_core_api::discord_core_internal::event_delegate_token::operator== ( const event_delegate_token & rhs) const
inline
Parameters
rhsthe right-hand side event_delegate_token to compare against.
Returns
bool true if the event_delegate_token instances are equal, otherwise false.

Definition at line 48 of file EventEntities.hpp.

Here is the call graph for this function: