AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
QueryCallback::QueryCallbackData Struct Reference

Public Member Functions

 QueryCallbackData (std::function< void(QueryCallback &, QueryResult)> &&callback)
 
 QueryCallbackData (std::function< void(QueryCallback &, PreparedQueryResult)> &&callback)
 
 QueryCallbackData (QueryCallbackData &&right) noexcept
 
QueryCallbackDataoperator= (QueryCallbackData &&right) noexcept
 
 ~QueryCallbackData ()
 

Private Member Functions

 QueryCallbackData (QueryCallbackData const &)=delete
 
QueryCallbackDataoperator= (QueryCallbackData const &)=delete
 

Private Attributes

union {
   std::function< void(QueryCallback &, QueryResult)>   _string
 
   std::function< void(QueryCallback &, PreparedQueryResult)>   _prepared
 
}; 
 
bool _isPrepared
 

Friends

class QueryCallback
 
template<typename T >
void ConstructActiveMember (T *obj)
 
template<typename T >
void DestroyActiveMember (T *obj)
 
template<typename T >
void MoveFrom (T *to, T &&from)
 

Detailed Description

Constructor & Destructor Documentation

◆ QueryCallbackData() [1/4]

QueryCallback::QueryCallbackData::QueryCallbackData ( std::function< void(QueryCallback &, QueryResult)> &&  callback)
inline
68: _string(std::move(callback)), _isPrepared(false) { }
std::function< void(QueryCallback &, QueryResult)> _string
Definition: QueryCallback.cpp:107
bool _isPrepared
Definition: QueryCallback.cpp:110

◆ QueryCallbackData() [2/4]

QueryCallback::QueryCallbackData::QueryCallbackData ( std::function< void(QueryCallback &, PreparedQueryResult)> &&  callback)
inline
69: _prepared(std::move(callback)), _isPrepared(true) { }
std::function< void(QueryCallback &, PreparedQueryResult)> _prepared
Definition: QueryCallback.cpp:108

◆ QueryCallbackData() [3/4]

QueryCallback::QueryCallbackData::QueryCallbackData ( QueryCallbackData &&  right)
inlinenoexcept
72 {
73 _isPrepared = right._isPrepared;
75 MoveFrom(this, std::move(right));
76 }
friend void MoveFrom(T *to, T &&from)
Definition: QueryCallback.cpp:53
friend void ConstructActiveMember(T *obj)
Definition: QueryCallback.cpp:35

References _isPrepared, ConstructActiveMember, and MoveFrom.

◆ ~QueryCallbackData()

QueryCallback::QueryCallbackData::~QueryCallbackData ( )
inline
95{ DestroyActiveMember(this); }
friend void DestroyActiveMember(T *obj)
Definition: QueryCallback.cpp:44

References DestroyActiveMember.

◆ QueryCallbackData() [4/4]

QueryCallback::QueryCallbackData::QueryCallbackData ( QueryCallbackData const &  )
privatedelete

Member Function Documentation

◆ operator=() [1/2]

QueryCallbackData & QueryCallback::QueryCallbackData::operator= ( QueryCallbackData &&  right)
inlinenoexcept
79 {
80 if (this != &right)
81 {
82 if (_isPrepared != right._isPrepared)
83 {
85 _isPrepared = right._isPrepared;
87 }
88
89 MoveFrom(this, std::move(right));
90 }
91
92 return *this;
93 }

References _isPrepared, ConstructActiveMember, DestroyActiveMember, and MoveFrom.

◆ operator=() [2/2]

QueryCallbackData & QueryCallback::QueryCallbackData::operator= ( QueryCallbackData const &  )
privatedelete

Friends And Related Function Documentation

◆ ConstructActiveMember

template<typename T >
void ConstructActiveMember ( T *  obj)
friend
36{
37 if (!obj->_isPrepared)
38 Construct(obj->_string);
39 else
40 Construct(obj->_prepared);
41}
void Construct(T &t, Args &&... args)
Definition: QueryCallback.cpp:23

Referenced by operator=(), and QueryCallbackData().

◆ DestroyActiveMember

template<typename T >
void DestroyActiveMember ( T *  obj)
friend
45{
46 if (!obj->_isPrepared)
47 Destroy(obj->_string);
48 else
49 Destroy(obj->_prepared);
50}

Referenced by operator=(), and ~QueryCallbackData().

◆ MoveFrom

template<typename T >
void MoveFrom ( T *  to,
T &&  from 
)
friend
54{
55 ASSERT(to->_isPrepared == from._isPrepared);
56
57 if (!to->_isPrepared)
58 to->_string = std::move(from._string);
59 else
60 to->_prepared = std::move(from._prepared);
61}
#define ASSERT
Definition: Errors.h:68

Referenced by operator=(), and QueryCallbackData().

◆ QueryCallback

friend class QueryCallback
friend

Member Data Documentation

◆ 

union { ... } QueryCallback::QueryCallbackData::@3

◆ _isPrepared

bool QueryCallback::QueryCallbackData::_isPrepared
private

Referenced by operator=(), and QueryCallbackData().

◆ _prepared

std::function<void(QueryCallback&, PreparedQueryResult)> QueryCallback::QueryCallbackData::_prepared

◆ _string

std::function<void(QueryCallback&, QueryResult)> QueryCallback::QueryCallbackData::_string