AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::Impl::ChatCommands::FilteredCommandListIterator Struct Reference

Public Member Functions

 FilteredCommandListIterator (ChatSubCommandMap const &map, ChatHandler const &handler, std::string_view token)
 
decltype(auto) operator* () const
 
decltype(auto) operator-> () const
 
FilteredCommandListIteratoroperator++ ()
 
 operator bool () const
 
bool operator! () const
 

Private Member Functions

void _skip ()
 

Private Attributes

ChatHandler const & _handler
 
std::string_view const _token
 
ChatSubCommandMap::const_iterator _it
 
ChatSubCommandMap::const_iterator _end
 

Detailed Description

Constructor & Destructor Documentation

◆ FilteredCommandListIterator()

Acore::Impl::ChatCommands::FilteredCommandListIterator::FilteredCommandListIterator ( ChatSubCommandMap const &  map,
ChatHandler const &  handler,
std::string_view  token 
)
inline
238 : _handler{ handler }, _token{ token }, _it{ map.lower_bound(token) }, _end{ map.end() }
239 {
240 _skip();
241 }
ChatHandler const & _handler
Definition: ChatCommand.cpp:267
ChatSubCommandMap::const_iterator _end
Definition: ChatCommand.cpp:269
ChatSubCommandMap::const_iterator _it
Definition: ChatCommand.cpp:269
void _skip()
Definition: ChatCommand.cpp:255
std::string_view const _token
Definition: ChatCommand.cpp:268

References _skip().

Member Function Documentation

◆ _skip()

void Acore::Impl::ChatCommands::FilteredCommandListIterator::_skip ( )
inlineprivate
256 {
257 if ((_it != _end) && !StringStartsWithI(_it->first, _token))
258 _it = _end;
259 while ((_it != _end) && !_it->second.IsVisible(_handler))
260 {
261 ++_it;
262 if ((_it != _end) && !StringStartsWithI(_it->first, _token))
263 _it = _end;
264 }
265 }
bool StringStartsWithI(std::string_view haystack, std::string_view needle)
Definition: Util.h:402

References _end, _handler, _it, _token, and StringStartsWithI().

Referenced by FilteredCommandListIterator(), and operator++().

◆ operator bool()

Acore::Impl::ChatCommands::FilteredCommandListIterator::operator bool ( ) const
inlineexplicit
251{ return (_it != _end); }

References _end, and _it.

◆ operator!()

bool Acore::Impl::ChatCommands::FilteredCommandListIterator::operator! ( ) const
inline
252{ return !static_cast<bool>(*this); }

◆ operator*()

decltype(auto) Acore::Impl::ChatCommands::FilteredCommandListIterator::operator* ( ) const
inline
243{ return _it.operator*(); }

References _it.

◆ operator++()

FilteredCommandListIterator & Acore::Impl::ChatCommands::FilteredCommandListIterator::operator++ ( )
inline
246 {
247 ++_it;
248 _skip();
249 return *this;
250 }

References _it, and _skip().

◆ operator->()

decltype(auto) Acore::Impl::ChatCommands::FilteredCommandListIterator::operator-> ( ) const
inline
244{ return _it.operator->(); }

References _it.

Member Data Documentation

◆ _end

ChatSubCommandMap::const_iterator Acore::Impl::ChatCommands::FilteredCommandListIterator::_end
private

Referenced by _skip(), and operator bool().

◆ _handler

ChatHandler const& Acore::Impl::ChatCommands::FilteredCommandListIterator::_handler
private

Referenced by _skip().

◆ _it

ChatSubCommandMap::const_iterator Acore::Impl::ChatCommands::FilteredCommandListIterator::_it
private

◆ _token

std::string_view const Acore::Impl::ChatCommands::FilteredCommandListIterator::_token
private

Referenced by _skip().