mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-28 23:05:11 +08:00
dropped "c" prefix from class names
This commit is contained in:
@@ -20,10 +20,10 @@
|
||||
#include "base/EventQueue.h"
|
||||
|
||||
//
|
||||
// CEvent
|
||||
// Event
|
||||
//
|
||||
|
||||
CEvent::CEvent() :
|
||||
Event::Event() :
|
||||
m_type(kUnknown),
|
||||
m_target(NULL),
|
||||
m_data(NULL),
|
||||
@@ -33,7 +33,7 @@ CEvent::CEvent() :
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CEvent::CEvent(Type type, void* target, void* data, Flags flags) :
|
||||
Event::Event(Type type, void* target, void* data, Flags flags) :
|
||||
m_type(type),
|
||||
m_target(target),
|
||||
m_data(data),
|
||||
@@ -43,38 +43,38 @@ CEvent::CEvent(Type type, void* target, void* data, Flags flags) :
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CEvent::getType() const
|
||||
Event::Type
|
||||
Event::getType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void*
|
||||
CEvent::getTarget() const
|
||||
Event::getTarget() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
void*
|
||||
CEvent::getData() const
|
||||
Event::getData() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
CEventData*
|
||||
CEvent::getDataObject() const
|
||||
EventData*
|
||||
Event::getDataObject() const
|
||||
{
|
||||
return m_dataObject;
|
||||
}
|
||||
|
||||
CEvent::Flags
|
||||
CEvent::getFlags() const
|
||||
Event::Flags
|
||||
Event::getFlags() const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
void
|
||||
CEvent::deleteData(const CEvent& event)
|
||||
Event::deleteData(const Event& event)
|
||||
{
|
||||
switch (event.getType()) {
|
||||
case kUnknown:
|
||||
@@ -93,7 +93,7 @@ CEvent::deleteData(const CEvent& event)
|
||||
}
|
||||
|
||||
void
|
||||
CEvent::setDataObject(CEventData* dataObject)
|
||||
Event::setDataObject(EventData* dataObject)
|
||||
{
|
||||
assert(m_dataObject == nullptr);
|
||||
m_dataObject = dataObject;
|
||||
|
||||
@@ -21,17 +21,17 @@
|
||||
#include "common/basic_types.h"
|
||||
#include "common/stdmap.h"
|
||||
|
||||
class CEventData {
|
||||
class EventData {
|
||||
public:
|
||||
CEventData() { }
|
||||
virtual ~CEventData() { }
|
||||
EventData() { }
|
||||
virtual ~EventData() { }
|
||||
};
|
||||
|
||||
//! Event
|
||||
/*!
|
||||
A \c CEvent holds an event type and a pointer to event data.
|
||||
A \c Event holds an event type and a pointer to event data.
|
||||
*/
|
||||
class CEvent {
|
||||
class Event {
|
||||
public:
|
||||
typedef UInt32 Type;
|
||||
enum {
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
kDontFreeData = 0x02 //!< Don't free data in deleteData
|
||||
};
|
||||
|
||||
CEvent();
|
||||
Event();
|
||||
|
||||
//! Create \c CEvent with data (POD)
|
||||
//! Create \c Event with data (POD)
|
||||
/*!
|
||||
The \p data must be POD (plain old data) allocated by malloc(),
|
||||
which means it cannot have a constructor, destructor or be
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
\p target is the intended recipient of the event.
|
||||
\p flags is any combination of \c Flags.
|
||||
*/
|
||||
CEvent(Type type, void* target = NULL, void* data = NULL,
|
||||
Event(Type type, void* target = NULL, void* data = NULL,
|
||||
Flags flags = kNone);
|
||||
|
||||
//! @name manipulators
|
||||
@@ -70,14 +70,14 @@ public:
|
||||
/*!
|
||||
Deletes event data for the given event (using free()).
|
||||
*/
|
||||
static void deleteData(const CEvent&);
|
||||
static void deleteData(const Event&);
|
||||
|
||||
//! Set data (non-POD)
|
||||
/*!
|
||||
Set non-POD (non plain old data), where delete is called when the event
|
||||
is deleted, and the destructor is called.
|
||||
*/
|
||||
void setDataObject(CEventData* dataObject);
|
||||
void setDataObject(EventData* dataObject);
|
||||
|
||||
//@}
|
||||
//! @name accessors
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
\c getData() is that when delete is called on this data, so non-POD
|
||||
(non plain old data) dtor is called.
|
||||
*/
|
||||
CEventData* getDataObject() const;
|
||||
EventData* getDataObject() const;
|
||||
|
||||
//! Get event flags
|
||||
/*!
|
||||
@@ -122,5 +122,5 @@ private:
|
||||
void* m_target;
|
||||
void* m_data;
|
||||
Flags m_flags;
|
||||
CEventData* m_dataObject;
|
||||
EventData* m_dataObject;
|
||||
};
|
||||
|
||||
@@ -28,21 +28,21 @@
|
||||
#include "base/Log.h"
|
||||
#include "base/XBase.h"
|
||||
|
||||
EVENT_TYPE_ACCESSOR(CClient)
|
||||
EVENT_TYPE_ACCESSOR(Client)
|
||||
EVENT_TYPE_ACCESSOR(IStream)
|
||||
EVENT_TYPE_ACCESSOR(CIpcClient)
|
||||
EVENT_TYPE_ACCESSOR(CIpcClientProxy)
|
||||
EVENT_TYPE_ACCESSOR(CIpcServer)
|
||||
EVENT_TYPE_ACCESSOR(CIpcServerProxy)
|
||||
EVENT_TYPE_ACCESSOR(IpcClient)
|
||||
EVENT_TYPE_ACCESSOR(IpcClientProxy)
|
||||
EVENT_TYPE_ACCESSOR(IpcServer)
|
||||
EVENT_TYPE_ACCESSOR(IpcServerProxy)
|
||||
EVENT_TYPE_ACCESSOR(IDataSocket)
|
||||
EVENT_TYPE_ACCESSOR(IListenSocket)
|
||||
EVENT_TYPE_ACCESSOR(ISocket)
|
||||
EVENT_TYPE_ACCESSOR(COSXScreen)
|
||||
EVENT_TYPE_ACCESSOR(CClientListener)
|
||||
EVENT_TYPE_ACCESSOR(CClientProxy)
|
||||
EVENT_TYPE_ACCESSOR(CClientProxyUnknown)
|
||||
EVENT_TYPE_ACCESSOR(CServer)
|
||||
EVENT_TYPE_ACCESSOR(CServerApp)
|
||||
EVENT_TYPE_ACCESSOR(OSXScreen)
|
||||
EVENT_TYPE_ACCESSOR(ClientListener)
|
||||
EVENT_TYPE_ACCESSOR(ClientProxy)
|
||||
EVENT_TYPE_ACCESSOR(ClientProxyUnknown)
|
||||
EVENT_TYPE_ACCESSOR(Server)
|
||||
EVENT_TYPE_ACCESSOR(ServerApp)
|
||||
EVENT_TYPE_ACCESSOR(IKeyState)
|
||||
EVENT_TYPE_ACCESSOR(IPrimaryScreen)
|
||||
EVENT_TYPE_ACCESSOR(IScreen)
|
||||
@@ -50,89 +50,89 @@ EVENT_TYPE_ACCESSOR(IScreen)
|
||||
// interrupt handler. this just adds a quit event to the queue.
|
||||
static
|
||||
void
|
||||
interrupt(CArch::ESignal, void* data)
|
||||
interrupt(Arch::ESignal, void* data)
|
||||
{
|
||||
CEventQueue* events = reinterpret_cast<CEventQueue*>(data);
|
||||
events->addEvent(CEvent(CEvent::kQuit));
|
||||
EventQueue* events = reinterpret_cast<EventQueue*>(data);
|
||||
events->addEvent(Event(Event::kQuit));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// CEventQueue
|
||||
// EventQueue
|
||||
//
|
||||
|
||||
CEventQueue::CEventQueue() :
|
||||
EventQueue::EventQueue() :
|
||||
m_systemTarget(0),
|
||||
m_nextType(CEvent::kLast),
|
||||
m_typesForCClient(NULL),
|
||||
m_nextType(Event::kLast),
|
||||
m_typesForClient(NULL),
|
||||
m_typesForIStream(NULL),
|
||||
m_typesForCIpcClient(NULL),
|
||||
m_typesForCIpcClientProxy(NULL),
|
||||
m_typesForCIpcServer(NULL),
|
||||
m_typesForCIpcServerProxy(NULL),
|
||||
m_typesForIpcClient(NULL),
|
||||
m_typesForIpcClientProxy(NULL),
|
||||
m_typesForIpcServer(NULL),
|
||||
m_typesForIpcServerProxy(NULL),
|
||||
m_typesForIDataSocket(NULL),
|
||||
m_typesForIListenSocket(NULL),
|
||||
m_typesForISocket(NULL),
|
||||
m_typesForCOSXScreen(NULL),
|
||||
m_typesForCClientListener(NULL),
|
||||
m_typesForCClientProxy(NULL),
|
||||
m_typesForCClientProxyUnknown(NULL),
|
||||
m_typesForCServer(NULL),
|
||||
m_typesForCServerApp(NULL),
|
||||
m_typesForOSXScreen(NULL),
|
||||
m_typesForClientListener(NULL),
|
||||
m_typesForClientProxy(NULL),
|
||||
m_typesForClientProxyUnknown(NULL),
|
||||
m_typesForServer(NULL),
|
||||
m_typesForServerApp(NULL),
|
||||
m_typesForIKeyState(NULL),
|
||||
m_typesForIPrimaryScreen(NULL),
|
||||
m_typesForIScreen(NULL),
|
||||
m_readyMutex(new CMutex),
|
||||
m_readyCondVar(new CCondVar<bool>(m_readyMutex, false))
|
||||
m_readyMutex(new Mutex),
|
||||
m_readyCondVar(new CondVar<bool>(m_readyMutex, false))
|
||||
{
|
||||
m_mutex = ARCH->newMutex();
|
||||
ARCH->setSignalHandler(CArch::kINTERRUPT, &interrupt, this);
|
||||
ARCH->setSignalHandler(CArch::kTERMINATE, &interrupt, this);
|
||||
m_buffer = new CSimpleEventQueueBuffer;
|
||||
ARCH->setSignalHandler(Arch::kINTERRUPT, &interrupt, this);
|
||||
ARCH->setSignalHandler(Arch::kTERMINATE, &interrupt, this);
|
||||
m_buffer = new SimpleEventQueueBuffer;
|
||||
}
|
||||
|
||||
CEventQueue::~CEventQueue()
|
||||
EventQueue::~EventQueue()
|
||||
{
|
||||
delete m_buffer;
|
||||
delete m_readyCondVar;
|
||||
delete m_readyMutex;
|
||||
|
||||
ARCH->setSignalHandler(CArch::kINTERRUPT, NULL, NULL);
|
||||
ARCH->setSignalHandler(CArch::kTERMINATE, NULL, NULL);
|
||||
ARCH->setSignalHandler(Arch::kINTERRUPT, NULL, NULL);
|
||||
ARCH->setSignalHandler(Arch::kTERMINATE, NULL, NULL);
|
||||
ARCH->closeMutex(m_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::loop()
|
||||
EventQueue::loop()
|
||||
{
|
||||
m_buffer->init();
|
||||
{
|
||||
CLock lock(m_readyMutex);
|
||||
Lock lock(m_readyMutex);
|
||||
*m_readyCondVar = true;
|
||||
m_readyCondVar->signal();
|
||||
}
|
||||
LOG((CLOG_DEBUG "event queue is ready"));
|
||||
while (!m_pending.empty()) {
|
||||
LOG((CLOG_DEBUG "add pending events to buffer"));
|
||||
CEvent& event = m_pending.front();
|
||||
Event& event = m_pending.front();
|
||||
addEventToBuffer(event);
|
||||
m_pending.pop();
|
||||
}
|
||||
|
||||
CEvent event;
|
||||
Event event;
|
||||
getEvent(event);
|
||||
while (event.getType() != CEvent::kQuit) {
|
||||
while (event.getType() != Event::kQuit) {
|
||||
dispatchEvent(event);
|
||||
CEvent::deleteData(event);
|
||||
Event::deleteData(event);
|
||||
getEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CEventQueue::registerTypeOnce(CEvent::Type& type, const char* name)
|
||||
Event::Type
|
||||
EventQueue::registerTypeOnce(Event::Type& type, const char* name)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
if (type == CEvent::kUnknown) {
|
||||
ArchMutexLock lock(m_mutex);
|
||||
if (type == Event::kUnknown) {
|
||||
m_typeMap.insert(std::make_pair(m_nextType, name));
|
||||
m_nameMap.insert(std::make_pair(name, m_nextType));
|
||||
LOG((CLOG_DEBUG1 "registered event type %s as %d", name, m_nextType));
|
||||
@@ -142,23 +142,23 @@ CEventQueue::registerTypeOnce(CEvent::Type& type, const char* name)
|
||||
}
|
||||
|
||||
const char*
|
||||
CEventQueue::getTypeName(CEvent::Type type)
|
||||
EventQueue::getTypeName(Event::Type type)
|
||||
{
|
||||
switch (type) {
|
||||
case CEvent::kUnknown:
|
||||
case Event::kUnknown:
|
||||
return "nil";
|
||||
|
||||
case CEvent::kQuit:
|
||||
case Event::kQuit:
|
||||
return "quit";
|
||||
|
||||
case CEvent::kSystem:
|
||||
case Event::kSystem:
|
||||
return "system";
|
||||
|
||||
case CEvent::kTimer:
|
||||
case Event::kTimer:
|
||||
return "timer";
|
||||
|
||||
default:
|
||||
CTypeMap::const_iterator i = m_typeMap.find(type);
|
||||
TypeMap::const_iterator i = m_typeMap.find(type);
|
||||
if (i == m_typeMap.end()) {
|
||||
return "<unknown>";
|
||||
}
|
||||
@@ -169,9 +169,9 @@ CEventQueue::getTypeName(CEvent::Type type)
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::adoptBuffer(IEventQueueBuffer* buffer)
|
||||
EventQueue::adoptBuffer(IEventQueueBuffer* buffer)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
|
||||
LOG((CLOG_DEBUG "adopting new buffer"));
|
||||
|
||||
@@ -183,8 +183,8 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer)
|
||||
|
||||
// discard old buffer and old events
|
||||
delete m_buffer;
|
||||
for (CEventTable::iterator i = m_events.begin(); i != m_events.end(); ++i) {
|
||||
CEvent::deleteData(i->second);
|
||||
for (EventTable::iterator i = m_events.begin(); i != m_events.end(); ++i) {
|
||||
Event::deleteData(i->second);
|
||||
}
|
||||
m_events.clear();
|
||||
m_oldEventIDs.clear();
|
||||
@@ -192,14 +192,14 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer)
|
||||
// use new buffer
|
||||
m_buffer = buffer;
|
||||
if (m_buffer == NULL) {
|
||||
m_buffer = new CSimpleEventQueueBuffer;
|
||||
m_buffer = new SimpleEventQueueBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
CEventQueue::getEvent(CEvent& event, double timeout)
|
||||
EventQueue::getEvent(Event& event, double timeout)
|
||||
{
|
||||
CStopwatch timer(true);
|
||||
Stopwatch timer(true);
|
||||
retry:
|
||||
// if no events are waiting then handle timers and then wait
|
||||
while (m_buffer->isEmpty()) {
|
||||
@@ -244,7 +244,7 @@ retry:
|
||||
|
||||
case IEventQueueBuffer::kUser:
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
event = removeEvent(dataID);
|
||||
return true;
|
||||
}
|
||||
@@ -256,12 +256,12 @@ retry:
|
||||
}
|
||||
|
||||
bool
|
||||
CEventQueue::dispatchEvent(const CEvent& event)
|
||||
EventQueue::dispatchEvent(const Event& event)
|
||||
{
|
||||
void* target = event.getTarget();
|
||||
IEventJob* job = getHandler(event.getType(), target);
|
||||
if (job == NULL) {
|
||||
job = getHandler(CEvent::kUnknown, target);
|
||||
job = getHandler(Event::kUnknown, target);
|
||||
}
|
||||
if (job != NULL) {
|
||||
job->run(event);
|
||||
@@ -271,22 +271,22 @@ CEventQueue::dispatchEvent(const CEvent& event)
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::addEvent(const CEvent& event)
|
||||
EventQueue::addEvent(const Event& event)
|
||||
{
|
||||
// discard bogus event types
|
||||
switch (event.getType()) {
|
||||
case CEvent::kUnknown:
|
||||
case CEvent::kSystem:
|
||||
case CEvent::kTimer:
|
||||
case Event::kUnknown:
|
||||
case Event::kSystem:
|
||||
case Event::kTimer:
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((event.getFlags() & CEvent::kDeliverImmediately) != 0) {
|
||||
if ((event.getFlags() & Event::kDeliverImmediately) != 0) {
|
||||
dispatchEvent(event);
|
||||
CEvent::deleteData(event);
|
||||
Event::deleteData(event);
|
||||
}
|
||||
else if (!(*m_readyCondVar)) {
|
||||
m_pending.push(event);
|
||||
@@ -297,9 +297,9 @@ CEventQueue::addEvent(const CEvent& event)
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::addEventToBuffer(const CEvent& event)
|
||||
EventQueue::addEventToBuffer(const Event& event)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
|
||||
// store the event's data locally
|
||||
UInt32 eventID = saveEvent(event);
|
||||
@@ -308,60 +308,60 @@ CEventQueue::addEventToBuffer(const CEvent& event)
|
||||
if (!m_buffer->addEvent(eventID)) {
|
||||
// failed to send event
|
||||
removeEvent(eventID);
|
||||
CEvent::deleteData(event);
|
||||
Event::deleteData(event);
|
||||
}
|
||||
}
|
||||
|
||||
CEventQueueTimer*
|
||||
CEventQueue::newTimer(double duration, void* target)
|
||||
EventQueueTimer*
|
||||
EventQueue::newTimer(double duration, void* target)
|
||||
{
|
||||
assert(duration > 0.0);
|
||||
|
||||
CEventQueueTimer* timer = m_buffer->newTimer(duration, false);
|
||||
EventQueueTimer* timer = m_buffer->newTimer(duration, false);
|
||||
if (target == NULL) {
|
||||
target = timer;
|
||||
}
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
m_timers.insert(timer);
|
||||
// initial duration is requested duration plus whatever's on
|
||||
// the clock currently because the latter will be subtracted
|
||||
// the next time we check for timers.
|
||||
m_timerQueue.push(CTimer(timer, duration,
|
||||
m_timerQueue.push(Timer(timer, duration,
|
||||
duration + m_time.getTime(), target, false));
|
||||
return timer;
|
||||
}
|
||||
|
||||
CEventQueueTimer*
|
||||
CEventQueue::newOneShotTimer(double duration, void* target)
|
||||
EventQueueTimer*
|
||||
EventQueue::newOneShotTimer(double duration, void* target)
|
||||
{
|
||||
assert(duration > 0.0);
|
||||
|
||||
CEventQueueTimer* timer = m_buffer->newTimer(duration, true);
|
||||
EventQueueTimer* timer = m_buffer->newTimer(duration, true);
|
||||
if (target == NULL) {
|
||||
target = timer;
|
||||
}
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
m_timers.insert(timer);
|
||||
// initial duration is requested duration plus whatever's on
|
||||
// the clock currently because the latter will be subtracted
|
||||
// the next time we check for timers.
|
||||
m_timerQueue.push(CTimer(timer, duration,
|
||||
m_timerQueue.push(Timer(timer, duration,
|
||||
duration + m_time.getTime(), target, true));
|
||||
return timer;
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::deleteTimer(CEventQueueTimer* timer)
|
||||
EventQueue::deleteTimer(EventQueueTimer* timer)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
for (CTimerQueue::iterator index = m_timerQueue.begin();
|
||||
ArchMutexLock lock(m_mutex);
|
||||
for (TimerQueue::iterator index = m_timerQueue.begin();
|
||||
index != m_timerQueue.end(); ++index) {
|
||||
if (index->getTimer() == timer) {
|
||||
m_timerQueue.erase(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
CTimers::iterator index = m_timers.find(timer);
|
||||
Timers::iterator index = m_timers.find(timer);
|
||||
if (index != m_timers.end()) {
|
||||
m_timers.erase(index);
|
||||
}
|
||||
@@ -369,24 +369,24 @@ CEventQueue::deleteTimer(CEventQueueTimer* timer)
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::adoptHandler(CEvent::Type type, void* target, IEventJob* handler)
|
||||
EventQueue::adoptHandler(Event::Type type, void* target, IEventJob* handler)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
IEventJob*& job = m_handlers[target][type];
|
||||
delete job;
|
||||
job = handler;
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::removeHandler(CEvent::Type type, void* target)
|
||||
EventQueue::removeHandler(Event::Type type, void* target)
|
||||
{
|
||||
IEventJob* handler = NULL;
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
CHandlerTable::iterator index = m_handlers.find(target);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
HandlerTable::iterator index = m_handlers.find(target);
|
||||
if (index != m_handlers.end()) {
|
||||
CTypeHandlerTable& typeHandlers = index->second;
|
||||
CTypeHandlerTable::iterator index2 = typeHandlers.find(type);
|
||||
TypeHandlerTable& typeHandlers = index->second;
|
||||
TypeHandlerTable::iterator index2 = typeHandlers.find(type);
|
||||
if (index2 != typeHandlers.end()) {
|
||||
handler = index2->second;
|
||||
typeHandlers.erase(index2);
|
||||
@@ -397,16 +397,16 @@ CEventQueue::removeHandler(CEvent::Type type, void* target)
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::removeHandlers(void* target)
|
||||
EventQueue::removeHandlers(void* target)
|
||||
{
|
||||
std::vector<IEventJob*> handlers;
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
CHandlerTable::iterator index = m_handlers.find(target);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
HandlerTable::iterator index = m_handlers.find(target);
|
||||
if (index != m_handlers.end()) {
|
||||
// copy to handlers array and clear table for target
|
||||
CTypeHandlerTable& typeHandlers = index->second;
|
||||
for (CTypeHandlerTable::iterator index2 = typeHandlers.begin();
|
||||
TypeHandlerTable& typeHandlers = index->second;
|
||||
for (TypeHandlerTable::iterator index2 = typeHandlers.begin();
|
||||
index2 != typeHandlers.end(); ++index2) {
|
||||
handlers.push_back(index2->second);
|
||||
}
|
||||
@@ -422,19 +422,19 @@ CEventQueue::removeHandlers(void* target)
|
||||
}
|
||||
|
||||
bool
|
||||
CEventQueue::isEmpty() const
|
||||
EventQueue::isEmpty() const
|
||||
{
|
||||
return (m_buffer->isEmpty() && getNextTimerTimeout() != 0.0);
|
||||
}
|
||||
|
||||
IEventJob*
|
||||
CEventQueue::getHandler(CEvent::Type type, void* target) const
|
||||
EventQueue::getHandler(Event::Type type, void* target) const
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
CHandlerTable::const_iterator index = m_handlers.find(target);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
HandlerTable::const_iterator index = m_handlers.find(target);
|
||||
if (index != m_handlers.end()) {
|
||||
const CTypeHandlerTable& typeHandlers = index->second;
|
||||
CTypeHandlerTable::const_iterator index2 = typeHandlers.find(type);
|
||||
const TypeHandlerTable& typeHandlers = index->second;
|
||||
TypeHandlerTable::const_iterator index2 = typeHandlers.find(type);
|
||||
if (index2 != typeHandlers.end()) {
|
||||
return index2->second;
|
||||
}
|
||||
@@ -443,7 +443,7 @@ CEventQueue::getHandler(CEvent::Type type, void* target) const
|
||||
}
|
||||
|
||||
UInt32
|
||||
CEventQueue::saveEvent(const CEvent& event)
|
||||
EventQueue::saveEvent(const Event& event)
|
||||
{
|
||||
// choose id
|
||||
UInt32 id;
|
||||
@@ -462,17 +462,17 @@ CEventQueue::saveEvent(const CEvent& event)
|
||||
return id;
|
||||
}
|
||||
|
||||
CEvent
|
||||
CEventQueue::removeEvent(UInt32 eventID)
|
||||
Event
|
||||
EventQueue::removeEvent(UInt32 eventID)
|
||||
{
|
||||
// look up id
|
||||
CEventTable::iterator index = m_events.find(eventID);
|
||||
EventTable::iterator index = m_events.find(eventID);
|
||||
if (index == m_events.end()) {
|
||||
return CEvent();
|
||||
return Event();
|
||||
}
|
||||
|
||||
// get data
|
||||
CEvent event = index->second;
|
||||
Event event = index->second;
|
||||
m_events.erase(index);
|
||||
|
||||
// save old id for reuse
|
||||
@@ -482,7 +482,7 @@ CEventQueue::removeEvent(UInt32 eventID)
|
||||
}
|
||||
|
||||
bool
|
||||
CEventQueue::hasTimerExpired(CEvent& event)
|
||||
EventQueue::hasTimerExpired(Event& event)
|
||||
{
|
||||
// return true if there's a timer in the timer priority queue that
|
||||
// has expired. if returning true then fill in event appropriately
|
||||
@@ -496,7 +496,7 @@ CEventQueue::hasTimerExpired(CEvent& event)
|
||||
m_time.reset();
|
||||
|
||||
// countdown elapsed time
|
||||
for (CTimerQueue::iterator index = m_timerQueue.begin();
|
||||
for (TimerQueue::iterator index = m_timerQueue.begin();
|
||||
index != m_timerQueue.end(); ++index) {
|
||||
(*index) -= time;
|
||||
}
|
||||
@@ -507,12 +507,12 @@ CEventQueue::hasTimerExpired(CEvent& event)
|
||||
}
|
||||
|
||||
// remove timer from queue
|
||||
CTimer timer = m_timerQueue.top();
|
||||
Timer timer = m_timerQueue.top();
|
||||
m_timerQueue.pop();
|
||||
|
||||
// prepare event and reset the timer's clock
|
||||
timer.fillEvent(m_timerEvent);
|
||||
event = CEvent(CEvent::kTimer, timer.getTarget(), &m_timerEvent);
|
||||
event = Event(Event::kTimer, timer.getTarget(), &m_timerEvent);
|
||||
timer.reset();
|
||||
|
||||
// reinsert timer into queue if it's not a one-shot
|
||||
@@ -524,7 +524,7 @@ CEventQueue::hasTimerExpired(CEvent& event)
|
||||
}
|
||||
|
||||
double
|
||||
CEventQueue::getNextTimerTimeout() const
|
||||
EventQueue::getNextTimerTimeout() const
|
||||
{
|
||||
// return -1 if no timers, 0 if the top timer has expired, otherwise
|
||||
// the time until the top timer in the timer priority queue will
|
||||
@@ -538,28 +538,28 @@ CEventQueue::getNextTimerTimeout() const
|
||||
return m_timerQueue.top();
|
||||
}
|
||||
|
||||
CEvent::Type
|
||||
CEventQueue::getRegisteredType(const CString& name) const
|
||||
Event::Type
|
||||
EventQueue::getRegisteredType(const String& name) const
|
||||
{
|
||||
CNameMap::const_iterator found = m_nameMap.find(name);
|
||||
NameMap::const_iterator found = m_nameMap.find(name);
|
||||
if (found != m_nameMap.end())
|
||||
return found->second;
|
||||
|
||||
return CEvent::kUnknown;
|
||||
return Event::kUnknown;
|
||||
}
|
||||
|
||||
void*
|
||||
CEventQueue::getSystemTarget()
|
||||
EventQueue::getSystemTarget()
|
||||
{
|
||||
// any unique arbitrary pointer will do
|
||||
return &m_systemTarget;
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::waitForReady() const
|
||||
EventQueue::waitForReady() const
|
||||
{
|
||||
double timeout = ARCH->time() + 10;
|
||||
CLock lock(m_readyMutex);
|
||||
Lock lock(m_readyMutex);
|
||||
|
||||
while (!m_readyCondVar->wait()) {
|
||||
if(ARCH->time() > timeout) {
|
||||
@@ -569,10 +569,10 @@ CEventQueue::waitForReady() const
|
||||
}
|
||||
|
||||
//
|
||||
// CEventQueue::CTimer
|
||||
// EventQueue::Timer
|
||||
//
|
||||
|
||||
CEventQueue::CTimer::CTimer(CEventQueueTimer* timer, double timeout,
|
||||
EventQueue::Timer::Timer(EventQueueTimer* timer, double timeout,
|
||||
double initialTime, void* target, bool oneShot) :
|
||||
m_timer(timer),
|
||||
m_timeout(timeout),
|
||||
@@ -583,49 +583,49 @@ CEventQueue::CTimer::CTimer(CEventQueueTimer* timer, double timeout,
|
||||
assert(m_timeout > 0.0);
|
||||
}
|
||||
|
||||
CEventQueue::CTimer::~CTimer()
|
||||
EventQueue::Timer::~Timer()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::CTimer::reset()
|
||||
EventQueue::Timer::reset()
|
||||
{
|
||||
m_time = m_timeout;
|
||||
}
|
||||
|
||||
CEventQueue::CTimer&
|
||||
CEventQueue::CTimer::operator-=(double dt)
|
||||
EventQueue::Timer&
|
||||
EventQueue::Timer::operator-=(double dt)
|
||||
{
|
||||
m_time -= dt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CEventQueue::CTimer::operator double() const
|
||||
EventQueue::Timer::operator double() const
|
||||
{
|
||||
return m_time;
|
||||
}
|
||||
|
||||
bool
|
||||
CEventQueue::CTimer::isOneShot() const
|
||||
EventQueue::Timer::isOneShot() const
|
||||
{
|
||||
return m_oneShot;
|
||||
}
|
||||
|
||||
CEventQueueTimer*
|
||||
CEventQueue::CTimer::getTimer() const
|
||||
EventQueueTimer*
|
||||
EventQueue::Timer::getTimer() const
|
||||
{
|
||||
return m_timer;
|
||||
}
|
||||
|
||||
void*
|
||||
CEventQueue::CTimer::getTarget() const
|
||||
EventQueue::Timer::getTarget() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
void
|
||||
CEventQueue::CTimer::fillEvent(CTimerEvent& event) const
|
||||
EventQueue::Timer::fillEvent(TimerEvent& event) const
|
||||
{
|
||||
event.m_timer = m_timer;
|
||||
event.m_count = 0;
|
||||
@@ -635,7 +635,7 @@ CEventQueue::CTimer::fillEvent(CTimerEvent& event) const
|
||||
}
|
||||
|
||||
bool
|
||||
CEventQueue::CTimer::operator<(const CTimer& t) const
|
||||
EventQueue::Timer::operator<(const Timer& t) const
|
||||
{
|
||||
return m_time < t.m_time;
|
||||
}
|
||||
|
||||
@@ -29,162 +29,162 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
class CMutex;
|
||||
class Mutex;
|
||||
|
||||
//! Event queue
|
||||
/*!
|
||||
An event queue that implements the platform independent parts and
|
||||
delegates the platform dependent parts to a subclass.
|
||||
*/
|
||||
class CEventQueue : public IEventQueue {
|
||||
class EventQueue : public IEventQueue {
|
||||
public:
|
||||
CEventQueue();
|
||||
virtual ~CEventQueue();
|
||||
EventQueue();
|
||||
virtual ~EventQueue();
|
||||
|
||||
// IEventQueue overrides
|
||||
virtual void loop();
|
||||
virtual void adoptBuffer(IEventQueueBuffer*);
|
||||
virtual bool getEvent(CEvent& event, double timeout = -1.0);
|
||||
virtual bool dispatchEvent(const CEvent& event);
|
||||
virtual void addEvent(const CEvent& event);
|
||||
virtual CEventQueueTimer*
|
||||
virtual bool getEvent(Event& event, double timeout = -1.0);
|
||||
virtual bool dispatchEvent(const Event& event);
|
||||
virtual void addEvent(const Event& event);
|
||||
virtual EventQueueTimer*
|
||||
newTimer(double duration, void* target);
|
||||
virtual CEventQueueTimer*
|
||||
virtual EventQueueTimer*
|
||||
newOneShotTimer(double duration, void* target);
|
||||
virtual void deleteTimer(CEventQueueTimer*);
|
||||
virtual void adoptHandler(CEvent::Type type,
|
||||
virtual void deleteTimer(EventQueueTimer*);
|
||||
virtual void adoptHandler(Event::Type type,
|
||||
void* target, IEventJob* handler);
|
||||
virtual void removeHandler(CEvent::Type type, void* target);
|
||||
virtual void removeHandler(Event::Type type, void* target);
|
||||
virtual void removeHandlers(void* target);
|
||||
virtual CEvent::Type
|
||||
registerTypeOnce(CEvent::Type& type, const char* name);
|
||||
virtual Event::Type
|
||||
registerTypeOnce(Event::Type& type, const char* name);
|
||||
virtual bool isEmpty() const;
|
||||
virtual IEventJob* getHandler(CEvent::Type type, void* target) const;
|
||||
virtual const char* getTypeName(CEvent::Type type);
|
||||
virtual CEvent::Type
|
||||
getRegisteredType(const CString& name) const;
|
||||
virtual IEventJob* getHandler(Event::Type type, void* target) const;
|
||||
virtual const char* getTypeName(Event::Type type);
|
||||
virtual Event::Type
|
||||
getRegisteredType(const String& name) const;
|
||||
void* getSystemTarget();
|
||||
virtual void waitForReady() const;
|
||||
|
||||
private:
|
||||
UInt32 saveEvent(const CEvent& event);
|
||||
CEvent removeEvent(UInt32 eventID);
|
||||
bool hasTimerExpired(CEvent& event);
|
||||
UInt32 saveEvent(const Event& event);
|
||||
Event removeEvent(UInt32 eventID);
|
||||
bool hasTimerExpired(Event& event);
|
||||
double getNextTimerTimeout() const;
|
||||
void addEventToBuffer(const CEvent& event);
|
||||
void addEventToBuffer(const Event& event);
|
||||
|
||||
private:
|
||||
class CTimer {
|
||||
class Timer {
|
||||
public:
|
||||
CTimer(CEventQueueTimer*, double timeout, double initialTime,
|
||||
Timer(EventQueueTimer*, double timeout, double initialTime,
|
||||
void* target, bool oneShot);
|
||||
~CTimer();
|
||||
~Timer();
|
||||
|
||||
void reset();
|
||||
|
||||
CTimer& operator-=(double);
|
||||
Timer& operator-=(double);
|
||||
|
||||
operator double() const;
|
||||
|
||||
bool isOneShot() const;
|
||||
CEventQueueTimer*
|
||||
EventQueueTimer*
|
||||
getTimer() const;
|
||||
void* getTarget() const;
|
||||
void fillEvent(CTimerEvent&) const;
|
||||
void fillEvent(TimerEvent&) const;
|
||||
|
||||
bool operator<(const CTimer&) const;
|
||||
bool operator<(const Timer&) const;
|
||||
|
||||
private:
|
||||
CEventQueueTimer* m_timer;
|
||||
EventQueueTimer* m_timer;
|
||||
double m_timeout;
|
||||
void* m_target;
|
||||
bool m_oneShot;
|
||||
double m_time;
|
||||
};
|
||||
|
||||
typedef std::set<CEventQueueTimer*> CTimers;
|
||||
typedef CPriorityQueue<CTimer> CTimerQueue;
|
||||
typedef std::map<UInt32, CEvent> CEventTable;
|
||||
typedef std::vector<UInt32> CEventIDList;
|
||||
typedef std::map<CEvent::Type, const char*> CTypeMap;
|
||||
typedef std::map<CString, CEvent::Type> CNameMap;
|
||||
typedef std::map<CEvent::Type, IEventJob*> CTypeHandlerTable;
|
||||
typedef std::map<void*, CTypeHandlerTable> CHandlerTable;
|
||||
typedef std::set<EventQueueTimer*> Timers;
|
||||
typedef PriorityQueue<Timer> TimerQueue;
|
||||
typedef std::map<UInt32, Event> EventTable;
|
||||
typedef std::vector<UInt32> EventIDList;
|
||||
typedef std::map<Event::Type, const char*> TypeMap;
|
||||
typedef std::map<String, Event::Type> NameMap;
|
||||
typedef std::map<Event::Type, IEventJob*> TypeHandlerTable;
|
||||
typedef std::map<void*, TypeHandlerTable> HandlerTable;
|
||||
|
||||
int m_systemTarget;
|
||||
CArchMutex m_mutex;
|
||||
ArchMutex m_mutex;
|
||||
|
||||
// registered events
|
||||
CEvent::Type m_nextType;
|
||||
CTypeMap m_typeMap;
|
||||
CNameMap m_nameMap;
|
||||
Event::Type m_nextType;
|
||||
TypeMap m_typeMap;
|
||||
NameMap m_nameMap;
|
||||
|
||||
// buffer of events
|
||||
IEventQueueBuffer* m_buffer;
|
||||
|
||||
// saved events
|
||||
CEventTable m_events;
|
||||
CEventIDList m_oldEventIDs;
|
||||
EventTable m_events;
|
||||
EventIDList m_oldEventIDs;
|
||||
|
||||
// timers
|
||||
CStopwatch m_time;
|
||||
CTimers m_timers;
|
||||
CTimerQueue m_timerQueue;
|
||||
CTimerEvent m_timerEvent;
|
||||
Stopwatch m_time;
|
||||
Timers m_timers;
|
||||
TimerQueue m_timerQueue;
|
||||
TimerEvent m_timerEvent;
|
||||
|
||||
// event handlers
|
||||
CHandlerTable m_handlers;
|
||||
HandlerTable m_handlers;
|
||||
|
||||
public:
|
||||
//
|
||||
// Event type providers.
|
||||
//
|
||||
CClientEvents& forCClient();
|
||||
ClientEvents& forClient();
|
||||
IStreamEvents& forIStream();
|
||||
CIpcClientEvents& forCIpcClient();
|
||||
CIpcClientProxyEvents& forCIpcClientProxy();
|
||||
CIpcServerEvents& forCIpcServer();
|
||||
CIpcServerProxyEvents& forCIpcServerProxy();
|
||||
IpcClientEvents& forIpcClient();
|
||||
IpcClientProxyEvents& forIpcClientProxy();
|
||||
IpcServerEvents& forIpcServer();
|
||||
IpcServerProxyEvents& forIpcServerProxy();
|
||||
IDataSocketEvents& forIDataSocket();
|
||||
IListenSocketEvents& forIListenSocket();
|
||||
ISocketEvents& forISocket();
|
||||
COSXScreenEvents& forCOSXScreen();
|
||||
CClientListenerEvents& forCClientListener();
|
||||
CClientProxyEvents& forCClientProxy();
|
||||
CClientProxyUnknownEvents& forCClientProxyUnknown();
|
||||
CServerEvents& forCServer();
|
||||
CServerAppEvents& forCServerApp();
|
||||
OSXScreenEvents& forOSXScreen();
|
||||
ClientListenerEvents& forClientListener();
|
||||
ClientProxyEvents& forClientProxy();
|
||||
ClientProxyUnknownEvents& forClientProxyUnknown();
|
||||
ServerEvents& forServer();
|
||||
ServerAppEvents& forServerApp();
|
||||
IKeyStateEvents& forIKeyState();
|
||||
IPrimaryScreenEvents& forIPrimaryScreen();
|
||||
IScreenEvents& forIScreen();
|
||||
|
||||
private:
|
||||
CClientEvents* m_typesForCClient;
|
||||
ClientEvents* m_typesForClient;
|
||||
IStreamEvents* m_typesForIStream;
|
||||
CIpcClientEvents* m_typesForCIpcClient;
|
||||
CIpcClientProxyEvents* m_typesForCIpcClientProxy;
|
||||
CIpcServerEvents* m_typesForCIpcServer;
|
||||
CIpcServerProxyEvents* m_typesForCIpcServerProxy;
|
||||
IpcClientEvents* m_typesForIpcClient;
|
||||
IpcClientProxyEvents* m_typesForIpcClientProxy;
|
||||
IpcServerEvents* m_typesForIpcServer;
|
||||
IpcServerProxyEvents* m_typesForIpcServerProxy;
|
||||
IDataSocketEvents* m_typesForIDataSocket;
|
||||
IListenSocketEvents* m_typesForIListenSocket;
|
||||
ISocketEvents* m_typesForISocket;
|
||||
COSXScreenEvents* m_typesForCOSXScreen;
|
||||
CClientListenerEvents* m_typesForCClientListener;
|
||||
CClientProxyEvents* m_typesForCClientProxy;
|
||||
CClientProxyUnknownEvents* m_typesForCClientProxyUnknown;
|
||||
CServerEvents* m_typesForCServer;
|
||||
CServerAppEvents* m_typesForCServerApp;
|
||||
OSXScreenEvents* m_typesForOSXScreen;
|
||||
ClientListenerEvents* m_typesForClientListener;
|
||||
ClientProxyEvents* m_typesForClientProxy;
|
||||
ClientProxyUnknownEvents* m_typesForClientProxyUnknown;
|
||||
ServerEvents* m_typesForServer;
|
||||
ServerAppEvents* m_typesForServerApp;
|
||||
IKeyStateEvents* m_typesForIKeyState;
|
||||
IPrimaryScreenEvents* m_typesForIPrimaryScreen;
|
||||
IScreenEvents* m_typesForIScreen;
|
||||
CMutex* m_readyMutex;
|
||||
CCondVar<bool>* m_readyCondVar;
|
||||
std::queue<CEvent> m_pending;
|
||||
Mutex* m_readyMutex;
|
||||
CondVar<bool>* m_readyCondVar;
|
||||
std::queue<Event> m_pending;
|
||||
};
|
||||
|
||||
#define EVENT_TYPE_ACCESSOR(type_) \
|
||||
type_##Events& \
|
||||
CEventQueue::for##type_() { \
|
||||
EventQueue::for##type_() { \
|
||||
if (m_typesFor##type_ == NULL) { \
|
||||
m_typesFor##type_ = new type_##Events(); \
|
||||
m_typesFor##type_->setEvents(dynamic_cast<IEventQueue*>(this)); \
|
||||
|
||||
@@ -21,31 +21,31 @@
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
CEventTypes::CEventTypes() :
|
||||
EventTypes::EventTypes() :
|
||||
m_events(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
IEventQueue*
|
||||
CEventTypes::getEvents() const
|
||||
EventTypes::getEvents() const
|
||||
{
|
||||
assert(m_events != NULL);
|
||||
return m_events;
|
||||
}
|
||||
|
||||
void
|
||||
CEventTypes::setEvents(IEventQueue* events)
|
||||
EventTypes::setEvents(IEventQueue* events)
|
||||
{
|
||||
m_events = events;
|
||||
}
|
||||
|
||||
//
|
||||
// CClient
|
||||
// Client
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CClient, connected)
|
||||
REGISTER_EVENT(CClient, connectionFailed)
|
||||
REGISTER_EVENT(CClient, disconnected)
|
||||
REGISTER_EVENT(Client, connected)
|
||||
REGISTER_EVENT(Client, connectionFailed)
|
||||
REGISTER_EVENT(Client, disconnected)
|
||||
|
||||
//
|
||||
// IStream
|
||||
@@ -58,24 +58,24 @@ REGISTER_EVENT(IStream, inputShutdown)
|
||||
REGISTER_EVENT(IStream, outputShutdown)
|
||||
|
||||
//
|
||||
// CIpcClient
|
||||
// IpcClient
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CIpcClient, connected)
|
||||
REGISTER_EVENT(CIpcClient, messageReceived)
|
||||
REGISTER_EVENT(IpcClient, connected)
|
||||
REGISTER_EVENT(IpcClient, messageReceived)
|
||||
|
||||
//
|
||||
// CIpcClientProxy
|
||||
// IpcClientProxy
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CIpcClientProxy, messageReceived)
|
||||
REGISTER_EVENT(CIpcClientProxy, disconnected)
|
||||
REGISTER_EVENT(IpcClientProxy, messageReceived)
|
||||
REGISTER_EVENT(IpcClientProxy, disconnected)
|
||||
|
||||
//
|
||||
// CIpcServerProxy
|
||||
// IpcServerProxy
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CIpcServerProxy, messageReceived)
|
||||
REGISTER_EVENT(IpcServerProxy, messageReceived)
|
||||
|
||||
//
|
||||
// IDataSocket
|
||||
@@ -97,52 +97,52 @@ REGISTER_EVENT(IListenSocket, connecting)
|
||||
REGISTER_EVENT(ISocket, disconnected)
|
||||
|
||||
//
|
||||
// COSXScreen
|
||||
// OSXScreen
|
||||
//
|
||||
|
||||
REGISTER_EVENT(COSXScreen, confirmSleep)
|
||||
REGISTER_EVENT(OSXScreen, confirmSleep)
|
||||
|
||||
//
|
||||
// CClientListener
|
||||
// ClientListener
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CClientListener, connected)
|
||||
REGISTER_EVENT(ClientListener, connected)
|
||||
|
||||
//
|
||||
// CClientProxy
|
||||
// ClientProxy
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CClientProxy, ready)
|
||||
REGISTER_EVENT(CClientProxy, disconnected)
|
||||
REGISTER_EVENT(CClientProxy, clipboardChanged)
|
||||
REGISTER_EVENT(ClientProxy, ready)
|
||||
REGISTER_EVENT(ClientProxy, disconnected)
|
||||
REGISTER_EVENT(ClientProxy, clipboardChanged)
|
||||
|
||||
//
|
||||
// CClientProxyUnknown
|
||||
// ClientProxyUnknown
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CClientProxyUnknown, success)
|
||||
REGISTER_EVENT(CClientProxyUnknown, failure)
|
||||
REGISTER_EVENT(ClientProxyUnknown, success)
|
||||
REGISTER_EVENT(ClientProxyUnknown, failure)
|
||||
|
||||
//
|
||||
// CServer
|
||||
// Server
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CServer, error)
|
||||
REGISTER_EVENT(CServer, connected)
|
||||
REGISTER_EVENT(CServer, disconnected)
|
||||
REGISTER_EVENT(CServer, switchToScreen)
|
||||
REGISTER_EVENT(CServer, switchInDirection)
|
||||
REGISTER_EVENT(CServer, keyboardBroadcast)
|
||||
REGISTER_EVENT(CServer, lockCursorToScreen)
|
||||
REGISTER_EVENT(CServer, screenSwitched)
|
||||
REGISTER_EVENT(Server, error)
|
||||
REGISTER_EVENT(Server, connected)
|
||||
REGISTER_EVENT(Server, disconnected)
|
||||
REGISTER_EVENT(Server, switchToScreen)
|
||||
REGISTER_EVENT(Server, switchInDirection)
|
||||
REGISTER_EVENT(Server, keyboardBroadcast)
|
||||
REGISTER_EVENT(Server, lockCursorToScreen)
|
||||
REGISTER_EVENT(Server, screenSwitched)
|
||||
|
||||
//
|
||||
// CServerApp
|
||||
// ServerApp
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CServerApp, reloadConfig)
|
||||
REGISTER_EVENT(CServerApp, forceReconnect)
|
||||
REGISTER_EVENT(CServerApp, resetServer)
|
||||
REGISTER_EVENT(ServerApp, reloadConfig)
|
||||
REGISTER_EVENT(ServerApp, forceReconnect)
|
||||
REGISTER_EVENT(ServerApp, resetServer)
|
||||
|
||||
//
|
||||
// IKeyState
|
||||
@@ -181,8 +181,8 @@ REGISTER_EVENT(IScreen, fileChunkSending)
|
||||
REGISTER_EVENT(IScreen, fileRecieveCompleted)
|
||||
|
||||
//
|
||||
// CIpcServer
|
||||
// IpcServer
|
||||
//
|
||||
|
||||
REGISTER_EVENT(CIpcServer, clientConnected)
|
||||
REGISTER_EVENT(CIpcServer, messageReceived)
|
||||
REGISTER_EVENT(IpcServer, clientConnected)
|
||||
REGISTER_EVENT(IpcServer, messageReceived)
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
class IEventQueue;
|
||||
|
||||
class CEventTypes {
|
||||
class EventTypes {
|
||||
public:
|
||||
CEventTypes();
|
||||
EventTypes();
|
||||
void setEvents(IEventQueue* events);
|
||||
|
||||
protected:
|
||||
@@ -34,18 +34,18 @@ private:
|
||||
};
|
||||
|
||||
#define REGISTER_EVENT(type_, name_) \
|
||||
CEvent::Type \
|
||||
Event::Type \
|
||||
type_##Events::name_() \
|
||||
{ \
|
||||
return getEvents()->registerTypeOnce(m_##name_, __FUNCTION__); \
|
||||
}
|
||||
|
||||
class CClientEvents : public CEventTypes {
|
||||
class ClientEvents : public EventTypes {
|
||||
public:
|
||||
CClientEvents() :
|
||||
m_connected(CEvent::kUnknown),
|
||||
m_connectionFailed(CEvent::kUnknown),
|
||||
m_disconnected(CEvent::kUnknown) { }
|
||||
ClientEvents() :
|
||||
m_connected(Event::kUnknown),
|
||||
m_connectionFailed(Event::kUnknown),
|
||||
m_disconnected(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -55,14 +55,14 @@ public:
|
||||
Returns the connected event type. This is sent when the client has
|
||||
successfully connected to the server.
|
||||
*/
|
||||
CEvent::Type connected();
|
||||
Event::Type connected();
|
||||
|
||||
//! Get connection failed event type
|
||||
/*!
|
||||
Returns the connection failed event type. This is sent when the
|
||||
server fails for some reason. The event data is a CFailInfo*.
|
||||
server fails for some reason. The event data is a FailInfo*.
|
||||
*/
|
||||
CEvent::Type connectionFailed();
|
||||
Event::Type connectionFailed();
|
||||
|
||||
//! Get disconnected event type
|
||||
/*!
|
||||
@@ -70,24 +70,24 @@ public:
|
||||
has disconnected from the server (and only after having successfully
|
||||
connected).
|
||||
*/
|
||||
CEvent::Type disconnected();
|
||||
Event::Type disconnected();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_connected;
|
||||
CEvent::Type m_connectionFailed;
|
||||
CEvent::Type m_disconnected;
|
||||
Event::Type m_connected;
|
||||
Event::Type m_connectionFailed;
|
||||
Event::Type m_disconnected;
|
||||
};
|
||||
|
||||
class IStreamEvents : public CEventTypes {
|
||||
class IStreamEvents : public EventTypes {
|
||||
public:
|
||||
IStreamEvents() :
|
||||
m_inputReady(CEvent::kUnknown),
|
||||
m_outputFlushed(CEvent::kUnknown),
|
||||
m_outputError(CEvent::kUnknown),
|
||||
m_inputShutdown(CEvent::kUnknown),
|
||||
m_outputShutdown(CEvent::kUnknown) { }
|
||||
m_inputReady(Event::kUnknown),
|
||||
m_outputFlushed(Event::kUnknown),
|
||||
m_outputError(Event::kUnknown),
|
||||
m_inputShutdown(Event::kUnknown),
|
||||
m_outputShutdown(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
Returns the input ready event type. A stream sends this event
|
||||
when \c read() will return with data.
|
||||
*/
|
||||
CEvent::Type inputReady();
|
||||
Event::Type inputReady();
|
||||
|
||||
//! Get output flushed event type
|
||||
/*!
|
||||
@@ -107,14 +107,14 @@ public:
|
||||
\c close() will not discard any data and \c flush() will return
|
||||
immediately.
|
||||
*/
|
||||
CEvent::Type outputFlushed();
|
||||
Event::Type outputFlushed();
|
||||
|
||||
//! Get output error event type
|
||||
/*!
|
||||
Returns the output error event type. A stream sends this event
|
||||
when a write has failed.
|
||||
*/
|
||||
CEvent::Type outputError();
|
||||
Event::Type outputError();
|
||||
|
||||
//! Get input shutdown event type
|
||||
/*!
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
input side of the stream has shutdown. When the input has
|
||||
shutdown, no more data will ever be available to read.
|
||||
*/
|
||||
CEvent::Type inputShutdown();
|
||||
Event::Type inputShutdown();
|
||||
|
||||
//! Get output shutdown event type
|
||||
/*!
|
||||
@@ -131,106 +131,106 @@ public:
|
||||
shutdown, no more data can ever be written to the stream. Any
|
||||
attempt to do so will generate a output error event.
|
||||
*/
|
||||
CEvent::Type outputShutdown();
|
||||
Event::Type outputShutdown();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_inputReady;
|
||||
CEvent::Type m_outputFlushed;
|
||||
CEvent::Type m_outputError;
|
||||
CEvent::Type m_inputShutdown;
|
||||
CEvent::Type m_outputShutdown;
|
||||
Event::Type m_inputReady;
|
||||
Event::Type m_outputFlushed;
|
||||
Event::Type m_outputError;
|
||||
Event::Type m_inputShutdown;
|
||||
Event::Type m_outputShutdown;
|
||||
};
|
||||
|
||||
class CIpcClientEvents : public CEventTypes {
|
||||
class IpcClientEvents : public EventTypes {
|
||||
public:
|
||||
CIpcClientEvents() :
|
||||
m_connected(CEvent::kUnknown),
|
||||
m_messageReceived(CEvent::kUnknown) { }
|
||||
IpcClientEvents() :
|
||||
m_connected(Event::kUnknown),
|
||||
m_messageReceived(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Raised when the socket is connected.
|
||||
CEvent::Type connected();
|
||||
Event::Type connected();
|
||||
|
||||
//! Raised when a message is received.
|
||||
CEvent::Type messageReceived();
|
||||
Event::Type messageReceived();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_connected;
|
||||
CEvent::Type m_messageReceived;
|
||||
Event::Type m_connected;
|
||||
Event::Type m_messageReceived;
|
||||
};
|
||||
|
||||
class CIpcClientProxyEvents : public CEventTypes {
|
||||
class IpcClientProxyEvents : public EventTypes {
|
||||
public:
|
||||
CIpcClientProxyEvents() :
|
||||
m_messageReceived(CEvent::kUnknown),
|
||||
m_disconnected(CEvent::kUnknown) { }
|
||||
IpcClientProxyEvents() :
|
||||
m_messageReceived(Event::kUnknown),
|
||||
m_disconnected(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Raised when the server receives a message from a client.
|
||||
CEvent::Type messageReceived();
|
||||
Event::Type messageReceived();
|
||||
|
||||
//! Raised when the client disconnects from the server.
|
||||
CEvent::Type disconnected();
|
||||
Event::Type disconnected();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_messageReceived;
|
||||
CEvent::Type m_disconnected;
|
||||
Event::Type m_messageReceived;
|
||||
Event::Type m_disconnected;
|
||||
};
|
||||
|
||||
class CIpcServerEvents : public CEventTypes {
|
||||
class IpcServerEvents : public EventTypes {
|
||||
public:
|
||||
CIpcServerEvents() :
|
||||
m_clientConnected(CEvent::kUnknown),
|
||||
m_messageReceived(CEvent::kUnknown) { }
|
||||
IpcServerEvents() :
|
||||
m_clientConnected(Event::kUnknown),
|
||||
m_messageReceived(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Raised when we have created the client proxy.
|
||||
CEvent::Type clientConnected();
|
||||
Event::Type clientConnected();
|
||||
|
||||
//! Raised when a message is received through a client proxy.
|
||||
CEvent::Type messageReceived();
|
||||
Event::Type messageReceived();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_clientConnected;
|
||||
CEvent::Type m_messageReceived;
|
||||
Event::Type m_clientConnected;
|
||||
Event::Type m_messageReceived;
|
||||
};
|
||||
|
||||
class CIpcServerProxyEvents : public CEventTypes {
|
||||
class IpcServerProxyEvents : public EventTypes {
|
||||
public:
|
||||
CIpcServerProxyEvents() :
|
||||
m_messageReceived(CEvent::kUnknown) { }
|
||||
IpcServerProxyEvents() :
|
||||
m_messageReceived(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Raised when the client receives a message from the server.
|
||||
CEvent::Type messageReceived();
|
||||
Event::Type messageReceived();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_messageReceived;
|
||||
Event::Type m_messageReceived;
|
||||
};
|
||||
|
||||
class IDataSocketEvents : public CEventTypes {
|
||||
class IDataSocketEvents : public EventTypes {
|
||||
public:
|
||||
IDataSocketEvents() :
|
||||
m_connected(CEvent::kUnknown),
|
||||
m_connectionFailed(CEvent::kUnknown) { }
|
||||
m_connected(Event::kUnknown),
|
||||
m_connectionFailed(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -240,27 +240,27 @@ public:
|
||||
Returns the socket connected event type. A socket sends this
|
||||
event when a remote connection has been established.
|
||||
*/
|
||||
CEvent::Type connected();
|
||||
Event::Type connected();
|
||||
|
||||
//! Get connection failed event type
|
||||
/*!
|
||||
Returns the socket connection failed event type. A socket sends
|
||||
this event when an attempt to connect to a remote port has failed.
|
||||
The data is a pointer to a CConnectionFailedInfo.
|
||||
The data is a pointer to a ConnectionFailedInfo.
|
||||
*/
|
||||
CEvent::Type connectionFailed();
|
||||
Event::Type connectionFailed();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_connected;
|
||||
CEvent::Type m_connectionFailed;
|
||||
Event::Type m_connected;
|
||||
Event::Type m_connectionFailed;
|
||||
};
|
||||
|
||||
class IListenSocketEvents : public CEventTypes {
|
||||
class IListenSocketEvents : public EventTypes {
|
||||
public:
|
||||
IListenSocketEvents() :
|
||||
m_connecting(CEvent::kUnknown) { }
|
||||
m_connecting(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -270,18 +270,18 @@ public:
|
||||
Returns the socket connecting event type. A socket sends this
|
||||
event when a remote connection is waiting to be accepted.
|
||||
*/
|
||||
CEvent::Type connecting();
|
||||
Event::Type connecting();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_connecting;
|
||||
Event::Type m_connecting;
|
||||
};
|
||||
|
||||
class ISocketEvents : public CEventTypes {
|
||||
class ISocketEvents : public EventTypes {
|
||||
public:
|
||||
ISocketEvents() :
|
||||
m_disconnected(CEvent::kUnknown) { }
|
||||
m_disconnected(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -292,34 +292,34 @@ public:
|
||||
event when the remote side of the socket has disconnected or
|
||||
shutdown both input and output.
|
||||
*/
|
||||
CEvent::Type disconnected();
|
||||
Event::Type disconnected();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_disconnected;
|
||||
Event::Type m_disconnected;
|
||||
};
|
||||
|
||||
class COSXScreenEvents : public CEventTypes {
|
||||
class OSXScreenEvents : public EventTypes {
|
||||
public:
|
||||
COSXScreenEvents() :
|
||||
m_confirmSleep(CEvent::kUnknown) { }
|
||||
OSXScreenEvents() :
|
||||
m_confirmSleep(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
CEvent::Type confirmSleep();
|
||||
Event::Type confirmSleep();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_confirmSleep;
|
||||
Event::Type m_confirmSleep;
|
||||
};
|
||||
|
||||
class CClientListenerEvents : public CEventTypes {
|
||||
class ClientListenerEvents : public EventTypes {
|
||||
public:
|
||||
CClientListenerEvents() :
|
||||
m_connected(CEvent::kUnknown) { }
|
||||
ClientListenerEvents() :
|
||||
m_connected(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -329,20 +329,20 @@ public:
|
||||
Returns the connected event type. This is sent whenever a
|
||||
a client connects.
|
||||
*/
|
||||
CEvent::Type connected();
|
||||
Event::Type connected();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_connected;
|
||||
Event::Type m_connected;
|
||||
};
|
||||
|
||||
class CClientProxyEvents : public CEventTypes {
|
||||
class ClientProxyEvents : public EventTypes {
|
||||
public:
|
||||
CClientProxyEvents() :
|
||||
m_ready(CEvent::kUnknown),
|
||||
m_disconnected(CEvent::kUnknown),
|
||||
m_clipboardChanged(CEvent::kUnknown) { }
|
||||
ClientProxyEvents() :
|
||||
m_ready(Event::kUnknown),
|
||||
m_disconnected(Event::kUnknown),
|
||||
m_clipboardChanged(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -353,36 +353,36 @@ public:
|
||||
completed the initial handshake. Until it is sent, the client is
|
||||
not fully connected.
|
||||
*/
|
||||
CEvent::Type ready();
|
||||
Event::Type ready();
|
||||
|
||||
//! Get disconnect event type
|
||||
/*!
|
||||
Returns the disconnect event type. This is sent when the client
|
||||
disconnects or is disconnected. The target is getEventTarget().
|
||||
*/
|
||||
CEvent::Type disconnected();
|
||||
Event::Type disconnected();
|
||||
|
||||
//! Get clipboard changed event type
|
||||
/*!
|
||||
Returns the clipboard changed event type. This is sent whenever the
|
||||
contents of the clipboard has changed. The data is a pointer to a
|
||||
IScreen::CClipboardInfo.
|
||||
IScreen::ClipboardInfo.
|
||||
*/
|
||||
CEvent::Type clipboardChanged();
|
||||
Event::Type clipboardChanged();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_ready;
|
||||
CEvent::Type m_disconnected;
|
||||
CEvent::Type m_clipboardChanged;
|
||||
Event::Type m_ready;
|
||||
Event::Type m_disconnected;
|
||||
Event::Type m_clipboardChanged;
|
||||
};
|
||||
|
||||
class CClientProxyUnknownEvents : public CEventTypes {
|
||||
class ClientProxyUnknownEvents : public EventTypes {
|
||||
public:
|
||||
CClientProxyUnknownEvents() :
|
||||
m_success(CEvent::kUnknown),
|
||||
m_failure(CEvent::kUnknown) { }
|
||||
ClientProxyUnknownEvents() :
|
||||
m_success(Event::kUnknown),
|
||||
m_failure(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -392,33 +392,33 @@ public:
|
||||
Returns the success event type. This is sent when the client has
|
||||
correctly responded to the hello message. The target is this.
|
||||
*/
|
||||
CEvent::Type success();
|
||||
Event::Type success();
|
||||
|
||||
//! Get failure event type
|
||||
/*!
|
||||
Returns the failure event type. This is sent when a client fails
|
||||
to correctly respond to the hello message. The target is this.
|
||||
*/
|
||||
CEvent::Type failure();
|
||||
Event::Type failure();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_success;
|
||||
CEvent::Type m_failure;
|
||||
Event::Type m_success;
|
||||
Event::Type m_failure;
|
||||
};
|
||||
|
||||
class CServerEvents : public CEventTypes {
|
||||
class ServerEvents : public EventTypes {
|
||||
public:
|
||||
CServerEvents() :
|
||||
m_error(CEvent::kUnknown),
|
||||
m_connected(CEvent::kUnknown),
|
||||
m_disconnected(CEvent::kUnknown),
|
||||
m_switchToScreen(CEvent::kUnknown),
|
||||
m_switchInDirection(CEvent::kUnknown),
|
||||
m_keyboardBroadcast(CEvent::kUnknown),
|
||||
m_lockCursorToScreen(CEvent::kUnknown),
|
||||
m_screenSwitched(CEvent::kUnknown) { }
|
||||
ServerEvents() :
|
||||
m_error(Event::kUnknown),
|
||||
m_connected(Event::kUnknown),
|
||||
m_disconnected(Event::kUnknown),
|
||||
m_switchToScreen(Event::kUnknown),
|
||||
m_switchInDirection(Event::kUnknown),
|
||||
m_keyboardBroadcast(Event::kUnknown),
|
||||
m_lockCursorToScreen(Event::kUnknown),
|
||||
m_screenSwitched(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -428,208 +428,208 @@ public:
|
||||
Returns the error event type. This is sent when the server fails
|
||||
for some reason.
|
||||
*/
|
||||
CEvent::Type error();
|
||||
Event::Type error();
|
||||
|
||||
//! Get connected event type
|
||||
/*!
|
||||
Returns the connected event type. This is sent when a client screen
|
||||
has connected. The event data is a \c CScreenConnectedInfo* that
|
||||
has connected. The event data is a \c ScreenConnectedInfo* that
|
||||
indicates the connected screen.
|
||||
*/
|
||||
CEvent::Type connected();
|
||||
Event::Type connected();
|
||||
|
||||
//! Get disconnected event type
|
||||
/*!
|
||||
Returns the disconnected event type. This is sent when all the
|
||||
clients have disconnected.
|
||||
*/
|
||||
CEvent::Type disconnected();
|
||||
Event::Type disconnected();
|
||||
|
||||
//! Get switch to screen event type
|
||||
/*!
|
||||
Returns the switch to screen event type. The server responds to this
|
||||
by switching screens. The event data is a \c CSwitchToScreenInfo*
|
||||
by switching screens. The event data is a \c SwitchToScreenInfo*
|
||||
that indicates the target screen.
|
||||
*/
|
||||
CEvent::Type switchToScreen();
|
||||
Event::Type switchToScreen();
|
||||
|
||||
//! Get switch in direction event type
|
||||
/*!
|
||||
Returns the switch in direction event type. The server responds to this
|
||||
by switching screens. The event data is a \c CSwitchInDirectionInfo*
|
||||
by switching screens. The event data is a \c SwitchInDirectionInfo*
|
||||
that indicates the target direction.
|
||||
*/
|
||||
CEvent::Type switchInDirection();
|
||||
Event::Type switchInDirection();
|
||||
|
||||
//! Get keyboard broadcast event type
|
||||
/*!
|
||||
Returns the keyboard broadcast event type. The server responds
|
||||
to this by turning on keyboard broadcasting or turning it off. The
|
||||
event data is a \c CKeyboardBroadcastInfo*.
|
||||
event data is a \c KeyboardBroadcastInfo*.
|
||||
*/
|
||||
CEvent::Type keyboardBroadcast();
|
||||
Event::Type keyboardBroadcast();
|
||||
|
||||
//! Get lock cursor event type
|
||||
/*!
|
||||
Returns the lock cursor event type. The server responds to this
|
||||
by locking the cursor to the active screen or unlocking it. The
|
||||
event data is a \c CLockCursorToScreenInfo*.
|
||||
event data is a \c LockCursorToScreenInfo*.
|
||||
*/
|
||||
CEvent::Type lockCursorToScreen();
|
||||
Event::Type lockCursorToScreen();
|
||||
|
||||
//! Get screen switched event type
|
||||
/*!
|
||||
Returns the screen switched event type. This is raised when the
|
||||
screen has been switched to a client.
|
||||
*/
|
||||
CEvent::Type screenSwitched();
|
||||
Event::Type screenSwitched();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_error;
|
||||
CEvent::Type m_connected;
|
||||
CEvent::Type m_disconnected;
|
||||
CEvent::Type m_switchToScreen;
|
||||
CEvent::Type m_switchInDirection;
|
||||
CEvent::Type m_keyboardBroadcast;
|
||||
CEvent::Type m_lockCursorToScreen;
|
||||
CEvent::Type m_screenSwitched;
|
||||
Event::Type m_error;
|
||||
Event::Type m_connected;
|
||||
Event::Type m_disconnected;
|
||||
Event::Type m_switchToScreen;
|
||||
Event::Type m_switchInDirection;
|
||||
Event::Type m_keyboardBroadcast;
|
||||
Event::Type m_lockCursorToScreen;
|
||||
Event::Type m_screenSwitched;
|
||||
};
|
||||
|
||||
class CServerAppEvents : public CEventTypes {
|
||||
class ServerAppEvents : public EventTypes {
|
||||
public:
|
||||
CServerAppEvents() :
|
||||
m_reloadConfig(CEvent::kUnknown),
|
||||
m_forceReconnect(CEvent::kUnknown),
|
||||
m_resetServer(CEvent::kUnknown) { }
|
||||
ServerAppEvents() :
|
||||
m_reloadConfig(Event::kUnknown),
|
||||
m_forceReconnect(Event::kUnknown),
|
||||
m_resetServer(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
CEvent::Type reloadConfig();
|
||||
CEvent::Type forceReconnect();
|
||||
CEvent::Type resetServer();
|
||||
Event::Type reloadConfig();
|
||||
Event::Type forceReconnect();
|
||||
Event::Type resetServer();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_reloadConfig;
|
||||
CEvent::Type m_forceReconnect;
|
||||
CEvent::Type m_resetServer;
|
||||
Event::Type m_reloadConfig;
|
||||
Event::Type m_forceReconnect;
|
||||
Event::Type m_resetServer;
|
||||
};
|
||||
|
||||
class IKeyStateEvents : public CEventTypes {
|
||||
class IKeyStateEvents : public EventTypes {
|
||||
public:
|
||||
IKeyStateEvents() :
|
||||
m_keyDown(CEvent::kUnknown),
|
||||
m_keyUp(CEvent::kUnknown),
|
||||
m_keyRepeat(CEvent::kUnknown) { }
|
||||
m_keyDown(Event::kUnknown),
|
||||
m_keyUp(Event::kUnknown),
|
||||
m_keyRepeat(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! Get key down event type. Event data is CKeyInfo*, count == 1.
|
||||
CEvent::Type keyDown();
|
||||
//! Get key down event type. Event data is KeyInfo*, count == 1.
|
||||
Event::Type keyDown();
|
||||
|
||||
//! Get key up event type. Event data is CKeyInfo*, count == 1.
|
||||
CEvent::Type keyUp();
|
||||
//! Get key up event type. Event data is KeyInfo*, count == 1.
|
||||
Event::Type keyUp();
|
||||
|
||||
//! Get key repeat event type. Event data is CKeyInfo*.
|
||||
CEvent::Type keyRepeat();
|
||||
//! Get key repeat event type. Event data is KeyInfo*.
|
||||
Event::Type keyRepeat();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_keyDown;
|
||||
CEvent::Type m_keyUp;
|
||||
CEvent::Type m_keyRepeat;
|
||||
Event::Type m_keyDown;
|
||||
Event::Type m_keyUp;
|
||||
Event::Type m_keyRepeat;
|
||||
};
|
||||
|
||||
class IPrimaryScreenEvents : public CEventTypes {
|
||||
class IPrimaryScreenEvents : public EventTypes {
|
||||
public:
|
||||
IPrimaryScreenEvents() :
|
||||
m_buttonDown(CEvent::kUnknown),
|
||||
m_buttonUp(CEvent::kUnknown),
|
||||
m_motionOnPrimary(CEvent::kUnknown),
|
||||
m_motionOnSecondary(CEvent::kUnknown),
|
||||
m_wheel(CEvent::kUnknown),
|
||||
m_screensaverActivated(CEvent::kUnknown),
|
||||
m_screensaverDeactivated(CEvent::kUnknown),
|
||||
m_hotKeyDown(CEvent::kUnknown),
|
||||
m_hotKeyUp(CEvent::kUnknown),
|
||||
m_fakeInputBegin(CEvent::kUnknown),
|
||||
m_fakeInputEnd(CEvent::kUnknown) { }
|
||||
m_buttonDown(Event::kUnknown),
|
||||
m_buttonUp(Event::kUnknown),
|
||||
m_motionOnPrimary(Event::kUnknown),
|
||||
m_motionOnSecondary(Event::kUnknown),
|
||||
m_wheel(Event::kUnknown),
|
||||
m_screensaverActivated(Event::kUnknown),
|
||||
m_screensaverDeactivated(Event::kUnknown),
|
||||
m_hotKeyDown(Event::kUnknown),
|
||||
m_hotKeyUp(Event::kUnknown),
|
||||
m_fakeInputBegin(Event::kUnknown),
|
||||
m_fakeInputEnd(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
|
||||
//! button down event type. Event data is CButtonInfo*.
|
||||
CEvent::Type buttonDown();
|
||||
//! button down event type. Event data is ButtonInfo*.
|
||||
Event::Type buttonDown();
|
||||
|
||||
//! button up event type. Event data is CButtonInfo*.
|
||||
CEvent::Type buttonUp();
|
||||
//! button up event type. Event data is ButtonInfo*.
|
||||
Event::Type buttonUp();
|
||||
|
||||
//! mouse motion on the primary screen event type
|
||||
/*!
|
||||
Event data is CMotionInfo* and the values are an absolute position.
|
||||
Event data is MotionInfo* and the values are an absolute position.
|
||||
*/
|
||||
CEvent::Type motionOnPrimary();
|
||||
Event::Type motionOnPrimary();
|
||||
|
||||
//! mouse motion on a secondary screen event type
|
||||
/*!
|
||||
Event data is CMotionInfo* and the values are motion deltas not
|
||||
Event data is MotionInfo* and the values are motion deltas not
|
||||
absolute coordinates.
|
||||
*/
|
||||
CEvent::Type motionOnSecondary();
|
||||
Event::Type motionOnSecondary();
|
||||
|
||||
//! mouse wheel event type. Event data is CWheelInfo*.
|
||||
CEvent::Type wheel();
|
||||
//! mouse wheel event type. Event data is WheelInfo*.
|
||||
Event::Type wheel();
|
||||
|
||||
//! screensaver activated event type
|
||||
CEvent::Type screensaverActivated();
|
||||
Event::Type screensaverActivated();
|
||||
|
||||
//! screensaver deactivated event type
|
||||
CEvent::Type screensaverDeactivated();
|
||||
Event::Type screensaverDeactivated();
|
||||
|
||||
//! hot key down event type. Event data is CHotKeyInfo*.
|
||||
CEvent::Type hotKeyDown();
|
||||
//! hot key down event type. Event data is HotKeyInfo*.
|
||||
Event::Type hotKeyDown();
|
||||
|
||||
//! hot key up event type. Event data is CHotKeyInfo*.
|
||||
CEvent::Type hotKeyUp();
|
||||
//! hot key up event type. Event data is HotKeyInfo*.
|
||||
Event::Type hotKeyUp();
|
||||
|
||||
//! start of fake input event type
|
||||
CEvent::Type fakeInputBegin();
|
||||
Event::Type fakeInputBegin();
|
||||
|
||||
//! end of fake input event type
|
||||
CEvent::Type fakeInputEnd();
|
||||
Event::Type fakeInputEnd();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_buttonDown;
|
||||
CEvent::Type m_buttonUp;
|
||||
CEvent::Type m_motionOnPrimary;
|
||||
CEvent::Type m_motionOnSecondary;
|
||||
CEvent::Type m_wheel;
|
||||
CEvent::Type m_screensaverActivated;
|
||||
CEvent::Type m_screensaverDeactivated;
|
||||
CEvent::Type m_hotKeyDown;
|
||||
CEvent::Type m_hotKeyUp;
|
||||
CEvent::Type m_fakeInputBegin;
|
||||
CEvent::Type m_fakeInputEnd;
|
||||
Event::Type m_buttonDown;
|
||||
Event::Type m_buttonUp;
|
||||
Event::Type m_motionOnPrimary;
|
||||
Event::Type m_motionOnSecondary;
|
||||
Event::Type m_wheel;
|
||||
Event::Type m_screensaverActivated;
|
||||
Event::Type m_screensaverDeactivated;
|
||||
Event::Type m_hotKeyDown;
|
||||
Event::Type m_hotKeyUp;
|
||||
Event::Type m_fakeInputBegin;
|
||||
Event::Type m_fakeInputEnd;
|
||||
};
|
||||
|
||||
class IScreenEvents : public CEventTypes {
|
||||
class IScreenEvents : public EventTypes {
|
||||
public:
|
||||
IScreenEvents() :
|
||||
m_error(CEvent::kUnknown),
|
||||
m_shapeChanged(CEvent::kUnknown),
|
||||
m_clipboardGrabbed(CEvent::kUnknown),
|
||||
m_suspend(CEvent::kUnknown),
|
||||
m_resume(CEvent::kUnknown),
|
||||
m_fileChunkSending(CEvent::kUnknown),
|
||||
m_fileRecieveCompleted(CEvent::kUnknown) { }
|
||||
m_error(Event::kUnknown),
|
||||
m_shapeChanged(Event::kUnknown),
|
||||
m_clipboardGrabbed(Event::kUnknown),
|
||||
m_suspend(Event::kUnknown),
|
||||
m_resume(Event::kUnknown),
|
||||
m_fileChunkSending(Event::kUnknown),
|
||||
m_fileRecieveCompleted(Event::kUnknown) { }
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -639,51 +639,51 @@ public:
|
||||
Returns the error event type. This is sent whenever the screen has
|
||||
failed for some reason (e.g. the X Windows server died).
|
||||
*/
|
||||
CEvent::Type error();
|
||||
Event::Type error();
|
||||
|
||||
//! Get shape changed event type
|
||||
/*!
|
||||
Returns the shape changed event type. This is sent whenever the
|
||||
screen's shape changes.
|
||||
*/
|
||||
CEvent::Type shapeChanged();
|
||||
Event::Type shapeChanged();
|
||||
|
||||
//! Get clipboard grabbed event type
|
||||
/*!
|
||||
Returns the clipboard grabbed event type. This is sent whenever the
|
||||
clipboard is grabbed by some other application so we don't own it
|
||||
anymore. The data is a pointer to a CClipboardInfo.
|
||||
anymore. The data is a pointer to a ClipboardInfo.
|
||||
*/
|
||||
CEvent::Type clipboardGrabbed();
|
||||
Event::Type clipboardGrabbed();
|
||||
|
||||
//! Get suspend event type
|
||||
/*!
|
||||
Returns the suspend event type. This is sent whenever the system goes
|
||||
to sleep or a user session is deactivated (fast user switching).
|
||||
*/
|
||||
CEvent::Type suspend();
|
||||
Event::Type suspend();
|
||||
|
||||
//! Get resume event type
|
||||
/*!
|
||||
Returns the resume event type. This is sent whenever the system wakes
|
||||
up or a user session is activated (fast user switching).
|
||||
*/
|
||||
CEvent::Type resume();
|
||||
Event::Type resume();
|
||||
|
||||
//! Sending a file chunk
|
||||
CEvent::Type fileChunkSending();
|
||||
Event::Type fileChunkSending();
|
||||
|
||||
//! Completed receiving a file
|
||||
CEvent::Type fileRecieveCompleted();
|
||||
Event::Type fileRecieveCompleted();
|
||||
|
||||
//@}
|
||||
|
||||
private:
|
||||
CEvent::Type m_error;
|
||||
CEvent::Type m_shapeChanged;
|
||||
CEvent::Type m_clipboardGrabbed;
|
||||
CEvent::Type m_suspend;
|
||||
CEvent::Type m_resume;
|
||||
CEvent::Type m_fileChunkSending;
|
||||
CEvent::Type m_fileRecieveCompleted;
|
||||
Event::Type m_error;
|
||||
Event::Type m_shapeChanged;
|
||||
Event::Type m_clipboardGrabbed;
|
||||
Event::Type m_suspend;
|
||||
Event::Type m_resume;
|
||||
Event::Type m_fileChunkSending;
|
||||
Event::Type m_fileRecieveCompleted;
|
||||
};
|
||||
|
||||
@@ -19,24 +19,24 @@
|
||||
#include "base/FunctionEventJob.h"
|
||||
|
||||
//
|
||||
// CFunctionEventJob
|
||||
// FunctionEventJob
|
||||
//
|
||||
|
||||
CFunctionEventJob::CFunctionEventJob(
|
||||
void (*func)(const CEvent&, void*), void* arg) :
|
||||
FunctionEventJob::FunctionEventJob(
|
||||
void (*func)(const Event&, void*), void* arg) :
|
||||
m_func(func),
|
||||
m_arg(arg)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CFunctionEventJob::~CFunctionEventJob()
|
||||
FunctionEventJob::~FunctionEventJob()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CFunctionEventJob::run(const CEvent& event)
|
||||
FunctionEventJob::run(const Event& event)
|
||||
{
|
||||
if (m_func != NULL) {
|
||||
m_func(event, m_arg);
|
||||
|
||||
@@ -24,16 +24,16 @@
|
||||
/*!
|
||||
An event job class that invokes a function.
|
||||
*/
|
||||
class CFunctionEventJob : public IEventJob {
|
||||
class FunctionEventJob : public IEventJob {
|
||||
public:
|
||||
//! run() invokes \c func(arg)
|
||||
CFunctionEventJob(void (*func)(const CEvent&, void*), void* arg = NULL);
|
||||
virtual ~CFunctionEventJob();
|
||||
FunctionEventJob(void (*func)(const Event&, void*), void* arg = NULL);
|
||||
virtual ~FunctionEventJob();
|
||||
|
||||
// IEventJob overrides
|
||||
virtual void run(const CEvent&);
|
||||
virtual void run(const Event&);
|
||||
|
||||
private:
|
||||
void (*m_func)(const CEvent&, void*);
|
||||
void (*m_func)(const Event&, void*);
|
||||
void* m_arg;
|
||||
};
|
||||
|
||||
@@ -19,23 +19,23 @@
|
||||
#include "base/FunctionJob.h"
|
||||
|
||||
//
|
||||
// CFunctionJob
|
||||
// FunctionJob
|
||||
//
|
||||
|
||||
CFunctionJob::CFunctionJob(void (*func)(void*), void* arg) :
|
||||
FunctionJob::FunctionJob(void (*func)(void*), void* arg) :
|
||||
m_func(func),
|
||||
m_arg(arg)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CFunctionJob::~CFunctionJob()
|
||||
FunctionJob::~FunctionJob()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CFunctionJob::run()
|
||||
FunctionJob::run()
|
||||
{
|
||||
if (m_func != NULL) {
|
||||
m_func(m_arg);
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
/*!
|
||||
A job class that invokes a function.
|
||||
*/
|
||||
class CFunctionJob : public IJob {
|
||||
class FunctionJob : public IJob {
|
||||
public:
|
||||
//! run() invokes \c func(arg)
|
||||
CFunctionJob(void (*func)(void*), void* arg = NULL);
|
||||
virtual ~CFunctionJob();
|
||||
FunctionJob(void (*func)(void*), void* arg = NULL);
|
||||
virtual ~FunctionJob();
|
||||
|
||||
// IJob overrides
|
||||
virtual void run();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "common/IInterface.h"
|
||||
|
||||
class CEvent;
|
||||
class Event;
|
||||
|
||||
//! Event handler interface
|
||||
/*!
|
||||
@@ -29,5 +29,5 @@ An event job is an interface for executing a event handler.
|
||||
class IEventJob : public IInterface {
|
||||
public:
|
||||
//! Run the job
|
||||
virtual void run(const CEvent&) = 0;
|
||||
virtual void run(const Event&) = 0;
|
||||
};
|
||||
|
||||
@@ -27,40 +27,40 @@ class IEventQueueBuffer;
|
||||
|
||||
// Opaque type for timer info. This is defined by subclasses of
|
||||
// IEventQueueBuffer.
|
||||
class CEventQueueTimer;
|
||||
class EventQueueTimer;
|
||||
|
||||
// Event type registration classes.
|
||||
class CClientEvents;
|
||||
class ClientEvents;
|
||||
class IStreamEvents;
|
||||
class CIpcClientEvents;
|
||||
class CIpcClientProxyEvents;
|
||||
class CIpcServerEvents;
|
||||
class CIpcServerProxyEvents;
|
||||
class IpcClientEvents;
|
||||
class IpcClientProxyEvents;
|
||||
class IpcServerEvents;
|
||||
class IpcServerProxyEvents;
|
||||
class IDataSocketEvents;
|
||||
class IListenSocketEvents;
|
||||
class ISocketEvents;
|
||||
class COSXScreenEvents;
|
||||
class CClientListenerEvents;
|
||||
class CClientProxyEvents;
|
||||
class CClientProxyUnknownEvents;
|
||||
class CServerEvents;
|
||||
class CServerAppEvents;
|
||||
class OSXScreenEvents;
|
||||
class ClientListenerEvents;
|
||||
class ClientProxyEvents;
|
||||
class ClientProxyUnknownEvents;
|
||||
class ServerEvents;
|
||||
class ServerAppEvents;
|
||||
class IKeyStateEvents;
|
||||
class IPrimaryScreenEvents;
|
||||
class IScreenEvents;
|
||||
|
||||
//! Event queue interface
|
||||
/*!
|
||||
An event queue provides a queue of CEvents. Clients can block waiting
|
||||
An event queue provides a queue of Events. Clients can block waiting
|
||||
on any event becoming available at the head of the queue and can place
|
||||
new events at the end of the queue. Clients can also add and remove
|
||||
timers which generate events periodically.
|
||||
*/
|
||||
class IEventQueue : public IInterface {
|
||||
public:
|
||||
class CTimerEvent {
|
||||
class TimerEvent {
|
||||
public:
|
||||
CEventQueueTimer* m_timer; //!< The timer
|
||||
EventQueueTimer* m_timer; //!< The timer
|
||||
UInt32 m_count; //!< Number of repeats
|
||||
};
|
||||
|
||||
@@ -86,26 +86,26 @@ public:
|
||||
available then blocks for up to \p timeout seconds, or forever if
|
||||
\p timeout is negative. Returns true iff an event was available.
|
||||
*/
|
||||
virtual bool getEvent(CEvent& event, double timeout = -1.0) = 0;
|
||||
virtual bool getEvent(Event& event, double timeout = -1.0) = 0;
|
||||
|
||||
//! Dispatch an event
|
||||
/*!
|
||||
Looks up the dispatcher for the event's target and invokes it.
|
||||
Returns true iff a dispatcher exists for the target.
|
||||
*/
|
||||
virtual bool dispatchEvent(const CEvent& event) = 0;
|
||||
virtual bool dispatchEvent(const Event& event) = 0;
|
||||
|
||||
//! Add event to queue
|
||||
/*!
|
||||
Adds \p event to the end of the queue.
|
||||
*/
|
||||
virtual void addEvent(const CEvent& event) = 0;
|
||||
virtual void addEvent(const Event& event) = 0;
|
||||
|
||||
//! Create a recurring timer
|
||||
/*!
|
||||
Creates and returns a timer. An event is returned after \p duration
|
||||
seconds and the timer is reset to countdown again. When a timer event
|
||||
is returned the data points to a \c CTimerEvent. The client must pass
|
||||
is returned the data points to a \c TimerEvent. The client must pass
|
||||
the returned timer to \c deleteTimer() (whether or not the timer has
|
||||
expired) to release the timer. The returned timer event uses the
|
||||
given \p target. If \p target is NULL it uses the returned timer as
|
||||
@@ -113,25 +113,25 @@ public:
|
||||
|
||||
Events for a single timer don't accumulate in the queue, even if the
|
||||
client reading events can't keep up. Instead, the \c m_count member
|
||||
of the \c CTimerEvent indicates how many events for the timer would
|
||||
of the \c TimerEvent indicates how many events for the timer would
|
||||
have been put on the queue since the last event for the timer was
|
||||
removed (or since the timer was added).
|
||||
*/
|
||||
virtual CEventQueueTimer*
|
||||
virtual EventQueueTimer*
|
||||
newTimer(double duration, void* target) = 0;
|
||||
|
||||
//! Create a one-shot timer
|
||||
/*!
|
||||
Creates and returns a one-shot timer. An event is returned when
|
||||
the timer expires and the timer is removed from further handling.
|
||||
When a timer event is returned the data points to a \c CTimerEvent.
|
||||
The c_count member of the \c CTimerEvent is always 1. The client
|
||||
When a timer event is returned the data points to a \c TimerEvent.
|
||||
The c_count member of the \c TimerEvent is always 1. The client
|
||||
must pass the returned timer to \c deleteTimer() (whether or not the
|
||||
timer has expired) to release the timer. The returned timer event
|
||||
uses the given \p target. If \p target is NULL it uses the returned
|
||||
timer as the target.
|
||||
*/
|
||||
virtual CEventQueueTimer*
|
||||
virtual EventQueueTimer*
|
||||
newOneShotTimer(double duration,
|
||||
void* target) = 0;
|
||||
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
Destroys a previously created timer. The timer is removed from the
|
||||
queue and will not generate event, even if the timer has expired.
|
||||
*/
|
||||
virtual void deleteTimer(CEventQueueTimer*) = 0;
|
||||
virtual void deleteTimer(EventQueueTimer*) = 0;
|
||||
|
||||
//! Register an event handler for an event type
|
||||
/*!
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
of type \p type. If no such handler exists it will use the handler
|
||||
for \p target and type \p kUnknown if it exists.
|
||||
*/
|
||||
virtual void adoptHandler(CEvent::Type type,
|
||||
virtual void adoptHandler(Event::Type type,
|
||||
void* target, IEventJob* handler) = 0;
|
||||
|
||||
//! Unregister an event handler for an event type
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
Unregisters an event handler for the \p type, \p target pair and
|
||||
deletes it.
|
||||
*/
|
||||
virtual void removeHandler(CEvent::Type type, void* target) = 0;
|
||||
virtual void removeHandler(Event::Type type, void* target) = 0;
|
||||
|
||||
//! Unregister all event handlers for an event target
|
||||
/*!
|
||||
@@ -172,8 +172,8 @@ public:
|
||||
type id otherwise it is left alone. The final value of \p type
|
||||
is returned.
|
||||
*/
|
||||
virtual CEvent::Type
|
||||
registerTypeOnce(CEvent::Type& type,
|
||||
virtual Event::Type
|
||||
registerTypeOnce(Event::Type& type,
|
||||
const char* name) = 0;
|
||||
|
||||
//! Wait for event queue to become ready
|
||||
@@ -199,24 +199,24 @@ public:
|
||||
Finds and returns the event handler for the \p type, \p target pair
|
||||
if it exists, otherwise it returns NULL.
|
||||
*/
|
||||
virtual IEventJob* getHandler(CEvent::Type type, void* target) const = 0;
|
||||
virtual IEventJob* getHandler(Event::Type type, void* target) const = 0;
|
||||
|
||||
//! Get name for event
|
||||
/*!
|
||||
Returns the name for the event \p type. This is primarily for
|
||||
debugging.
|
||||
*/
|
||||
virtual const char* getTypeName(CEvent::Type type) = 0;
|
||||
virtual const char* getTypeName(Event::Type type) = 0;
|
||||
|
||||
//! Get an event type by name
|
||||
/*!
|
||||
Returns the registered type for an event for a given name.
|
||||
*/
|
||||
virtual CEvent::Type getRegisteredType(const CString& name) const = 0;
|
||||
virtual Event::Type getRegisteredType(const String& name) const = 0;
|
||||
|
||||
//! Get the system event type target
|
||||
/*!
|
||||
Returns the target to use for dispatching \c CEvent::kSystem events.
|
||||
Returns the target to use for dispatching \c Event::kSystem events.
|
||||
*/
|
||||
virtual void* getSystemTarget() = 0;
|
||||
|
||||
@@ -226,21 +226,21 @@ public:
|
||||
// Event type providers.
|
||||
//
|
||||
|
||||
virtual CClientEvents& forCClient() = 0;
|
||||
virtual ClientEvents& forClient() = 0;
|
||||
virtual IStreamEvents& forIStream() = 0;
|
||||
virtual CIpcClientEvents& forCIpcClient() = 0;
|
||||
virtual CIpcClientProxyEvents& forCIpcClientProxy() = 0;
|
||||
virtual CIpcServerEvents& forCIpcServer() = 0;
|
||||
virtual CIpcServerProxyEvents& forCIpcServerProxy() = 0;
|
||||
virtual IpcClientEvents& forIpcClient() = 0;
|
||||
virtual IpcClientProxyEvents& forIpcClientProxy() = 0;
|
||||
virtual IpcServerEvents& forIpcServer() = 0;
|
||||
virtual IpcServerProxyEvents& forIpcServerProxy() = 0;
|
||||
virtual IDataSocketEvents& forIDataSocket() = 0;
|
||||
virtual IListenSocketEvents& forIListenSocket() = 0;
|
||||
virtual ISocketEvents& forISocket() = 0;
|
||||
virtual COSXScreenEvents& forCOSXScreen() = 0;
|
||||
virtual CClientListenerEvents& forCClientListener() = 0;
|
||||
virtual CClientProxyEvents& forCClientProxy() = 0;
|
||||
virtual CClientProxyUnknownEvents& forCClientProxyUnknown() = 0;
|
||||
virtual CServerEvents& forCServer() = 0;
|
||||
virtual CServerAppEvents& forCServerApp() = 0;
|
||||
virtual OSXScreenEvents& forOSXScreen() = 0;
|
||||
virtual ClientListenerEvents& forClientListener() = 0;
|
||||
virtual ClientProxyEvents& forClientProxy() = 0;
|
||||
virtual ClientProxyUnknownEvents& forClientProxyUnknown() = 0;
|
||||
virtual ServerEvents& forServer() = 0;
|
||||
virtual ServerAppEvents& forServerApp() = 0;
|
||||
virtual IKeyStateEvents& forIKeyState() = 0;
|
||||
virtual IPrimaryScreenEvents& forIPrimaryScreen() = 0;
|
||||
virtual IScreenEvents& forIScreen() = 0;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "common/IInterface.h"
|
||||
#include "common/basic_types.h"
|
||||
|
||||
class CEvent;
|
||||
class CEventQueueTimer;
|
||||
class Event;
|
||||
class EventQueueTimer;
|
||||
|
||||
//! Event queue buffer interface
|
||||
/*!
|
||||
@@ -57,11 +57,11 @@ public:
|
||||
Get the next event from the buffer. Return kNone if no event is
|
||||
available. If a system event is next, return kSystem and fill in
|
||||
event. The event data in a system event can point to a static
|
||||
buffer (because CEvent::deleteData() will not attempt to delete
|
||||
buffer (because Event::deleteData() will not attempt to delete
|
||||
data in a kSystem event). Otherwise, return kUser and fill in
|
||||
\p dataID with the value passed to \c addEvent().
|
||||
*/
|
||||
virtual Type getEvent(CEvent& event, UInt32& dataID) = 0;
|
||||
virtual Type getEvent(Event& event, UInt32& dataID) = 0;
|
||||
|
||||
//! Post an event
|
||||
/*!
|
||||
@@ -88,14 +88,14 @@ public:
|
||||
used only by the buffer but it must be a valid object (i.e.
|
||||
not NULL).
|
||||
*/
|
||||
virtual CEventQueueTimer*
|
||||
virtual EventQueueTimer*
|
||||
newTimer(double duration, bool oneShot) const = 0;
|
||||
|
||||
//! Destroy a timer object
|
||||
/*!
|
||||
Destroy a timer object previously returned by \c newTimer().
|
||||
*/
|
||||
virtual void deleteTimer(CEventQueueTimer*) const = 0;
|
||||
virtual void deleteTimer(EventQueueTimer*) const = 0;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
//! Write a message with level
|
||||
/*!
|
||||
Writes \c message, which has the given \c level, to a log.
|
||||
If this method returns true then CLog will stop passing the
|
||||
If this method returns true then Log will stop passing the
|
||||
message to all outputters in the outputter chain, otherwise
|
||||
it continues. Most implementations should return true.
|
||||
*/
|
||||
|
||||
@@ -54,12 +54,12 @@ static const int g_defaultMaxPriority = kINFO;
|
||||
#endif
|
||||
|
||||
//
|
||||
// CLog
|
||||
// Log
|
||||
//
|
||||
|
||||
CLog* CLog::s_log = NULL;
|
||||
Log* Log::s_log = NULL;
|
||||
|
||||
CLog::CLog()
|
||||
Log::Log()
|
||||
{
|
||||
assert(s_log == NULL);
|
||||
|
||||
@@ -69,40 +69,40 @@ CLog::CLog()
|
||||
// other initalization
|
||||
m_maxPriority = g_defaultMaxPriority;
|
||||
m_maxNewlineLength = 0;
|
||||
insert(new CConsoleLogOutputter);
|
||||
insert(new ConsoleLogOutputter);
|
||||
|
||||
s_log = this;
|
||||
}
|
||||
|
||||
CLog::~CLog()
|
||||
Log::~Log()
|
||||
{
|
||||
// clean up
|
||||
for (COutputterList::iterator index = m_outputters.begin();
|
||||
for (OutputterList::iterator index = m_outputters.begin();
|
||||
index != m_outputters.end(); ++index) {
|
||||
delete *index;
|
||||
}
|
||||
for (COutputterList::iterator index = m_alwaysOutputters.begin();
|
||||
for (OutputterList::iterator index = m_alwaysOutputters.begin();
|
||||
index != m_alwaysOutputters.end(); ++index) {
|
||||
delete *index;
|
||||
}
|
||||
ARCH->closeMutex(m_mutex);
|
||||
}
|
||||
|
||||
CLog*
|
||||
CLog::getInstance()
|
||||
Log*
|
||||
Log::getInstance()
|
||||
{
|
||||
assert(s_log != NULL);
|
||||
return s_log;
|
||||
}
|
||||
|
||||
const char*
|
||||
CLog::getFilterName() const
|
||||
Log::getFilterName() const
|
||||
{
|
||||
return getFilterName(getFilter());
|
||||
}
|
||||
|
||||
const char*
|
||||
CLog::getFilterName(int level) const
|
||||
Log::getFilterName(int level) const
|
||||
{
|
||||
if (level < 0) {
|
||||
return "Message";
|
||||
@@ -111,7 +111,7 @@ CLog::getFilterName(int level) const
|
||||
}
|
||||
|
||||
void
|
||||
CLog::print(const char* file, int line, const char* fmt, ...)
|
||||
Log::print(const char* file, int line, const char* fmt, ...)
|
||||
{
|
||||
// check if fmt begins with a priority argument
|
||||
ELevel priority = kINFO;
|
||||
@@ -193,11 +193,11 @@ CLog::print(const char* file, int line, const char* fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
CLog::insert(ILogOutputter* outputter, bool alwaysAtHead)
|
||||
Log::insert(ILogOutputter* outputter, bool alwaysAtHead)
|
||||
{
|
||||
assert(outputter != NULL);
|
||||
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
if (alwaysAtHead) {
|
||||
m_alwaysOutputters.push_front(outputter);
|
||||
}
|
||||
@@ -218,18 +218,18 @@ CLog::insert(ILogOutputter* outputter, bool alwaysAtHead)
|
||||
}
|
||||
|
||||
void
|
||||
CLog::remove(ILogOutputter* outputter)
|
||||
Log::remove(ILogOutputter* outputter)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
m_outputters.remove(outputter);
|
||||
m_alwaysOutputters.remove(outputter);
|
||||
}
|
||||
|
||||
void
|
||||
CLog::pop_front(bool alwaysAtHead)
|
||||
Log::pop_front(bool alwaysAtHead)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
COutputterList* list = alwaysAtHead ? &m_alwaysOutputters : &m_outputters;
|
||||
ArchMutexLock lock(m_mutex);
|
||||
OutputterList* list = alwaysAtHead ? &m_alwaysOutputters : &m_outputters;
|
||||
if (!list->empty()) {
|
||||
delete list->front();
|
||||
list->pop_front();
|
||||
@@ -237,7 +237,7 @@ CLog::pop_front(bool alwaysAtHead)
|
||||
}
|
||||
|
||||
bool
|
||||
CLog::setFilter(const char* maxPriority)
|
||||
Log::setFilter(const char* maxPriority)
|
||||
{
|
||||
if (maxPriority != NULL) {
|
||||
for (int i = 0; i < g_numPriority; ++i) {
|
||||
@@ -252,29 +252,29 @@ CLog::setFilter(const char* maxPriority)
|
||||
}
|
||||
|
||||
void
|
||||
CLog::setFilter(int maxPriority)
|
||||
Log::setFilter(int maxPriority)
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
m_maxPriority = maxPriority;
|
||||
}
|
||||
|
||||
int
|
||||
CLog::getFilter() const
|
||||
Log::getFilter() const
|
||||
{
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
return m_maxPriority;
|
||||
}
|
||||
|
||||
void
|
||||
CLog::output(ELevel priority, char* msg)
|
||||
Log::output(ELevel priority, char* msg)
|
||||
{
|
||||
assert(priority >= -1 && priority < g_numPriority);
|
||||
assert(msg != NULL);
|
||||
if (!msg) return;
|
||||
|
||||
CArchMutexLock lock(m_mutex);
|
||||
ArchMutexLock lock(m_mutex);
|
||||
|
||||
COutputterList::const_iterator i;
|
||||
OutputterList::const_iterator i;
|
||||
|
||||
for (i = m_alwaysOutputters.begin(); i != m_alwaysOutputters.end(); ++i) {
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define CLOG (CLog::getInstance())
|
||||
#define CLOG (Log::getInstance())
|
||||
#define BYE "\nTry `%s --help' for more information."
|
||||
|
||||
class ILogOutputter;
|
||||
class CThread;
|
||||
class Thread;
|
||||
|
||||
//! Logging facility
|
||||
/*!
|
||||
@@ -38,10 +38,10 @@ It supports multithread safe operation, several message priority levels,
|
||||
filtering by priority, and output redirection. The macros LOG() and
|
||||
LOGC() provide convenient access.
|
||||
*/
|
||||
class CLog {
|
||||
class Log {
|
||||
public:
|
||||
CLog();
|
||||
~CLog();
|
||||
Log();
|
||||
~Log();
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
const char* getFilterName(int level) const;
|
||||
|
||||
//! Get the singleton instance of the log
|
||||
static CLog* getInstance();
|
||||
static Log* getInstance();
|
||||
|
||||
//! Get the console filter level (messages above this are not sent to console).
|
||||
int getConsoleMaxLevel() const { return kDEBUG2; }
|
||||
@@ -127,13 +127,13 @@ private:
|
||||
void output(ELevel priority, char* msg);
|
||||
|
||||
private:
|
||||
typedef std::list<ILogOutputter*> COutputterList;
|
||||
typedef std::list<ILogOutputter*> OutputterList;
|
||||
|
||||
static CLog* s_log;
|
||||
static Log* s_log;
|
||||
|
||||
CArchMutex m_mutex;
|
||||
COutputterList m_outputters;
|
||||
COutputterList m_alwaysOutputters;
|
||||
ArchMutex m_mutex;
|
||||
OutputterList m_outputters;
|
||||
OutputterList m_alwaysOutputters;
|
||||
int m_maxNewlineLength;
|
||||
int m_maxPriority;
|
||||
};
|
||||
@@ -149,13 +149,13 @@ LOG((CLOG_XXX "%d and %d are %s", x, y, x == y ? "equal" : "not equal"));
|
||||
\endcode
|
||||
In particular, notice the double open and close parentheses. Also note
|
||||
that there is no comma after the \c CLOG_XXX. The \c XXX should be
|
||||
replaced by one of enumerants in \c CLog::ELevel without the leading
|
||||
replaced by one of enumerants in \c Log::ELevel without the leading
|
||||
\c k. For example, \c CLOG_INFO. The special \c CLOG_PRINT level will
|
||||
not be filtered and is never prefixed by the filename and line number.
|
||||
|
||||
If \c NOLOGGING is defined during the build then this macro expands to
|
||||
nothing. If \c NDEBUG is defined during the build then it expands to a
|
||||
call to CLog::print. Otherwise it expands to a call to CLog::printt,
|
||||
call to Log::print. Otherwise it expands to a call to Log::printt,
|
||||
which includes the filename and line number.
|
||||
*/
|
||||
|
||||
@@ -168,14 +168,14 @@ LOGC(x == y, (CLOG_XXX "%d and %d are equal", x, y));
|
||||
\endcode
|
||||
In particular, notice the parentheses around everything after the boolean
|
||||
expression. Also note that there is no comma after the \c CLOG_XXX.
|
||||
The \c XXX should be replaced by one of enumerants in \c CLog::ELevel
|
||||
The \c XXX should be replaced by one of enumerants in \c Log::ELevel
|
||||
without the leading \c k. For example, \c CLOG_INFO. The special
|
||||
\c CLOG_PRINT level will not be filtered and is never prefixed by the
|
||||
filename and line number.
|
||||
|
||||
If \c NOLOGGING is defined during the build then this macro expands to
|
||||
nothing. If \c NDEBUG is not defined during the build then it expands
|
||||
to a call to CLog::print that prints the filename and line number,
|
||||
to a call to Log::print that prints the filename and line number,
|
||||
otherwise it expands to a call that doesn't.
|
||||
*/
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ template <class T, class Container = std::vector<T>,
|
||||
#else
|
||||
class Compare = std::greater<typename Container::value_type> >
|
||||
#endif
|
||||
class CPriorityQueue {
|
||||
class PriorityQueue {
|
||||
public:
|
||||
typedef typename Container::value_type value_type;
|
||||
typedef typename Container::size_type size_type;
|
||||
@@ -43,9 +43,9 @@ public:
|
||||
typedef typename Container::const_iterator const_iterator;
|
||||
typedef Container container_type;
|
||||
|
||||
CPriorityQueue() { }
|
||||
CPriorityQueue(Container& swappedIn) { swap(swappedIn); }
|
||||
~CPriorityQueue() { }
|
||||
PriorityQueue() { }
|
||||
PriorityQueue(Container& swappedIn) { swap(swappedIn); }
|
||||
~PriorityQueue() { }
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
//! Swap contents with another priority queue
|
||||
void swap(CPriorityQueue<T, Container, Compare>& q)
|
||||
void swap(PriorityQueue<T, Container, Compare>& q)
|
||||
{
|
||||
c.swap(q.c);
|
||||
}
|
||||
|
||||
@@ -21,27 +21,27 @@
|
||||
#include "arch/Arch.h"
|
||||
|
||||
//
|
||||
// CSimpleEventQueueBuffer
|
||||
// SimpleEventQueueBuffer
|
||||
//
|
||||
|
||||
CSimpleEventQueueBuffer::CSimpleEventQueueBuffer()
|
||||
SimpleEventQueueBuffer::SimpleEventQueueBuffer()
|
||||
{
|
||||
m_queueMutex = ARCH->newMutex();
|
||||
m_queueReadyCond = ARCH->newCondVar();
|
||||
m_queueReady = false;
|
||||
}
|
||||
|
||||
CSimpleEventQueueBuffer::~CSimpleEventQueueBuffer()
|
||||
SimpleEventQueueBuffer::~SimpleEventQueueBuffer()
|
||||
{
|
||||
ARCH->closeCondVar(m_queueReadyCond);
|
||||
ARCH->closeMutex(m_queueMutex);
|
||||
}
|
||||
|
||||
void
|
||||
CSimpleEventQueueBuffer::waitForEvent(double timeout)
|
||||
SimpleEventQueueBuffer::waitForEvent(double timeout)
|
||||
{
|
||||
CArchMutexLock lock(m_queueMutex);
|
||||
CStopwatch timer(true);
|
||||
ArchMutexLock lock(m_queueMutex);
|
||||
Stopwatch timer(true);
|
||||
while (!m_queueReady) {
|
||||
double timeLeft = timeout;
|
||||
if (timeLeft >= 0.0) {
|
||||
@@ -55,9 +55,9 @@ CSimpleEventQueueBuffer::waitForEvent(double timeout)
|
||||
}
|
||||
|
||||
IEventQueueBuffer::Type
|
||||
CSimpleEventQueueBuffer::getEvent(CEvent&, UInt32& dataID)
|
||||
SimpleEventQueueBuffer::getEvent(Event&, UInt32& dataID)
|
||||
{
|
||||
CArchMutexLock lock(m_queueMutex);
|
||||
ArchMutexLock lock(m_queueMutex);
|
||||
if (!m_queueReady) {
|
||||
return kNone;
|
||||
}
|
||||
@@ -68,9 +68,9 @@ CSimpleEventQueueBuffer::getEvent(CEvent&, UInt32& dataID)
|
||||
}
|
||||
|
||||
bool
|
||||
CSimpleEventQueueBuffer::addEvent(UInt32 dataID)
|
||||
SimpleEventQueueBuffer::addEvent(UInt32 dataID)
|
||||
{
|
||||
CArchMutexLock lock(m_queueMutex);
|
||||
ArchMutexLock lock(m_queueMutex);
|
||||
m_queue.push_front(dataID);
|
||||
if (!m_queueReady) {
|
||||
m_queueReady = true;
|
||||
@@ -80,20 +80,20 @@ CSimpleEventQueueBuffer::addEvent(UInt32 dataID)
|
||||
}
|
||||
|
||||
bool
|
||||
CSimpleEventQueueBuffer::isEmpty() const
|
||||
SimpleEventQueueBuffer::isEmpty() const
|
||||
{
|
||||
CArchMutexLock lock(m_queueMutex);
|
||||
ArchMutexLock lock(m_queueMutex);
|
||||
return !m_queueReady;
|
||||
}
|
||||
|
||||
CEventQueueTimer*
|
||||
CSimpleEventQueueBuffer::newTimer(double, bool) const
|
||||
EventQueueTimer*
|
||||
SimpleEventQueueBuffer::newTimer(double, bool) const
|
||||
{
|
||||
return new CEventQueueTimer;
|
||||
return new EventQueueTimer;
|
||||
}
|
||||
|
||||
void
|
||||
CSimpleEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const
|
||||
SimpleEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
|
||||
{
|
||||
delete timer;
|
||||
}
|
||||
|
||||
@@ -26,33 +26,33 @@
|
||||
/*!
|
||||
An event queue buffer provides a queue of events for an IEventQueue.
|
||||
*/
|
||||
class CSimpleEventQueueBuffer : public IEventQueueBuffer {
|
||||
class SimpleEventQueueBuffer : public IEventQueueBuffer {
|
||||
public:
|
||||
CSimpleEventQueueBuffer();
|
||||
~CSimpleEventQueueBuffer();
|
||||
SimpleEventQueueBuffer();
|
||||
~SimpleEventQueueBuffer();
|
||||
|
||||
// IEventQueueBuffer overrides
|
||||
void init() { }
|
||||
virtual void waitForEvent(double timeout);
|
||||
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
||||
virtual Type getEvent(Event& event, UInt32& dataID);
|
||||
virtual bool addEvent(UInt32 dataID);
|
||||
virtual bool isEmpty() const;
|
||||
virtual CEventQueueTimer*
|
||||
virtual EventQueueTimer*
|
||||
newTimer(double duration, bool oneShot) const;
|
||||
virtual void deleteTimer(CEventQueueTimer*) const;
|
||||
virtual void deleteTimer(EventQueueTimer*) const;
|
||||
|
||||
private:
|
||||
typedef std::deque<UInt32> CEventDeque;
|
||||
typedef std::deque<UInt32> EventDeque;
|
||||
|
||||
CArchMutex m_queueMutex;
|
||||
CArchCond m_queueReadyCond;
|
||||
ArchMutex m_queueMutex;
|
||||
ArchCond m_queueReadyCond;
|
||||
bool m_queueReady;
|
||||
CEventDeque m_queue;
|
||||
EventDeque m_queue;
|
||||
};
|
||||
|
||||
class CEventQueueTimer
|
||||
class EventQueueTimer
|
||||
{
|
||||
public:
|
||||
CEventQueueTimer() { }
|
||||
virtual ~CEventQueueTimer() { }
|
||||
EventQueueTimer() { }
|
||||
virtual ~EventQueueTimer() { }
|
||||
};
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
#include "arch/Arch.h"
|
||||
|
||||
//
|
||||
// CStopwatch
|
||||
// Stopwatch
|
||||
//
|
||||
|
||||
CStopwatch::CStopwatch(bool triggered) :
|
||||
Stopwatch::Stopwatch(bool triggered) :
|
||||
m_mark(0.0),
|
||||
m_triggered(triggered),
|
||||
m_stopped(triggered)
|
||||
@@ -33,13 +33,13 @@ CStopwatch::CStopwatch(bool triggered) :
|
||||
}
|
||||
}
|
||||
|
||||
CStopwatch::~CStopwatch()
|
||||
Stopwatch::~Stopwatch()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
double
|
||||
CStopwatch::reset()
|
||||
Stopwatch::reset()
|
||||
{
|
||||
if (m_stopped) {
|
||||
const double dt = m_mark;
|
||||
@@ -55,7 +55,7 @@ CStopwatch::reset()
|
||||
}
|
||||
|
||||
void
|
||||
CStopwatch::stop()
|
||||
Stopwatch::stop()
|
||||
{
|
||||
if (m_stopped) {
|
||||
return;
|
||||
@@ -67,7 +67,7 @@ CStopwatch::stop()
|
||||
}
|
||||
|
||||
void
|
||||
CStopwatch::start()
|
||||
Stopwatch::start()
|
||||
{
|
||||
m_triggered = false;
|
||||
if (!m_stopped) {
|
||||
@@ -80,14 +80,14 @@ CStopwatch::start()
|
||||
}
|
||||
|
||||
void
|
||||
CStopwatch::setTrigger()
|
||||
Stopwatch::setTrigger()
|
||||
{
|
||||
stop();
|
||||
m_triggered = true;
|
||||
}
|
||||
|
||||
double
|
||||
CStopwatch::getTime()
|
||||
Stopwatch::getTime()
|
||||
{
|
||||
if (m_triggered) {
|
||||
const double dt = m_mark;
|
||||
@@ -102,19 +102,19 @@ CStopwatch::getTime()
|
||||
}
|
||||
}
|
||||
|
||||
CStopwatch::operator double()
|
||||
Stopwatch::operator double()
|
||||
{
|
||||
return getTime();
|
||||
}
|
||||
|
||||
bool
|
||||
CStopwatch::isStopped() const
|
||||
Stopwatch::isStopped() const
|
||||
{
|
||||
return m_stopped;
|
||||
}
|
||||
|
||||
double
|
||||
CStopwatch::getTime() const
|
||||
Stopwatch::getTime() const
|
||||
{
|
||||
if (m_stopped) {
|
||||
return m_mark;
|
||||
@@ -124,7 +124,7 @@ CStopwatch::getTime() const
|
||||
}
|
||||
}
|
||||
|
||||
CStopwatch::operator double() const
|
||||
Stopwatch::operator double() const
|
||||
{
|
||||
return getTime();
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
This class measures time intervals. All time interval measurement
|
||||
should use this class.
|
||||
*/
|
||||
class CStopwatch {
|
||||
class Stopwatch {
|
||||
public:
|
||||
/*!
|
||||
The default constructor does an implicit reset() or setTrigger().
|
||||
If triggered == false then the clock starts ticking.
|
||||
*/
|
||||
CStopwatch(bool triggered = false);
|
||||
~CStopwatch();
|
||||
Stopwatch(bool triggered = false);
|
||||
~Stopwatch();
|
||||
|
||||
//! @name manipulators
|
||||
//@{
|
||||
|
||||
@@ -31,17 +31,17 @@
|
||||
namespace synergy {
|
||||
namespace string {
|
||||
|
||||
CString
|
||||
String
|
||||
format(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
CString result = vformat(fmt, args);
|
||||
String result = vformat(fmt, args);
|
||||
va_end(args);
|
||||
return result;
|
||||
}
|
||||
|
||||
CString
|
||||
String
|
||||
vformat(const char* fmt, va_list args)
|
||||
{
|
||||
// find highest indexed substitution and the locations of substitutions
|
||||
@@ -106,7 +106,7 @@ vformat(const char* fmt, va_list args)
|
||||
}
|
||||
|
||||
// substitute
|
||||
CString result;
|
||||
String result;
|
||||
result.reserve(resultLength);
|
||||
size_t src = 0;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
@@ -119,13 +119,13 @@ vformat(const char* fmt, va_list args)
|
||||
return result;
|
||||
}
|
||||
|
||||
CString
|
||||
String
|
||||
sprintf(const char* fmt, ...)
|
||||
{
|
||||
char tmp[1024];
|
||||
char* buffer = tmp;
|
||||
int len = (int)(sizeof(tmp) / sizeof(tmp[0]));
|
||||
CString result;
|
||||
String result;
|
||||
while (buffer != NULL) {
|
||||
// try printing into the buffer
|
||||
va_list args;
|
||||
@@ -157,12 +157,12 @@ sprintf(const char* fmt, ...)
|
||||
|
||||
void
|
||||
findReplaceAll(
|
||||
CString& subject,
|
||||
const CString& find,
|
||||
const CString& replace)
|
||||
String& subject,
|
||||
const String& find,
|
||||
const String& replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
while ((pos = subject.find(find, pos)) != CString::npos) {
|
||||
while ((pos = subject.find(find, pos)) != String::npos) {
|
||||
subject.replace(pos, find.length(), replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
@@ -175,8 +175,8 @@ findReplaceAll(
|
||||
|
||||
bool
|
||||
CaselessCmp::cmpEqual(
|
||||
const CString::value_type& a,
|
||||
const CString::value_type& b)
|
||||
const String::value_type& a,
|
||||
const String::value_type& b)
|
||||
{
|
||||
// should use std::tolower but not in all versions of libstdc++ have it
|
||||
return tolower(a) == tolower(b);
|
||||
@@ -184,15 +184,15 @@ CaselessCmp::cmpEqual(
|
||||
|
||||
bool
|
||||
CaselessCmp::cmpLess(
|
||||
const CString::value_type& a,
|
||||
const CString::value_type& b)
|
||||
const String::value_type& a,
|
||||
const String::value_type& b)
|
||||
{
|
||||
// should use std::tolower but not in all versions of libstdc++ have it
|
||||
return tolower(a) < tolower(b);
|
||||
}
|
||||
|
||||
bool
|
||||
CaselessCmp::less(const CString& a, const CString& b)
|
||||
CaselessCmp::less(const String& a, const String& b)
|
||||
{
|
||||
return std::lexicographical_compare(
|
||||
a.begin(), a.end(),
|
||||
@@ -201,13 +201,13 @@ CaselessCmp::less(const CString& a, const CString& b)
|
||||
}
|
||||
|
||||
bool
|
||||
CaselessCmp::equal(const CString& a, const CString& b)
|
||||
CaselessCmp::equal(const String& a, const String& b)
|
||||
{
|
||||
return !(less(a, b) || less(b, a));
|
||||
}
|
||||
|
||||
bool
|
||||
CaselessCmp::operator()(const CString& a, const CString& b) const
|
||||
CaselessCmp::operator()(const String& a, const String& b) const
|
||||
{
|
||||
return less(a, b);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
// use standard C++ string class for our string class
|
||||
typedef std::string CString;
|
||||
typedef std::string String;
|
||||
|
||||
namespace synergy {
|
||||
|
||||
@@ -44,25 +44,25 @@ characters and conversion specifications introduced by `\%':
|
||||
All arguments in the variable list are const char*. Positional
|
||||
elements are indexed from 1.
|
||||
*/
|
||||
CString format(const char* fmt, ...);
|
||||
String format(const char* fmt, ...);
|
||||
|
||||
//! Format positional arguments
|
||||
/*!
|
||||
Same as format() except takes va_list.
|
||||
*/
|
||||
CString vformat(const char* fmt, va_list);
|
||||
String vformat(const char* fmt, va_list);
|
||||
|
||||
//! Print a string using sprintf-style formatting
|
||||
/*!
|
||||
Equivalent to sprintf() except the result is returned as a CString.
|
||||
Equivalent to sprintf() except the result is returned as a String.
|
||||
*/
|
||||
CString sprintf(const char* fmt, ...);
|
||||
String sprintf(const char* fmt, ...);
|
||||
|
||||
//! Find and replace all
|
||||
/*!
|
||||
Finds \c find inside \c subject and replaces it with \c replace
|
||||
*/
|
||||
void findReplaceAll(CString& subject, const CString& find, const CString& replace);
|
||||
void findReplaceAll(String& subject, const String& find, const String& replace);
|
||||
|
||||
//! Case-insensitive comparisons
|
||||
/*!
|
||||
@@ -71,21 +71,21 @@ This class provides case-insensitve comparison functions.
|
||||
class CaselessCmp {
|
||||
public:
|
||||
//! Same as less()
|
||||
bool operator()(const CString& a, const CString& b) const;
|
||||
bool operator()(const String& a, const String& b) const;
|
||||
|
||||
//! Returns true iff \c a is lexicographically less than \c b
|
||||
static bool less(const CString& a, const CString& b);
|
||||
static bool less(const String& a, const String& b);
|
||||
|
||||
//! Returns true iff \c a is lexicographically equal to \c b
|
||||
static bool equal(const CString& a, const CString& b);
|
||||
static bool equal(const String& a, const String& b);
|
||||
|
||||
//! Returns true iff \c a is lexicographically less than \c b
|
||||
static bool cmpLess(const CString::value_type& a,
|
||||
const CString::value_type& b);
|
||||
static bool cmpLess(const String::value_type& a,
|
||||
const String::value_type& b);
|
||||
|
||||
//! Returns true iff \c a is lexicographically equal to \c b
|
||||
static bool cmpEqual(const CString::value_type& a,
|
||||
const CString::value_type& b);
|
||||
static bool cmpEqual(const String::value_type& a,
|
||||
const String::value_type& b);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,23 +29,23 @@ class TMethodEventJob : public IEventJob {
|
||||
public:
|
||||
//! run(event) invokes \c object->method(event, arg)
|
||||
TMethodEventJob(T* object,
|
||||
void (T::*method)(const CEvent&, void*),
|
||||
void (T::*method)(const Event&, void*),
|
||||
void* arg = NULL);
|
||||
virtual ~TMethodEventJob();
|
||||
|
||||
// IJob overrides
|
||||
virtual void run(const CEvent&);
|
||||
virtual void run(const Event&);
|
||||
|
||||
private:
|
||||
T* m_object;
|
||||
void (T::*m_method)(const CEvent&, void*);
|
||||
void (T::*m_method)(const Event&, void*);
|
||||
void* m_arg;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
TMethodEventJob<T>::TMethodEventJob(T* object,
|
||||
void (T::*method)(const CEvent&, void*), void* arg) :
|
||||
void (T::*method)(const Event&, void*), void* arg) :
|
||||
m_object(object),
|
||||
m_method(method),
|
||||
m_arg(arg)
|
||||
@@ -63,7 +63,7 @@ TMethodEventJob<T>::~TMethodEventJob()
|
||||
template <class T>
|
||||
inline
|
||||
void
|
||||
TMethodEventJob<T>::run(const CEvent& event)
|
||||
TMethodEventJob<T>::run(const Event& event)
|
||||
{
|
||||
if (m_object != NULL) {
|
||||
(m_object->*m_method)(event, m_arg);
|
||||
|
||||
@@ -91,14 +91,14 @@ setError(bool* errors)
|
||||
|
||||
|
||||
//
|
||||
// CUnicode
|
||||
// Unicode
|
||||
//
|
||||
|
||||
UInt32 CUnicode::s_invalid = 0x0000ffff;
|
||||
UInt32 CUnicode::s_replacement = 0x0000fffd;
|
||||
UInt32 Unicode::s_invalid = 0x0000ffff;
|
||||
UInt32 Unicode::s_replacement = 0x0000fffd;
|
||||
|
||||
bool
|
||||
CUnicode::isUTF8(const CString& src)
|
||||
Unicode::isUTF8(const String& src)
|
||||
{
|
||||
// convert and test each character
|
||||
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str());
|
||||
@@ -110,15 +110,15 @@ CUnicode::isUTF8(const CString& src)
|
||||
return true;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF8ToUCS2(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF8ToUCS2(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(2 * n);
|
||||
|
||||
// convert each character
|
||||
@@ -139,15 +139,15 @@ CUnicode::UTF8ToUCS2(const CString& src, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF8ToUCS4(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF8ToUCS4(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(4 * n);
|
||||
|
||||
// convert each character
|
||||
@@ -163,15 +163,15 @@ CUnicode::UTF8ToUCS4(const CString& src, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF8ToUTF16(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF8ToUTF16(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(2 * n);
|
||||
|
||||
// convert each character
|
||||
@@ -201,15 +201,15 @@ CUnicode::UTF8ToUTF16(const CString& src, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF8ToUTF32(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF8ToUTF32(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(4 * n);
|
||||
|
||||
// convert each character
|
||||
@@ -229,8 +229,8 @@ CUnicode::UTF8ToUTF32(const CString& src, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF8ToText(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF8ToText(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
@@ -243,7 +243,7 @@ CUnicode::UTF8ToText(const CString& src, bool* errors)
|
||||
int len = ARCH->convStringWCToMB(NULL, tmp, size, errors);
|
||||
char* mbs = new char[len + 1];
|
||||
ARCH->convStringWCToMB(mbs, tmp, size, errors);
|
||||
CString text(mbs, len);
|
||||
String text(mbs, len);
|
||||
|
||||
// clean up
|
||||
delete[] mbs;
|
||||
@@ -252,8 +252,8 @@ CUnicode::UTF8ToText(const CString& src, bool* errors)
|
||||
return text;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UCS2ToUTF8(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UCS2ToUTF8(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
@@ -263,8 +263,8 @@ CUnicode::UCS2ToUTF8(const CString& src, bool* errors)
|
||||
return doUCS2ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UCS4ToUTF8(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UCS4ToUTF8(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
@@ -274,8 +274,8 @@ CUnicode::UCS4ToUTF8(const CString& src, bool* errors)
|
||||
return doUCS4ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF16ToUTF8(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF16ToUTF8(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
@@ -285,8 +285,8 @@ CUnicode::UTF16ToUTF8(const CString& src, bool* errors)
|
||||
return doUTF16ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::UTF32ToUTF8(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::UTF32ToUTF8(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
@@ -296,8 +296,8 @@ CUnicode::UTF32ToUTF8(const CString& src, bool* errors)
|
||||
return doUTF32ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::textToUTF8(const CString& src, bool* errors)
|
||||
String
|
||||
Unicode::textToUTF8(const String& src, bool* errors)
|
||||
{
|
||||
// default to success
|
||||
resetError(errors);
|
||||
@@ -309,7 +309,7 @@ CUnicode::textToUTF8(const CString& src, bool* errors)
|
||||
ARCH->convStringMBToWC(wcs, src.c_str(), n, errors);
|
||||
|
||||
// convert to UTF8
|
||||
CString utf8 = wideCharToUTF8(wcs, len, errors);
|
||||
String utf8 = wideCharToUTF8(wcs, len, errors);
|
||||
|
||||
// clean up
|
||||
delete[] wcs;
|
||||
@@ -318,10 +318,10 @@ CUnicode::textToUTF8(const CString& src, bool* errors)
|
||||
}
|
||||
|
||||
wchar_t*
|
||||
CUnicode::UTF8ToWideChar(const CString& src, UInt32& size, bool* errors)
|
||||
Unicode::UTF8ToWideChar(const String& src, UInt32& size, bool* errors)
|
||||
{
|
||||
// convert to platform's wide character encoding
|
||||
CString tmp;
|
||||
String tmp;
|
||||
switch (ARCH->getWideCharEncoding()) {
|
||||
case IArchString::kUCS2:
|
||||
tmp = UTF8ToUCS2(src, errors);
|
||||
@@ -353,12 +353,12 @@ CUnicode::UTF8ToWideChar(const CString& src, UInt32& size, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors)
|
||||
String
|
||||
Unicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors)
|
||||
{
|
||||
// convert from platform's wide character encoding.
|
||||
// note -- this must include a wide nul character (independent of
|
||||
// the CString's nul character).
|
||||
// the String's nul character).
|
||||
switch (ARCH->getWideCharEncoding()) {
|
||||
case IArchString::kUCS2:
|
||||
return doUCS2ToUTF8(reinterpret_cast<const UInt8*>(src), size, errors);
|
||||
@@ -374,15 +374,15 @@ CUnicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors)
|
||||
|
||||
default:
|
||||
assert(0 && "unknown wide character encoding");
|
||||
return CString();
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
String
|
||||
Unicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
{
|
||||
// make some space
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(n);
|
||||
|
||||
// check if first character is 0xfffe or 0xfeff
|
||||
@@ -414,11 +414,11 @@ CUnicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
String
|
||||
Unicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
{
|
||||
// make some space
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(n);
|
||||
|
||||
// check if first character is 0xfffe or 0xfeff
|
||||
@@ -450,11 +450,11 @@ CUnicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
String
|
||||
Unicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
{
|
||||
// make some space
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(n);
|
||||
|
||||
// check if first character is 0xfffe or 0xfeff
|
||||
@@ -512,11 +512,11 @@ CUnicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
return dst;
|
||||
}
|
||||
|
||||
CString
|
||||
CUnicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
String
|
||||
Unicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
{
|
||||
// make some space
|
||||
CString dst;
|
||||
String dst;
|
||||
dst.reserve(n);
|
||||
|
||||
// check if first character is 0xfffe or 0xfeff
|
||||
@@ -553,7 +553,7 @@ CUnicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors)
|
||||
}
|
||||
|
||||
UInt32
|
||||
CUnicode::fromUTF8(const UInt8*& data, UInt32& n)
|
||||
Unicode::fromUTF8(const UInt8*& data, UInt32& n)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(n != 0);
|
||||
@@ -728,7 +728,7 @@ CUnicode::fromUTF8(const UInt8*& data, UInt32& n)
|
||||
}
|
||||
|
||||
void
|
||||
CUnicode::toUTF8(CString& dst, UInt32 c, bool* errors)
|
||||
Unicode::toUTF8(String& dst, UInt32 c, bool* errors)
|
||||
{
|
||||
UInt8 data[6];
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
This class provides functions for converting between various Unicode
|
||||
encodings and the current locale encoding.
|
||||
*/
|
||||
class CUnicode {
|
||||
class Unicode {
|
||||
public:
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
Returns true iff the string contains a valid sequence of UTF-8
|
||||
encoded characters.
|
||||
*/
|
||||
static bool isUTF8(const CString&);
|
||||
static bool isUTF8(const String&);
|
||||
|
||||
//! Convert from UTF-8 to UCS-2 encoding
|
||||
/*!
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
is set to true iff any character could not be encoded in UCS-2.
|
||||
Decoding errors do not set *errors.
|
||||
*/
|
||||
static CString UTF8ToUCS2(const CString&, bool* errors = NULL);
|
||||
static String UTF8ToUCS2(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UTF-8 to UCS-4 encoding
|
||||
/*!
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
is set to true iff any character could not be encoded in UCS-4.
|
||||
Decoding errors do not set *errors.
|
||||
*/
|
||||
static CString UTF8ToUCS4(const CString&, bool* errors = NULL);
|
||||
static String UTF8ToUCS4(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UTF-8 to UTF-16 encoding
|
||||
/*!
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
is set to true iff any character could not be encoded in UTF-16.
|
||||
Decoding errors do not set *errors.
|
||||
*/
|
||||
static CString UTF8ToUTF16(const CString&, bool* errors = NULL);
|
||||
static String UTF8ToUTF16(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UTF-8 to UTF-32 encoding
|
||||
/*!
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
is set to true iff any character could not be encoded in UTF-32.
|
||||
Decoding errors do not set *errors.
|
||||
*/
|
||||
static CString UTF8ToUTF32(const CString&, bool* errors = NULL);
|
||||
static String UTF8ToUTF32(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UTF-8 to the current locale encoding
|
||||
/*!
|
||||
@@ -76,42 +76,42 @@ public:
|
||||
NULL then *errors is set to true iff any character could not be encoded.
|
||||
Decoding errors do not set *errors.
|
||||
*/
|
||||
static CString UTF8ToText(const CString&, bool* errors = NULL);
|
||||
static String UTF8ToText(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UCS-2 to UTF-8
|
||||
/*!
|
||||
Convert from UCS-2 to UTF-8. If errors is not NULL then *errors is
|
||||
set to true iff any character could not be decoded.
|
||||
*/
|
||||
static CString UCS2ToUTF8(const CString&, bool* errors = NULL);
|
||||
static String UCS2ToUTF8(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UCS-4 to UTF-8
|
||||
/*!
|
||||
Convert from UCS-4 to UTF-8. If errors is not NULL then *errors is
|
||||
set to true iff any character could not be decoded.
|
||||
*/
|
||||
static CString UCS4ToUTF8(const CString&, bool* errors = NULL);
|
||||
static String UCS4ToUTF8(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UTF-16 to UTF-8
|
||||
/*!
|
||||
Convert from UTF-16 to UTF-8. If errors is not NULL then *errors is
|
||||
set to true iff any character could not be decoded.
|
||||
*/
|
||||
static CString UTF16ToUTF8(const CString&, bool* errors = NULL);
|
||||
static String UTF16ToUTF8(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from UTF-32 to UTF-8
|
||||
/*!
|
||||
Convert from UTF-32 to UTF-8. If errors is not NULL then *errors is
|
||||
set to true iff any character could not be decoded.
|
||||
*/
|
||||
static CString UTF32ToUTF8(const CString&, bool* errors = NULL);
|
||||
static String UTF32ToUTF8(const String&, bool* errors = NULL);
|
||||
|
||||
//! Convert from the current locale encoding to UTF-8
|
||||
/*!
|
||||
Convert from the current locale encoding to UTF-8. If errors is not
|
||||
NULL then *errors is set to true iff any character could not be decoded.
|
||||
*/
|
||||
static CString textToUTF8(const CString&, bool* errors = NULL);
|
||||
static String textToUTF8(const String&, bool* errors = NULL);
|
||||
|
||||
//@}
|
||||
|
||||
@@ -120,23 +120,23 @@ private:
|
||||
// to the platform). caller must delete[] the returned string. the
|
||||
// string is *not* nul terminated; the length (in characters) is
|
||||
// returned in size.
|
||||
static wchar_t* UTF8ToWideChar(const CString&,
|
||||
static wchar_t* UTF8ToWideChar(const String&,
|
||||
UInt32& size, bool* errors);
|
||||
|
||||
// convert nul terminated wchar_t string (in platform's native
|
||||
// encoding) to UTF8.
|
||||
static CString wideCharToUTF8(const wchar_t*,
|
||||
static String wideCharToUTF8(const wchar_t*,
|
||||
UInt32 size, bool* errors);
|
||||
|
||||
// internal conversion to UTF8
|
||||
static CString doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static CString doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static CString doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static CString doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static String doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static String doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static String doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
static String doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors);
|
||||
|
||||
// convert characters to/from UTF8
|
||||
static UInt32 fromUTF8(const UInt8*& src, UInt32& size);
|
||||
static void toUTF8(CString& dst, UInt32 c, bool* errors);
|
||||
static void toUTF8(String& dst, UInt32 c, bool* errors);
|
||||
|
||||
private:
|
||||
static UInt32 s_invalid;
|
||||
|
||||
@@ -32,7 +32,7 @@ XBase::XBase() :
|
||||
// do nothing
|
||||
}
|
||||
|
||||
XBase::XBase(const CString& msg) :
|
||||
XBase::XBase(const String& msg) :
|
||||
std::runtime_error(msg)
|
||||
{
|
||||
// do nothing
|
||||
@@ -54,14 +54,14 @@ XBase::what() const _NOEXCEPT
|
||||
return what;
|
||||
}
|
||||
|
||||
CString
|
||||
String
|
||||
XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
|
||||
{
|
||||
// FIXME -- lookup message string using id as an index. set
|
||||
// fmt to that string if it exists.
|
||||
|
||||
// format
|
||||
CString result;
|
||||
String result;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
try {
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
//! Use getWhat() as the result of what()
|
||||
XBase();
|
||||
//! Use \c msg as the result of what()
|
||||
XBase(const CString& msg);
|
||||
XBase(const String& msg);
|
||||
virtual ~XBase() _NOEXCEPT;
|
||||
|
||||
//! Reason for exception
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
protected:
|
||||
//! Get a human readable string describing the exception
|
||||
virtual CString getWhat() const throw() { return ""; }
|
||||
virtual String getWhat() const throw() { return ""; }
|
||||
|
||||
//! Format a string
|
||||
/*!
|
||||
@@ -46,47 +46,47 @@ protected:
|
||||
no format can be found, then replaces positional parameters in
|
||||
the format string and returns the result.
|
||||
*/
|
||||
virtual CString format(const char* id,
|
||||
virtual String format(const char* id,
|
||||
const char* defaultFormat, ...) const throw();
|
||||
private:
|
||||
mutable CString m_what;
|
||||
mutable String m_what;
|
||||
};
|
||||
|
||||
/*!
|
||||
\def XBASE_SUBCLASS
|
||||
Convenience macro to subclass from XBase (or a subclass of it),
|
||||
providing the c'tor taking a const CString&. getWhat() is not
|
||||
providing the c'tor taking a const String&. getWhat() is not
|
||||
declared.
|
||||
*/
|
||||
#define XBASE_SUBCLASS(name_, super_) \
|
||||
class name_ : public super_ { \
|
||||
public: \
|
||||
name_() : super_() { } \
|
||||
name_(const CString& msg) : super_(msg) { } \
|
||||
name_(const String& msg) : super_(msg) { } \
|
||||
virtual ~name_() _NOEXCEPT { } \
|
||||
}
|
||||
|
||||
/*!
|
||||
\def XBASE_SUBCLASS
|
||||
Convenience macro to subclass from XBase (or a subclass of it),
|
||||
providing the c'tor taking a const CString&. getWhat() must be
|
||||
providing the c'tor taking a const String&. getWhat() must be
|
||||
implemented.
|
||||
*/
|
||||
#define XBASE_SUBCLASS_WHAT(name_, super_) \
|
||||
class name_ : public super_ { \
|
||||
public: \
|
||||
name_() : super_() { } \
|
||||
name_(const CString& msg) : super_(msg) { } \
|
||||
name_(const String& msg) : super_(msg) { } \
|
||||
virtual ~name_() _NOEXCEPT { } \
|
||||
\
|
||||
protected: \
|
||||
virtual CString getWhat() const throw(); \
|
||||
virtual String getWhat() const throw(); \
|
||||
}
|
||||
|
||||
/*!
|
||||
\def XBASE_SUBCLASS_FORMAT
|
||||
Convenience macro to subclass from XBase (or a subclass of it),
|
||||
providing the c'tor taking a const CString&. what() is overridden
|
||||
providing the c'tor taking a const String&. what() is overridden
|
||||
to call getWhat() when first called; getWhat() can format the
|
||||
error message and can call what() to get the message passed to the
|
||||
c'tor.
|
||||
@@ -98,7 +98,7 @@ private: \
|
||||
\
|
||||
public: \
|
||||
name_() : super_(), m_state(kDone) { } \
|
||||
name_(const CString& msg) : super_(msg), m_state(kFirst) { } \
|
||||
name_(const String& msg) : super_(msg), m_state(kFirst) { } \
|
||||
virtual ~name_() _NOEXCEPT { } \
|
||||
\
|
||||
virtual const char* what() const _NOEXCEPT \
|
||||
@@ -117,7 +117,7 @@ public: \
|
||||
} \
|
||||
\
|
||||
protected: \
|
||||
virtual CString getWhat() const throw(); \
|
||||
virtual String getWhat() const throw(); \
|
||||
\
|
||||
private: \
|
||||
mutable EState m_state; \
|
||||
|
||||
@@ -23,145 +23,145 @@
|
||||
#include <fstream>
|
||||
|
||||
//
|
||||
// CStopLogOutputter
|
||||
// StopLogOutputter
|
||||
//
|
||||
|
||||
CStopLogOutputter::CStopLogOutputter()
|
||||
StopLogOutputter::StopLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CStopLogOutputter::~CStopLogOutputter()
|
||||
StopLogOutputter::~StopLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CStopLogOutputter::open(const char*)
|
||||
StopLogOutputter::open(const char*)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CStopLogOutputter::close()
|
||||
StopLogOutputter::close()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CStopLogOutputter::show(bool)
|
||||
StopLogOutputter::show(bool)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
bool
|
||||
CStopLogOutputter::write(ELevel, const char*)
|
||||
StopLogOutputter::write(ELevel, const char*)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// CConsoleLogOutputter
|
||||
// ConsoleLogOutputter
|
||||
//
|
||||
|
||||
CConsoleLogOutputter::CConsoleLogOutputter()
|
||||
ConsoleLogOutputter::ConsoleLogOutputter()
|
||||
{
|
||||
}
|
||||
|
||||
CConsoleLogOutputter::~CConsoleLogOutputter()
|
||||
ConsoleLogOutputter::~ConsoleLogOutputter()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CConsoleLogOutputter::open(const char* title)
|
||||
ConsoleLogOutputter::open(const char* title)
|
||||
{
|
||||
ARCH->openConsole(title);
|
||||
}
|
||||
|
||||
void
|
||||
CConsoleLogOutputter::close()
|
||||
ConsoleLogOutputter::close()
|
||||
{
|
||||
ARCH->closeConsole();
|
||||
}
|
||||
|
||||
void
|
||||
CConsoleLogOutputter::show(bool showIfEmpty)
|
||||
ConsoleLogOutputter::show(bool showIfEmpty)
|
||||
{
|
||||
ARCH->showConsole(showIfEmpty);
|
||||
}
|
||||
|
||||
bool
|
||||
CConsoleLogOutputter::write(ELevel level, const char* msg)
|
||||
ConsoleLogOutputter::write(ELevel level, const char* msg)
|
||||
{
|
||||
ARCH->writeConsole(level, msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CConsoleLogOutputter::flush()
|
||||
ConsoleLogOutputter::flush()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// CSystemLogOutputter
|
||||
// SystemLogOutputter
|
||||
//
|
||||
|
||||
CSystemLogOutputter::CSystemLogOutputter()
|
||||
SystemLogOutputter::SystemLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CSystemLogOutputter::~CSystemLogOutputter()
|
||||
SystemLogOutputter::~SystemLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CSystemLogOutputter::open(const char* title)
|
||||
SystemLogOutputter::open(const char* title)
|
||||
{
|
||||
ARCH->openLog(title);
|
||||
}
|
||||
|
||||
void
|
||||
CSystemLogOutputter::close()
|
||||
SystemLogOutputter::close()
|
||||
{
|
||||
ARCH->closeLog();
|
||||
}
|
||||
|
||||
void
|
||||
CSystemLogOutputter::show(bool showIfEmpty)
|
||||
SystemLogOutputter::show(bool showIfEmpty)
|
||||
{
|
||||
ARCH->showLog(showIfEmpty);
|
||||
}
|
||||
|
||||
bool
|
||||
CSystemLogOutputter::write(ELevel level, const char* msg)
|
||||
SystemLogOutputter::write(ELevel level, const char* msg)
|
||||
{
|
||||
ARCH->writeLog(level, msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// CSystemLogger
|
||||
// SystemLogger
|
||||
//
|
||||
|
||||
CSystemLogger::CSystemLogger(const char* title, bool blockConsole) :
|
||||
SystemLogger::SystemLogger(const char* title, bool blockConsole) :
|
||||
m_stop(NULL)
|
||||
{
|
||||
// redirect log messages
|
||||
if (blockConsole) {
|
||||
m_stop = new CStopLogOutputter;
|
||||
m_stop = new StopLogOutputter;
|
||||
CLOG->insert(m_stop);
|
||||
}
|
||||
m_syslog = new CSystemLogOutputter;
|
||||
m_syslog = new SystemLogOutputter;
|
||||
m_syslog->open(title);
|
||||
CLOG->insert(m_syslog);
|
||||
}
|
||||
|
||||
CSystemLogger::~CSystemLogger()
|
||||
SystemLogger::~SystemLogger()
|
||||
{
|
||||
CLOG->remove(m_syslog);
|
||||
delete m_syslog;
|
||||
@@ -173,72 +173,72 @@ CSystemLogger::~CSystemLogger()
|
||||
|
||||
|
||||
//
|
||||
// CBufferedLogOutputter
|
||||
// BufferedLogOutputter
|
||||
//
|
||||
|
||||
CBufferedLogOutputter::CBufferedLogOutputter(UInt32 maxBufferSize) :
|
||||
BufferedLogOutputter::BufferedLogOutputter(UInt32 maxBufferSize) :
|
||||
m_maxBufferSize(maxBufferSize)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CBufferedLogOutputter::~CBufferedLogOutputter()
|
||||
BufferedLogOutputter::~BufferedLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CBufferedLogOutputter::const_iterator
|
||||
CBufferedLogOutputter::begin() const
|
||||
BufferedLogOutputter::const_iterator
|
||||
BufferedLogOutputter::begin() const
|
||||
{
|
||||
return m_buffer.begin();
|
||||
}
|
||||
|
||||
CBufferedLogOutputter::const_iterator
|
||||
CBufferedLogOutputter::end() const
|
||||
BufferedLogOutputter::const_iterator
|
||||
BufferedLogOutputter::end() const
|
||||
{
|
||||
return m_buffer.end();
|
||||
}
|
||||
|
||||
void
|
||||
CBufferedLogOutputter::open(const char*)
|
||||
BufferedLogOutputter::open(const char*)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CBufferedLogOutputter::close()
|
||||
BufferedLogOutputter::close()
|
||||
{
|
||||
// remove all elements from the buffer
|
||||
m_buffer.clear();
|
||||
}
|
||||
|
||||
void
|
||||
CBufferedLogOutputter::show(bool)
|
||||
BufferedLogOutputter::show(bool)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
bool
|
||||
CBufferedLogOutputter::write(ELevel, const char* message)
|
||||
BufferedLogOutputter::write(ELevel, const char* message)
|
||||
{
|
||||
while (m_buffer.size() >= m_maxBufferSize) {
|
||||
m_buffer.pop_front();
|
||||
}
|
||||
m_buffer.push_back(CString(message));
|
||||
m_buffer.push_back(String(message));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// CFileLogOutputter
|
||||
// FileLogOutputter
|
||||
//
|
||||
|
||||
CFileLogOutputter::CFileLogOutputter(const char* logFile)
|
||||
FileLogOutputter::FileLogOutputter(const char* logFile)
|
||||
{
|
||||
setLogFilename(logFile);
|
||||
}
|
||||
|
||||
CFileLogOutputter::~CFileLogOutputter()
|
||||
FileLogOutputter::~FileLogOutputter()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ CFileLogOutputter::setLogFilename(const char* logFile)
|
||||
}
|
||||
|
||||
bool
|
||||
CFileLogOutputter::write(ELevel level, const char *message)
|
||||
FileLogOutputter::write(ELevel level, const char *message)
|
||||
{
|
||||
std::ofstream m_handle;
|
||||
m_handle.open(m_fileName.c_str(), std::fstream::app);
|
||||
@@ -263,48 +263,48 @@ CFileLogOutputter::write(ELevel level, const char *message)
|
||||
}
|
||||
|
||||
void
|
||||
CFileLogOutputter::open(const char *title) {}
|
||||
FileLogOutputter::open(const char *title) {}
|
||||
|
||||
void
|
||||
CFileLogOutputter::close() {}
|
||||
FileLogOutputter::close() {}
|
||||
|
||||
void
|
||||
CFileLogOutputter::show(bool showIfEmpty) {}
|
||||
FileLogOutputter::show(bool showIfEmpty) {}
|
||||
|
||||
//
|
||||
// CMesssageBoxLogOutputter
|
||||
// MesssageBoxLogOutputter
|
||||
//
|
||||
|
||||
CMesssageBoxLogOutputter::CMesssageBoxLogOutputter()
|
||||
MesssageBoxLogOutputter::MesssageBoxLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
CMesssageBoxLogOutputter::~CMesssageBoxLogOutputter()
|
||||
MesssageBoxLogOutputter::~MesssageBoxLogOutputter()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CMesssageBoxLogOutputter::open(const char* title)
|
||||
MesssageBoxLogOutputter::open(const char* title)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CMesssageBoxLogOutputter::close()
|
||||
MesssageBoxLogOutputter::close()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
void
|
||||
CMesssageBoxLogOutputter::show(bool showIfEmpty)
|
||||
MesssageBoxLogOutputter::show(bool showIfEmpty)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
bool
|
||||
CMesssageBoxLogOutputter::write(ELevel level, const char* msg)
|
||||
MesssageBoxLogOutputter::write(ELevel level, const char* msg)
|
||||
{
|
||||
// don't spam user with messages.
|
||||
if (level > kERROR) {
|
||||
|
||||
@@ -33,10 +33,10 @@ This outputter performs no output and returns false from \c write(),
|
||||
causing the logger to stop traversing the outputter chain. Insert
|
||||
this to prevent already inserted outputters from writing.
|
||||
*/
|
||||
class CStopLogOutputter : public ILogOutputter {
|
||||
class StopLogOutputter : public ILogOutputter {
|
||||
public:
|
||||
CStopLogOutputter();
|
||||
virtual ~CStopLogOutputter();
|
||||
StopLogOutputter();
|
||||
virtual ~StopLogOutputter();
|
||||
|
||||
// ILogOutputter overrides
|
||||
virtual void open(const char* title);
|
||||
@@ -50,10 +50,10 @@ public:
|
||||
This outputter writes output to the console. The level for each
|
||||
message is ignored.
|
||||
*/
|
||||
class CConsoleLogOutputter : public ILogOutputter {
|
||||
class ConsoleLogOutputter : public ILogOutputter {
|
||||
public:
|
||||
CConsoleLogOutputter();
|
||||
virtual ~CConsoleLogOutputter();
|
||||
ConsoleLogOutputter();
|
||||
virtual ~ConsoleLogOutputter();
|
||||
|
||||
// ILogOutputter overrides
|
||||
virtual void open(const char* title);
|
||||
@@ -69,10 +69,10 @@ This outputter writes output to the file. The level for each
|
||||
message is ignored.
|
||||
*/
|
||||
|
||||
class CFileLogOutputter : public ILogOutputter {
|
||||
class FileLogOutputter : public ILogOutputter {
|
||||
public:
|
||||
CFileLogOutputter(const char* logFile);
|
||||
virtual ~CFileLogOutputter();
|
||||
FileLogOutputter(const char* logFile);
|
||||
virtual ~FileLogOutputter();
|
||||
|
||||
// ILogOutputter overrides
|
||||
virtual void open(const char* title);
|
||||
@@ -90,10 +90,10 @@ private:
|
||||
/*!
|
||||
This outputter writes output to the system log.
|
||||
*/
|
||||
class CSystemLogOutputter : public ILogOutputter {
|
||||
class SystemLogOutputter : public ILogOutputter {
|
||||
public:
|
||||
CSystemLogOutputter();
|
||||
virtual ~CSystemLogOutputter();
|
||||
SystemLogOutputter();
|
||||
virtual ~SystemLogOutputter();
|
||||
|
||||
// ILogOutputter overrides
|
||||
virtual void open(const char* title);
|
||||
@@ -104,16 +104,16 @@ public:
|
||||
|
||||
//! Write log to system log only
|
||||
/*!
|
||||
Creating an object of this type inserts a CStopLogOutputter followed
|
||||
by a CSystemLogOutputter into CLog. The destructor removes those
|
||||
Creating an object of this type inserts a StopLogOutputter followed
|
||||
by a SystemLogOutputter into Log. The destructor removes those
|
||||
outputters. Add one of these to any scope that needs to write to
|
||||
the system log (only) and restore the old outputters when exiting
|
||||
the scope.
|
||||
*/
|
||||
class CSystemLogger {
|
||||
class SystemLogger {
|
||||
public:
|
||||
CSystemLogger(const char* title, bool blockConsole);
|
||||
~CSystemLogger();
|
||||
SystemLogger(const char* title, bool blockConsole);
|
||||
~SystemLogger();
|
||||
|
||||
private:
|
||||
ILogOutputter* m_syslog;
|
||||
@@ -124,15 +124,15 @@ private:
|
||||
/*!
|
||||
This outputter records the last N log messages.
|
||||
*/
|
||||
class CBufferedLogOutputter : public ILogOutputter {
|
||||
class BufferedLogOutputter : public ILogOutputter {
|
||||
private:
|
||||
typedef std::deque<CString> CBuffer;
|
||||
typedef std::deque<String> Buffer;
|
||||
|
||||
public:
|
||||
typedef CBuffer::const_iterator const_iterator;
|
||||
typedef Buffer::const_iterator const_iterator;
|
||||
|
||||
CBufferedLogOutputter(UInt32 maxBufferSize);
|
||||
virtual ~CBufferedLogOutputter();
|
||||
BufferedLogOutputter(UInt32 maxBufferSize);
|
||||
virtual ~BufferedLogOutputter();
|
||||
|
||||
//! @name accessors
|
||||
//@{
|
||||
@@ -152,17 +152,17 @@ public:
|
||||
virtual bool write(ELevel level, const char* message);
|
||||
private:
|
||||
UInt32 m_maxBufferSize;
|
||||
CBuffer m_buffer;
|
||||
Buffer m_buffer;
|
||||
};
|
||||
|
||||
//! Write log to message box
|
||||
/*!
|
||||
The level for each message is ignored.
|
||||
*/
|
||||
class CMesssageBoxLogOutputter : public ILogOutputter {
|
||||
class MesssageBoxLogOutputter : public ILogOutputter {
|
||||
public:
|
||||
CMesssageBoxLogOutputter();
|
||||
virtual ~CMesssageBoxLogOutputter();
|
||||
MesssageBoxLogOutputter();
|
||||
virtual ~MesssageBoxLogOutputter();
|
||||
|
||||
// ILogOutputter overrides
|
||||
virtual void open(const char* title);
|
||||
|
||||
Reference in New Issue
Block a user