本文整理汇总了C++中EventType::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ EventType::GetString方法的具体用法?C++ EventType::GetString怎么用?C++ EventType::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventType
的用法示例。
在下文中一共展示了EventType::GetString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VAddListener
// *****************************************************************************
void cEventManager::VAddListener(const EventListenerCallBackFn & fnListener,
const EventType & eventType)
{
Log_Write(ILogger::LT_EVENT, 2, "Attempting to add listener for event " + eventType.GetString());
EventListenerList & eventListeners = m_eventListeners[eventType.GetHash()];
for (auto it = eventListeners.begin(); it != eventListeners.end(); it++)
{
if (fnListener.target_type() == (*it).target_type())
{
Log_Write(ILogger::LT_WARNING, 2, "Attempting to double-register a listener for event " + eventType.GetString());
return;
}
}
eventListeners.push_back(fnListener);
Log_Write(ILogger::LT_EVENT, 2, "Successfully added delegate for event type " + eventType.GetString());
}
示例2: VRemoveListener
// *****************************************************************************
void cEventManager::VRemoveListener(const EventListenerCallBackFn & fnListener,
const EventType & eventType)
{
bool success = false;
Log_Write(ILogger::LT_EVENT, 2, "Attempting to remove delegate function from event type " + eventType.GetString());
EventListenerList & eventListeners = m_eventListeners[eventType.GetHash()];
auto findIt = m_eventListeners.find(eventType.GetHash());
if (findIt != m_eventListeners.end())
{
EventListenerList & listeners = findIt->second;
for (auto it = listeners.begin(); it != listeners.end(); it++)
{
if (fnListener == (*it))
{
listeners.erase(it);
Log_Write(ILogger::LT_EVENT, 2, "Successfully removed delegate for event type " + eventType.GetString());
return;
}
}
}
if(!success)
{
Log_Write(ILogger::LT_WARNING, 2, "Attempting to double-register a listener for event " + eventType.GetString());
}
}