AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Guild::LogHolder< Entry > Class Template Reference

Public Member Functions

 LogHolder ()
 
uint32 GetGuildId () const
 
bool CanInsert () const
 
template<typename... Ts>
void LoadEvent (Ts &&... args)
 
template<typename... Ts>
void AddEvent (CharacterDatabaseTransaction trans, Ts &&... args)
 
uint32 GetNextGUID ()
 
std::list< Entry > & GetGuildLog ()
 
std::list< Entry > const & GetGuildLog () const
 

Private Attributes

uint32 m_guildId
 
std::list< Entrym_log
 
uint32 const m_maxRecords
 
uint32 m_nextGUID
 

Detailed Description

template<typename Entry>
class Guild::LogHolder< Entry >

Constructor & Destructor Documentation

◆ LogHolder()

template<typename Entry >
Guild::LogHolder< Entry >::LogHolder ( )
138{ }
std::uint32_t uint32
Definition: Define.h:107
@ GUILD_EVENT_LOG_GUID_UNDEFINED
Definition: Guild.h:50
@ CONFIG_GUILD_EVENT_LOG_COUNT
Definition: IWorld.h:347
@ CONFIG_GUILD_BANK_EVENT_LOG_COUNT
Definition: IWorld.h:348
#define sWorld
Definition: World.h:443
uint32 m_nextGUID
Definition: Guild.h:505
uint32 const m_maxRecords
Definition: Guild.h:504

Member Function Documentation

◆ AddEvent()

template<typename Entry >
template<typename... Ts>
void Guild::LogHolder< Entry >::AddEvent ( CharacterDatabaseTransaction  trans,
Ts &&...  args 
)
150{
151 // Check max records limit
152 if (!CanInsert())
153 {
154 m_log.pop_front();
155 }
156 // Add event to list
157 Entry const& entry = m_log.emplace_back(std::forward<Ts>(args)...);
158 // Save to DB
159 entry.SaveToDB(trans);
160}
uint32 const Entry[3]
Definition: instance_blackwing_lair.cpp:72
std::list< Entry > m_log
Definition: Guild.h:503
bool CanInsert() const
Definition: Guild.h:490

References Entry.

Referenced by Guild::_LogBankEvent().

◆ CanInsert()

template<typename Entry >
bool Guild::LogHolder< Entry >::CanInsert ( ) const
inline

◆ GetGuildId()

template<typename Entry >
uint32 Guild::LogHolder< Entry >::GetGuildId ( ) const
inline
488{ return m_guildId; }
uint32 m_guildId
Definition: Guild.h:502

References Guild::LogHolder< Entry >::m_guildId.

◆ GetGuildLog() [1/2]

template<typename Entry >
std::list< Entry > & Guild::LogHolder< Entry >::GetGuildLog ( )
inline
498{ return m_log; }

References Guild::LogHolder< Entry >::m_log.

◆ GetGuildLog() [2/2]

template<typename Entry >
std::list< Entry > const & Guild::LogHolder< Entry >::GetGuildLog ( ) const
inline
499{ return m_log; }

References Guild::LogHolder< Entry >::m_log.

◆ GetNextGUID()

template<typename Entry >
uint32 Guild::LogHolder< Entry >::GetNextGUID ( )
inline
164{
165 // Next guid was not initialized. It means there are no records for this holder in DB yet.
166 // Start from the beginning.
168 m_nextGUID = 0;
169 else
171
172 return m_nextGUID;
173}

References GUILD_EVENT_LOG_GUID_UNDEFINED.

Referenced by Guild::_LogBankEvent().

◆ LoadEvent()

template<typename Entry >
template<typename... Ts>
void Guild::LogHolder< Entry >::LoadEvent ( Ts &&...  args)
142{
143 Entry const& newEntry = m_log.emplace_front(std::forward<Ts>(args)...);
145 m_nextGUID = newEntry.GetGUID();
146}

References Entry, and GUILD_EVENT_LOG_GUID_UNDEFINED.

Referenced by Guild::LoadBankEventLogFromDB().

Member Data Documentation

◆ m_guildId

template<typename Entry >
uint32 Guild::LogHolder< Entry >::m_guildId
private

◆ m_log

template<typename Entry >
std::list<Entry> Guild::LogHolder< Entry >::m_log
private

◆ m_maxRecords

template<typename Entry >
uint32 const Guild::LogHolder< Entry >::m_maxRecords
private

◆ m_nextGUID

template<typename Entry >
uint32 Guild::LogHolder< Entry >::m_nextGUID
private