TrinityCore
Loading...
Searching...
No Matches
Trinity::Impl::ChatCommands Namespace Reference

Classes

struct  are_all_assignable
 
struct  are_all_assignable< void, Ts... >
 
struct  ArgInfo
 
struct  ArgInfo< AchievementEntry const * >
 
struct  ArgInfo< CurrencyTypesEntry const * >
 
struct  ArgInfo< GameTele const * >
 
struct  ArgInfo< ItemTemplate const * >
 
struct  ArgInfo< Quest const * >
 
struct  ArgInfo< SpellInfo const * >
 
struct  ArgInfo< std::array< T, N >, void >
 
struct  ArgInfo< std::string, void >
 
struct  ArgInfo< std::string_view, void >
 
struct  ArgInfo< std::vector< T >, void >
 
struct  ArgInfo< std::wstring, void >
 
struct  ArgInfo< T, std::enable_if_t< std::is_base_of_v< ContainerTag, T > > >
 
struct  ArgInfo< T, std::enable_if_t< std::is_enum_v< T > > >
 
struct  ArgInfo< T, std::enable_if_t< std::is_integral_v< T >||std::is_floating_point_v< T > > >
 
struct  ArgInfo< Trinity::ChatCommands::Variant< Ts... > >
 
class  ChatCommandNode
 
struct  ChatCommandResult
 
struct  CommandInvoker
 
struct  CommandPermissions
 
struct  ContainerTag
 
struct  FilteredCommandListIterator
 
struct  get_nth
 
struct  get_nth< 0, T1, Ts... >
 
struct  HandlerToTuple
 
struct  HandlerToTuple< bool(ChatHandler *, Ts...)>
 
struct  MultiConsumer
 
struct  MultiConsumer< Tuple, Optional< NestedNextType >, offset >
 
struct  tag_base
 
struct  tag_base< T, std::enable_if_t< std::is_base_of_v< ContainerTag, T > > >
 
struct  TokenizeResult
 

Typedefs

template<typename T >
using TupleType = typename HandlerToTuple< T >::type
 
template<typename T >
using tag_base_t = typename tag_base< T >::type
 
template<std::size_t index, typename... Ts>
using get_nth_t = typename get_nth< index, Ts... >::type
 

Functions

template<typename Tuple , size_t offset>
ChatCommandResult ConsumeFromOffset (Tuple &, ChatHandler const *handler, std::string_view args)
 
TokenizeResult tokenize (std::string_view args)
 
TC_GAME_API void SendErrorMessageToHandler (ChatHandler *handler, std::string_view str)
 
TC_GAME_API char const * GetTrinityString (ChatHandler const *handler, TrinityStrings which)
 
template<typename... Ts>
std::string FormatTrinityString (ChatHandler const *handler, TrinityStrings which, Ts &&... args)
 
template<size_t N>
constexpr char GetChar (char const (&s)[N], size_t i)
 

Variables

static constexpr char COMMAND_DELIMITER = ' '
 

Typedef Documentation

◆ get_nth_t

template<std::size_t index, typename... Ts>
using Trinity::Impl::ChatCommands::get_nth_t = typedef typename get_nth<index, Ts...>::type

Definition at line 93 of file ChatCommandHelpers.h.

◆ tag_base_t

template<typename T >
using Trinity::Impl::ChatCommands::tag_base_t = typedef typename tag_base<T>::type

Definition at line 48 of file ChatCommandHelpers.h.

◆ TupleType

template<typename T >
using Trinity::Impl::ChatCommands::TupleType = typedef typename HandlerToTuple<T>::type

Definition at line 118 of file ChatCommand.h.

Function Documentation

◆ ConsumeFromOffset()

template<typename Tuple , size_t offset>
ChatCommandResult Trinity::Impl::ChatCommands::ConsumeFromOffset ( Tuple &  tuple,
ChatHandler const *  handler,
std::string_view  args 
)

Definition at line 106 of file ChatCommand.h.

107 {
108 if constexpr (offset < std::tuple_size_v<Tuple>)
109 return MultiConsumer<Tuple, std::tuple_element_t<offset, Tuple>, offset>::TryConsumeTo(tuple, handler, args);
110 else if (!args.empty()) /* the entire string must be consumed */
111 return std::nullopt;
112 else
113 return args;
114 }

◆ FormatTrinityString()

template<typename... Ts>
std::string Trinity::Impl::ChatCommands::FormatTrinityString ( ChatHandler const *  handler,
TrinityStrings  which,
Ts &&...  args 
)

Definition at line 127 of file ChatCommandHelpers.h.

128 {
129 return fmt::sprintf(GetTrinityString(handler, which), std::forward<Ts>(args)...);
130 }
TC_GAME_API char const * GetTrinityString(ChatHandler const *handler, TrinityStrings which)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetChar()

template<size_t N>
constexpr char Trinity::Impl::ChatCommands::GetChar ( char const (&)  s[N],
size_t  i 
)
inlineconstexpr

Definition at line 54 of file ChatCommandTags.h.

55 {
56 static_assert(N <= 25, "The EXACT_SEQUENCE macro can only be used with up to 25 character long literals. Specify them char-by-char (null terminated) as parameters to ExactSequence<> instead.");
57 return i >= N ? '\0' : s[i];
58 }

◆ GetTrinityString()

char const * Trinity::Impl::ChatCommands::GetTrinityString ( ChatHandler const *  handler,
TrinityStrings  which 
)

Definition at line 27 of file ChatCommandHelpers.cpp.

28{
29 return handler->GetTrinityString(which);
30}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SendErrorMessageToHandler()

void Trinity::Impl::ChatCommands::SendErrorMessageToHandler ( ChatHandler handler,
std::string_view  str 
)

Definition at line 21 of file ChatCommandHelpers.cpp.

22{
23 handler->SendSysMessage(str);
24 handler->SetSentErrorMessage(true);
25}
void SetSentErrorMessage(bool val)
Definition: Chat.h:115
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tokenize()

TokenizeResult Trinity::Impl::ChatCommands::tokenize ( std::string_view  args)
inline

Definition at line 56 of file ChatCommandHelpers.h.

57 {
58 TokenizeResult result;
59 if (size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos)
60 {
61 result.token = args.substr(0, delimPos);
62 if (size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos)
63 result.tail = args.substr(tailPos);
64 }
65 else
66 result.token = args;
67
68 return result;
69 }
+ Here is the caller graph for this function:

Variable Documentation

◆ COMMAND_DELIMITER

constexpr char Trinity::Impl::ChatCommands::COMMAND_DELIMITER = ' '
staticconstexpr

Definition at line 39 of file ChatCommandHelpers.h.