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

For utility classes/functions. More...

Concepts

concept  DiscordCoreAPI::IsRelatedPtr
 Concept to check if two types of pointers are related.
 

Classes and Structures

struct  DiscordCoreAPI::BaseFunction
 Base class for the command classes. More...
 
struct  DiscordCoreAPI::BaseFunctionArguments
 Base arguments for the command classes. More...
 
class  DiscordCoreAPI::ButtonCollector
 ButtonCollector, for collecting button input from one or more Users. More...
 
struct  DiscordCoreAPI::ButtonResponseData
 Button response data. More...
 
class  DiscordCoreAPI::CommandData
 Command data, for functions executed by the CommandController. More...
 
class  DiscordCoreAPI::CoRoutine< ReturnType, timeOut >
 A CoRoutine - representing a potentially asynchronous operation/function. More...
 
class  DiscordCoreAPI::CoRoutine< ReturnType, timeOut >
 A CoRoutine - representing a potentially asynchronous operation/function. More...
 
struct  DiscordCoreAPI::CoRoutineError
 An error type for CoRoutines. More...
 
class  DiscordCoreAPI::CountedPtr< ValueType, Deleter >
 A smart pointer class that maintains a reference count for shared ownership. More...
 
class  DiscordCoreAPI::CountedPtr< ValueType[], Deleter >
 A smart pointer class that maintains a reference count for shared ownership. More...
 
struct  DiscordCoreAPI::DCAException
 An exception class derived from std::runtime_error for DCA-related exceptions. More...
 
class  DiscordCoreAPI::DiscordCoreInternal::Event< ReturnType, ArgTypes >
 Template class representing an event that executes event functions. More...
 
class  DiscordCoreAPI::DiscordCoreInternal::EventDelegate< ReturnType, ArgTypes >
 Event-delegate, representing an event function to be executed. More...
 
struct  DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken
 Struct representing an event delegate token, associated with an event. More...
 
class  DiscordCoreAPI::DiscordCoreInternal::TriggerEvent< ReturnType, ArgTypes >
 A trigger event that fires based on the result of trigger-function return value. More...
 
class  DiscordCoreAPI::DiscordCoreInternal::TriggerEventDelegate< ReturnType, ArgTypes >
 Event-delegate, for representing an event-function to be executed conditionally. More...
 
class  DiscordCoreAPI::MessagePrinter
 Class for printing different types of messages to output and error streams. More...
 
class  DiscordCoreAPI::ModalCollector
 ModalCollector, for collecting modal text input from one or more Users. More...
 
struct  DiscordCoreAPI::ModalResponseData
 Button response data. More...
 
class  DiscordCoreAPI::NewThreadAwaiter< ReturnType, timeOut >
 An awaitable that can be used to launch the CoRoutine onto a new thread - as well as return the handle for stoppping its execution. More...
 
class  DiscordCoreAPI::SelectMenuCollector
 SelectMenuCollector, for collecting select-menu input from one or more Users. More...
 
struct  DiscordCoreAPI::SelectMenuResponseData
 Select menu response data. More...
 
class  DiscordCoreAPI::Snowflake
 A class representing a Snowflake identifier with various operations. More...
 
class  DiscordCoreAPI::TimeStamp
 A class that extends TimeStampBase to provide additional functionality. More...
 
class  DiscordCoreAPI::TimeStampBase< ValueType >
 A base class for handling time stamps and conversions. More...
 
class  DiscordCoreAPI::TimeStampParse
 A class that extends TimeStampBase and std::string to provide additional functionality. More...
 
class  DiscordCoreAPI::UniquePtr< ValueType, Deleter >
 A smart pointer class that provides unique ownership semantics. More...
 
class  DiscordCoreAPI::UniquePtr< ValueType[], Deleter >
 Specialization of UniquePtr for arrays. More...
 

Enumerations

enum class  DiscordCoreAPI::CoRoutineStatus { CoRoutineStatus::Idle = 0 , CoRoutineStatus::Running = 1 , CoRoutineStatus::Complete = 2 , CoRoutineStatus::Cancelled = 3 }
 The current status of the associated CoRoutine. More...
 
enum class  DiscordCoreAPI::TimeFormat : char {
  TimeFormat::LongDate = 'D' , TimeFormat::LongDateTime = 'F' , TimeFormat::LongTime = 'T' , TimeFormat::ShortDate = 'd' ,
  TimeFormat::ShortDateTime = 'f' , TimeFormat::ShortTime = 't'
}
 Time formatting methods. More...
 

Functions

 DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::EventDelegateToken ()=default
 Default constructor for EventDelegateToken.
 
template<typename ValueType , typename Deleter = std::default_delete<ValueType>, typename... ArgTypes, std::enable_if_t<!std::is_array_v< ValueType >, int32_t > = 0>
CountedPtr< ValueType, Deleter > DiscordCoreAPI::makeCounted (ArgTypes &&... args)
 Creates a CountedPtr instance for non-array types. More...
 
template<typename ValueType , typename... ArgTypes, std::enable_if_t< std::extent_v< ValueType > !=0, int32_t > = 0>
void DiscordCoreAPI::makeCounted (ArgTypes &&...)=delete
 Explicitly deletes the function for arrays with non-zero extent. More...
 
template<typename ValueType , typename Deleter = std::default_delete<ValueType>, std::enable_if_t< std::is_array_v< ValueType > &&std::extent_v< ValueType >==0, int32_t > = 0>
CountedPtr< ValueType, Deleter > DiscordCoreAPI::makeCounted (const uint64_t size)
 Creates a CountedPtr instance for arrays with zero extent. More...
 
template<typename ValueType , typename Deleter = std::default_delete<ValueType>, typename... ArgTypes, std::enable_if_t<!std::is_array_v< ValueType >, int32_t > = 0>
UniquePtr< ValueType, Deleter > DiscordCoreAPI::makeUnique (ArgTypes &&... args)
 Helper function to create a UniquePtr for a non-array object. More...
 
template<typename ValueType , typename... ArgTypes, std::enable_if_t< std::extent_v< ValueType > !=0, int32_t > = 0>
void DiscordCoreAPI::makeUnique (ArgTypes &&...)=delete
 Deleted overload for creating UniquePtr for static arrays.
 
template<typename ValueType , typename Deleter = std::default_delete<ValueType>, std::enable_if_t< std::is_array_v< ValueType > &&std::extent_v< ValueType >==0, int32_t > = 0>
UniquePtr< ValueType, Deleter > DiscordCoreAPI::makeUnique (const uint64_t size)
 Helper function to create a UniquePtr for a dynamic array. More...
 
template<typename ReturnType , bool timeOut = true>
auto DiscordCoreAPI::NewThreadAwaitable ()
 An awaitable that can be used to launch the CoRoutine onto a new thread - as well as return the handle for stoppping its execution. More...
 
bool DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::operator< (const EventDelegateToken &rhs) const
 Less-than operator for comparing EventDelegateToken instances. More...
 
bool DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::operator== (const EventDelegateToken &rhs) const
 Equality operator for comparing EventDelegateToken instances. More...
 

Variables

std::string DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::eventId {}
 Identifier for the event.
 
std::string DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::handlerId {}
 Identifier for the handler.
 

Enumeration Type Documentation

◆ CoRoutineStatus

Enumerator
Idle 

Idle.

Running 

Running.

Complete 

Complete.

Cancelled 

Cancelled.

Definition at line 45 of file CoRoutine.hpp.

◆ TimeFormat

enum class DiscordCoreAPI::TimeFormat : char
strong
Enumerator
LongDate 

"20 April 2021" - Long Date

LongDateTime 

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

LongTime 

"16:20:30" - Long Time

ShortDate 

"20/04/2021" - Short Date

ShortDateTime 

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

ShortTime 

"16:20" - Short Time

Definition at line 294 of file Base.hpp.

Function Documentation

◆ makeCounted() [1/3]

template<typename ValueType , typename Deleter = std::default_delete<ValueType>, typename... ArgTypes, std::enable_if_t<!std::is_array_v< ValueType >, int32_t > = 0>
CountedPtr< ValueType, Deleter > DiscordCoreAPI::makeCounted ( ArgTypes &&...  args)
inline
Template Parameters
ValueTypeThe type of value to be managed.
DeleterThe deleter type to be used (default: std::default_delete<ValueType>).
ArgTypesThe argument types for constructing the value.
Parameters
argsThe arguments for constructing the value.
Returns
A CountedPtr instance managing the created value.

Definition at line 420 of file CountedPtr.hpp.

◆ makeCounted() [2/3]

template<typename ValueType , typename... ArgTypes, std::enable_if_t< std::extent_v< ValueType > !=0, int32_t > = 0>
void DiscordCoreAPI::makeCounted ( ArgTypes &&  ...)
inlinedelete
Template Parameters
ValueTypeThe type of array with non-zero extent.
ArgTypesThe argument types (not applicable for deletion).

◆ makeCounted() [3/3]

template<typename ValueType , typename Deleter = std::default_delete<ValueType>, std::enable_if_t< std::is_array_v< ValueType > &&std::extent_v< ValueType >==0, int32_t > = 0>
CountedPtr< ValueType, Deleter > DiscordCoreAPI::makeCounted ( const uint64_t  size)
inline
Template Parameters
ValueTypeThe type of array element.
DeleterThe deleter type to be used (default: std::default_delete<ValueType>).
Parameters
sizeThe size of the array to be created.
Returns
A CountedPtr instance managing the created array.

Definition at line 430 of file CountedPtr.hpp.

◆ makeUnique() [1/2]

template<typename ValueType , typename Deleter = std::default_delete<ValueType>, typename... ArgTypes, std::enable_if_t<!std::is_array_v< ValueType >, int32_t > = 0>
UniquePtr< ValueType, Deleter > DiscordCoreAPI::makeUnique ( ArgTypes &&...  args)
inline
Parameters
argsThe arguments to construct the new object from.
Template Parameters
ValueTypeThe type of value to store in the UniquePtr.
DeleterThe type of deleter to use for the stored object.
ArgTypesThe types of arguments for constructing the object.
Returns
UniquePtr<ValueType, Deleter> The managed object.

Definition at line 374 of file UniquePtr.hpp.

◆ makeUnique() [2/2]

template<typename ValueType , typename Deleter = std::default_delete<ValueType>, std::enable_if_t< std::is_array_v< ValueType > &&std::extent_v< ValueType >==0, int32_t > = 0>
UniquePtr< ValueType, Deleter > DiscordCoreAPI::makeUnique ( const uint64_t  size)
inline
Parameters
sizeThe size to allocate for the array.
Template Parameters
ValueTypeThe type of value to store in the UniquePtr.
DeleterThe type of deleter to use for the stored object.
Returns
UniquePtr<ValueType, Deleter> The managed object.

Definition at line 384 of file UniquePtr.hpp.

◆ NewThreadAwaitable()

template<typename ReturnType , bool timeOut = true>
auto DiscordCoreAPI::NewThreadAwaitable ( )
inline
Template Parameters
ReturnTypeThe type of value returned by the containing CoRoutine.
timeOutWhether or not to time out the CoRoutine's execution after a period of time.
Returns
NewThreadAwaiter<ReturnType, timeOut> A NewThreadAwaiter for suspendint the current CoRoutine's execution.

Definition at line 907 of file Utilities.hpp.

◆ operator<()

bool DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::operator< ( const EventDelegateToken rhs) const
inline
Parameters
rhsThe right-hand side EventDelegateToken to compare against.
Returns
bool True if this EventDelegateToken is less than rhs, otherwise false.

Definition at line 56 of file EventEntities.hpp.

◆ operator==()

bool DiscordCoreAPI::DiscordCoreInternal::EventDelegateToken::operator== ( const EventDelegateToken rhs) const
inline
Parameters
rhsThe right-hand side EventDelegateToken to compare against.
Returns
bool True if the EventDelegateToken instances are equal, otherwise false.

Definition at line 49 of file EventEntities.hpp.