AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::Impl::ChatCommands Namespace Reference

Classes

struct  are_all_assignable
 
struct  are_all_assignable< void, Ts... >
 
struct  ArgInfo
 
struct  ArgInfo< AchievementEntry const * >
 
struct  ArgInfo< Acore::ChatCommands::Variant< Ts... > >
 
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 > > >
 
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)
 
AC_GAME_API void SendErrorMessageToHandler (ChatHandler *handler, std::string_view str)
 
AC_GAME_API char const * GetAcoreString (ChatHandler const *handler, AcoreStrings which)
 
template<typename... Ts>
std::string FormatAcoreString (ChatHandler const *handler, AcoreStrings 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 Acore::Impl::ChatCommands::get_nth_t = typedef typename get_nth<index, Ts...>::type

◆ tag_base_t

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

◆ TupleType

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

Function Documentation

◆ ConsumeFromOffset()

template<typename Tuple , size_t offset>
ChatCommandResult Acore::Impl::ChatCommands::ConsumeFromOffset ( Tuple &  tuple,
ChatHandler const *  handler,
std::string_view  args 
)
108 {
109 if constexpr (offset < std::tuple_size_v<Tuple>)
110 return MultiConsumer<Tuple, std::tuple_element_t<offset, Tuple>, offset>::TryConsumeTo(tuple, handler, args);
111 else if (!args.empty()) /* the entire string must be consumed */
112 return std::nullopt;
113 else
114 return args;
115 }
Definition: ChatCommand.h:64

◆ FormatAcoreString()

template<typename... Ts>
std::string Acore::Impl::ChatCommands::FormatAcoreString ( ChatHandler const *  handler,
AcoreStrings  which,
Ts &&...  args 
)
127 {
128 return Acore::StringFormat(GetAcoreString(handler, which), std::forward<Ts>(args)...);
129 }
std::string StringFormat(Format &&fmt, Args &&... args)
Default AC string format function.
Definition: StringFormat.h:29
AC_GAME_API char const * GetAcoreString(ChatHandler const *handler, AcoreStrings which)
Definition: ChatCommandHelpers.cpp:28

References GetAcoreString(), and Acore::StringFormat().

Referenced by Acore::ChatCommands::AccountIdentifier::TryConsume(), Acore::ChatCommands::PlayerIdentifier::TryConsume(), Acore::ChatCommands::ExactSequence< chars >::TryConsume(), Acore::Impl::ChatCommands::ArgInfo< T, std::enable_if_t< std::is_integral_v< T >||std::is_floating_point_v< T > > >::TryConsume(), and Acore::Impl::ChatCommands::ArgInfo< T, std::enable_if_t< std::is_enum_v< T > > >::TryConsume().

◆ GetAcoreString()

◆ GetChar()

template<size_t N>
constexpr char Acore::Impl::ChatCommands::GetChar ( char const (&)  s[N],
size_t  i 
)
inlineconstexpr
57 {
58 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.");
59 return i >= N ? '\0' : s[i];
60 }

◆ SendErrorMessageToHandler()

void Acore::Impl::ChatCommands::SendErrorMessageToHandler ( ChatHandler handler,
std::string_view  str 
)
23{
24 handler->SendSysMessage(str);
25 handler->SetSentErrorMessage(true);
26}
void SetSentErrorMessage(bool val)
Definition: Chat.h:118
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:103

References ChatHandler::SendSysMessage(), and ChatHandler::SetSentErrorMessage().

Referenced by Acore::Impl::ChatCommands::CommandInvoker::CommandInvoker().

◆ tokenize()

TokenizeResult Acore::Impl::ChatCommands::tokenize ( std::string_view  args)
inline
56 {
57 TokenizeResult result;
58 if (size_t delimPos = args.find(COMMAND_DELIMITER); delimPos != std::string_view::npos)
59 {
60 result.token = args.substr(0, delimPos);
61 if (size_t tailPos = args.find_first_not_of(COMMAND_DELIMITER, delimPos); tailPos != std::string_view::npos)
62 result.tail = args.substr(tailPos);
63 }
64 else
65 result.token = args;
66
67 return result;
68 }
Definition: ChatCommandHelpers.h:49
std::string_view tail
Definition: ChatCommandHelpers.h:52
std::string_view token
Definition: ChatCommandHelpers.h:51

References COMMAND_DELIMITER, Acore::Impl::ChatCommands::TokenizeResult::tail, and Acore::Impl::ChatCommands::TokenizeResult::token.

Referenced by Acore::Impl::ChatCommands::ChatCommandNode::GetAutoCompletionsFor(), Acore::ChatCommands::QuotedString::TryConsume(), Acore::ChatCommands::Hyperlink< linktag >::TryConsume(), Acore::ChatCommands::ExactSequence< chars >::TryConsume(), Acore::Impl::ChatCommands::ArgInfo< std::string_view, void >::TryConsume(), Acore::Impl::ChatCommands::ArgInfo< T, std::enable_if_t< std::is_integral_v< T >||std::is_floating_point_v< T > > >::TryConsume(), and Acore::Impl::ChatCommands::ChatCommandNode::TryExecuteCommand().

Variable Documentation

◆ COMMAND_DELIMITER