AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::ChatCommands::Hyperlink< linktag > Struct Template Reference

#include "ChatCommandTags.h"

Inheritance diagram for Acore::ChatCommands::Hyperlink< linktag >:
Acore::Impl::ChatCommands::ContainerTag

Public Types

using value_type = typename linktag::value_type
 
using storage_type = std::remove_cvref_t< value_type >
 
- Public Types inherited from Acore::Impl::ChatCommands::ContainerTag
using ChatCommandResult = Acore::Impl::ChatCommands::ChatCommandResult
 

Public Member Functions

 operator value_type () const
 
value_type operator* () const
 
storage_type const * operator-> () const
 
ChatCommandResult TryConsume (ChatHandler const *handler, std::string_view args)
 

Private Attributes

storage_type val
 

Detailed Description

template<typename linktag>
struct Acore::ChatCommands::Hyperlink< linktag >

Member Typedef Documentation

◆ storage_type

template<typename linktag >
using Acore::ChatCommands::Hyperlink< linktag >::storage_type = std::remove_cvref_t<value_type>

◆ value_type

template<typename linktag >
using Acore::ChatCommands::Hyperlink< linktag >::value_type = typename linktag::value_type

Member Function Documentation

◆ operator value_type()

template<typename linktag >
Acore::ChatCommands::Hyperlink< linktag >::operator value_type ( ) const
inline
204{ return val; }
storage_type val
Definition: ChatCommandTags.h:232

References Acore::ChatCommands::Hyperlink< linktag >::val.

◆ operator*()

template<typename linktag >
value_type Acore::ChatCommands::Hyperlink< linktag >::operator* ( ) const
inline

◆ operator->()

template<typename linktag >
storage_type const * Acore::ChatCommands::Hyperlink< linktag >::operator-> ( ) const
inline

◆ TryConsume()

template<typename linktag >
ChatCommandResult Acore::ChatCommands::Hyperlink< linktag >::TryConsume ( ChatHandler const *  handler,
std::string_view  args 
)
inline
209 {
211 // invalid hyperlinks cannot be consumed
212 if (!info)
213 return std::nullopt;
214
215 // check if we got the right tag
216 if (info.tag != linktag::tag())
217 return std::nullopt;
218
219 // store value
220 if (!linktag::StoreTo(val, info.data))
222
223 // finally, skip any potential delimiters
224 auto [token, next] = Acore::Impl::ChatCommands::tokenize(info.tail);
225 if (token.empty()) /* empty token = first character is delimiter, skip past it */
226 return next;
227 else
228 return info.tail;
229 }
@ LANG_CMDPARSER_LINKDATA_INVALID
Definition: Language.h:995
AC_GAME_API char const * GetAcoreString(ChatHandler const *handler, AcoreStrings which)
Definition: ChatCommandHelpers.cpp:27
TokenizeResult tokenize(std::string_view args)
Definition: ChatCommandHelpers.h:54
HyperlinkInfo AC_GAME_API ParseSingleHyperlink(std::string_view str)
Definition: Hyperlinks.cpp:33
Definition: Hyperlinks.h:235
std::string_view const tail
Definition: Hyperlinks.h:242
std::string_view const tag
Definition: Hyperlinks.h:244
std::string_view const data
Definition: Hyperlinks.h:245

References Acore::Hyperlinks::HyperlinkInfo::data, Acore::Impl::ChatCommands::GetAcoreString(), LANG_CMDPARSER_LINKDATA_INVALID, Acore::Hyperlinks::ParseSingleHyperlink(), Acore::Hyperlinks::HyperlinkInfo::tag, Acore::Hyperlinks::HyperlinkInfo::tail, Acore::Impl::ChatCommands::tokenize(), and Acore::ChatCommands::Hyperlink< linktag >::val.

Member Data Documentation

◆ val