AzerothCore 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 , std::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<std::size_t N>
constexpr char GetChar (char const (&s)[N], std::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 , std::size_t offset>
ChatCommandResult Acore::Impl::ChatCommands::ConsumeFromOffset ( Tuple &  tuple,
ChatHandler const *  handler,
std::string_view  args 
)
104 {
105 if constexpr (offset < std::tuple_size_v<Tuple>)
106 return MultiConsumer<Tuple, std::tuple_element_t<offset, Tuple>, offset>::TryConsumeTo(tuple, handler, args);
107 else if (!args.empty()) /* the entire string must be consumed */
108 return std::nullopt;
109 else
110 return args;
111 }
Definition: ChatCommand.h:60

◆ FormatAcoreString()

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

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<std::size_t N>
constexpr char Acore::Impl::ChatCommands::GetChar ( char const (&)  s[N],
std::size_t  i 
)
inlineconstexpr
52 {
53 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.");
54 return i >= N ? '\0' : s[i];
55 }

◆ SendErrorMessageToHandler()

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

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

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

◆ tokenize()

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

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