dropped "c" prefix from class names

This commit is contained in:
Nick Bolton 2014-11-11 13:51:47 +00:00
parent f6c05e7635
commit e8e156f0e2
382 changed files with 7430 additions and 7423 deletions

View File

@ -43,8 +43,8 @@ const UINT CMSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] =
}; };
CMSWindowsClientTaskBarReceiver::CMSWindowsClientTaskBarReceiver( CMSWindowsClientTaskBarReceiver::CMSWindowsClientTaskBarReceiver(
HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer, IEventQueue* events) : HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
CClientTaskBarReceiver(events), ClientTaskBarReceiver(events),
m_appInstance(appInstance), m_appInstance(appInstance),
m_window(NULL), m_window(NULL),
m_logBuffer(logBuffer) m_logBuffer(logBuffer)
@ -229,8 +229,8 @@ CMSWindowsClientTaskBarReceiver::copyLog() const
{ {
if (m_logBuffer != NULL) { if (m_logBuffer != NULL) {
// collect log buffer // collect log buffer
CString data; String data;
for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin(); for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) { index != m_logBuffer->end(); ++index) {
data += *index; data += *index;
data += "\n"; data += "\n";
@ -297,14 +297,14 @@ CMSWindowsClientTaskBarReceiver::createWindow()
SetWindowLongPtr(m_window, GWL_EXSTYLE, style); SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog // tell the task bar about this dialog
CArchTaskBarWindows::addDialog(m_window); ArchTaskBarWindows::addDialog(m_window);
} }
void void
CMSWindowsClientTaskBarReceiver::destroyWindow() CMSWindowsClientTaskBarReceiver::destroyWindow()
{ {
if (m_window != NULL) { if (m_window != NULL) {
CArchTaskBarWindows::removeDialog(m_window); ArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window); DestroyWindow(m_window);
m_window = NULL; m_window = NULL;
} }
@ -359,14 +359,14 @@ CMSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd,
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
CArchMiscWindows::setIcons( ArchMiscWindows::setIcons(
(HICON)LoadImage(CArchMiscWindows::instanceWin32(), (HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY), MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON, IMAGE_ICON,
32, 32, LR_SHARED), 32, 32, LR_SHARED),
(HICON)LoadImage(CArchMiscWindows::instanceWin32(), (HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY), MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON, IMAGE_ICON,
16, 16, LR_SHARED)); 16, 16, LR_SHARED));

View File

@ -23,13 +23,13 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
class CBufferedLogOutputter; class BufferedLogOutputter;
class IEventQueue; class IEventQueue;
//! Implementation of CClientTaskBarReceiver for Microsoft Windows //! Implementation of ClientTaskBarReceiver for Microsoft Windows
class CMSWindowsClientTaskBarReceiver : public CClientTaskBarReceiver { class CMSWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
public: public:
CMSWindowsClientTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*, IEventQueue* events); CMSWindowsClientTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
virtual ~CMSWindowsClientTaskBarReceiver(); virtual ~CMSWindowsClientTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides
@ -42,7 +42,7 @@ public:
protected: protected:
void copyLog() const; void copyLog() const;
// CClientTaskBarReceiver overrides // ClientTaskBarReceiver overrides
virtual void onStatusChanged(); virtual void onStatusChanged();
private: private:
@ -62,7 +62,7 @@ private:
HWND m_window; HWND m_window;
HMENU m_menu; HMENU m_menu;
HICON m_icon[kMaxState]; HICON m_icon[kMaxState];
const CBufferedLogOutputter* m_logBuffer; const BufferedLogOutputter* m_logBuffer;
static const UINT s_stateToIconID[]; static const UINT s_stateToIconID[];
}; };

View File

@ -20,50 +20,50 @@
#include "arch/Arch.h" #include "arch/Arch.h"
// //
// COSXClientTaskBarReceiver // OSXClientTaskBarReceiver
// //
COSXClientTaskBarReceiver::COSXClientTaskBarReceiver( OSXClientTaskBarReceiver::OSXClientTaskBarReceiver(
const CBufferedLogOutputter*, const BufferedLogOutputter*,
IEventQueue* events) : IEventQueue* events) :
CClientTaskBarReceiver(events) ClientTaskBarReceiver(events)
{ {
// add ourself to the task bar // add ourself to the task bar
ARCH->addReceiver(this); ARCH->addReceiver(this);
} }
COSXClientTaskBarReceiver::~COSXClientTaskBarReceiver() OSXClientTaskBarReceiver::~OSXClientTaskBarReceiver()
{ {
ARCH->removeReceiver(this); ARCH->removeReceiver(this);
} }
void void
COSXClientTaskBarReceiver::showStatus() OSXClientTaskBarReceiver::showStatus()
{ {
// do nothing // do nothing
} }
void void
COSXClientTaskBarReceiver::runMenu(int, int) OSXClientTaskBarReceiver::runMenu(int, int)
{ {
// do nothing // do nothing
} }
void void
COSXClientTaskBarReceiver::primaryAction() OSXClientTaskBarReceiver::primaryAction()
{ {
// do nothing // do nothing
} }
const IArchTaskBarReceiver::Icon const IArchTaskBarReceiver::Icon
COSXClientTaskBarReceiver::getIcon() const OSXClientTaskBarReceiver::getIcon() const
{ {
return NULL; return NULL;
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
return new COSXClientTaskBarReceiver(logBuffer, events); return new OSXClientTaskBarReceiver(logBuffer, events);
} }

View File

@ -20,14 +20,14 @@
#include "synergy/ClientTaskBarReceiver.h" #include "synergy/ClientTaskBarReceiver.h"
class CBufferedLogOutputter; class BufferedLogOutputter;
class IEventQueue; class IEventQueue;
//! Implementation of CClientTaskBarReceiver for OS X //! Implementation of ClientTaskBarReceiver for OS X
class COSXClientTaskBarReceiver : public CClientTaskBarReceiver { class OSXClientTaskBarReceiver : public ClientTaskBarReceiver {
public: public:
COSXClientTaskBarReceiver(const CBufferedLogOutputter*, IEventQueue* events); OSXClientTaskBarReceiver(const BufferedLogOutputter*, IEventQueue* events);
virtual ~COSXClientTaskBarReceiver(); virtual ~OSXClientTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides
virtual void showStatus(); virtual void showStatus();

View File

@ -24,9 +24,9 @@
// //
CXWindowsClientTaskBarReceiver::CXWindowsClientTaskBarReceiver( CXWindowsClientTaskBarReceiver::CXWindowsClientTaskBarReceiver(
const CBufferedLogOutputter*, const BufferedLogOutputter*,
IEventQueue* events) : IEventQueue* events) :
CClientTaskBarReceiver(events) ClientTaskBarReceiver(events)
{ {
// add ourself to the task bar // add ourself to the task bar
ARCH->addReceiver(this); ARCH->addReceiver(this);
@ -62,7 +62,7 @@ CXWindowsClientTaskBarReceiver::getIcon() const
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
return new CXWindowsClientTaskBarReceiver(logBuffer, events); return new CXWindowsClientTaskBarReceiver(logBuffer, events);
} }

View File

@ -20,14 +20,14 @@
#include "synergy/ClientTaskBarReceiver.h" #include "synergy/ClientTaskBarReceiver.h"
class CBufferedLogOutputter; class BufferedLogOutputter;
class IEventQueue; class IEventQueue;
//! Implementation of CClientTaskBarReceiver for X Windows //! Implementation of ClientTaskBarReceiver for X Windows
class CXWindowsClientTaskBarReceiver : public CClientTaskBarReceiver { class CXWindowsClientTaskBarReceiver : public ClientTaskBarReceiver {
public: public:
CXWindowsClientTaskBarReceiver( CXWindowsClientTaskBarReceiver(
const CBufferedLogOutputter*, IEventQueue* events); const BufferedLogOutputter*, IEventQueue* events);
virtual ~CXWindowsClientTaskBarReceiver(); virtual ~CXWindowsClientTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides

View File

@ -36,15 +36,15 @@ main(int argc, char** argv)
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
// record window instance for tray icon, etc // record window instance for tray icon, etc
CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
#endif #endif
CArch arch; Arch arch;
arch.init(); arch.init();
CLog log; Log log;
CEventQueue events; EventQueue events;
CClientApp app(&events, createTaskBarReceiver); ClientApp app(&events, createTaskBarReceiver);
return app.run(argc, argv); return app.run(argc, argv);
} }

View File

@ -25,7 +25,7 @@
int int
main(int argc, char** argv) main(int argc, char** argv)
{ {
CDaemonApp app; DaemonApp app;
return app.run(argc, argv); return app.run(argc, argv);
} }
@ -37,7 +37,7 @@ main(int argc, char** argv)
int WINAPI int WINAPI
WinMain(HINSTANCE, HINSTANCE, LPSTR, int) WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{ {
CDaemonApp app; DaemonApp app;
return app.run(__argc, __argv); return app.run(__argc, __argv);
} }

View File

@ -42,8 +42,8 @@ const UINT CMSWindowsPortableTaskBarReceiver::s_stateToIconID[kMaxState] =
}; };
CMSWindowsPortableTaskBarReceiver::CMSWindowsPortableTaskBarReceiver( CMSWindowsPortableTaskBarReceiver::CMSWindowsPortableTaskBarReceiver(
HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer, IEventQueue* events) : HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
CPortableTaskBarReceiver(events), PortableTaskBarReceiver(events),
m_events(events), m_events(events),
m_appInstance(appInstance), m_appInstance(appInstance),
m_window(NULL), m_window(NULL),
@ -181,17 +181,17 @@ CMSWindowsPortableTaskBarReceiver::runMenu(int x, int y)
break; break;
case IDC_RELOAD_CONFIG: case IDC_RELOAD_CONFIG:
m_events->addEvent(CEvent(m_events->forCServerApp().reloadConfig(), m_events->addEvent(Event(m_events->forCServerApp().reloadConfig(),
m_events->getSystemTarget())); m_events->getSystemTarget()));
break; break;
case IDC_FORCE_RECONNECT: case IDC_FORCE_RECONNECT:
m_events->addEvent(CEvent(m_events->forCServerApp().forceReconnect(), m_events->addEvent(Event(m_events->forCServerApp().forceReconnect(),
m_events->getSystemTarget())); m_events->getSystemTarget()));
break; break;
case ID_SYNERGY_RESETSERVER: case ID_SYNERGY_RESETSERVER:
m_events->addEvent(CEvent(m_events->forCServerApp().resetServer(), m_events->addEvent(Event(m_events->forCServerApp().resetServer(),
m_events->getSystemTarget())); m_events->getSystemTarget()));
break; break;
@ -246,8 +246,8 @@ CMSWindowsPortableTaskBarReceiver::copyLog() const
{ {
if (m_logBuffer != NULL) { if (m_logBuffer != NULL) {
// collect log buffer // collect log buffer
CString data; String data;
for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin(); for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) { index != m_logBuffer->end(); ++index) {
data += *index; data += *index;
data += "\n"; data += "\n";
@ -314,14 +314,14 @@ CMSWindowsPortableTaskBarReceiver::createWindow()
SetWindowLongPtr(m_window, GWL_EXSTYLE, style); SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog // tell the task bar about this dialog
CArchTaskBarWindows::addDialog(m_window); ArchTaskBarWindows::addDialog(m_window);
} }
void void
CMSWindowsPortableTaskBarReceiver::destroyWindow() CMSWindowsPortableTaskBarReceiver::destroyWindow()
{ {
if (m_window != NULL) { if (m_window != NULL) {
CArchTaskBarWindows::removeDialog(m_window); ArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window); DestroyWindow(m_window);
m_window = NULL; m_window = NULL;
} }
@ -377,14 +377,14 @@ CMSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd,
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
CArchMiscWindows::setIcons( ArchMiscWindows::setIcons(
(HICON)LoadImage(CArchMiscWindows::instanceWin32(), (HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY), MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON, IMAGE_ICON,
32, 32, LR_SHARED), 32, 32, LR_SHARED),
(HICON)LoadImage(CArchMiscWindows::instanceWin32(), (HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY), MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON, IMAGE_ICON,
16, 16, LR_SHARED)); 16, 16, LR_SHARED));

View File

@ -23,13 +23,13 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
class CBufferedLogOutputter; class BufferedLogOutputter;
class IEventQueue; class IEventQueue;
//! Implementation of CPortableTaskBarReceiver for Microsoft Windows //! Implementation of PortableTaskBarReceiver for Microsoft Windows
class CMSWindowsPortableTaskBarReceiver : public CPortableTaskBarReceiver { class CMSWindowsPortableTaskBarReceiver : public PortableTaskBarReceiver {
public: public:
CMSWindowsPortableTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*, IEventQueue* events); CMSWindowsPortableTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
virtual ~CMSWindowsPortableTaskBarReceiver(); virtual ~CMSWindowsPortableTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides
@ -42,7 +42,7 @@ public:
protected: protected:
void copyLog() const; void copyLog() const;
// CPortableTaskBarReceiver overrides // PortableTaskBarReceiver overrides
virtual void onStatusChanged(); virtual void onStatusChanged();
private: private:
@ -62,7 +62,7 @@ private:
HWND m_window; HWND m_window;
HMENU m_menu; HMENU m_menu;
HICON m_icon[kMaxState]; HICON m_icon[kMaxState];
const CBufferedLogOutputter* m_logBuffer; const BufferedLogOutputter* m_logBuffer;
IEventQueue* m_events; IEventQueue* m_events;
static const UINT s_stateToIconID[]; static const UINT s_stateToIconID[];

View File

@ -20,47 +20,47 @@
#include "arch/Arch.h" #include "arch/Arch.h"
// //
// COSXServerTaskBarReceiver // OSXServerTaskBarReceiver
// //
COSXServerTaskBarReceiver::COSXServerTaskBarReceiver( OSXServerTaskBarReceiver::OSXServerTaskBarReceiver(
const CBufferedLogOutputter*) const BufferedLogOutputter*)
{ {
// add ourself to the task bar // add ourself to the task bar
ARCH->addReceiver(this); ARCH->addReceiver(this);
} }
COSXServerTaskBarReceiver::~COSXServerTaskBarReceiver() OSXServerTaskBarReceiver::~OSXServerTaskBarReceiver()
{ {
ARCH->removeReceiver(this); ARCH->removeReceiver(this);
} }
void void
COSXServerTaskBarReceiver::showStatus() OSXServerTaskBarReceiver::showStatus()
{ {
// do nothing // do nothing
} }
void void
COSXServerTaskBarReceiver::runMenu(int, int) OSXServerTaskBarReceiver::runMenu(int, int)
{ {
// do nothing // do nothing
} }
void void
COSXServerTaskBarReceiver::primaryAction() OSXServerTaskBarReceiver::primaryAction()
{ {
// do nothing // do nothing
} }
const IArchTaskBarReceiver::Icon const IArchTaskBarReceiver::Icon
COSXServerTaskBarReceiver::getIcon() const OSXServerTaskBarReceiver::getIcon() const
{ {
return NULL; return NULL;
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer) createTaskBarReceiver(const BufferedLogOutputter* logBuffer)
{ {
return new COSXServerTaskBarReceiver(logBuffer); return new OSXServerTaskBarReceiver(logBuffer);
} }

View File

@ -20,13 +20,13 @@
#include "synergyp/PortableTaskBarReceiver.h" #include "synergyp/PortableTaskBarReceiver.h"
class CBufferedLogOutputter; class BufferedLogOutputter;
//! Implementation of CPortableTaskBarReceiver for OS X //! Implementation of PortableTaskBarReceiver for OS X
class COSXServerTaskBarReceiver : public CPortableTaskBarReceiver { class OSXServerTaskBarReceiver : public PortableTaskBarReceiver {
public: public:
COSXServerTaskBarReceiver(const CBufferedLogOutputter*); OSXServerTaskBarReceiver(const BufferedLogOutputter*);
virtual ~COSXServerTaskBarReceiver(); virtual ~OSXServerTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides
virtual void showStatus(); virtual void showStatus();

View File

@ -24,7 +24,7 @@
// //
CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver( CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver(
const CBufferedLogOutputter*) const BufferedLogOutputter*)
{ {
// add ourself to the task bar // add ourself to the task bar
ARCH->addReceiver(this); ARCH->addReceiver(this);
@ -60,7 +60,7 @@ CXWindowsServerTaskBarReceiver::getIcon() const
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer) createTaskBarReceiver(const BufferedLogOutputter* logBuffer)
{ {
return new CXWindowsServerTaskBarReceiver(logBuffer); return new CXWindowsServerTaskBarReceiver(logBuffer);
} }

View File

@ -20,12 +20,12 @@
#include "synergyp/PortableTaskBarReceiver.h" #include "synergyp/PortableTaskBarReceiver.h"
class CBufferedLogOutputter; class BufferedLogOutputter;
//! Implementation of CPortableTaskBarReceiver for X Windows //! Implementation of PortableTaskBarReceiver for X Windows
class CXWindowsServerTaskBarReceiver : public CPortableTaskBarReceiver { class CXWindowsServerTaskBarReceiver : public PortableTaskBarReceiver {
public: public:
CXWindowsServerTaskBarReceiver(const CBufferedLogOutputter*); CXWindowsServerTaskBarReceiver(const BufferedLogOutputter*);
virtual ~CXWindowsServerTaskBarReceiver(); virtual ~CXWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides

View File

@ -39,16 +39,16 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdSh
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
// record window instance for tray icon, etc // record window instance for tray icon, etc
CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
#endif #endif
CArch arch; Arch arch;
arch.init(); arch.init();
CLog log; Log log;
CEventQueue events; EventQueue events;
CLOG->insert(new CMesssageBoxLogOutputter()); CLOG->insert(new MesssageBoxLogOutputter());
int argc = __argc; int argc = __argc;
char** argv = __argv; char** argv = __argv;
@ -79,11 +79,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdSh
} }
if (server) { if (server) {
CServerApp app(&events, createTaskBarReceiver); ServerApp app(&events, createTaskBarReceiver);
return app.run(argc, argv); return app.run(argc, argv);
} }
else if (client) { else if (client) {
CClientApp app(&events, createTaskBarReceiver); ClientApp app(&events, createTaskBarReceiver);
return app.run(argc, argv); return app.run(argc, argv);
} }

View File

@ -43,8 +43,8 @@ const UINT CMSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] =
}; };
CMSWindowsServerTaskBarReceiver::CMSWindowsServerTaskBarReceiver( CMSWindowsServerTaskBarReceiver::CMSWindowsServerTaskBarReceiver(
HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer, IEventQueue* events) : HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) :
CServerTaskBarReceiver(events), ServerTaskBarReceiver(events),
m_events(events), m_events(events),
m_appInstance(appInstance), m_appInstance(appInstance),
m_window(NULL), m_window(NULL),
@ -93,7 +93,7 @@ CMSWindowsServerTaskBarReceiver::showStatus()
std::string status = getToolTip(); std::string status = getToolTip();
// get the connect clients, if any // get the connect clients, if any
const CClients& clients = getClients(); const Clients& clients = getClients();
// done getting status // done getting status
unlock(); unlock();
@ -103,7 +103,7 @@ CMSWindowsServerTaskBarReceiver::showStatus()
SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str()); SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str());
child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_CLIENTS); child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_CLIENTS);
SendMessage(child, LB_RESETCONTENT, 0, 0); SendMessage(child, LB_RESETCONTENT, 0, 0);
for (CClients::const_iterator index = clients.begin(); for (Clients::const_iterator index = clients.begin();
index != clients.end(); ) { index != clients.end(); ) {
const char* client = index->c_str(); const char* client = index->c_str();
if (++index == clients.end()) { if (++index == clients.end()) {
@ -195,17 +195,17 @@ CMSWindowsServerTaskBarReceiver::runMenu(int x, int y)
break; break;
case IDC_RELOAD_CONFIG: case IDC_RELOAD_CONFIG:
m_events->addEvent(CEvent(m_events->forCServerApp().reloadConfig(), m_events->addEvent(Event(m_events->forCServerApp().reloadConfig(),
m_events->getSystemTarget())); m_events->getSystemTarget()));
break; break;
case IDC_FORCE_RECONNECT: case IDC_FORCE_RECONNECT:
m_events->addEvent(CEvent(m_events->forCServerApp().forceReconnect(), m_events->addEvent(Event(m_events->forCServerApp().forceReconnect(),
m_events->getSystemTarget())); m_events->getSystemTarget()));
break; break;
case ID_SYNERGY_RESETSERVER: case ID_SYNERGY_RESETSERVER:
m_events->addEvent(CEvent(m_events->forCServerApp().resetServer(), m_events->addEvent(Event(m_events->forCServerApp().resetServer(),
m_events->getSystemTarget())); m_events->getSystemTarget()));
break; break;
@ -260,8 +260,8 @@ CMSWindowsServerTaskBarReceiver::copyLog() const
{ {
if (m_logBuffer != NULL) { if (m_logBuffer != NULL) {
// collect log buffer // collect log buffer
CString data; String data;
for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin(); for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin();
index != m_logBuffer->end(); ++index) { index != m_logBuffer->end(); ++index) {
data += *index; data += *index;
data += "\n"; data += "\n";
@ -328,14 +328,14 @@ CMSWindowsServerTaskBarReceiver::createWindow()
SetWindowLongPtr(m_window, GWL_EXSTYLE, style); SetWindowLongPtr(m_window, GWL_EXSTYLE, style);
// tell the task bar about this dialog // tell the task bar about this dialog
CArchTaskBarWindows::addDialog(m_window); ArchTaskBarWindows::addDialog(m_window);
} }
void void
CMSWindowsServerTaskBarReceiver::destroyWindow() CMSWindowsServerTaskBarReceiver::destroyWindow()
{ {
if (m_window != NULL) { if (m_window != NULL) {
CArchTaskBarWindows::removeDialog(m_window); ArchTaskBarWindows::removeDialog(m_window);
DestroyWindow(m_window); DestroyWindow(m_window);
m_window = NULL; m_window = NULL;
} }
@ -391,14 +391,14 @@ CMSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd,
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
CArchMiscWindows::setIcons( ArchMiscWindows::setIcons(
(HICON)LoadImage(CArchMiscWindows::instanceWin32(), (HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY), MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON, IMAGE_ICON,
32, 32, LR_SHARED), 32, 32, LR_SHARED),
(HICON)LoadImage(CArchMiscWindows::instanceWin32(), (HICON)LoadImage(ArchMiscWindows::instanceWin32(),
MAKEINTRESOURCE(IDI_SYNERGY), MAKEINTRESOURCE(IDI_SYNERGY),
IMAGE_ICON, IMAGE_ICON,
16, 16, LR_SHARED)); 16, 16, LR_SHARED));

View File

@ -23,13 +23,13 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
class CBufferedLogOutputter; class BufferedLogOutputter;
class IEventQueue; class IEventQueue;
//! Implementation of CServerTaskBarReceiver for Microsoft Windows //! Implementation of ServerTaskBarReceiver for Microsoft Windows
class CMSWindowsServerTaskBarReceiver : public CServerTaskBarReceiver { class CMSWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
public: public:
CMSWindowsServerTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*, IEventQueue* events); CMSWindowsServerTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events);
virtual ~CMSWindowsServerTaskBarReceiver(); virtual ~CMSWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides
@ -42,7 +42,7 @@ public:
protected: protected:
void copyLog() const; void copyLog() const;
// CServerTaskBarReceiver overrides // ServerTaskBarReceiver overrides
virtual void onStatusChanged(); virtual void onStatusChanged();
private: private:
@ -62,7 +62,7 @@ private:
HWND m_window; HWND m_window;
HMENU m_menu; HMENU m_menu;
HICON m_icon[kMaxState]; HICON m_icon[kMaxState];
const CBufferedLogOutputter* m_logBuffer; const BufferedLogOutputter* m_logBuffer;
IEventQueue* m_events; IEventQueue* m_events;
static const UINT s_stateToIconID[]; static const UINT s_stateToIconID[];

View File

@ -20,48 +20,48 @@
#include "arch/Arch.h" #include "arch/Arch.h"
// //
// COSXServerTaskBarReceiver // OSXServerTaskBarReceiver
// //
COSXServerTaskBarReceiver::COSXServerTaskBarReceiver( OSXServerTaskBarReceiver::OSXServerTaskBarReceiver(
const CBufferedLogOutputter*, IEventQueue* events) : const BufferedLogOutputter*, IEventQueue* events) :
CServerTaskBarReceiver(events) ServerTaskBarReceiver(events)
{ {
// add ourself to the task bar // add ourself to the task bar
ARCH->addReceiver(this); ARCH->addReceiver(this);
} }
COSXServerTaskBarReceiver::~COSXServerTaskBarReceiver() OSXServerTaskBarReceiver::~OSXServerTaskBarReceiver()
{ {
ARCH->removeReceiver(this); ARCH->removeReceiver(this);
} }
void void
COSXServerTaskBarReceiver::showStatus() OSXServerTaskBarReceiver::showStatus()
{ {
// do nothing // do nothing
} }
void void
COSXServerTaskBarReceiver::runMenu(int, int) OSXServerTaskBarReceiver::runMenu(int, int)
{ {
// do nothing // do nothing
} }
void void
COSXServerTaskBarReceiver::primaryAction() OSXServerTaskBarReceiver::primaryAction()
{ {
// do nothing // do nothing
} }
const IArchTaskBarReceiver::Icon const IArchTaskBarReceiver::Icon
COSXServerTaskBarReceiver::getIcon() const OSXServerTaskBarReceiver::getIcon() const
{ {
return NULL; return NULL;
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
return new COSXServerTaskBarReceiver(logBuffer, events); return new OSXServerTaskBarReceiver(logBuffer, events);
} }

View File

@ -20,13 +20,13 @@
#include "synergy/ServerTaskBarReceiver.h" #include "synergy/ServerTaskBarReceiver.h"
class CBufferedLogOutputter; class BufferedLogOutputter;
//! Implementation of CServerTaskBarReceiver for OS X //! Implementation of ServerTaskBarReceiver for OS X
class COSXServerTaskBarReceiver : public CServerTaskBarReceiver { class OSXServerTaskBarReceiver : public ServerTaskBarReceiver {
public: public:
COSXServerTaskBarReceiver(const CBufferedLogOutputter*, IEventQueue* events); OSXServerTaskBarReceiver(const BufferedLogOutputter*, IEventQueue* events);
virtual ~COSXServerTaskBarReceiver(); virtual ~OSXServerTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides
virtual void showStatus(); virtual void showStatus();

View File

@ -24,8 +24,8 @@
// //
CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver( CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver(
const CBufferedLogOutputter*, IEventQueue* events) : const BufferedLogOutputter*, IEventQueue* events) :
CServerTaskBarReceiver(events) ServerTaskBarReceiver(events)
{ {
// add ourself to the task bar // add ourself to the task bar
ARCH->addReceiver(this); ARCH->addReceiver(this);
@ -61,7 +61,7 @@ CXWindowsServerTaskBarReceiver::getIcon() const
} }
IArchTaskBarReceiver* IArchTaskBarReceiver*
createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events)
{ {
return new CXWindowsServerTaskBarReceiver(logBuffer, events); return new CXWindowsServerTaskBarReceiver(logBuffer, events);
} }

View File

@ -20,14 +20,14 @@
#include "synergy/ServerTaskBarReceiver.h" #include "synergy/ServerTaskBarReceiver.h"
class CBufferedLogOutputter; class BufferedLogOutputter;
class IEventQueue; class IEventQueue;
//! Implementation of CServerTaskBarReceiver for X Windows //! Implementation of ServerTaskBarReceiver for X Windows
class CXWindowsServerTaskBarReceiver : public CServerTaskBarReceiver { class CXWindowsServerTaskBarReceiver : public ServerTaskBarReceiver {
public: public:
CXWindowsServerTaskBarReceiver( CXWindowsServerTaskBarReceiver(
const CBufferedLogOutputter*, IEventQueue* events); const BufferedLogOutputter*, IEventQueue* events);
virtual ~CXWindowsServerTaskBarReceiver(); virtual ~CXWindowsServerTaskBarReceiver();
// IArchTaskBarReceiver overrides // IArchTaskBarReceiver overrides

View File

@ -36,15 +36,15 @@ main(int argc, char** argv)
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
// record window instance for tray icon, etc // record window instance for tray icon, etc
CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
#endif #endif
CArch arch; Arch arch;
arch.init(); arch.init();
CLog log; Log log;
CEventQueue events; EventQueue events;
CServerApp app(&events, createTaskBarReceiver); ServerApp app(&events, createTaskBarReceiver);
return app.run(argc, argv); return app.run(argc, argv);
} }

View File

@ -23,12 +23,12 @@ main(int argc, char** argv)
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
// record window instance for tray icon, etc // record window instance for tray icon, etc
CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
#endif #endif
CArch arch; Arch arch;
arch.init(); arch.init();
CToolApp app; ToolApp app;
return app.run(argc, argv); return app.run(argc, argv);
} }

View File

@ -19,36 +19,36 @@
#include "arch/Arch.h" #include "arch/Arch.h"
// //
// CArch // Arch
// //
CArch* CArch::s_instance = NULL; Arch* Arch::s_instance = NULL;
CArch::CArch() Arch::Arch()
{ {
assert(s_instance == NULL); assert(s_instance == NULL);
s_instance = this; s_instance = this;
} }
CArch::~CArch() Arch::~Arch()
{ {
#if SYSAPI_WIN32 #if SYSAPI_WIN32
CArchMiscWindows::cleanup(); ArchMiscWindows::cleanup();
#endif #endif
} }
void void
CArch::init() Arch::init()
{ {
ARCH_NETWORK::init(); ARCH_NETWORK::init();
#if SYSAPI_WIN32 #if SYSAPI_WIN32
ARCH_TASKBAR::init(); ARCH_TASKBAR::init();
CArchMiscWindows::init(); ArchMiscWindows::init();
#endif #endif
} }
CArch* Arch*
CArch::getInstance() Arch::getInstance()
{ {
assert(s_instance != NULL); assert(s_instance != NULL);
return s_instance; return s_instance;

View File

@ -72,9 +72,9 @@
/*! /*!
\def ARCH \def ARCH
This macro evaluates to the singleton CArch object. This macro evaluates to the singleton Arch object.
*/ */
#define ARCH (CArch::getInstance()) #define ARCH (Arch::getInstance())
//! Delegating implementation of architecture dependent interfaces //! Delegating implementation of architecture dependent interfaces
/*! /*!
@ -86,7 +86,7 @@ to each method to those implementations. Clients should use the
exactly one of these objects before attempting to call any method, exactly one of these objects before attempting to call any method,
typically at the beginning of \c main(). typically at the beginning of \c main().
*/ */
class CArch : public ARCH_CONSOLE, class Arch : public ARCH_CONSOLE,
public ARCH_DAEMON, public ARCH_DAEMON,
public ARCH_FILE, public ARCH_FILE,
public ARCH_LOG, public ARCH_LOG,
@ -98,8 +98,8 @@ class CArch : public ARCH_CONSOLE,
public ARCH_TASKBAR, public ARCH_TASKBAR,
public ARCH_TIME { public ARCH_TIME {
public: public:
CArch(); Arch();
virtual ~CArch(); virtual ~Arch();
//! Call init on other arch classes. //! Call init on other arch classes.
/*! /*!
@ -114,32 +114,32 @@ public:
//! Return the singleton instance //! Return the singleton instance
/*! /*!
The client must have instantiated exactly once CArch object before The client must have instantiated exactly once Arch object before
calling this function. calling this function.
*/ */
static CArch* getInstance(); static Arch* getInstance();
ARCH_PLUGIN& plugin() const { return (ARCH_PLUGIN&)m_plugin; } ARCH_PLUGIN& plugin() const { return (ARCH_PLUGIN&)m_plugin; }
ARCH_INTERNET& internet() const { return (ARCH_INTERNET&)m_internet; } ARCH_INTERNET& internet() const { return (ARCH_INTERNET&)m_internet; }
private: private:
static CArch* s_instance; static Arch* s_instance;
ARCH_PLUGIN m_plugin; ARCH_PLUGIN m_plugin;
ARCH_INTERNET m_internet; ARCH_INTERNET m_internet;
}; };
//! Convenience object to lock/unlock an arch mutex //! Convenience object to lock/unlock an arch mutex
class CArchMutexLock { class ArchMutexLock {
public: public:
CArchMutexLock(CArchMutex mutex) : m_mutex(mutex) ArchMutexLock(ArchMutex mutex) : m_mutex(mutex)
{ {
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
} }
~CArchMutexLock() ~ArchMutexLock()
{ {
ARCH->unlockMutex(m_mutex); ARCH->unlockMutex(m_mutex);
} }
private: private:
CArchMutex m_mutex; ArchMutex m_mutex;
}; };

View File

@ -22,7 +22,7 @@
#include <iostream> #include <iostream>
void void
CArchConsoleStd::writeConsole(ELevel level, const char* str) ArchConsoleStd::writeConsole(ELevel level, const char* str)
{ {
if ((level >= kFATAL) && (level <= kWARNING)) if ((level >= kFATAL) && (level <= kWARNING))
std::cerr << str << std::endl; std::cerr << str << std::endl;

View File

@ -21,10 +21,10 @@
#include "arch/IArchConsole.h" #include "arch/IArchConsole.h"
//! Cross platform implementation of IArchConsole //! Cross platform implementation of IArchConsole
class CArchConsoleStd : public IArchConsole { class ArchConsoleStd : public IArchConsole {
public: public:
CArchConsoleStd() { } ArchConsoleStd() { }
virtual ~CArchConsoleStd() { } virtual ~ArchConsoleStd() { }
// IArchConsole overrides // IArchConsole overrides
virtual void openConsole(const char* title) { } virtual void openConsole(const char* title) { }

View File

@ -19,21 +19,21 @@
#include "arch/ArchDaemonNone.h" #include "arch/ArchDaemonNone.h"
// //
// CArchDaemonNone // ArchDaemonNone
// //
CArchDaemonNone::CArchDaemonNone() ArchDaemonNone::ArchDaemonNone()
{ {
// do nothing // do nothing
} }
CArchDaemonNone::~CArchDaemonNone() ArchDaemonNone::~ArchDaemonNone()
{ {
// do nothing // do nothing
} }
void void
CArchDaemonNone::installDaemon(const char*, ArchDaemonNone::installDaemon(const char*,
const char*, const char*,
const char*, const char*,
const char*, const char*,
@ -43,13 +43,13 @@ CArchDaemonNone::installDaemon(const char*,
} }
void void
CArchDaemonNone::uninstallDaemon(const char*) ArchDaemonNone::uninstallDaemon(const char*)
{ {
// do nothing // do nothing
} }
int int
CArchDaemonNone::daemonize(const char* name, DaemonFunc func) ArchDaemonNone::daemonize(const char* name, DaemonFunc func)
{ {
// simply forward the call to func. obviously, this doesn't // simply forward the call to func. obviously, this doesn't
// do any daemonizing. // do any daemonizing.
@ -57,29 +57,29 @@ CArchDaemonNone::daemonize(const char* name, DaemonFunc func)
} }
bool bool
CArchDaemonNone::canInstallDaemon(const char*) ArchDaemonNone::canInstallDaemon(const char*)
{ {
return false; return false;
} }
bool bool
CArchDaemonNone::isDaemonInstalled(const char*) ArchDaemonNone::isDaemonInstalled(const char*)
{ {
return false; return false;
} }
void void
CArchDaemonNone::installDaemon() ArchDaemonNone::installDaemon()
{ {
} }
void void
CArchDaemonNone::uninstallDaemon() ArchDaemonNone::uninstallDaemon()
{ {
} }
std::string std::string
CArchDaemonNone::commandLine() const ArchDaemonNone::commandLine() const
{ {
return ""; return "";
} }

View File

@ -20,7 +20,7 @@
#include "arch/IArchDaemon.h" #include "arch/IArchDaemon.h"
#define ARCH_DAEMON CArchDaemonNone #define ARCH_DAEMON ArchDaemonNone
//! Dummy implementation of IArchDaemon //! Dummy implementation of IArchDaemon
/*! /*!
@ -29,10 +29,10 @@ daemons. The install and uninstall functions do nothing, the query
functions return false, and \c daemonize() simply calls the passed functions return false, and \c daemonize() simply calls the passed
function and returns its result. function and returns its result.
*/ */
class CArchDaemonNone : public IArchDaemon { class ArchDaemonNone : public IArchDaemon {
public: public:
CArchDaemonNone(); ArchDaemonNone();
virtual ~CArchDaemonNone(); virtual ~ArchDaemonNone();
// IArchDaemon overrides // IArchDaemon overrides
virtual void installDaemon(const char* name, virtual void installDaemon(const char* name,

View File

@ -86,16 +86,16 @@ public:
Becomes a service. Argument 0 is the name of the service Becomes a service. Argument 0 is the name of the service
and the rest are the arguments passed to StartService(). and the rest are the arguments passed to StartService().
\c func is only called when the service is actually started. \c func is only called when the service is actually started.
\c func must call \c CArchMiscWindows::runDaemon() to finally \c func must call \c ArchMiscWindows::runDaemon() to finally
becoming a service. The \c runFunc function passed to \c runDaemon() becoming a service. The \c runFunc function passed to \c runDaemon()
must call \c CArchMiscWindows::daemonRunning(true) when it must call \c ArchMiscWindows::daemonRunning(true) when it
enters the main loop (i.e. after initialization) and enters the main loop (i.e. after initialization) and
\c CArchMiscWindows::daemonRunning(false) when it leaves \c ArchMiscWindows::daemonRunning(false) when it leaves
the main loop. The \c stopFunc function passed to \c runDaemon() the main loop. The \c stopFunc function passed to \c runDaemon()
is called when the daemon must exit the main loop and it must cause is called when the daemon must exit the main loop and it must cause
\c runFunc to return. \c func should return what \c runDaemon() \c runFunc to return. \c func should return what \c runDaemon()
returns. \c func or \c runFunc can call returns. \c func or \c runFunc can call
\c CArchMiscWindows::daemonFailed() to indicate startup failure. \c ArchMiscWindows::daemonFailed() to indicate startup failure.
</ul> </ul>
*/ */
virtual int daemonize(const char* name, DaemonFunc func) = 0; virtual int daemonize(const char* name, DaemonFunc func) = 0;

View File

@ -21,47 +21,47 @@
#include "common/IInterface.h" #include "common/IInterface.h"
/*! /*!
\class CArchCondImpl \class ArchCondImpl
\brief Internal condition variable data. \brief Internal condition variable data.
An architecture dependent type holding the necessary data for a An architecture dependent type holding the necessary data for a
condition variable. condition variable.
*/ */
class CArchCondImpl; class ArchCondImpl;
/*! /*!
\var CArchCond \var ArchCond
\brief Opaque condition variable type. \brief Opaque condition variable type.
An opaque type representing a condition variable. An opaque type representing a condition variable.
*/ */
typedef CArchCondImpl* CArchCond; typedef ArchCondImpl* ArchCond;
/*! /*!
\class CArchMutexImpl \class ArchMutexImpl
\brief Internal mutex data. \brief Internal mutex data.
An architecture dependent type holding the necessary data for a mutex. An architecture dependent type holding the necessary data for a mutex.
*/ */
class CArchMutexImpl; class ArchMutexImpl;
/*! /*!
\var CArchMutex \var ArchMutex
\brief Opaque mutex type. \brief Opaque mutex type.
An opaque type representing a mutex. An opaque type representing a mutex.
*/ */
typedef CArchMutexImpl* CArchMutex; typedef ArchMutexImpl* ArchMutex;
/*! /*!
\class CArchThreadImpl \class ArchThreadImpl
\brief Internal thread data. \brief Internal thread data.
An architecture dependent type holding the necessary data for a thread. An architecture dependent type holding the necessary data for a thread.
*/ */
class CArchThreadImpl; class ArchThreadImpl;
/*! /*!
\var CArchThread \var ArchThread
\brief Opaque thread type. \brief Opaque thread type.
An opaque type representing a thread. An opaque type representing a thread.
*/ */
typedef CArchThreadImpl* CArchThread; typedef ArchThreadImpl* ArchThread;
//! Interface for architecture dependent multithreading //! Interface for architecture dependent multithreading
/*! /*!
@ -100,22 +100,22 @@ public:
/*! /*!
The condition variable is an opaque data type. The condition variable is an opaque data type.
*/ */
virtual CArchCond newCondVar() = 0; virtual ArchCond newCondVar() = 0;
//! Destroy a condition variable //! Destroy a condition variable
virtual void closeCondVar(CArchCond) = 0; virtual void closeCondVar(ArchCond) = 0;
//! Signal a condition variable //! Signal a condition variable
/*! /*!
Signalling a condition variable releases one waiting thread. Signalling a condition variable releases one waiting thread.
*/ */
virtual void signalCondVar(CArchCond) = 0; virtual void signalCondVar(ArchCond) = 0;
//! Broadcast a condition variable //! Broadcast a condition variable
/*! /*!
Broadcasting a condition variable releases all waiting threads. Broadcasting a condition variable releases all waiting threads.
*/ */
virtual void broadcastCondVar(CArchCond) = 0; virtual void broadcastCondVar(ArchCond) = 0;
//! Wait on a condition variable //! Wait on a condition variable
/*! /*!
@ -128,7 +128,7 @@ public:
(Cancellation point) (Cancellation point)
*/ */
virtual bool waitCondVar(CArchCond, CArchMutex, double timeout) = 0; virtual bool waitCondVar(ArchCond, ArchMutex, double timeout) = 0;
// //
// mutex methods // mutex methods
@ -140,16 +140,16 @@ public:
when it already holds a lock on that mutex. The mutex is an when it already holds a lock on that mutex. The mutex is an
opaque data type. opaque data type.
*/ */
virtual CArchMutex newMutex() = 0; virtual ArchMutex newMutex() = 0;
//! Destroy a mutex //! Destroy a mutex
virtual void closeMutex(CArchMutex) = 0; virtual void closeMutex(ArchMutex) = 0;
//! Lock a mutex //! Lock a mutex
virtual void lockMutex(CArchMutex) = 0; virtual void lockMutex(ArchMutex) = 0;
//! Unlock a mutex //! Unlock a mutex
virtual void unlockMutex(CArchMutex) = 0; virtual void unlockMutex(ArchMutex) = 0;
// //
// thread methods // thread methods
@ -160,19 +160,19 @@ public:
Creates and starts a new thread, using \c func as the entry point Creates and starts a new thread, using \c func as the entry point
and passing it \c userData. The thread is an opaque data type. and passing it \c userData. The thread is an opaque data type.
*/ */
virtual CArchThread newThread(ThreadFunc func, void* userData) = 0; virtual ArchThread newThread(ThreadFunc func, void* userData) = 0;
//! Get a reference to the calling thread //! Get a reference to the calling thread
/*! /*!
Returns a thread representing the current (i.e. calling) thread. Returns a thread representing the current (i.e. calling) thread.
*/ */
virtual CArchThread newCurrentThread() = 0; virtual ArchThread newCurrentThread() = 0;
//! Copy a thread object //! Copy a thread object
/*! /*!
Returns a reference to to thread referred to by \c thread. Returns a reference to to thread referred to by \c thread.
*/ */
virtual CArchThread copyThread(CArchThread thread) = 0; virtual ArchThread copyThread(ArchThread thread) = 0;
//! Release a thread reference //! Release a thread reference
/*! /*!
@ -181,7 +181,7 @@ public:
Use cancelThread() and waitThread() to stop a thread and wait for Use cancelThread() and waitThread() to stop a thread and wait for
it to exit. it to exit.
*/ */
virtual void closeThread(CArchThread) = 0; virtual void closeThread(ArchThread) = 0;
//! Force a thread to exit //! Force a thread to exit
/*! /*!
@ -191,7 +191,7 @@ public:
must always let cancellation go to completion but may take as must always let cancellation go to completion but may take as
long as necessary to clean up. long as necessary to clean up.
*/ */
virtual void cancelThread(CArchThread thread) = 0; virtual void cancelThread(ArchThread thread) = 0;
//! Change thread priority //! Change thread priority
/*! /*!
@ -199,7 +199,7 @@ public:
the thread has a lower priority and if negative a higher priority. the thread has a lower priority and if negative a higher priority.
Some architectures may not support either or both directions. Some architectures may not support either or both directions.
*/ */
virtual void setPriorityOfThread(CArchThread, int n) = 0; virtual void setPriorityOfThread(ArchThread, int n) = 0;
//! Cancellation point //! Cancellation point
/*! /*!
@ -220,20 +220,20 @@ public:
(Cancellation point) (Cancellation point)
*/ */
virtual bool wait(CArchThread thread, double timeout) = 0; virtual bool wait(ArchThread thread, double timeout) = 0;
//! Compare threads //! Compare threads
/*! /*!
Returns true iff two thread objects refer to the same thread. Returns true iff two thread objects refer to the same thread.
Note that comparing thread objects directly is meaningless. Note that comparing thread objects directly is meaningless.
*/ */
virtual bool isSameThread(CArchThread, CArchThread) = 0; virtual bool isSameThread(ArchThread, ArchThread) = 0;
//! Test if thread exited //! Test if thread exited
/*! /*!
Returns true iff \c thread has exited. Returns true iff \c thread has exited.
*/ */
virtual bool isExitedThread(CArchThread thread) = 0; virtual bool isExitedThread(ArchThread thread) = 0;
//! Returns the exit code of a thread //! Returns the exit code of a thread
/*! /*!
@ -242,7 +242,7 @@ public:
(Cancellation point) (Cancellation point)
*/ */
virtual void* getResultOfThread(CArchThread thread) = 0; virtual void* getResultOfThread(ArchThread thread) = 0;
//! Returns an ID for a thread //! Returns an ID for a thread
/*! /*!
@ -251,7 +251,7 @@ public:
However, clients should us isSameThread() to compare thread objects However, clients should us isSameThread() to compare thread objects
instead of comparing IDs. instead of comparing IDs.
*/ */
virtual ThreadID getIDOfThread(CArchThread thread) = 0; virtual ThreadID getIDOfThread(ArchThread thread) = 0;
//! Set the interrupt handler //! Set the interrupt handler
/*! /*!

View File

@ -21,37 +21,37 @@
#include "common/IInterface.h" #include "common/IInterface.h"
#include "common/stdstring.h" #include "common/stdstring.h"
class CArchThreadImpl; class ArchThreadImpl;
typedef CArchThreadImpl* CArchThread; typedef ArchThreadImpl* ArchThread;
/*! /*!
\class CArchSocketImpl \class ArchSocketImpl
\brief Internal socket data. \brief Internal socket data.
An architecture dependent type holding the necessary data for a socket. An architecture dependent type holding the necessary data for a socket.
*/ */
class CArchSocketImpl; class ArchSocketImpl;
/*! /*!
\var CArchSocket \var ArchSocket
\brief Opaque socket type. \brief Opaque socket type.
An opaque type representing a socket. An opaque type representing a socket.
*/ */
typedef CArchSocketImpl* CArchSocket; typedef ArchSocketImpl* ArchSocket;
/*! /*!
\class CArchNetAddressImpl \class ArchNetAddressImpl
\brief Internal network address data. \brief Internal network address data.
An architecture dependent type holding the necessary data for a network An architecture dependent type holding the necessary data for a network
address. address.
*/ */
class CArchNetAddressImpl; class ArchNetAddressImpl;
/*! /*!
\var CArchNetAddress \var ArchNetAddress
\brief Opaque network address type. \brief Opaque network address type.
An opaque type representing a network address. An opaque type representing a network address.
*/ */
typedef CArchNetAddressImpl* CArchNetAddress; typedef ArchNetAddressImpl* ArchNetAddress;
//! Interface for architecture dependent networking //! Interface for architecture dependent networking
/*! /*!
@ -85,10 +85,10 @@ public:
}; };
//! A socket query for \c poll() //! A socket query for \c poll()
class CPollEntry { class PollEntry {
public: public:
//! The socket to query //! The socket to query
CArchSocket m_socket; ArchSocket m_socket;
//! The events to query for //! The events to query for
/*! /*!
@ -108,13 +108,13 @@ public:
/*! /*!
The socket is an opaque data type. The socket is an opaque data type.
*/ */
virtual CArchSocket newSocket(EAddressFamily, ESocketType) = 0; virtual ArchSocket newSocket(EAddressFamily, ESocketType) = 0;
//! Copy a socket object //! Copy a socket object
/*! /*!
Returns a reference to to socket referred to by \c s. Returns a reference to to socket referred to by \c s.
*/ */
virtual CArchSocket copySocket(CArchSocket s) = 0; virtual ArchSocket copySocket(ArchSocket s) = 0;
//! Release a socket reference //! Release a socket reference
/*! /*!
@ -122,31 +122,31 @@ public:
the object referred to until there are no remaining references for the object referred to until there are no remaining references for
the socket. the socket.
*/ */
virtual void closeSocket(CArchSocket s) = 0; virtual void closeSocket(ArchSocket s) = 0;
//! Close socket for further reads //! Close socket for further reads
/*! /*!
Calling this disallows future reads on socket \c s. Calling this disallows future reads on socket \c s.
*/ */
virtual void closeSocketForRead(CArchSocket s) = 0; virtual void closeSocketForRead(ArchSocket s) = 0;
//! Close socket for further writes //! Close socket for further writes
/*! /*!
Calling this disallows future writes on socket \c s. Calling this disallows future writes on socket \c s.
*/ */
virtual void closeSocketForWrite(CArchSocket s) = 0; virtual void closeSocketForWrite(ArchSocket s) = 0;
//! Bind socket to address //! Bind socket to address
/*! /*!
Binds socket \c s to the address \c addr. Binds socket \c s to the address \c addr.
*/ */
virtual void bindSocket(CArchSocket s, CArchNetAddress addr) = 0; virtual void bindSocket(ArchSocket s, ArchNetAddress addr) = 0;
//! Listen for connections on socket //! Listen for connections on socket
/*! /*!
Causes the socket \c s to begin listening for incoming connections. Causes the socket \c s to begin listening for incoming connections.
*/ */
virtual void listenOnSocket(CArchSocket s) = 0; virtual void listenOnSocket(ArchSocket s) = 0;
//! Accept connection on socket //! Accept connection on socket
/*! /*!
@ -158,7 +158,7 @@ public:
it's not in the listening state and it's connected. Returns NULL it's not in the listening state and it's connected. Returns NULL
if there are no pending connection requests. if there are no pending connection requests.
*/ */
virtual CArchSocket acceptSocket(CArchSocket s, CArchNetAddress* addr) = 0; virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress* addr) = 0;
//! Connect socket //! Connect socket
/*! /*!
@ -169,7 +169,7 @@ public:
socket for writing to detect when the connection finally succeeds socket for writing to detect when the connection finally succeeds
or fails. or fails.
*/ */
virtual bool connectSocket(CArchSocket s, CArchNetAddress addr) = 0; virtual bool connectSocket(ArchSocket s, ArchNetAddress addr) = 0;
//! Check socket state //! Check socket state
/*! /*!
@ -186,7 +186,7 @@ public:
(Cancellation point) (Cancellation point)
*/ */
virtual int pollSocket(CPollEntry[], int num, double timeout) = 0; virtual int pollSocket(PollEntry[], int num, double timeout) = 0;
//! Unblock thread in pollSocket() //! Unblock thread in pollSocket()
/*! /*!
@ -194,7 +194,7 @@ public:
call may return before the thread is unblocked. If the thread is call may return before the thread is unblocked. If the thread is
not in a pollSocket() call this call has no effect. not in a pollSocket() call this call has no effect.
*/ */
virtual void unblockPollSocket(CArchThread thread) = 0; virtual void unblockPollSocket(ArchThread thread) = 0;
//! Read data from socket //! Read data from socket
/*! /*!
@ -203,7 +203,7 @@ public:
if not enough data is available. Returns 0 if the remote end has if not enough data is available. Returns 0 if the remote end has
disconnected and/or there is no more queued received data. disconnected and/or there is no more queued received data.
*/ */
virtual size_t readSocket(CArchSocket s, void* buf, size_t len) = 0; virtual size_t readSocket(ArchSocket s, void* buf, size_t len) = 0;
//! Write data from socket //! Write data from socket
/*! /*!
@ -212,7 +212,7 @@ public:
\c len if the remote end disconnected or the internal buffers fill \c len if the remote end disconnected or the internal buffers fill
up. up.
*/ */
virtual size_t writeSocket(CArchSocket s, virtual size_t writeSocket(ArchSocket s,
const void* buf, size_t len) = 0; const void* buf, size_t len) = 0;
//! Check error on socket //! Check error on socket
@ -220,61 +220,61 @@ public:
If the socket \c s is in an error state then throws an appropriate If the socket \c s is in an error state then throws an appropriate
XArchNetwork exception. XArchNetwork exception.
*/ */
virtual void throwErrorOnSocket(CArchSocket s) = 0; virtual void throwErrorOnSocket(ArchSocket s) = 0;
//! Turn Nagle algorithm on or off on socket //! Turn Nagle algorithm on or off on socket
/*! /*!
Set socket to send messages immediately (true) or to collect small Set socket to send messages immediately (true) or to collect small
messages into one packet (false). Returns the previous state. messages into one packet (false). Returns the previous state.
*/ */
virtual bool setNoDelayOnSocket(CArchSocket, bool noDelay) = 0; virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay) = 0;
//! Turn address reuse on or off on socket //! Turn address reuse on or off on socket
/*! /*!
Allows the address this socket is bound to to be reused while in the Allows the address this socket is bound to to be reused while in the
TIME_WAIT state. Returns the previous state. TIME_WAIT state. Returns the previous state.
*/ */
virtual bool setReuseAddrOnSocket(CArchSocket, bool reuse) = 0; virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse) = 0;
//! Return local host's name //! Return local host's name
virtual std::string getHostName() = 0; virtual std::string getHostName() = 0;
//! Create an "any" network address //! Create an "any" network address
virtual CArchNetAddress newAnyAddr(EAddressFamily) = 0; virtual ArchNetAddress newAnyAddr(EAddressFamily) = 0;
//! Copy a network address //! Copy a network address
virtual CArchNetAddress copyAddr(CArchNetAddress) = 0; virtual ArchNetAddress copyAddr(ArchNetAddress) = 0;
//! Convert a name to a network address //! Convert a name to a network address
virtual CArchNetAddress nameToAddr(const std::string&) = 0; virtual ArchNetAddress nameToAddr(const std::string&) = 0;
//! Destroy a network address //! Destroy a network address
virtual void closeAddr(CArchNetAddress) = 0; virtual void closeAddr(ArchNetAddress) = 0;
//! Convert an address to a host name //! Convert an address to a host name
virtual std::string addrToName(CArchNetAddress) = 0; virtual std::string addrToName(ArchNetAddress) = 0;
//! Convert an address to a string //! Convert an address to a string
virtual std::string addrToString(CArchNetAddress) = 0; virtual std::string addrToString(ArchNetAddress) = 0;
//! Get an address's family //! Get an address's family
virtual EAddressFamily getAddrFamily(CArchNetAddress) = 0; virtual EAddressFamily getAddrFamily(ArchNetAddress) = 0;
//! Set the port of an address //! Set the port of an address
virtual void setAddrPort(CArchNetAddress, int port) = 0; virtual void setAddrPort(ArchNetAddress, int port) = 0;
//! Get the port of an address //! Get the port of an address
virtual int getAddrPort(CArchNetAddress) = 0; virtual int getAddrPort(ArchNetAddress) = 0;
//! Test addresses for equality //! Test addresses for equality
virtual bool isEqualAddr(CArchNetAddress, CArchNetAddress) = 0; virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress) = 0;
//! Test for the "any" address //! Test for the "any" address
/*! /*!
Returns true if \c addr is the "any" address. \c newAnyAddr() Returns true if \c addr is the "any" address. \c newAnyAddr()
returns an "any" address. returns an "any" address.
*/ */
virtual bool isAnyAddr(CArchNetAddress addr) = 0; virtual bool isAnyAddr(ArchNetAddress addr) = 0;
//@} //@}

View File

@ -24,7 +24,7 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
static CArchMutex s_mutex = NULL; static ArchMutex s_mutex = NULL;
// //
// use C library non-reentrant multibyte conversion with mutex // use C library non-reentrant multibyte conversion with mutex

View File

@ -90,7 +90,7 @@ public:
*/ */
virtual std::string getToolTip() const = 0; virtual std::string getToolTip() const = 0;
virtual void updateStatus(INode*, const CString& errorMsg) = 0; virtual void updateStatus(INode*, const String& errorMsg) = 0;
virtual void cleanup() {} virtual void cleanup() {}

View File

@ -18,6 +18,6 @@
#include "arch/unix/ArchConsoleUnix.h" #include "arch/unix/ArchConsoleUnix.h"
CArchConsoleUnix::CArchConsoleUnix() { } ArchConsoleUnix::ArchConsoleUnix() { }
CArchConsoleUnix::~CArchConsoleUnix() { } ArchConsoleUnix::~ArchConsoleUnix() { }

View File

@ -20,10 +20,10 @@
#include "arch/ArchConsoleStd.h" #include "arch/ArchConsoleStd.h"
#define ARCH_CONSOLE CArchConsoleUnix #define ARCH_CONSOLE ArchConsoleUnix
class CArchConsoleUnix : public CArchConsoleStd { class ArchConsoleUnix : public ArchConsoleStd {
public: public:
CArchConsoleUnix(); ArchConsoleUnix();
virtual ~CArchConsoleUnix(); virtual ~ArchConsoleUnix();
}; };

View File

@ -29,15 +29,15 @@
#include <cstdlib> #include <cstdlib>
// //
// CArchDaemonUnix // ArchDaemonUnix
// //
CArchDaemonUnix::CArchDaemonUnix() ArchDaemonUnix::ArchDaemonUnix()
{ {
// do nothing // do nothing
} }
CArchDaemonUnix::~CArchDaemonUnix() ArchDaemonUnix::~ArchDaemonUnix()
{ {
// do nothing // do nothing
} }
@ -67,7 +67,7 @@ bool alreadyDaemonized() {
#endif #endif
int int
CArchDaemonUnix::daemonize(const char* name, DaemonFunc func) ArchDaemonUnix::daemonize(const char* name, DaemonFunc func)
{ {
#ifdef __APPLE__ #ifdef __APPLE__
if (alreadyDaemonized()) if (alreadyDaemonized())

View File

@ -21,13 +21,13 @@
#include "arch/ArchDaemonNone.h" #include "arch/ArchDaemonNone.h"
#undef ARCH_DAEMON #undef ARCH_DAEMON
#define ARCH_DAEMON CArchDaemonUnix #define ARCH_DAEMON ArchDaemonUnix
//! Unix implementation of IArchDaemon //! Unix implementation of IArchDaemon
class CArchDaemonUnix : public CArchDaemonNone { class ArchDaemonUnix : public ArchDaemonNone {
public: public:
CArchDaemonUnix(); ArchDaemonUnix();
virtual ~CArchDaemonUnix(); virtual ~ArchDaemonUnix();
// IArchDaemon overrides // IArchDaemon overrides
virtual int daemonize(const char* name, DaemonFunc func); virtual int daemonize(const char* name, DaemonFunc func);

View File

@ -25,21 +25,21 @@
#include <cstring> #include <cstring>
// //
// CArchFileUnix // ArchFileUnix
// //
CArchFileUnix::CArchFileUnix() ArchFileUnix::ArchFileUnix()
{ {
// do nothing // do nothing
} }
CArchFileUnix::~CArchFileUnix() ArchFileUnix::~ArchFileUnix()
{ {
// do nothing // do nothing
} }
const char* const char*
CArchFileUnix::getBasename(const char* pathname) ArchFileUnix::getBasename(const char* pathname)
{ {
if (pathname == NULL) { if (pathname == NULL) {
return NULL; return NULL;
@ -55,7 +55,7 @@ CArchFileUnix::getBasename(const char* pathname)
} }
std::string std::string
CArchFileUnix::getUserDirectory() ArchFileUnix::getUserDirectory()
{ {
char* buffer = NULL; char* buffer = NULL;
std::string dir; std::string dir;
@ -83,13 +83,12 @@ CArchFileUnix::getUserDirectory()
} }
std::string std::string
CArchFileUnix::getSystemDirectory() ArchFileUnix::getSystemDirectory()
{ {
return "/etc"; return "/etc";
} }
std::string ArchFileUnix::getInstalledDirectory()
CArchFileUnix::getInstalledDirectory()
{ {
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
return "/bin"; return "/bin";
@ -99,13 +98,13 @@ CArchFileUnix::getInstalledDirectory()
} }
std::string std::string
CArchFileUnix::getLogDirectory() ArchFileUnix::getLogDirectory()
{ {
return "/var/log"; return "/var/log";
} }
std::string std::string
CArchFileUnix::concatPath(const std::string& prefix, ArchFileUnix::concatPath(const std::string& prefix,
const std::string& suffix) const std::string& suffix)
{ {
std::string path; std::string path;

View File

@ -20,13 +20,13 @@
#include "arch/IArchFile.h" #include "arch/IArchFile.h"
#define ARCH_FILE CArchFileUnix #define ARCH_FILE ArchFileUnix
//! Unix implementation of IArchFile //! Unix implementation of IArchFile
class CArchFileUnix : public IArchFile { class ArchFileUnix : public IArchFile {
public: public:
CArchFileUnix(); ArchFileUnix();
virtual ~CArchFileUnix(); virtual ~ArchFileUnix();
// IArchFile overrides // IArchFile overrides
virtual const char* getBasename(const char* pathname); virtual const char* getBasename(const char* pathname);

View File

@ -28,26 +28,26 @@ class CurlFacade {
public: public:
CurlFacade(); CurlFacade();
~CurlFacade(); ~CurlFacade();
CString get(const CString& url); String get(const String& url);
CString urlEncode(const CString& url); String urlEncode(const String& url);
private: private:
CURL* m_curl; CURL* m_curl;
}; };
// //
// CArchInternetUnix // ArchInternetUnix
// //
CString String
CArchInternetUnix::get(const CString& url) ArchInternetUnix::get(const String& url)
{ {
CurlFacade curl; CurlFacade curl;
return curl.get(url); return curl.get(url);
} }
CString String
CArchInternetUnix::urlEncode(const CString& url) ArchInternetUnix::urlEncode(const String& url)
{ {
CurlFacade curl; CurlFacade curl;
return curl.urlEncode(url); return curl.urlEncode(url);
@ -87,8 +87,8 @@ CurlFacade::~CurlFacade()
curl_global_cleanup(); curl_global_cleanup();
} }
CString String
CurlFacade::get(const CString& url) CurlFacade::get(const String& url)
{ {
curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, curlWriteCallback); curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, curlWriteCallback);
@ -110,8 +110,8 @@ CurlFacade::get(const CString& url)
return result; return result;
} }
CString String
CurlFacade::urlEncode(const CString& url) CurlFacade::urlEncode(const String& url)
{ {
char* resultCStr = curl_easy_escape(m_curl, url.c_str(), 0); char* resultCStr = curl_easy_escape(m_curl, url.c_str(), 0);

View File

@ -17,12 +17,12 @@
#pragma once #pragma once
#define ARCH_INTERNET CArchInternetUnix #define ARCH_INTERNET ArchInternetUnix
#include "base/String.h" #include "base/String.h"
class CArchInternetUnix { class ArchInternetUnix {
public: public:
CString get(const CString& url); String get(const String& url);
CString urlEncode(const CString& url); String urlEncode(const String& url);
}; };

View File

@ -21,39 +21,39 @@
#include <syslog.h> #include <syslog.h>
// //
// CArchLogUnix // ArchLogUnix
// //
CArchLogUnix::CArchLogUnix() ArchLogUnix::ArchLogUnix()
{ {
// do nothing // do nothing
} }
CArchLogUnix::~CArchLogUnix() ArchLogUnix::~ArchLogUnix()
{ {
// do nothing // do nothing
} }
void void
CArchLogUnix::openLog(const char* name) ArchLogUnix::openLog(const char* name)
{ {
openlog(name, 0, LOG_DAEMON); openlog(name, 0, LOG_DAEMON);
} }
void void
CArchLogUnix::closeLog() ArchLogUnix::closeLog()
{ {
closelog(); closelog();
} }
void void
CArchLogUnix::showLog(bool) ArchLogUnix::showLog(bool)
{ {
// do nothing // do nothing
} }
void void
CArchLogUnix::writeLog(ELevel level, const char* msg) ArchLogUnix::writeLog(ELevel level, const char* msg)
{ {
// convert level // convert level
int priority; int priority;

View File

@ -20,13 +20,13 @@
#include "arch/IArchLog.h" #include "arch/IArchLog.h"
#define ARCH_LOG CArchLogUnix #define ARCH_LOG ArchLogUnix
//! Unix implementation of IArchLog //! Unix implementation of IArchLog
class CArchLogUnix : public IArchLog { class ArchLogUnix : public IArchLog {
public: public:
CArchLogUnix(); ArchLogUnix();
virtual ~CArchLogUnix(); virtual ~ArchLogUnix();
// IArchLog overrides // IArchLog overrides
virtual void openLog(const char* name); virtual void openLog(const char* name);

View File

@ -59,12 +59,12 @@ setSignalSet(sigset_t* sigset)
} }
// //
// CArchThreadImpl // ArchThreadImpl
// //
class CArchThreadImpl { class ArchThreadImpl {
public: public:
CArchThreadImpl(); ArchThreadImpl();
public: public:
int m_refCount; int m_refCount;
@ -79,7 +79,7 @@ public:
void* m_networkData; void* m_networkData;
}; };
CArchThreadImpl::CArchThreadImpl() : ArchThreadImpl::ArchThreadImpl() :
m_refCount(1), m_refCount(1),
m_id(0), m_id(0),
m_func(NULL), m_func(NULL),
@ -95,12 +95,12 @@ CArchThreadImpl::CArchThreadImpl() :
// //
// CArchMultithreadPosix // ArchMultithreadPosix
// //
CArchMultithreadPosix* CArchMultithreadPosix::s_instance = NULL; ArchMultithreadPosix* ArchMultithreadPosix::s_instance = NULL;
CArchMultithreadPosix::CArchMultithreadPosix() : ArchMultithreadPosix::ArchMultithreadPosix() :
m_newThreadCalled(false), m_newThreadCalled(false),
m_nextID(0) m_nextID(0)
{ {
@ -119,7 +119,7 @@ CArchMultithreadPosix::CArchMultithreadPosix() :
// create thread for calling (main) thread and add it to our // create thread for calling (main) thread and add it to our
// list. no need to lock the mutex since we're the only thread. // list. no need to lock the mutex since we're the only thread.
m_mainThread = new CArchThreadImpl; m_mainThread = new ArchThreadImpl;
m_mainThread->m_thread = pthread_self(); m_mainThread->m_thread = pthread_self();
insert(m_mainThread); insert(m_mainThread);
@ -149,7 +149,7 @@ CArchMultithreadPosix::CArchMultithreadPosix() :
pthread_sigmask(SIG_BLOCK, &sigset, NULL); pthread_sigmask(SIG_BLOCK, &sigset, NULL);
} }
CArchMultithreadPosix::~CArchMultithreadPosix() ArchMultithreadPosix::~ArchMultithreadPosix()
{ {
assert(s_instance != NULL); assert(s_instance != NULL);
@ -158,16 +158,16 @@ CArchMultithreadPosix::~CArchMultithreadPosix()
} }
void void
CArchMultithreadPosix::setNetworkDataForCurrentThread(void* data) ArchMultithreadPosix::setNetworkDataForCurrentThread(void* data)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = find(pthread_self()); ArchThreadImpl* thread = find(pthread_self());
thread->m_networkData = data; thread->m_networkData = data;
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
} }
void* void*
CArchMultithreadPosix::getNetworkDataForThread(CArchThread thread) ArchMultithreadPosix::getNetworkDataForThread(ArchThread thread)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
void* data = thread->m_networkData; void* data = thread->m_networkData;
@ -175,16 +175,16 @@ CArchMultithreadPosix::getNetworkDataForThread(CArchThread thread)
return data; return data;
} }
CArchMultithreadPosix* ArchMultithreadPosix*
CArchMultithreadPosix::getInstance() ArchMultithreadPosix::getInstance()
{ {
return s_instance; return s_instance;
} }
CArchCond ArchCond
CArchMultithreadPosix::newCondVar() ArchMultithreadPosix::newCondVar()
{ {
CArchCondImpl* cond = new CArchCondImpl; ArchCondImpl* cond = new ArchCondImpl;
int status = pthread_cond_init(&cond->m_cond, NULL); int status = pthread_cond_init(&cond->m_cond, NULL);
(void)status; (void)status;
assert(status == 0); assert(status == 0);
@ -192,7 +192,7 @@ CArchMultithreadPosix::newCondVar()
} }
void void
CArchMultithreadPosix::closeCondVar(CArchCond cond) ArchMultithreadPosix::closeCondVar(ArchCond cond)
{ {
int status = pthread_cond_destroy(&cond->m_cond); int status = pthread_cond_destroy(&cond->m_cond);
(void)status; (void)status;
@ -201,7 +201,7 @@ CArchMultithreadPosix::closeCondVar(CArchCond cond)
} }
void void
CArchMultithreadPosix::signalCondVar(CArchCond cond) ArchMultithreadPosix::signalCondVar(ArchCond cond)
{ {
int status = pthread_cond_signal(&cond->m_cond); int status = pthread_cond_signal(&cond->m_cond);
(void)status; (void)status;
@ -209,7 +209,7 @@ CArchMultithreadPosix::signalCondVar(CArchCond cond)
} }
void void
CArchMultithreadPosix::broadcastCondVar(CArchCond cond) ArchMultithreadPosix::broadcastCondVar(ArchCond cond)
{ {
int status = pthread_cond_broadcast(&cond->m_cond); int status = pthread_cond_broadcast(&cond->m_cond);
(void)status; (void)status;
@ -217,8 +217,8 @@ CArchMultithreadPosix::broadcastCondVar(CArchCond cond)
} }
bool bool
CArchMultithreadPosix::waitCondVar(CArchCond cond, ArchMultithreadPosix::waitCondVar(ArchCond cond,
CArchMutex mutex, double timeout) ArchMutex mutex, double timeout)
{ {
// we can't wait on a condition variable and also wake it up for // we can't wait on a condition variable and also wake it up for
// cancellation since we don't use posix cancellation. so we // cancellation since we don't use posix cancellation. so we
@ -272,20 +272,20 @@ CArchMultithreadPosix::waitCondVar(CArchCond cond,
} }
} }
CArchMutex ArchMutex
CArchMultithreadPosix::newMutex() ArchMultithreadPosix::newMutex()
{ {
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
int status = pthread_mutexattr_init(&attr); int status = pthread_mutexattr_init(&attr);
assert(status == 0); assert(status == 0);
CArchMutexImpl* mutex = new CArchMutexImpl; ArchMutexImpl* mutex = new ArchMutexImpl;
status = pthread_mutex_init(&mutex->m_mutex, &attr); status = pthread_mutex_init(&mutex->m_mutex, &attr);
assert(status == 0); assert(status == 0);
return mutex; return mutex;
} }
void void
CArchMultithreadPosix::closeMutex(CArchMutex mutex) ArchMultithreadPosix::closeMutex(ArchMutex mutex)
{ {
int status = pthread_mutex_destroy(&mutex->m_mutex); int status = pthread_mutex_destroy(&mutex->m_mutex);
(void)status; (void)status;
@ -294,7 +294,7 @@ CArchMultithreadPosix::closeMutex(CArchMutex mutex)
} }
void void
CArchMultithreadPosix::lockMutex(CArchMutex mutex) ArchMultithreadPosix::lockMutex(ArchMutex mutex)
{ {
int status = pthread_mutex_lock(&mutex->m_mutex); int status = pthread_mutex_lock(&mutex->m_mutex);
@ -318,7 +318,7 @@ CArchMultithreadPosix::lockMutex(CArchMutex mutex)
} }
void void
CArchMultithreadPosix::unlockMutex(CArchMutex mutex) ArchMultithreadPosix::unlockMutex(ArchMutex mutex)
{ {
int status = pthread_mutex_unlock(&mutex->m_mutex); int status = pthread_mutex_unlock(&mutex->m_mutex);
@ -337,8 +337,8 @@ CArchMultithreadPosix::unlockMutex(CArchMutex mutex)
} }
} }
CArchThread ArchThread
CArchMultithreadPosix::newThread(ThreadFunc func, void* data) ArchMultithreadPosix::newThread(ThreadFunc func, void* data)
{ {
assert(func != NULL); assert(func != NULL);
@ -359,7 +359,7 @@ CArchMultithreadPosix::newThread(ThreadFunc func, void* data)
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
// create thread impl for new thread // create thread impl for new thread
CArchThreadImpl* thread = new CArchThreadImpl; ArchThreadImpl* thread = new ArchThreadImpl;
thread->m_func = func; thread->m_func = func;
thread->m_userData = data; thread->m_userData = data;
@ -369,7 +369,7 @@ CArchMultithreadPosix::newThread(ThreadFunc func, void* data)
int status = pthread_attr_init(&attr); int status = pthread_attr_init(&attr);
if (status == 0) { if (status == 0) {
status = pthread_create(&thread->m_thread, &attr, status = pthread_create(&thread->m_thread, &attr,
&CArchMultithreadPosix::threadFunc, thread); &ArchMultithreadPosix::threadFunc, thread);
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
} }
@ -393,18 +393,18 @@ CArchMultithreadPosix::newThread(ThreadFunc func, void* data)
return thread; return thread;
} }
CArchThread ArchThread
CArchMultithreadPosix::newCurrentThread() ArchMultithreadPosix::newCurrentThread()
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = find(pthread_self()); ArchThreadImpl* thread = find(pthread_self());
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
assert(thread != NULL); assert(thread != NULL);
return thread; return thread;
} }
void void
CArchMultithreadPosix::closeThread(CArchThread thread) ArchMultithreadPosix::closeThread(ArchThread thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -426,15 +426,15 @@ CArchMultithreadPosix::closeThread(CArchThread thread)
} }
} }
CArchThread ArchThread
CArchMultithreadPosix::copyThread(CArchThread thread) ArchMultithreadPosix::copyThread(ArchThread thread)
{ {
refThread(thread); refThread(thread);
return thread; return thread;
} }
void void
CArchMultithreadPosix::cancelThread(CArchThread thread) ArchMultithreadPosix::cancelThread(ArchThread thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -454,7 +454,7 @@ CArchMultithreadPosix::cancelThread(CArchThread thread)
} }
void void
CArchMultithreadPosix::setPriorityOfThread(CArchThread thread, int /*n*/) ArchMultithreadPosix::setPriorityOfThread(ArchThread thread, int /*n*/)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -462,11 +462,11 @@ CArchMultithreadPosix::setPriorityOfThread(CArchThread thread, int /*n*/)
} }
void void
CArchMultithreadPosix::testCancelThread() ArchMultithreadPosix::testCancelThread()
{ {
// find current thread // find current thread
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = findNoRef(pthread_self()); ArchThreadImpl* thread = findNoRef(pthread_self());
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
// test cancel on thread // test cancel on thread
@ -474,14 +474,14 @@ CArchMultithreadPosix::testCancelThread()
} }
bool bool
CArchMultithreadPosix::wait(CArchThread target, double timeout) ArchMultithreadPosix::wait(ArchThread target, double timeout)
{ {
assert(target != NULL); assert(target != NULL);
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
// find current thread // find current thread
CArchThreadImpl* self = findNoRef(pthread_self()); ArchThreadImpl* self = findNoRef(pthread_self());
// ignore wait if trying to wait on ourself // ignore wait if trying to wait on ourself
if (target == self) { if (target == self) {
@ -530,13 +530,13 @@ CArchMultithreadPosix::wait(CArchThread target, double timeout)
} }
bool bool
CArchMultithreadPosix::isSameThread(CArchThread thread1, CArchThread thread2) ArchMultithreadPosix::isSameThread(ArchThread thread1, ArchThread thread2)
{ {
return (thread1 == thread2); return (thread1 == thread2);
} }
bool bool
CArchMultithreadPosix::isExitedThread(CArchThread thread) ArchMultithreadPosix::isExitedThread(ArchThread thread)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
bool exited = thread->m_exited; bool exited = thread->m_exited;
@ -545,7 +545,7 @@ CArchMultithreadPosix::isExitedThread(CArchThread thread)
} }
void* void*
CArchMultithreadPosix::getResultOfThread(CArchThread thread) ArchMultithreadPosix::getResultOfThread(ArchThread thread)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
void* result = thread->m_result; void* result = thread->m_result;
@ -554,13 +554,13 @@ CArchMultithreadPosix::getResultOfThread(CArchThread thread)
} }
IArchMultithread::ThreadID IArchMultithread::ThreadID
CArchMultithreadPosix::getIDOfThread(CArchThread thread) ArchMultithreadPosix::getIDOfThread(ArchThread thread)
{ {
return thread->m_id; return thread->m_id;
} }
void void
CArchMultithreadPosix::setSignalHandler( ArchMultithreadPosix::setSignalHandler(
ESignal signal, SignalFunc func, void* userData) ESignal signal, SignalFunc func, void* userData)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
@ -570,7 +570,7 @@ CArchMultithreadPosix::setSignalHandler(
} }
void void
CArchMultithreadPosix::raiseSignal(ESignal signal) ArchMultithreadPosix::raiseSignal(ESignal signal)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
if (m_signalFunc[signal] != NULL) { if (m_signalFunc[signal] != NULL) {
@ -584,7 +584,7 @@ CArchMultithreadPosix::raiseSignal(ESignal signal)
} }
void void
CArchMultithreadPosix::startSignalHandler() ArchMultithreadPosix::startSignalHandler()
{ {
// set signal mask. the main thread blocks these signals and // set signal mask. the main thread blocks these signals and
// the signal handler thread will listen for them. // the signal handler thread will listen for them.
@ -600,7 +600,7 @@ CArchMultithreadPosix::startSignalHandler()
int status = pthread_attr_init(&attr); int status = pthread_attr_init(&attr);
if (status == 0) { if (status == 0) {
status = pthread_create(&m_signalThread, &attr, status = pthread_create(&m_signalThread, &attr,
&CArchMultithreadPosix::threadSignalHandler, &ArchMultithreadPosix::threadSignalHandler,
NULL); NULL);
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
} }
@ -611,21 +611,21 @@ CArchMultithreadPosix::startSignalHandler()
} }
} }
CArchThreadImpl* ArchThreadImpl*
CArchMultithreadPosix::find(pthread_t thread) ArchMultithreadPosix::find(pthread_t thread)
{ {
CArchThreadImpl* impl = findNoRef(thread); ArchThreadImpl* impl = findNoRef(thread);
if (impl != NULL) { if (impl != NULL) {
refThread(impl); refThread(impl);
} }
return impl; return impl;
} }
CArchThreadImpl* ArchThreadImpl*
CArchMultithreadPosix::findNoRef(pthread_t thread) ArchMultithreadPosix::findNoRef(pthread_t thread)
{ {
// linear search // linear search
for (CThreadList::const_iterator index = m_threadList.begin(); for (ThreadList::const_iterator index = m_threadList.begin();
index != m_threadList.end(); ++index) { index != m_threadList.end(); ++index) {
if ((*index)->m_thread == thread) { if ((*index)->m_thread == thread) {
return *index; return *index;
@ -635,7 +635,7 @@ CArchMultithreadPosix::findNoRef(pthread_t thread)
} }
void void
CArchMultithreadPosix::insert(CArchThreadImpl* thread) ArchMultithreadPosix::insert(ArchThreadImpl* thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -653,9 +653,9 @@ CArchMultithreadPosix::insert(CArchThreadImpl* thread)
} }
void void
CArchMultithreadPosix::erase(CArchThreadImpl* thread) ArchMultithreadPosix::erase(ArchThreadImpl* thread)
{ {
for (CThreadList::iterator index = m_threadList.begin(); for (ThreadList::iterator index = m_threadList.begin();
index != m_threadList.end(); ++index) { index != m_threadList.end(); ++index) {
if (*index == thread) { if (*index == thread) {
m_threadList.erase(index); m_threadList.erase(index);
@ -665,7 +665,7 @@ CArchMultithreadPosix::erase(CArchThreadImpl* thread)
} }
void void
CArchMultithreadPosix::refThread(CArchThreadImpl* thread) ArchMultithreadPosix::refThread(ArchThreadImpl* thread)
{ {
assert(thread != NULL); assert(thread != NULL);
assert(findNoRef(thread->m_thread) != NULL); assert(findNoRef(thread->m_thread) != NULL);
@ -673,7 +673,7 @@ CArchMultithreadPosix::refThread(CArchThreadImpl* thread)
} }
void void
CArchMultithreadPosix::testCancelThreadImpl(CArchThreadImpl* thread) ArchMultithreadPosix::testCancelThreadImpl(ArchThreadImpl* thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -694,10 +694,10 @@ CArchMultithreadPosix::testCancelThreadImpl(CArchThreadImpl* thread)
} }
void* void*
CArchMultithreadPosix::threadFunc(void* vrep) ArchMultithreadPosix::threadFunc(void* vrep)
{ {
// get the thread // get the thread
CArchThreadImpl* thread = reinterpret_cast<CArchThreadImpl*>(vrep); ArchThreadImpl* thread = reinterpret_cast<ArchThreadImpl*>(vrep);
// setup pthreads // setup pthreads
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
@ -711,7 +711,7 @@ CArchMultithreadPosix::threadFunc(void* vrep)
} }
void void
CArchMultithreadPosix::doThreadFunc(CArchThread thread) ArchMultithreadPosix::doThreadFunc(ArchThread thread)
{ {
// default priority is slightly below normal // default priority is slightly below normal
setPriorityOfThread(thread, 1); setPriorityOfThread(thread, 1);
@ -749,13 +749,13 @@ CArchMultithreadPosix::doThreadFunc(CArchThread thread)
} }
void void
CArchMultithreadPosix::threadCancel(int) ArchMultithreadPosix::threadCancel(int)
{ {
// do nothing // do nothing
} }
void* void*
CArchMultithreadPosix::threadSignalHandler(void*) ArchMultithreadPosix::threadSignalHandler(void*)
{ {
// detach // detach
pthread_detach(pthread_self()); pthread_detach(pthread_self());

View File

@ -23,23 +23,23 @@
#include <pthread.h> #include <pthread.h>
#define ARCH_MULTITHREAD CArchMultithreadPosix #define ARCH_MULTITHREAD ArchMultithreadPosix
class CArchCondImpl { class ArchCondImpl {
public: public:
pthread_cond_t m_cond; pthread_cond_t m_cond;
}; };
class CArchMutexImpl { class ArchMutexImpl {
public: public:
pthread_mutex_t m_mutex; pthread_mutex_t m_mutex;
}; };
//! Posix implementation of IArchMultithread //! Posix implementation of IArchMultithread
class CArchMultithreadPosix : public IArchMultithread { class ArchMultithreadPosix : public IArchMultithread {
public: public:
CArchMultithreadPosix(); ArchMultithreadPosix();
virtual ~CArchMultithreadPosix(); virtual ~ArchMultithreadPosix();
//! @name manipulators //! @name manipulators
//@{ //@{
@ -50,63 +50,63 @@ public:
//! @name accessors //! @name accessors
//@{ //@{
void* getNetworkDataForThread(CArchThread); void* getNetworkDataForThread(ArchThread);
static CArchMultithreadPosix* getInstance(); static ArchMultithreadPosix* getInstance();
//@} //@}
// IArchMultithread overrides // IArchMultithread overrides
virtual CArchCond newCondVar(); virtual ArchCond newCondVar();
virtual void closeCondVar(CArchCond); virtual void closeCondVar(ArchCond);
virtual void signalCondVar(CArchCond); virtual void signalCondVar(ArchCond);
virtual void broadcastCondVar(CArchCond); virtual void broadcastCondVar(ArchCond);
virtual bool waitCondVar(CArchCond, CArchMutex, double timeout); virtual bool waitCondVar(ArchCond, ArchMutex, double timeout);
virtual CArchMutex newMutex(); virtual ArchMutex newMutex();
virtual void closeMutex(CArchMutex); virtual void closeMutex(ArchMutex);
virtual void lockMutex(CArchMutex); virtual void lockMutex(ArchMutex);
virtual void unlockMutex(CArchMutex); virtual void unlockMutex(ArchMutex);
virtual CArchThread newThread(ThreadFunc, void*); virtual ArchThread newThread(ThreadFunc, void*);
virtual CArchThread newCurrentThread(); virtual ArchThread newCurrentThread();
virtual CArchThread copyThread(CArchThread); virtual ArchThread copyThread(ArchThread);
virtual void closeThread(CArchThread); virtual void closeThread(ArchThread);
virtual void cancelThread(CArchThread); virtual void cancelThread(ArchThread);
virtual void setPriorityOfThread(CArchThread, int n); virtual void setPriorityOfThread(ArchThread, int n);
virtual void testCancelThread(); virtual void testCancelThread();
virtual bool wait(CArchThread, double timeout); virtual bool wait(ArchThread, double timeout);
virtual bool isSameThread(CArchThread, CArchThread); virtual bool isSameThread(ArchThread, ArchThread);
virtual bool isExitedThread(CArchThread); virtual bool isExitedThread(ArchThread);
virtual void* getResultOfThread(CArchThread); virtual void* getResultOfThread(ArchThread);
virtual ThreadID getIDOfThread(CArchThread); virtual ThreadID getIDOfThread(ArchThread);
virtual void setSignalHandler(ESignal, SignalFunc, void*); virtual void setSignalHandler(ESignal, SignalFunc, void*);
virtual void raiseSignal(ESignal); virtual void raiseSignal(ESignal);
private: private:
void startSignalHandler(); void startSignalHandler();
CArchThreadImpl* find(pthread_t thread); ArchThreadImpl* find(pthread_t thread);
CArchThreadImpl* findNoRef(pthread_t thread); ArchThreadImpl* findNoRef(pthread_t thread);
void insert(CArchThreadImpl* thread); void insert(ArchThreadImpl* thread);
void erase(CArchThreadImpl* thread); void erase(ArchThreadImpl* thread);
void refThread(CArchThreadImpl* rep); void refThread(ArchThreadImpl* rep);
void testCancelThreadImpl(CArchThreadImpl* rep); void testCancelThreadImpl(ArchThreadImpl* rep);
void doThreadFunc(CArchThread thread); void doThreadFunc(ArchThread thread);
static void* threadFunc(void* vrep); static void* threadFunc(void* vrep);
static void threadCancel(int); static void threadCancel(int);
static void* threadSignalHandler(void* vrep); static void* threadSignalHandler(void* vrep);
private: private:
typedef std::list<CArchThread> CThreadList; typedef std::list<ArchThread> ThreadList;
static CArchMultithreadPosix* s_instance; static ArchMultithreadPosix* s_instance;
bool m_newThreadCalled; bool m_newThreadCalled;
CArchMutex m_threadMutex; ArchMutex m_threadMutex;
CArchThread m_mainThread; ArchThread m_mainThread;
CThreadList m_threadList; ThreadList m_threadList;
ThreadID m_nextID; ThreadID m_nextID;
pthread_t m_signalThread; pthread_t m_signalThread;

View File

@ -83,27 +83,27 @@ inet_aton(const char* cp, struct in_addr* inp)
#endif #endif
// //
// CArchNetworkBSD // ArchNetworkBSD
// //
CArchNetworkBSD::CArchNetworkBSD() ArchNetworkBSD::ArchNetworkBSD()
{ {
} }
CArchNetworkBSD::~CArchNetworkBSD() ArchNetworkBSD::~ArchNetworkBSD()
{ {
ARCH->closeMutex(m_mutex); ARCH->closeMutex(m_mutex);
} }
void void
CArchNetworkBSD::init() ArchNetworkBSD::init()
{ {
// create mutex to make some calls thread safe // create mutex to make some calls thread safe
m_mutex = ARCH->newMutex(); m_mutex = ARCH->newMutex();
} }
CArchSocket ArchSocket
CArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type) ArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type)
{ {
// create socket // create socket
int fd = socket(s_family[family], s_type[type], 0); int fd = socket(s_family[family], s_type[type], 0);
@ -119,14 +119,14 @@ CArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type)
} }
// allocate socket object // allocate socket object
CArchSocketImpl* newSocket = new CArchSocketImpl; ArchSocketImpl* newSocket = new ArchSocketImpl;
newSocket->m_fd = fd; newSocket->m_fd = fd;
newSocket->m_refCount = 1; newSocket->m_refCount = 1;
return newSocket; return newSocket;
} }
CArchSocket ArchSocket
CArchNetworkBSD::copySocket(CArchSocket s) ArchNetworkBSD::copySocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -138,7 +138,7 @@ CArchNetworkBSD::copySocket(CArchSocket s)
} }
void void
CArchNetworkBSD::closeSocket(CArchSocket s) ArchNetworkBSD::closeSocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -162,7 +162,7 @@ CArchNetworkBSD::closeSocket(CArchSocket s)
} }
void void
CArchNetworkBSD::closeSocketForRead(CArchSocket s) ArchNetworkBSD::closeSocketForRead(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -174,7 +174,7 @@ CArchNetworkBSD::closeSocketForRead(CArchSocket s)
} }
void void
CArchNetworkBSD::closeSocketForWrite(CArchSocket s) ArchNetworkBSD::closeSocketForWrite(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -186,7 +186,7 @@ CArchNetworkBSD::closeSocketForWrite(CArchSocket s)
} }
void void
CArchNetworkBSD::bindSocket(CArchSocket s, CArchNetAddress addr) ArchNetworkBSD::bindSocket(ArchSocket s, ArchNetAddress addr)
{ {
assert(s != NULL); assert(s != NULL);
assert(addr != NULL); assert(addr != NULL);
@ -197,7 +197,7 @@ CArchNetworkBSD::bindSocket(CArchSocket s, CArchNetAddress addr)
} }
void void
CArchNetworkBSD::listenOnSocket(CArchSocket s) ArchNetworkBSD::listenOnSocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -207,20 +207,20 @@ CArchNetworkBSD::listenOnSocket(CArchSocket s)
} }
} }
CArchSocket ArchSocket
CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr) ArchNetworkBSD::acceptSocket(ArchSocket s, ArchNetAddress* addr)
{ {
assert(s != NULL); assert(s != NULL);
// if user passed NULL in addr then use scratch space // if user passed NULL in addr then use scratch space
CArchNetAddress dummy; ArchNetAddress dummy;
if (addr == NULL) { if (addr == NULL) {
addr = &dummy; addr = &dummy;
} }
// create new socket and address // create new socket and address
CArchSocketImpl* newSocket = new CArchSocketImpl; ArchSocketImpl* newSocket = new ArchSocketImpl;
*addr = new CArchNetAddressImpl; *addr = new ArchNetAddressImpl;
// accept on socket // accept on socket
ACCEPT_TYPE_ARG3 len = (ACCEPT_TYPE_ARG3)((*addr)->m_len); ACCEPT_TYPE_ARG3 len = (ACCEPT_TYPE_ARG3)((*addr)->m_len);
@ -261,7 +261,7 @@ CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr)
} }
bool bool
CArchNetworkBSD::connectSocket(CArchSocket s, CArchNetAddress addr) ArchNetworkBSD::connectSocket(ArchSocket s, ArchNetAddress addr)
{ {
assert(s != NULL); assert(s != NULL);
assert(addr != NULL); assert(addr != NULL);
@ -281,7 +281,7 @@ CArchNetworkBSD::connectSocket(CArchSocket s, CArchNetAddress addr)
#if HAVE_POLL #if HAVE_POLL
int int
CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) ArchNetworkBSD::pollSocket(PollEntry pe[], int num, double timeout)
{ {
assert(pe != NULL || num == 0); assert(pe != NULL || num == 0);
@ -373,7 +373,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
#else #else
int int
CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) ArchNetworkBSD::pollSocket(PollEntry pe[], int num, double timeout)
{ {
int i, n; int i, n;
@ -497,7 +497,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout)
#endif #endif
void void
CArchNetworkBSD::unblockPollSocket(CArchThread thread) ArchNetworkBSD::unblockPollSocket(ArchThread thread)
{ {
const int* unblockPipe = getUnblockPipeForThread(thread); const int* unblockPipe = getUnblockPipeForThread(thread);
if (unblockPipe != NULL) { if (unblockPipe != NULL) {
@ -509,7 +509,7 @@ CArchNetworkBSD::unblockPollSocket(CArchThread thread)
} }
size_t size_t
CArchNetworkBSD::readSocket(CArchSocket s, void* buf, size_t len) ArchNetworkBSD::readSocket(ArchSocket s, void* buf, size_t len)
{ {
assert(s != NULL); assert(s != NULL);
@ -524,7 +524,7 @@ CArchNetworkBSD::readSocket(CArchSocket s, void* buf, size_t len)
} }
size_t size_t
CArchNetworkBSD::writeSocket(CArchSocket s, const void* buf, size_t len) ArchNetworkBSD::writeSocket(ArchSocket s, const void* buf, size_t len)
{ {
assert(s != NULL); assert(s != NULL);
@ -539,7 +539,7 @@ CArchNetworkBSD::writeSocket(CArchSocket s, const void* buf, size_t len)
} }
void void
CArchNetworkBSD::throwErrorOnSocket(CArchSocket s) ArchNetworkBSD::throwErrorOnSocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -558,7 +558,7 @@ CArchNetworkBSD::throwErrorOnSocket(CArchSocket s)
} }
void void
CArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking) ArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking)
{ {
assert(fd != -1); assert(fd != -1);
@ -578,7 +578,7 @@ CArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking)
} }
bool bool
CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay) ArchNetworkBSD::setNoDelayOnSocket(ArchSocket s, bool noDelay)
{ {
assert(s != NULL); assert(s != NULL);
@ -601,7 +601,7 @@ CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay)
} }
bool bool
CArchNetworkBSD::setReuseAddrOnSocket(CArchSocket s, bool reuse) ArchNetworkBSD::setReuseAddrOnSocket(ArchSocket s, bool reuse)
{ {
assert(s != NULL); assert(s != NULL);
@ -624,7 +624,7 @@ CArchNetworkBSD::setReuseAddrOnSocket(CArchSocket s, bool reuse)
} }
std::string std::string
CArchNetworkBSD::getHostName() ArchNetworkBSD::getHostName()
{ {
char name[256]; char name[256];
if (gethostname(name, sizeof(name)) == -1) { if (gethostname(name, sizeof(name)) == -1) {
@ -636,11 +636,11 @@ CArchNetworkBSD::getHostName()
return name; return name;
} }
CArchNetAddress ArchNetAddress
CArchNetworkBSD::newAnyAddr(EAddressFamily family) ArchNetworkBSD::newAnyAddr(EAddressFamily family)
{ {
// allocate address // allocate address
CArchNetAddressImpl* addr = new CArchNetAddressImpl; ArchNetAddressImpl* addr = new ArchNetAddressImpl;
// fill it in // fill it in
switch (family) { switch (family) {
@ -662,20 +662,20 @@ CArchNetworkBSD::newAnyAddr(EAddressFamily family)
return addr; return addr;
} }
CArchNetAddress ArchNetAddress
CArchNetworkBSD::copyAddr(CArchNetAddress addr) ArchNetworkBSD::copyAddr(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
// allocate and copy address // allocate and copy address
return new CArchNetAddressImpl(*addr); return new ArchNetAddressImpl(*addr);
} }
CArchNetAddress ArchNetAddress
CArchNetworkBSD::nameToAddr(const std::string& name) ArchNetworkBSD::nameToAddr(const std::string& name)
{ {
// allocate address // allocate address
CArchNetAddressImpl* addr = new CArchNetAddressImpl; ArchNetAddressImpl* addr = new ArchNetAddressImpl;
// try to convert assuming an IPv4 dot notation address // try to convert assuming an IPv4 dot notation address
struct sockaddr_in inaddr; struct sockaddr_in inaddr;
@ -723,7 +723,7 @@ CArchNetworkBSD::nameToAddr(const std::string& name)
} }
void void
CArchNetworkBSD::closeAddr(CArchNetAddress addr) ArchNetworkBSD::closeAddr(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -731,7 +731,7 @@ CArchNetworkBSD::closeAddr(CArchNetAddress addr)
} }
std::string std::string
CArchNetworkBSD::addrToName(CArchNetAddress addr) ArchNetworkBSD::addrToName(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -755,7 +755,7 @@ CArchNetworkBSD::addrToName(CArchNetAddress addr)
} }
std::string std::string
CArchNetworkBSD::addrToString(CArchNetAddress addr) ArchNetworkBSD::addrToString(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -776,7 +776,7 @@ CArchNetworkBSD::addrToString(CArchNetAddress addr)
} }
IArchNetwork::EAddressFamily IArchNetwork::EAddressFamily
CArchNetworkBSD::getAddrFamily(CArchNetAddress addr) ArchNetworkBSD::getAddrFamily(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -790,7 +790,7 @@ CArchNetworkBSD::getAddrFamily(CArchNetAddress addr)
} }
void void
CArchNetworkBSD::setAddrPort(CArchNetAddress addr, int port) ArchNetworkBSD::setAddrPort(ArchNetAddress addr, int port)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -809,7 +809,7 @@ CArchNetworkBSD::setAddrPort(CArchNetAddress addr, int port)
} }
int int
CArchNetworkBSD::getAddrPort(CArchNetAddress addr) ArchNetworkBSD::getAddrPort(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -827,7 +827,7 @@ CArchNetworkBSD::getAddrPort(CArchNetAddress addr)
} }
bool bool
CArchNetworkBSD::isAnyAddr(CArchNetAddress addr) ArchNetworkBSD::isAnyAddr(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -846,26 +846,26 @@ CArchNetworkBSD::isAnyAddr(CArchNetAddress addr)
} }
bool bool
CArchNetworkBSD::isEqualAddr(CArchNetAddress a, CArchNetAddress b) ArchNetworkBSD::isEqualAddr(ArchNetAddress a, ArchNetAddress b)
{ {
return (a->m_len == b->m_len && return (a->m_len == b->m_len &&
memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0); memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0);
} }
const int* const int*
CArchNetworkBSD::getUnblockPipe() ArchNetworkBSD::getUnblockPipe()
{ {
CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance(); ArchMultithreadPosix* mt = ArchMultithreadPosix::getInstance();
CArchThread thread = mt->newCurrentThread(); ArchThread thread = mt->newCurrentThread();
const int* p = getUnblockPipeForThread(thread); const int* p = getUnblockPipeForThread(thread);
ARCH->closeThread(thread); ARCH->closeThread(thread);
return p; return p;
} }
const int* const int*
CArchNetworkBSD::getUnblockPipeForThread(CArchThread thread) ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread)
{ {
CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance(); ArchMultithreadPosix* mt = ArchMultithreadPosix::getInstance();
int* unblockPipe = (int*)mt->getNetworkDataForThread(thread); int* unblockPipe = (int*)mt->getNetworkDataForThread(thread);
if (unblockPipe == NULL) { if (unblockPipe == NULL) {
unblockPipe = new int[2]; unblockPipe = new int[2];
@ -888,7 +888,7 @@ CArchNetworkBSD::getUnblockPipeForThread(CArchThread thread)
} }
void void
CArchNetworkBSD::throwError(int err) ArchNetworkBSD::throwError(int err)
{ {
switch (err) { switch (err) {
case EINTR: case EINTR:
@ -960,7 +960,7 @@ CArchNetworkBSD::throwError(int err)
} }
void void
CArchNetworkBSD::throwNameError(int err) ArchNetworkBSD::throwNameError(int err)
{ {
static const char* s_msg[] = { static const char* s_msg[] = {
"The specified host is unknown", "The specified host is unknown",

View File

@ -37,17 +37,17 @@ typedef int socklen_t;
// compatible so we always use it. // compatible so we always use it.
typedef char optval_t; typedef char optval_t;
#define ARCH_NETWORK CArchNetworkBSD #define ARCH_NETWORK ArchNetworkBSD
class CArchSocketImpl { class ArchSocketImpl {
public: public:
int m_fd; int m_fd;
int m_refCount; int m_refCount;
}; };
class CArchNetAddressImpl { class ArchNetAddressImpl {
public: public:
CArchNetAddressImpl() : m_len(sizeof(m_addr)) { } ArchNetAddressImpl() : m_len(sizeof(m_addr)) { }
public: public:
struct sockaddr m_addr; struct sockaddr m_addr;
@ -55,50 +55,50 @@ public:
}; };
//! Berkeley (BSD) sockets implementation of IArchNetwork //! Berkeley (BSD) sockets implementation of IArchNetwork
class CArchNetworkBSD : public IArchNetwork { class ArchNetworkBSD : public IArchNetwork {
public: public:
CArchNetworkBSD(); ArchNetworkBSD();
virtual ~CArchNetworkBSD(); virtual ~ArchNetworkBSD();
virtual void init(); virtual void init();
// IArchNetwork overrides // IArchNetwork overrides
virtual CArchSocket newSocket(EAddressFamily, ESocketType); virtual ArchSocket newSocket(EAddressFamily, ESocketType);
virtual CArchSocket copySocket(CArchSocket s); virtual void closeSocket(CArchSocket s); virtual ArchSocket copySocket(ArchSocket s); virtual void closeSocket(ArchSocket s);
virtual void closeSocketForRead(CArchSocket s); virtual void closeSocketForRead(ArchSocket s);
virtual void closeSocketForWrite(CArchSocket s); virtual void closeSocketForWrite(ArchSocket s);
virtual void bindSocket(CArchSocket s, CArchNetAddress addr); virtual void bindSocket(ArchSocket s, ArchNetAddress addr);
virtual void listenOnSocket(CArchSocket s); virtual void listenOnSocket(ArchSocket s);
virtual CArchSocket acceptSocket(CArchSocket s, CArchNetAddress* addr); virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress* addr);
virtual bool connectSocket(CArchSocket s, CArchNetAddress name); virtual bool connectSocket(ArchSocket s, ArchNetAddress name);
virtual int pollSocket(CPollEntry[], int num, double timeout); virtual int pollSocket(PollEntry[], int num, double timeout);
virtual void unblockPollSocket(CArchThread thread); virtual void unblockPollSocket(ArchThread thread);
virtual size_t readSocket(CArchSocket s, void* buf, size_t len); virtual size_t readSocket(ArchSocket s, void* buf, size_t len);
virtual size_t writeSocket(CArchSocket s, virtual size_t writeSocket(ArchSocket s,
const void* buf, size_t len); const void* buf, size_t len);
virtual void throwErrorOnSocket(CArchSocket); virtual void throwErrorOnSocket(ArchSocket);
virtual bool setNoDelayOnSocket(CArchSocket, bool noDelay); virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay);
virtual bool setReuseAddrOnSocket(CArchSocket, bool reuse); virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse);
virtual std::string getHostName(); virtual std::string getHostName();
virtual CArchNetAddress newAnyAddr(EAddressFamily); virtual ArchNetAddress newAnyAddr(EAddressFamily);
virtual CArchNetAddress copyAddr(CArchNetAddress); virtual ArchNetAddress copyAddr(ArchNetAddress);
virtual CArchNetAddress nameToAddr(const std::string&); virtual ArchNetAddress nameToAddr(const std::string&);
virtual void closeAddr(CArchNetAddress); virtual void closeAddr(ArchNetAddress);
virtual std::string addrToName(CArchNetAddress); virtual std::string addrToName(ArchNetAddress);
virtual std::string addrToString(CArchNetAddress); virtual std::string addrToString(ArchNetAddress);
virtual EAddressFamily getAddrFamily(CArchNetAddress); virtual EAddressFamily getAddrFamily(ArchNetAddress);
virtual void setAddrPort(CArchNetAddress, int port); virtual void setAddrPort(ArchNetAddress, int port);
virtual int getAddrPort(CArchNetAddress); virtual int getAddrPort(ArchNetAddress);
virtual bool isAnyAddr(CArchNetAddress); virtual bool isAnyAddr(ArchNetAddress);
virtual bool isEqualAddr(CArchNetAddress, CArchNetAddress); virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress);
private: private:
const int* getUnblockPipe(); const int* getUnblockPipe();
const int* getUnblockPipeForThread(CArchThread); const int* getUnblockPipeForThread(ArchThread);
void setBlockingOnSocket(int fd, bool blocking); void setBlockingOnSocket(int fd, bool blocking);
void throwError(int); void throwError(int);
void throwNameError(int); void throwNameError(int);
private: private:
CArchMutex m_mutex; ArchMutex m_mutex;
}; };

View File

@ -18,15 +18,15 @@
#include "arch/unix/ArchPluginUnix.h" #include "arch/unix/ArchPluginUnix.h"
CArchPluginUnix::CArchPluginUnix() ArchPluginUnix::ArchPluginUnix()
{ {
} }
CArchPluginUnix::~CArchPluginUnix() ArchPluginUnix::~ArchPluginUnix()
{ {
} }
void void
CArchPluginUnix::init(void* eventTarget, IEventQueue* events) ArchPluginUnix::init(void* eventTarget, IEventQueue* events)
{ {
} }

View File

@ -20,15 +20,15 @@
#include "arch/IArchPlugin.h" #include "arch/IArchPlugin.h"
#define ARCH_PLUGIN CArchPluginUnix #define ARCH_PLUGIN ArchPluginUnix
class IEventQueue; class IEventQueue;
//! Unix implementation of IArchPlugin //! Unix implementation of IArchPlugin
class CArchPluginUnix : public IArchPlugin { class ArchPluginUnix : public IArchPlugin {
public: public:
CArchPluginUnix(); ArchPluginUnix();
virtual ~CArchPluginUnix(); virtual ~ArchPluginUnix();
// IArchPlugin overrides // IArchPlugin overrides
void init(void* eventTarget, IEventQueue* events); void init(void* eventTarget, IEventQueue* events);

View File

@ -43,21 +43,21 @@
#endif #endif
// //
// CArchSleepUnix // ArchSleepUnix
// //
CArchSleepUnix::CArchSleepUnix() ArchSleepUnix::ArchSleepUnix()
{ {
// do nothing // do nothing
} }
CArchSleepUnix::~CArchSleepUnix() ArchSleepUnix::~ArchSleepUnix()
{ {
// do nothing // do nothing
} }
void void
CArchSleepUnix::sleep(double timeout) ArchSleepUnix::sleep(double timeout)
{ {
ARCH->testCancelThread(); ARCH->testCancelThread();
if (timeout < 0.0) { if (timeout < 0.0) {

View File

@ -20,13 +20,13 @@
#include "arch/IArchSleep.h" #include "arch/IArchSleep.h"
#define ARCH_SLEEP CArchSleepUnix #define ARCH_SLEEP ArchSleepUnix
//! Unix implementation of IArchSleep //! Unix implementation of IArchSleep
class CArchSleepUnix : public IArchSleep { class ArchSleepUnix : public IArchSleep {
public: public:
CArchSleepUnix(); ArchSleepUnix();
virtual ~CArchSleepUnix(); virtual ~ArchSleepUnix();
// IArchSleep overrides // IArchSleep overrides
virtual void sleep(double timeout); virtual void sleep(double timeout);

View File

@ -21,22 +21,22 @@
#include <stdio.h> #include <stdio.h>
// //
// CArchStringUnix // ArchStringUnix
// //
#include "arch/multibyte.h" #include "arch/multibyte.h"
#include "arch/vsnprintf.h" #include "arch/vsnprintf.h"
CArchStringUnix::CArchStringUnix() ArchStringUnix::ArchStringUnix()
{ {
} }
CArchStringUnix::~CArchStringUnix() ArchStringUnix::~ArchStringUnix()
{ {
} }
IArchString::EWideCharEncoding IArchString::EWideCharEncoding
CArchStringUnix::getWideCharEncoding() ArchStringUnix::getWideCharEncoding()
{ {
return kUCS4; return kUCS4;
} }

View File

@ -20,13 +20,13 @@
#include "arch/IArchString.h" #include "arch/IArchString.h"
#define ARCH_STRING CArchStringUnix #define ARCH_STRING ArchStringUnix
//! Unix implementation of IArchString //! Unix implementation of IArchString
class CArchStringUnix : public IArchString { class ArchStringUnix : public IArchString {
public: public:
CArchStringUnix(); ArchStringUnix();
virtual ~CArchStringUnix(); virtual ~ArchStringUnix();
// IArchString overrides // IArchString overrides
virtual EWideCharEncoding virtual EWideCharEncoding

View File

@ -21,21 +21,21 @@
#include <sys/utsname.h> #include <sys/utsname.h>
// //
// CArchSystemUnix // ArchSystemUnix
// //
CArchSystemUnix::CArchSystemUnix() ArchSystemUnix::ArchSystemUnix()
{ {
// do nothing // do nothing
} }
CArchSystemUnix::~CArchSystemUnix() ArchSystemUnix::~ArchSystemUnix()
{ {
// do nothing // do nothing
} }
std::string std::string
CArchSystemUnix::getOSName() const ArchSystemUnix::getOSName() const
{ {
#if defined(HAVE_SYS_UTSNAME_H) #if defined(HAVE_SYS_UTSNAME_H)
struct utsname info; struct utsname info;
@ -53,7 +53,7 @@ CArchSystemUnix::getOSName() const
} }
std::string std::string
CArchSystemUnix::getPlatformName() const ArchSystemUnix::getPlatformName() const
{ {
#if defined(HAVE_SYS_UTSNAME_H) #if defined(HAVE_SYS_UTSNAME_H)
struct utsname info; struct utsname info;
@ -65,12 +65,12 @@ CArchSystemUnix::getPlatformName() const
} }
std::string std::string
CArchSystemUnix::setting(const std::string&) const ArchSystemUnix::setting(const std::string&) const
{ {
return ""; return "";
} }
void void
CArchSystemUnix::setting(const std::string&, const std::string&) const ArchSystemUnix::setting(const std::string&, const std::string&) const
{ {
} }

View File

@ -20,13 +20,13 @@
#include "arch/IArchSystem.h" #include "arch/IArchSystem.h"
#define ARCH_SYSTEM CArchSystemUnix #define ARCH_SYSTEM ArchSystemUnix
//! Unix implementation of IArchString //! Unix implementation of IArchString
class CArchSystemUnix : public IArchSystem { class ArchSystemUnix : public IArchSystem {
public: public:
CArchSystemUnix(); ArchSystemUnix();
virtual ~CArchSystemUnix(); virtual ~ArchSystemUnix();
// IArchSystem overrides // IArchSystem overrides
virtual std::string getOSName() const; virtual std::string getOSName() const;

View File

@ -19,33 +19,33 @@
#include "arch/unix/ArchTaskBarXWindows.h" #include "arch/unix/ArchTaskBarXWindows.h"
// //
// CArchTaskBarXWindows // ArchTaskBarXWindows
// //
CArchTaskBarXWindows::CArchTaskBarXWindows() ArchTaskBarXWindows::ArchTaskBarXWindows()
{ {
// do nothing // do nothing
} }
CArchTaskBarXWindows::~CArchTaskBarXWindows() ArchTaskBarXWindows::~ArchTaskBarXWindows()
{ {
// do nothing // do nothing
} }
void void
CArchTaskBarXWindows::addReceiver(IArchTaskBarReceiver* /*receiver*/) ArchTaskBarXWindows::addReceiver(IArchTaskBarReceiver* /*receiver*/)
{ {
// do nothing // do nothing
} }
void void
CArchTaskBarXWindows::removeReceiver(IArchTaskBarReceiver* /*receiver*/) ArchTaskBarXWindows::removeReceiver(IArchTaskBarReceiver* /*receiver*/)
{ {
// do nothing // do nothing
} }
void void
CArchTaskBarXWindows::updateReceiver(IArchTaskBarReceiver* /*receiver*/) ArchTaskBarXWindows::updateReceiver(IArchTaskBarReceiver* /*receiver*/)
{ {
// do nothing // do nothing
} }

View File

@ -20,13 +20,13 @@
#include "arch/IArchTaskBar.h" #include "arch/IArchTaskBar.h"
#define ARCH_TASKBAR CArchTaskBarXWindows #define ARCH_TASKBAR ArchTaskBarXWindows
//! X11 implementation of IArchTaskBar //! X11 implementation of IArchTaskBar
class CArchTaskBarXWindows : public IArchTaskBar { class ArchTaskBarXWindows : public IArchTaskBar {
public: public:
CArchTaskBarXWindows(); ArchTaskBarXWindows();
virtual ~CArchTaskBarXWindows(); virtual ~ArchTaskBarXWindows();
// IArchTaskBar overrides // IArchTaskBar overrides
virtual void addReceiver(IArchTaskBarReceiver*); virtual void addReceiver(IArchTaskBarReceiver*);

View File

@ -30,21 +30,21 @@
#endif #endif
// //
// CArchTimeUnix // ArchTimeUnix
// //
CArchTimeUnix::CArchTimeUnix() ArchTimeUnix::ArchTimeUnix()
{ {
// do nothing // do nothing
} }
CArchTimeUnix::~CArchTimeUnix() ArchTimeUnix::~ArchTimeUnix()
{ {
// do nothing // do nothing
} }
double double
CArchTimeUnix::time() ArchTimeUnix::time()
{ {
struct timeval t; struct timeval t;
gettimeofday(&t, NULL); gettimeofday(&t, NULL);

View File

@ -20,13 +20,13 @@
#include "arch/IArchTime.h" #include "arch/IArchTime.h"
#define ARCH_TIME CArchTimeUnix #define ARCH_TIME ArchTimeUnix
//! Generic Unix implementation of IArchTime //! Generic Unix implementation of IArchTime
class CArchTimeUnix : public IArchTime { class ArchTimeUnix : public IArchTime {
public: public:
CArchTimeUnix(); ArchTimeUnix();
virtual ~CArchTimeUnix(); virtual ~ArchTimeUnix();
// IArchTime overrides // IArchTime overrides
virtual double time(); virtual double time();

View File

@ -18,6 +18,6 @@
#include "arch/win32/ArchConsoleWindows.h" #include "arch/win32/ArchConsoleWindows.h"
CArchConsoleWindows::CArchConsoleWindows() { } ArchConsoleWindows::ArchConsoleWindows() { }
CArchConsoleWindows::~CArchConsoleWindows() { } ArchConsoleWindows::~ArchConsoleWindows() { }

View File

@ -20,10 +20,10 @@
#include "arch/ArchConsoleStd.h" #include "arch/ArchConsoleStd.h"
#define ARCH_CONSOLE CArchConsoleWindows #define ARCH_CONSOLE ArchConsoleWindows
class CArchConsoleWindows : public CArchConsoleStd { class ArchConsoleWindows : public ArchConsoleStd {
public: public:
CArchConsoleWindows(); ArchConsoleWindows();
virtual ~CArchConsoleWindows(); virtual ~ArchConsoleWindows();
}; };

View File

@ -25,31 +25,31 @@
#include <sstream> #include <sstream>
// //
// CArchDaemonWindows // ArchDaemonWindows
// //
CArchDaemonWindows* CArchDaemonWindows::s_daemon = NULL; ArchDaemonWindows* ArchDaemonWindows::s_daemon = NULL;
CArchDaemonWindows::CArchDaemonWindows() : ArchDaemonWindows::ArchDaemonWindows() :
m_daemonThreadID(0) m_daemonThreadID(0)
{ {
m_quitMessage = RegisterWindowMessage("SynergyDaemonExit"); m_quitMessage = RegisterWindowMessage("SynergyDaemonExit");
} }
CArchDaemonWindows::~CArchDaemonWindows() ArchDaemonWindows::~ArchDaemonWindows()
{ {
// do nothing // do nothing
} }
int int
CArchDaemonWindows::runDaemon(RunFunc runFunc) ArchDaemonWindows::runDaemon(RunFunc runFunc)
{ {
assert(s_daemon != NULL); assert(s_daemon != NULL);
return s_daemon->doRunDaemon(runFunc); return s_daemon->doRunDaemon(runFunc);
} }
void void
CArchDaemonWindows::daemonRunning(bool running) ArchDaemonWindows::daemonRunning(bool running)
{ {
if (s_daemon != NULL) { if (s_daemon != NULL) {
s_daemon->doDaemonRunning(running); s_daemon->doDaemonRunning(running);
@ -57,7 +57,7 @@ CArchDaemonWindows::daemonRunning(bool running)
} }
UINT UINT
CArchDaemonWindows::getDaemonQuitMessage() ArchDaemonWindows::getDaemonQuitMessage()
{ {
if (s_daemon != NULL) { if (s_daemon != NULL) {
return s_daemon->doGetDaemonQuitMessage(); return s_daemon->doGetDaemonQuitMessage();
@ -68,14 +68,14 @@ CArchDaemonWindows::getDaemonQuitMessage()
} }
void void
CArchDaemonWindows::daemonFailed(int result) ArchDaemonWindows::daemonFailed(int result)
{ {
assert(s_daemon != NULL); assert(s_daemon != NULL);
throw XArchDaemonRunFailed(result); throw XArchDaemonRunFailed(result);
} }
void void
CArchDaemonWindows::installDaemon(const char* name, ArchDaemonWindows::installDaemon(const char* name,
const char* description, const char* description,
const char* pathname, const char* pathname,
const char* commandLine, const char* commandLine,
@ -122,7 +122,7 @@ CArchDaemonWindows::installDaemon(const char* name,
// open the registry key for this service // open the registry key for this service
HKEY key = openNTServicesKey(); HKEY key = openNTServicesKey();
key = CArchMiscWindows::addKey(key, name); key = ArchMiscWindows::addKey(key, name);
if (key == NULL) { if (key == NULL) {
// can't open key // can't open key
DWORD err = GetLastError(); DWORD err = GetLastError();
@ -136,14 +136,14 @@ CArchDaemonWindows::installDaemon(const char* name,
} }
// set the description // set the description
CArchMiscWindows::setValue(key, _T("Description"), description); ArchMiscWindows::setValue(key, _T("Description"), description);
// set command line // set command line
key = CArchMiscWindows::addKey(key, _T("Parameters")); key = ArchMiscWindows::addKey(key, _T("Parameters"));
if (key == NULL) { if (key == NULL) {
// can't open key // can't open key
DWORD err = GetLastError(); DWORD err = GetLastError();
CArchMiscWindows::closeKey(key); ArchMiscWindows::closeKey(key);
try { try {
uninstallDaemon(name); uninstallDaemon(name);
} }
@ -152,21 +152,21 @@ CArchDaemonWindows::installDaemon(const char* name,
} }
throw XArchDaemonInstallFailed(new XArchEvalWindows(err)); throw XArchDaemonInstallFailed(new XArchEvalWindows(err));
} }
CArchMiscWindows::setValue(key, _T("CommandLine"), commandLine); ArchMiscWindows::setValue(key, _T("CommandLine"), commandLine);
// done with registry // done with registry
CArchMiscWindows::closeKey(key); ArchMiscWindows::closeKey(key);
} }
void void
CArchDaemonWindows::uninstallDaemon(const char* name) ArchDaemonWindows::uninstallDaemon(const char* name)
{ {
// remove parameters for this service. ignore failures. // remove parameters for this service. ignore failures.
HKEY key = openNTServicesKey(); HKEY key = openNTServicesKey();
key = CArchMiscWindows::openKey(key, name); key = ArchMiscWindows::openKey(key, name);
if (key != NULL) { if (key != NULL) {
CArchMiscWindows::deleteKey(key, _T("Parameters")); ArchMiscWindows::deleteKey(key, _T("Parameters"));
CArchMiscWindows::closeKey(key); ArchMiscWindows::closeKey(key);
} }
// open service manager // open service manager
@ -223,7 +223,7 @@ CArchDaemonWindows::uninstallDaemon(const char* name)
} }
int int
CArchDaemonWindows::daemonize(const char* name, DaemonFunc func) ArchDaemonWindows::daemonize(const char* name, DaemonFunc func)
{ {
assert(name != NULL); assert(name != NULL);
assert(func != NULL); assert(func != NULL);
@ -234,7 +234,7 @@ CArchDaemonWindows::daemonize(const char* name, DaemonFunc func)
// construct the service entry // construct the service entry
SERVICE_TABLE_ENTRY entry[2]; SERVICE_TABLE_ENTRY entry[2];
entry[0].lpServiceName = const_cast<char*>(name); entry[0].lpServiceName = const_cast<char*>(name);
entry[0].lpServiceProc = &CArchDaemonWindows::serviceMainEntry; entry[0].lpServiceProc = &ArchDaemonWindows::serviceMainEntry;
entry[1].lpServiceName = NULL; entry[1].lpServiceName = NULL;
entry[1].lpServiceProc = NULL; entry[1].lpServiceProc = NULL;
@ -252,7 +252,7 @@ CArchDaemonWindows::daemonize(const char* name, DaemonFunc func)
} }
bool bool
CArchDaemonWindows::canInstallDaemon(const char* /*name*/) ArchDaemonWindows::canInstallDaemon(const char* /*name*/)
{ {
// check if we can open service manager for write // check if we can open service manager for write
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE); SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_WRITE);
@ -263,13 +263,13 @@ CArchDaemonWindows::canInstallDaemon(const char* /*name*/)
// check if we can open the registry key // check if we can open the registry key
HKEY key = openNTServicesKey(); HKEY key = openNTServicesKey();
CArchMiscWindows::closeKey(key); ArchMiscWindows::closeKey(key);
return (key != NULL); return (key != NULL);
} }
bool bool
CArchDaemonWindows::isDaemonInstalled(const char* name) ArchDaemonWindows::isDaemonInstalled(const char* name)
{ {
// open service manager // open service manager
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ); SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ);
@ -290,7 +290,7 @@ CArchDaemonWindows::isDaemonInstalled(const char* name)
} }
HKEY HKEY
CArchDaemonWindows::openNTServicesKey() ArchDaemonWindows::openNTServicesKey()
{ {
static const char* s_keyNames[] = { static const char* s_keyNames[] = {
_T("SYSTEM"), _T("SYSTEM"),
@ -299,11 +299,11 @@ CArchDaemonWindows::openNTServicesKey()
NULL NULL
}; };
return CArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_keyNames); return ArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_keyNames);
} }
bool bool
CArchDaemonWindows::isRunState(DWORD state) ArchDaemonWindows::isRunState(DWORD state)
{ {
switch (state) { switch (state) {
case SERVICE_START_PENDING: case SERVICE_START_PENDING:
@ -317,7 +317,7 @@ CArchDaemonWindows::isRunState(DWORD state)
} }
int int
CArchDaemonWindows::doRunDaemon(RunFunc run) ArchDaemonWindows::doRunDaemon(RunFunc run)
{ {
// should only be called from DaemonFunc // should only be called from DaemonFunc
assert(m_serviceMutex != NULL); assert(m_serviceMutex != NULL);
@ -370,7 +370,7 @@ CArchDaemonWindows::doRunDaemon(RunFunc run)
} }
void void
CArchDaemonWindows::doDaemonRunning(bool running) ArchDaemonWindows::doDaemonRunning(bool running)
{ {
ARCH->lockMutex(m_serviceMutex); ARCH->lockMutex(m_serviceMutex);
if (running) { if (running) {
@ -382,19 +382,19 @@ CArchDaemonWindows::doDaemonRunning(bool running)
} }
UINT UINT
CArchDaemonWindows::doGetDaemonQuitMessage() ArchDaemonWindows::doGetDaemonQuitMessage()
{ {
return m_quitMessage; return m_quitMessage;
} }
void void
CArchDaemonWindows::setStatus(DWORD state) ArchDaemonWindows::setStatus(DWORD state)
{ {
setStatus(state, 0, 0); setStatus(state, 0, 0);
} }
void void
CArchDaemonWindows::setStatus(DWORD state, DWORD step, DWORD waitHint) ArchDaemonWindows::setStatus(DWORD state, DWORD step, DWORD waitHint)
{ {
assert(s_daemon != NULL); assert(s_daemon != NULL);
@ -413,7 +413,7 @@ CArchDaemonWindows::setStatus(DWORD state, DWORD step, DWORD waitHint)
} }
void void
CArchDaemonWindows::setStatusError(DWORD error) ArchDaemonWindows::setStatusError(DWORD error)
{ {
assert(s_daemon != NULL); assert(s_daemon != NULL);
@ -432,7 +432,7 @@ CArchDaemonWindows::setStatusError(DWORD error)
} }
void void
CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn) ArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn)
{ {
typedef std::vector<LPCTSTR> ArgList; typedef std::vector<LPCTSTR> ArgList;
typedef std::vector<std::string> Arguments; typedef std::vector<std::string> Arguments;
@ -444,7 +444,7 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn)
// register our service handler function // register our service handler function
m_statusHandle = RegisterServiceCtrlHandler(argv[0], m_statusHandle = RegisterServiceCtrlHandler(argv[0],
&CArchDaemonWindows::serviceHandlerEntry); &ArchDaemonWindows::serviceHandlerEntry);
if (m_statusHandle == 0) { if (m_statusHandle == 0) {
// cannot start as service // cannot start as service
m_daemonResult = -1; m_daemonResult = -1;
@ -466,10 +466,10 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn)
if (argc <= 1) { if (argc <= 1) {
// read command line // read command line
HKEY key = openNTServicesKey(); HKEY key = openNTServicesKey();
key = CArchMiscWindows::openKey(key, argvIn[0]); key = ArchMiscWindows::openKey(key, argvIn[0]);
key = CArchMiscWindows::openKey(key, _T("Parameters")); key = ArchMiscWindows::openKey(key, _T("Parameters"));
if (key != NULL) { if (key != NULL) {
commandLine = CArchMiscWindows::readValueString(key, commandLine = ArchMiscWindows::readValueString(key,
_T("CommandLine")); _T("CommandLine"));
} }
@ -553,13 +553,13 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn)
} }
void WINAPI void WINAPI
CArchDaemonWindows::serviceMainEntry(DWORD argc, LPTSTR* argv) ArchDaemonWindows::serviceMainEntry(DWORD argc, LPTSTR* argv)
{ {
s_daemon->serviceMain(argc, argv); s_daemon->serviceMain(argc, argv);
} }
void void
CArchDaemonWindows::serviceHandler(DWORD ctrl) ArchDaemonWindows::serviceHandler(DWORD ctrl)
{ {
assert(m_serviceMutex != NULL); assert(m_serviceMutex != NULL);
assert(m_serviceCondVar != NULL); assert(m_serviceCondVar != NULL);
@ -616,13 +616,13 @@ CArchDaemonWindows::serviceHandler(DWORD ctrl)
} }
void WINAPI void WINAPI
CArchDaemonWindows::serviceHandlerEntry(DWORD ctrl) ArchDaemonWindows::serviceHandlerEntry(DWORD ctrl)
{ {
s_daemon->serviceHandler(ctrl); s_daemon->serviceHandler(ctrl);
} }
void void
CArchDaemonWindows::start(const char* name) ArchDaemonWindows::start(const char* name)
{ {
// open service manager // open service manager
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ); SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ);
@ -646,7 +646,7 @@ CArchDaemonWindows::start(const char* name)
} }
void void
CArchDaemonWindows::stop(const char* name) ArchDaemonWindows::stop(const char* name)
{ {
// open service manager // open service manager
SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ); SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ);
@ -675,12 +675,12 @@ CArchDaemonWindows::stop(const char* name)
} }
void void
CArchDaemonWindows::installDaemon() ArchDaemonWindows::installDaemon()
{ {
// install default daemon if not already installed. // install default daemon if not already installed.
if (!isDaemonInstalled(DEFAULT_DAEMON_NAME)) { if (!isDaemonInstalled(DEFAULT_DAEMON_NAME)) {
char path[MAX_PATH]; char path[MAX_PATH];
GetModuleFileName(CArchMiscWindows::instanceWin32(), path, MAX_PATH); GetModuleFileName(ArchMiscWindows::instanceWin32(), path, MAX_PATH);
// wrap in quotes so a malicious user can't start \Program.exe as admin. // wrap in quotes so a malicious user can't start \Program.exe as admin.
std::stringstream ss; std::stringstream ss;
@ -695,7 +695,7 @@ CArchDaemonWindows::installDaemon()
} }
void void
CArchDaemonWindows::uninstallDaemon() ArchDaemonWindows::uninstallDaemon()
{ {
// remove legacy services if installed. // remove legacy services if installed.
if (isDaemonInstalled(LEGACY_SERVER_DAEMON_NAME)) { if (isDaemonInstalled(LEGACY_SERVER_DAEMON_NAME)) {

View File

@ -26,15 +26,15 @@
#include <Windows.h> #include <Windows.h>
#include <tchar.h> #include <tchar.h>
#define ARCH_DAEMON CArchDaemonWindows #define ARCH_DAEMON ArchDaemonWindows
//! Win32 implementation of IArchDaemon //! Win32 implementation of IArchDaemon
class CArchDaemonWindows : public IArchDaemon { class ArchDaemonWindows : public IArchDaemon {
public: public:
typedef int (*RunFunc)(void); typedef int (*RunFunc)(void);
CArchDaemonWindows(); ArchDaemonWindows();
virtual ~CArchDaemonWindows(); virtual ~ArchDaemonWindows();
//! Run the daemon //! Run the daemon
/*! /*!
@ -120,10 +120,10 @@ private:
}; };
private: private:
static CArchDaemonWindows* s_daemon; static ArchDaemonWindows* s_daemon;
CArchMutex m_serviceMutex; ArchMutex m_serviceMutex;
CArchCond m_serviceCondVar; ArchCond m_serviceCondVar;
DWORD m_serviceState; DWORD m_serviceState;
bool m_serviceHandlerWaiting; bool m_serviceHandlerWaiting;
bool m_serviceRunning; bool m_serviceRunning;

View File

@ -25,21 +25,21 @@
#include <string.h> #include <string.h>
// //
// CArchFileWindows // ArchFileWindows
// //
CArchFileWindows::CArchFileWindows() ArchFileWindows::ArchFileWindows()
{ {
// do nothing // do nothing
} }
CArchFileWindows::~CArchFileWindows() ArchFileWindows::~ArchFileWindows()
{ {
// do nothing // do nothing
} }
const char* const char*
CArchFileWindows::getBasename(const char* pathname) ArchFileWindows::getBasename(const char* pathname)
{ {
if (pathname == NULL) { if (pathname == NULL) {
return NULL; return NULL;
@ -64,7 +64,7 @@ CArchFileWindows::getBasename(const char* pathname)
} }
std::string std::string
CArchFileWindows::getUserDirectory() ArchFileWindows::getUserDirectory()
{ {
// try %HOMEPATH% // try %HOMEPATH%
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
@ -108,7 +108,7 @@ CArchFileWindows::getUserDirectory()
} }
std::string std::string
CArchFileWindows::getSystemDirectory() ArchFileWindows::getSystemDirectory()
{ {
// get windows directory // get windows directory
char dir[MAX_PATH]; char dir[MAX_PATH];
@ -122,7 +122,7 @@ CArchFileWindows::getSystemDirectory()
} }
std::string std::string
CArchFileWindows::getInstalledDirectory() ArchFileWindows::getInstalledDirectory()
{ {
char fileNameBuffer[MAX_PATH]; char fileNameBuffer[MAX_PATH];
GetModuleFileName(NULL, fileNameBuffer, MAX_PATH); GetModuleFileName(NULL, fileNameBuffer, MAX_PATH);
@ -134,13 +134,13 @@ CArchFileWindows::getInstalledDirectory()
} }
std::string std::string
CArchFileWindows::getLogDirectory() ArchFileWindows::getLogDirectory()
{ {
return getInstalledDirectory(); return getInstalledDirectory();
} }
std::string std::string
CArchFileWindows::concatPath(const std::string& prefix, ArchFileWindows::concatPath(const std::string& prefix,
const std::string& suffix) const std::string& suffix)
{ {
std::string path; std::string path;

View File

@ -20,13 +20,13 @@
#include "arch/IArchFile.h" #include "arch/IArchFile.h"
#define ARCH_FILE CArchFileWindows #define ARCH_FILE ArchFileWindows
//! Win32 implementation of IArchFile //! Win32 implementation of IArchFile
class CArchFileWindows : public IArchFile { class ArchFileWindows : public IArchFile {
public: public:
CArchFileWindows(); ArchFileWindows();
virtual ~CArchFileWindows(); virtual ~ArchFileWindows();
// IArchFile overrides // IArchFile overrides
virtual const char* getBasename(const char* pathname); virtual const char* getBasename(const char* pathname);

View File

@ -24,20 +24,20 @@
#include <Wininet.h> #include <Wininet.h>
#include <Shlwapi.h> #include <Shlwapi.h>
struct CWinINetUrl { struct WinINetUrl {
CString m_scheme; String m_scheme;
CString m_host; String m_host;
CString m_path; String m_path;
INTERNET_PORT m_port; INTERNET_PORT m_port;
DWORD m_flags; DWORD m_flags;
}; };
class CWinINetRequest { class WinINetRequest {
public: public:
CWinINetRequest(const CString& url); WinINetRequest(const String& url);
~CWinINetRequest(); ~WinINetRequest();
CString send(); String send();
void openSession(); void openSession();
void connect(); void connect();
void openRequest(); void openRequest();
@ -46,23 +46,23 @@ private:
HINTERNET m_session; HINTERNET m_session;
HINTERNET m_connect; HINTERNET m_connect;
HINTERNET m_request; HINTERNET m_request;
CWinINetUrl m_url; WinINetUrl m_url;
bool m_used; bool m_used;
}; };
// //
// CArchInternetWindows // ArchInternetWindows
// //
CString String
CArchInternetWindows::get(const CString& url) ArchInternetWindows::get(const String& url)
{ {
CWinINetRequest request(url); WinINetRequest request(url);
return request.send(); return request.send();
} }
CString String
CArchInternetWindows::urlEncode(const CString& url) ArchInternetWindows::urlEncode(const String& url)
{ {
TCHAR buffer[1024]; TCHAR buffer[1024];
DWORD bufferSize = sizeof(buffer); DWORD bufferSize = sizeof(buffer);
@ -71,7 +71,7 @@ CArchInternetWindows::urlEncode(const CString& url)
throw XArch(new XArchEvalWindows()); throw XArch(new XArchEvalWindows());
} }
CString result(buffer); String result(buffer);
// the win32 url encoding funcitons are pretty useless (to us) and only // the win32 url encoding funcitons are pretty useless (to us) and only
// escape "unsafe" chars, but not + or =, so we need to replace these // escape "unsafe" chars, but not + or =, so we need to replace these
@ -83,12 +83,12 @@ CArchInternetWindows::urlEncode(const CString& url)
} }
// //
// CWinINetRequest // WinINetRequest
// //
static CWinINetUrl parseUrl(const CString& url); static WinINetUrl parseUrl(const String& url);
CWinINetRequest::CWinINetRequest(const CString& url) : WinINetRequest::WinINetRequest(const String& url) :
m_session(NULL), m_session(NULL),
m_connect(NULL), m_connect(NULL),
m_request(NULL), m_request(NULL),
@ -97,7 +97,7 @@ CWinINetRequest::CWinINetRequest(const CString& url) :
{ {
} }
CWinINetRequest::~CWinINetRequest() WinINetRequest::~WinINetRequest()
{ {
if (m_request != NULL) { if (m_request != NULL) {
InternetCloseHandle(m_request); InternetCloseHandle(m_request);
@ -112,8 +112,8 @@ CWinINetRequest::~CWinINetRequest()
} }
} }
CString String
CWinINetRequest::send() WinINetRequest::send()
{ {
if (m_used) { if (m_used) {
throw XArch("class is one time use."); throw XArch("class is one time use.");
@ -124,7 +124,7 @@ CWinINetRequest::send()
connect(); connect();
openRequest(); openRequest();
CString headers("Content-Type: text/html"); String headers("Content-Type: text/html");
if (!HttpSendRequest(m_request, headers.c_str(), (DWORD)headers.length(), NULL, NULL)) { if (!HttpSendRequest(m_request, headers.c_str(), (DWORD)headers.length(), NULL, NULL)) {
throw XArch(new XArchEvalWindows()); throw XArch(new XArchEvalWindows());
} }
@ -143,7 +143,7 @@ CWinINetRequest::send()
} }
void void
CWinINetRequest::openSession() WinINetRequest::openSession()
{ {
std::stringstream userAgent; std::stringstream userAgent;
userAgent << "Synergy "; userAgent << "Synergy ";
@ -162,7 +162,7 @@ CWinINetRequest::openSession()
} }
void void
CWinINetRequest::connect() WinINetRequest::connect()
{ {
m_connect = InternetConnect( m_connect = InternetConnect(
m_session, m_session,
@ -180,7 +180,7 @@ CWinINetRequest::connect()
} }
void void
CWinINetRequest::openRequest() WinINetRequest::openRequest()
{ {
m_request = HttpOpenRequest( m_request = HttpOpenRequest(
m_connect, m_connect,
@ -200,10 +200,10 @@ CWinINetRequest::openRequest()
// nb: i tried to use InternetCrackUrl here, but couldn't quite get that to // nb: i tried to use InternetCrackUrl here, but couldn't quite get that to
// work. here's some (less robust) code to split the url into components. // work. here's some (less robust) code to split the url into components.
// this works fine with simple urls, but doesn't consider the full url spec. // this works fine with simple urls, but doesn't consider the full url spec.
static CWinINetUrl static WinINetUrl
parseUrl(const CString& url) parseUrl(const String& url)
{ {
CWinINetUrl parsed; WinINetUrl parsed;
size_t schemeEnd = url.find("://"); size_t schemeEnd = url.find("://");
size_t hostEnd = url.find('/', schemeEnd + 3); size_t hostEnd = url.find('/', schemeEnd + 3);
@ -215,7 +215,7 @@ parseUrl(const CString& url)
parsed.m_port = INTERNET_DEFAULT_HTTP_PORT; parsed.m_port = INTERNET_DEFAULT_HTTP_PORT;
parsed.m_flags = 0; parsed.m_flags = 0;
if (parsed.m_scheme.find("https") != CString::npos) { if (parsed.m_scheme.find("https") != String::npos) {
parsed.m_port = INTERNET_DEFAULT_HTTPS_PORT; parsed.m_port = INTERNET_DEFAULT_HTTPS_PORT;
parsed.m_flags = INTERNET_FLAG_SECURE; parsed.m_flags = INTERNET_FLAG_SECURE;
} }

View File

@ -17,12 +17,12 @@
#pragma once #pragma once
#define ARCH_INTERNET CArchInternetWindows #define ARCH_INTERNET ArchInternetWindows
#include "base/String.h" #include "base/String.h"
class CArchInternetWindows { class ArchInternetWindows {
public: public:
CString get(const CString& url); String get(const String& url);
CString urlEncode(const CString& url); String urlEncode(const String& url);
}; };

View File

@ -22,21 +22,21 @@
#include <string.h> #include <string.h>
// //
// CArchLogWindows // ArchLogWindows
// //
CArchLogWindows::CArchLogWindows() : m_eventLog(NULL) ArchLogWindows::ArchLogWindows() : m_eventLog(NULL)
{ {
// do nothing // do nothing
} }
CArchLogWindows::~CArchLogWindows() ArchLogWindows::~ArchLogWindows()
{ {
// do nothing // do nothing
} }
void void
CArchLogWindows::openLog(const char* name) ArchLogWindows::openLog(const char* name)
{ {
if (m_eventLog == NULL) { if (m_eventLog == NULL) {
m_eventLog = RegisterEventSource(NULL, name); m_eventLog = RegisterEventSource(NULL, name);
@ -44,7 +44,7 @@ CArchLogWindows::openLog(const char* name)
} }
void void
CArchLogWindows::closeLog() ArchLogWindows::closeLog()
{ {
if (m_eventLog != NULL) { if (m_eventLog != NULL) {
DeregisterEventSource(m_eventLog); DeregisterEventSource(m_eventLog);
@ -53,13 +53,13 @@ CArchLogWindows::closeLog()
} }
void void
CArchLogWindows::showLog(bool) ArchLogWindows::showLog(bool)
{ {
// do nothing // do nothing
} }
void void
CArchLogWindows::writeLog(ELevel level, const char* msg) ArchLogWindows::writeLog(ELevel level, const char* msg)
{ {
if (m_eventLog != NULL) { if (m_eventLog != NULL) {
// convert priority // convert priority

View File

@ -23,13 +23,13 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#define ARCH_LOG CArchLogWindows #define ARCH_LOG ArchLogWindows
//! Win32 implementation of IArchLog //! Win32 implementation of IArchLog
class CArchLogWindows : public IArchLog { class ArchLogWindows : public IArchLog {
public: public:
CArchLogWindows(); ArchLogWindows();
virtual ~CArchLogWindows(); virtual ~ArchLogWindows();
// IArchLog overrides // IArchLog overrides
virtual void openLog(const char* name); virtual void openLog(const char* name);

View File

@ -41,92 +41,92 @@
typedef DWORD EXECUTION_STATE; typedef DWORD EXECUTION_STATE;
// //
// CArchMiscWindows // ArchMiscWindows
// //
CArchMiscWindows::CDialogs* CArchMiscWindows::s_dialogs = NULL; ArchMiscWindows::Dialogs* ArchMiscWindows::s_dialogs = NULL;
DWORD CArchMiscWindows::s_busyState = 0; DWORD ArchMiscWindows::s_busyState = 0;
CArchMiscWindows::STES_t CArchMiscWindows::s_stes = NULL; ArchMiscWindows::STES_t ArchMiscWindows::s_stes = NULL;
HICON CArchMiscWindows::s_largeIcon = NULL; HICON ArchMiscWindows::s_largeIcon = NULL;
HICON CArchMiscWindows::s_smallIcon = NULL; HICON ArchMiscWindows::s_smallIcon = NULL;
HINSTANCE CArchMiscWindows::s_instanceWin32 = NULL; HINSTANCE ArchMiscWindows::s_instanceWin32 = NULL;
void void
CArchMiscWindows::cleanup() ArchMiscWindows::cleanup()
{ {
delete s_dialogs; delete s_dialogs;
} }
void void
CArchMiscWindows::init() ArchMiscWindows::init()
{ {
s_dialogs = new CDialogs; s_dialogs = new Dialogs;
} }
void void
CArchMiscWindows::setIcons(HICON largeIcon, HICON smallIcon) ArchMiscWindows::setIcons(HICON largeIcon, HICON smallIcon)
{ {
s_largeIcon = largeIcon; s_largeIcon = largeIcon;
s_smallIcon = smallIcon; s_smallIcon = smallIcon;
} }
void void
CArchMiscWindows::getIcons(HICON& largeIcon, HICON& smallIcon) ArchMiscWindows::getIcons(HICON& largeIcon, HICON& smallIcon)
{ {
largeIcon = s_largeIcon; largeIcon = s_largeIcon;
smallIcon = s_smallIcon; smallIcon = s_smallIcon;
} }
int int
CArchMiscWindows::runDaemon(RunFunc runFunc) ArchMiscWindows::runDaemon(RunFunc runFunc)
{ {
return CArchDaemonWindows::runDaemon(runFunc); return ArchDaemonWindows::runDaemon(runFunc);
} }
void void
CArchMiscWindows::daemonRunning(bool running) ArchMiscWindows::daemonRunning(bool running)
{ {
CArchDaemonWindows::daemonRunning(running); ArchDaemonWindows::daemonRunning(running);
} }
void void
CArchMiscWindows::daemonFailed(int result) ArchMiscWindows::daemonFailed(int result)
{ {
CArchDaemonWindows::daemonFailed(result); ArchDaemonWindows::daemonFailed(result);
} }
UINT UINT
CArchMiscWindows::getDaemonQuitMessage() ArchMiscWindows::getDaemonQuitMessage()
{ {
return CArchDaemonWindows::getDaemonQuitMessage(); return ArchDaemonWindows::getDaemonQuitMessage();
} }
HKEY HKEY
CArchMiscWindows::openKey(HKEY key, const TCHAR* keyName) ArchMiscWindows::openKey(HKEY key, const TCHAR* keyName)
{ {
return openKey(key, keyName, false); return openKey(key, keyName, false);
} }
HKEY HKEY
CArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames) ArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames)
{ {
return openKey(key, keyNames, false); return openKey(key, keyNames, false);
} }
HKEY HKEY
CArchMiscWindows::addKey(HKEY key, const TCHAR* keyName) ArchMiscWindows::addKey(HKEY key, const TCHAR* keyName)
{ {
return openKey(key, keyName, true); return openKey(key, keyName, true);
} }
HKEY HKEY
CArchMiscWindows::addKey(HKEY key, const TCHAR* const* keyNames) ArchMiscWindows::addKey(HKEY key, const TCHAR* const* keyNames)
{ {
return openKey(key, keyNames, true); return openKey(key, keyNames, true);
} }
HKEY HKEY
CArchMiscWindows::openKey(HKEY key, const TCHAR* keyName, bool create) ArchMiscWindows::openKey(HKEY key, const TCHAR* keyName, bool create)
{ {
// ignore if parent is NULL // ignore if parent is NULL
if (key == NULL) { if (key == NULL) {
@ -154,7 +154,7 @@ CArchMiscWindows::openKey(HKEY key, const TCHAR* keyName, bool create)
} }
HKEY HKEY
CArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames, bool create) ArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames, bool create)
{ {
for (size_t i = 0; key != NULL && keyNames[i] != NULL; ++i) { for (size_t i = 0; key != NULL && keyNames[i] != NULL; ++i) {
// open next key // open next key
@ -164,7 +164,7 @@ CArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames, bool create)
} }
void void
CArchMiscWindows::closeKey(HKEY key) ArchMiscWindows::closeKey(HKEY key)
{ {
assert(key != NULL); assert(key != NULL);
if (key==NULL) return; if (key==NULL) return;
@ -172,7 +172,7 @@ CArchMiscWindows::closeKey(HKEY key)
} }
void void
CArchMiscWindows::deleteKey(HKEY key, const TCHAR* name) ArchMiscWindows::deleteKey(HKEY key, const TCHAR* name)
{ {
assert(key != NULL); assert(key != NULL);
assert(name != NULL); assert(name != NULL);
@ -181,7 +181,7 @@ CArchMiscWindows::deleteKey(HKEY key, const TCHAR* name)
} }
void void
CArchMiscWindows::deleteValue(HKEY key, const TCHAR* name) ArchMiscWindows::deleteValue(HKEY key, const TCHAR* name)
{ {
assert(key != NULL); assert(key != NULL);
assert(name != NULL); assert(name != NULL);
@ -190,7 +190,7 @@ CArchMiscWindows::deleteValue(HKEY key, const TCHAR* name)
} }
bool bool
CArchMiscWindows::hasValue(HKEY key, const TCHAR* name) ArchMiscWindows::hasValue(HKEY key, const TCHAR* name)
{ {
DWORD type; DWORD type;
LONG result = RegQueryValueEx(key, name, 0, &type, NULL, NULL); LONG result = RegQueryValueEx(key, name, 0, &type, NULL, NULL);
@ -198,8 +198,8 @@ CArchMiscWindows::hasValue(HKEY key, const TCHAR* name)
(type == REG_DWORD || type == REG_SZ)); (type == REG_DWORD || type == REG_SZ));
} }
CArchMiscWindows::EValueType ArchMiscWindows::EValueType
CArchMiscWindows::typeOfValue(HKEY key, const TCHAR* name) ArchMiscWindows::typeOfValue(HKEY key, const TCHAR* name)
{ {
DWORD type; DWORD type;
LONG result = RegQueryValueEx(key, name, 0, &type, NULL, NULL); LONG result = RegQueryValueEx(key, name, 0, &type, NULL, NULL);
@ -222,7 +222,7 @@ CArchMiscWindows::typeOfValue(HKEY key, const TCHAR* name)
} }
void void
CArchMiscWindows::setValue(HKEY key, ArchMiscWindows::setValue(HKEY key,
const TCHAR* name, const std::string& value) const TCHAR* name, const std::string& value)
{ {
assert(key != NULL); assert(key != NULL);
@ -233,7 +233,7 @@ CArchMiscWindows::setValue(HKEY key,
} }
void void
CArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value) ArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value)
{ {
assert(key != NULL); assert(key != NULL);
if(key ==NULL) return; // TODO: throw exception if(key ==NULL) return; // TODO: throw exception
@ -243,7 +243,7 @@ CArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value)
} }
void void
CArchMiscWindows::setValueBinary(HKEY key, ArchMiscWindows::setValueBinary(HKEY key,
const TCHAR* name, const std::string& value) const TCHAR* name, const std::string& value)
{ {
assert(key != NULL); assert(key != NULL);
@ -255,7 +255,7 @@ CArchMiscWindows::setValueBinary(HKEY key,
} }
std::string std::string
CArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR* name, DWORD type) ArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR* name, DWORD type)
{ {
// get the size of the string // get the size of the string
DWORD actualType; DWORD actualType;
@ -292,19 +292,19 @@ CArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR* name, DWORD type)
} }
std::string std::string
CArchMiscWindows::readValueString(HKEY key, const TCHAR* name) ArchMiscWindows::readValueString(HKEY key, const TCHAR* name)
{ {
return readBinaryOrString(key, name, REG_SZ); return readBinaryOrString(key, name, REG_SZ);
} }
std::string std::string
CArchMiscWindows::readValueBinary(HKEY key, const TCHAR* name) ArchMiscWindows::readValueBinary(HKEY key, const TCHAR* name)
{ {
return readBinaryOrString(key, name, REG_BINARY); return readBinaryOrString(key, name, REG_BINARY);
} }
DWORD DWORD
CArchMiscWindows::readValueInt(HKEY key, const TCHAR* name) ArchMiscWindows::readValueInt(HKEY key, const TCHAR* name)
{ {
DWORD type; DWORD type;
DWORD value; DWORD value;
@ -318,21 +318,21 @@ CArchMiscWindows::readValueInt(HKEY key, const TCHAR* name)
} }
void void
CArchMiscWindows::addDialog(HWND hwnd) ArchMiscWindows::addDialog(HWND hwnd)
{ {
s_dialogs->insert(hwnd); s_dialogs->insert(hwnd);
} }
void void
CArchMiscWindows::removeDialog(HWND hwnd) ArchMiscWindows::removeDialog(HWND hwnd)
{ {
s_dialogs->erase(hwnd); s_dialogs->erase(hwnd);
} }
bool bool
CArchMiscWindows::processDialog(MSG* msg) ArchMiscWindows::processDialog(MSG* msg)
{ {
for (CDialogs::const_iterator index = s_dialogs->begin(); for (Dialogs::const_iterator index = s_dialogs->begin();
index != s_dialogs->end(); ++index) { index != s_dialogs->end(); ++index) {
if (IsDialogMessage(*index, msg)) { if (IsDialogMessage(*index, msg)) {
return true; return true;
@ -342,21 +342,21 @@ CArchMiscWindows::processDialog(MSG* msg)
} }
void void
CArchMiscWindows::addBusyState(DWORD busyModes) ArchMiscWindows::addBusyState(DWORD busyModes)
{ {
s_busyState |= busyModes; s_busyState |= busyModes;
setThreadExecutionState(s_busyState); setThreadExecutionState(s_busyState);
} }
void void
CArchMiscWindows::removeBusyState(DWORD busyModes) ArchMiscWindows::removeBusyState(DWORD busyModes)
{ {
s_busyState &= ~busyModes; s_busyState &= ~busyModes;
setThreadExecutionState(s_busyState); setThreadExecutionState(s_busyState);
} }
void void
CArchMiscWindows::setThreadExecutionState(DWORD busyModes) ArchMiscWindows::setThreadExecutionState(DWORD busyModes)
{ {
// look up function dynamically so we work on older systems // look up function dynamically so we work on older systems
if (s_stes == NULL) { if (s_stes == NULL) {
@ -366,7 +366,7 @@ CArchMiscWindows::setThreadExecutionState(DWORD busyModes)
"SetThreadExecutionState")); "SetThreadExecutionState"));
} }
if (s_stes == NULL) { if (s_stes == NULL) {
s_stes = &CArchMiscWindows::dummySetThreadExecutionState; s_stes = &ArchMiscWindows::dummySetThreadExecutionState;
} }
} }
@ -387,14 +387,14 @@ CArchMiscWindows::setThreadExecutionState(DWORD busyModes)
} }
DWORD DWORD
CArchMiscWindows::dummySetThreadExecutionState(DWORD) ArchMiscWindows::dummySetThreadExecutionState(DWORD)
{ {
// do nothing // do nothing
return 0; return 0;
} }
void void
CArchMiscWindows::wakeupDisplay() ArchMiscWindows::wakeupDisplay()
{ {
// We can't use ::setThreadExecutionState here because it sets // We can't use ::setThreadExecutionState here because it sets
// ES_CONTINUOUS, which we don't want. // ES_CONTINUOUS, which we don't want.
@ -406,7 +406,7 @@ CArchMiscWindows::wakeupDisplay()
"SetThreadExecutionState")); "SetThreadExecutionState"));
} }
if (s_stes == NULL) { if (s_stes == NULL) {
s_stes = &CArchMiscWindows::dummySetThreadExecutionState; s_stes = &ArchMiscWindows::dummySetThreadExecutionState;
} }
} }
@ -417,9 +417,9 @@ CArchMiscWindows::wakeupDisplay()
} }
bool bool
CArchMiscWindows::wasLaunchedAsService() ArchMiscWindows::wasLaunchedAsService()
{ {
CString name; String name;
if (!getParentProcessName(name)) { if (!getParentProcessName(name)) {
LOG((CLOG_ERR "cannot determine if process was launched as service")); LOG((CLOG_ERR "cannot determine if process was launched as service"));
return false; return false;
@ -429,7 +429,7 @@ CArchMiscWindows::wasLaunchedAsService()
} }
bool bool
CArchMiscWindows::getParentProcessName(CString &name) ArchMiscWindows::getParentProcessName(String &name)
{ {
PROCESSENTRY32 parentEntry; PROCESSENTRY32 parentEntry;
if (!getParentProcessEntry(parentEntry)){ if (!getParentProcessEntry(parentEntry)){
@ -442,14 +442,14 @@ CArchMiscWindows::getParentProcessName(CString &name)
} }
BOOL WINAPI BOOL WINAPI
CArchMiscWindows::getSelfProcessEntry(PROCESSENTRY32& entry) ArchMiscWindows::getSelfProcessEntry(PROCESSENTRY32& entry)
{ {
// get entry from current PID // get entry from current PID
return getProcessEntry(entry, GetCurrentProcessId()); return getProcessEntry(entry, GetCurrentProcessId());
} }
BOOL WINAPI BOOL WINAPI
CArchMiscWindows::getParentProcessEntry(PROCESSENTRY32& entry) ArchMiscWindows::getParentProcessEntry(PROCESSENTRY32& entry)
{ {
// get the current process, so we can get parent PID // get the current process, so we can get parent PID
PROCESSENTRY32 selfEntry; PROCESSENTRY32 selfEntry;
@ -462,7 +462,7 @@ CArchMiscWindows::getParentProcessEntry(PROCESSENTRY32& entry)
} }
BOOL WINAPI BOOL WINAPI
CArchMiscWindows::getProcessEntry(PROCESSENTRY32& entry, DWORD processID) ArchMiscWindows::getProcessEntry(PROCESSENTRY32& entry, DWORD processID)
{ {
// first we need to take a snapshot of the running processes // first we need to take a snapshot of the running processes
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
@ -498,14 +498,14 @@ CArchMiscWindows::getProcessEntry(PROCESSENTRY32& entry, DWORD processID)
} }
HINSTANCE HINSTANCE
CArchMiscWindows::instanceWin32() ArchMiscWindows::instanceWin32()
{ {
assert(s_instanceWin32 != NULL); assert(s_instanceWin32 != NULL);
return s_instanceWin32; return s_instanceWin32;
} }
void void
CArchMiscWindows::setInstanceWin32(HINSTANCE instance) ArchMiscWindows::setInstanceWin32(HINSTANCE instance)
{ {
assert(instance != NULL); assert(instance != NULL);
s_instanceWin32 = instance; s_instanceWin32 = instance;

View File

@ -28,7 +28,7 @@
#include <Tlhelp32.h> #include <Tlhelp32.h>
//! Miscellaneous win32 functions. //! Miscellaneous win32 functions.
class CArchMiscWindows { class ArchMiscWindows {
public: public:
enum EValueType { enum EValueType {
kUNKNOWN, kUNKNOWN,
@ -65,25 +65,25 @@ public:
//! Run the daemon //! Run the daemon
/*! /*!
Delegates to CArchDaemonWindows. Delegates to ArchDaemonWindows.
*/ */
static int runDaemon(RunFunc runFunc); static int runDaemon(RunFunc runFunc);
//! Indicate daemon is in main loop //! Indicate daemon is in main loop
/*! /*!
Delegates to CArchDaemonWindows. Delegates to ArchDaemonWindows.
*/ */
static void daemonRunning(bool running); static void daemonRunning(bool running);
//! Indicate failure of running daemon //! Indicate failure of running daemon
/*! /*!
Delegates to CArchDaemonWindows. Delegates to ArchDaemonWindows.
*/ */
static void daemonFailed(int result); static void daemonFailed(int result);
//! Get daemon quit message //! Get daemon quit message
/*! /*!
Delegates to CArchDaemonWindows. Delegates to ArchDaemonWindows.
*/ */
static UINT getDaemonQuitMessage(); static UINT getDaemonQuitMessage();
@ -163,7 +163,7 @@ public:
static bool wasLaunchedAsService(); static bool wasLaunchedAsService();
//! Returns true if we got the parent process name. //! Returns true if we got the parent process name.
static bool getParentProcessName(CString &name); static bool getParentProcessName(String &name);
static HINSTANCE instanceWin32(); static HINSTANCE instanceWin32();
@ -190,10 +190,10 @@ private:
static DWORD WINAPI dummySetThreadExecutionState(DWORD); static DWORD WINAPI dummySetThreadExecutionState(DWORD);
private: private:
typedef std::set<HWND> CDialogs; typedef std::set<HWND> Dialogs;
typedef DWORD (WINAPI *STES_t)(DWORD); typedef DWORD (WINAPI *STES_t)(DWORD);
static CDialogs* s_dialogs; static Dialogs* s_dialogs;
static DWORD s_busyState; static DWORD s_busyState;
static STES_t s_stes; static STES_t s_stes;
static HICON s_largeIcon; static HICON s_largeIcon;

View File

@ -37,13 +37,13 @@
// //
// //
// CArchThreadImpl // ArchThreadImpl
// //
class CArchThreadImpl { class ArchThreadImpl {
public: public:
CArchThreadImpl(); ArchThreadImpl();
~CArchThreadImpl(); ~ArchThreadImpl();
public: public:
int m_refCount; int m_refCount;
@ -58,7 +58,7 @@ public:
void* m_networkData; void* m_networkData;
}; };
CArchThreadImpl::CArchThreadImpl() : ArchThreadImpl::ArchThreadImpl() :
m_refCount(1), m_refCount(1),
m_thread(NULL), m_thread(NULL),
m_id(0), m_id(0),
@ -72,7 +72,7 @@ CArchThreadImpl::CArchThreadImpl() :
m_cancel = CreateEvent(NULL, TRUE, FALSE, NULL); m_cancel = CreateEvent(NULL, TRUE, FALSE, NULL);
} }
CArchThreadImpl::~CArchThreadImpl() ArchThreadImpl::~ArchThreadImpl()
{ {
CloseHandle(m_exit); CloseHandle(m_exit);
CloseHandle(m_cancel); CloseHandle(m_cancel);
@ -80,12 +80,12 @@ CArchThreadImpl::~CArchThreadImpl()
// //
// CArchMultithreadWindows // ArchMultithreadWindows
// //
CArchMultithreadWindows* CArchMultithreadWindows::s_instance = NULL; ArchMultithreadWindows* ArchMultithreadWindows::s_instance = NULL;
CArchMultithreadWindows::CArchMultithreadWindows() ArchMultithreadWindows::ArchMultithreadWindows()
{ {
assert(s_instance == NULL); assert(s_instance == NULL);
s_instance = this; s_instance = this;
@ -101,18 +101,18 @@ CArchMultithreadWindows::CArchMultithreadWindows()
// create thread for calling (main) thread and add it to our // create thread for calling (main) thread and add it to our
// list. no need to lock the mutex since we're the only thread. // list. no need to lock the mutex since we're the only thread.
m_mainThread = new CArchThreadImpl; m_mainThread = new ArchThreadImpl;
m_mainThread->m_thread = NULL; m_mainThread->m_thread = NULL;
m_mainThread->m_id = GetCurrentThreadId(); m_mainThread->m_id = GetCurrentThreadId();
insert(m_mainThread); insert(m_mainThread);
} }
CArchMultithreadWindows::~CArchMultithreadWindows() ArchMultithreadWindows::~ArchMultithreadWindows()
{ {
s_instance = NULL; s_instance = NULL;
// clean up thread list // clean up thread list
for (CThreadList::iterator index = m_threadList.begin(); for (ThreadList::iterator index = m_threadList.begin();
index != m_threadList.end(); ++index) { index != m_threadList.end(); ++index) {
delete *index; delete *index;
} }
@ -122,16 +122,16 @@ CArchMultithreadWindows::~CArchMultithreadWindows()
} }
void void
CArchMultithreadWindows::setNetworkDataForCurrentThread(void* data) ArchMultithreadWindows::setNetworkDataForCurrentThread(void* data)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); ArchThreadImpl* thread = findNoRef(GetCurrentThreadId());
thread->m_networkData = data; thread->m_networkData = data;
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
} }
void* void*
CArchMultithreadWindows::getNetworkDataForThread(CArchThread thread) ArchMultithreadWindows::getNetworkDataForThread(ArchThread thread)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
void* data = thread->m_networkData; void* data = thread->m_networkData;
@ -140,27 +140,27 @@ CArchMultithreadWindows::getNetworkDataForThread(CArchThread thread)
} }
HANDLE HANDLE
CArchMultithreadWindows::getCancelEventForCurrentThread() ArchMultithreadWindows::getCancelEventForCurrentThread()
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); ArchThreadImpl* thread = findNoRef(GetCurrentThreadId());
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
return thread->m_cancel; return thread->m_cancel;
} }
CArchMultithreadWindows* ArchMultithreadWindows*
CArchMultithreadWindows::getInstance() ArchMultithreadWindows::getInstance()
{ {
return s_instance; return s_instance;
} }
CArchCond ArchCond
CArchMultithreadWindows::newCondVar() ArchMultithreadWindows::newCondVar()
{ {
CArchCondImpl* cond = new CArchCondImpl; ArchCondImpl* cond = new ArchCondImpl;
cond->m_events[CArchCondImpl::kSignal] = CreateEvent(NULL, cond->m_events[ArchCondImpl::kSignal] = CreateEvent(NULL,
FALSE, FALSE, NULL); FALSE, FALSE, NULL);
cond->m_events[CArchCondImpl::kBroadcast] = CreateEvent(NULL, cond->m_events[ArchCondImpl::kBroadcast] = CreateEvent(NULL,
TRUE, FALSE, NULL); TRUE, FALSE, NULL);
cond->m_waitCountMutex = newMutex(); cond->m_waitCountMutex = newMutex();
cond->m_waitCount = 0; cond->m_waitCount = 0;
@ -168,16 +168,16 @@ CArchMultithreadWindows::newCondVar()
} }
void void
CArchMultithreadWindows::closeCondVar(CArchCond cond) ArchMultithreadWindows::closeCondVar(ArchCond cond)
{ {
CloseHandle(cond->m_events[CArchCondImpl::kSignal]); CloseHandle(cond->m_events[ArchCondImpl::kSignal]);
CloseHandle(cond->m_events[CArchCondImpl::kBroadcast]); CloseHandle(cond->m_events[ArchCondImpl::kBroadcast]);
closeMutex(cond->m_waitCountMutex); closeMutex(cond->m_waitCountMutex);
delete cond; delete cond;
} }
void void
CArchMultithreadWindows::signalCondVar(CArchCond cond) ArchMultithreadWindows::signalCondVar(ArchCond cond)
{ {
// is anybody waiting? // is anybody waiting?
lockMutex(cond->m_waitCountMutex); lockMutex(cond->m_waitCountMutex);
@ -186,12 +186,12 @@ CArchMultithreadWindows::signalCondVar(CArchCond cond)
// wake one thread if anybody is waiting // wake one thread if anybody is waiting
if (hasWaiter) { if (hasWaiter) {
SetEvent(cond->m_events[CArchCondImpl::kSignal]); SetEvent(cond->m_events[ArchCondImpl::kSignal]);
} }
} }
void void
CArchMultithreadWindows::broadcastCondVar(CArchCond cond) ArchMultithreadWindows::broadcastCondVar(ArchCond cond)
{ {
// is anybody waiting? // is anybody waiting?
lockMutex(cond->m_waitCountMutex); lockMutex(cond->m_waitCountMutex);
@ -200,13 +200,13 @@ CArchMultithreadWindows::broadcastCondVar(CArchCond cond)
// wake all threads if anybody is waiting // wake all threads if anybody is waiting
if (hasWaiter) { if (hasWaiter) {
SetEvent(cond->m_events[CArchCondImpl::kBroadcast]); SetEvent(cond->m_events[ArchCondImpl::kBroadcast]);
} }
} }
bool bool
CArchMultithreadWindows::waitCondVar(CArchCond cond, ArchMultithreadWindows::waitCondVar(ArchCond cond,
CArchMutex mutex, double timeout) ArchMutex mutex, double timeout)
{ {
// prepare to wait // prepare to wait
const DWORD winTimeout = (timeout < 0.0) ? INFINITE : const DWORD winTimeout = (timeout < 0.0) ? INFINITE :
@ -215,8 +215,8 @@ CArchMultithreadWindows::waitCondVar(CArchCond cond,
// make a list of the condition variable events and the cancel event // make a list of the condition variable events and the cancel event
// for the current thread. // for the current thread.
HANDLE handles[4]; HANDLE handles[4];
handles[0] = cond->m_events[CArchCondImpl::kSignal]; handles[0] = cond->m_events[ArchCondImpl::kSignal];
handles[1] = cond->m_events[CArchCondImpl::kBroadcast]; handles[1] = cond->m_events[ArchCondImpl::kBroadcast];
handles[2] = getCancelEventForCurrentThread(); handles[2] = getCancelEventForCurrentThread();
// update waiter count // update waiter count
@ -248,7 +248,7 @@ CArchMultithreadWindows::waitCondVar(CArchCond cond,
// reset the broadcast event if we're the last waiter // reset the broadcast event if we're the last waiter
if (last) { if (last) {
ResetEvent(cond->m_events[CArchCondImpl::kBroadcast]); ResetEvent(cond->m_events[ArchCondImpl::kBroadcast]);
} }
// reacquire the mutex // reacquire the mutex
@ -264,40 +264,40 @@ CArchMultithreadWindows::waitCondVar(CArchCond cond,
result == WAIT_OBJECT_0 + 1); result == WAIT_OBJECT_0 + 1);
} }
CArchMutex ArchMutex
CArchMultithreadWindows::newMutex() ArchMultithreadWindows::newMutex()
{ {
CArchMutexImpl* mutex = new CArchMutexImpl; ArchMutexImpl* mutex = new ArchMutexImpl;
InitializeCriticalSection(&mutex->m_mutex); InitializeCriticalSection(&mutex->m_mutex);
return mutex; return mutex;
} }
void void
CArchMultithreadWindows::closeMutex(CArchMutex mutex) ArchMultithreadWindows::closeMutex(ArchMutex mutex)
{ {
DeleteCriticalSection(&mutex->m_mutex); DeleteCriticalSection(&mutex->m_mutex);
delete mutex; delete mutex;
} }
void void
CArchMultithreadWindows::lockMutex(CArchMutex mutex) ArchMultithreadWindows::lockMutex(ArchMutex mutex)
{ {
EnterCriticalSection(&mutex->m_mutex); EnterCriticalSection(&mutex->m_mutex);
} }
void void
CArchMultithreadWindows::unlockMutex(CArchMutex mutex) ArchMultithreadWindows::unlockMutex(ArchMutex mutex)
{ {
LeaveCriticalSection(&mutex->m_mutex); LeaveCriticalSection(&mutex->m_mutex);
} }
CArchThread ArchThread
CArchMultithreadWindows::newThread(ThreadFunc func, void* data) ArchMultithreadWindows::newThread(ThreadFunc func, void* data)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
// create thread impl for new thread // create thread impl for new thread
CArchThreadImpl* thread = new CArchThreadImpl; ArchThreadImpl* thread = new ArchThreadImpl;
thread->m_func = func; thread->m_func = func;
thread->m_userData = data; thread->m_userData = data;
@ -327,18 +327,18 @@ CArchMultithreadWindows::newThread(ThreadFunc func, void* data)
return thread; return thread;
} }
CArchThread ArchThread
CArchMultithreadWindows::newCurrentThread() ArchMultithreadWindows::newCurrentThread()
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = find(GetCurrentThreadId()); ArchThreadImpl* thread = find(GetCurrentThreadId());
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
assert(thread != NULL); assert(thread != NULL);
return thread; return thread;
} }
void void
CArchMultithreadWindows::closeThread(CArchThread thread) ArchMultithreadWindows::closeThread(ArchThread thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -360,15 +360,15 @@ CArchMultithreadWindows::closeThread(CArchThread thread)
} }
} }
CArchThread ArchThread
CArchMultithreadWindows::copyThread(CArchThread thread) ArchMultithreadWindows::copyThread(ArchThread thread)
{ {
refThread(thread); refThread(thread);
return thread; return thread;
} }
void void
CArchMultithreadWindows::cancelThread(CArchThread thread) ArchMultithreadWindows::cancelThread(ArchThread thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -377,14 +377,14 @@ CArchMultithreadWindows::cancelThread(CArchThread thread)
} }
void void
CArchMultithreadWindows::setPriorityOfThread(CArchThread thread, int n) ArchMultithreadWindows::setPriorityOfThread(ArchThread thread, int n)
{ {
struct CPriorityInfo { struct PriorityInfo {
public: public:
DWORD m_class; DWORD m_class;
int m_level; int m_level;
}; };
static const CPriorityInfo s_pClass[] = { static const PriorityInfo s_pClass[] = {
{ IDLE_PRIORITY_CLASS, THREAD_PRIORITY_IDLE }, { IDLE_PRIORITY_CLASS, THREAD_PRIORITY_IDLE },
{ IDLE_PRIORITY_CLASS, THREAD_PRIORITY_LOWEST }, { IDLE_PRIORITY_CLASS, THREAD_PRIORITY_LOWEST },
{ IDLE_PRIORITY_CLASS, THREAD_PRIORITY_BELOW_NORMAL }, { IDLE_PRIORITY_CLASS, THREAD_PRIORITY_BELOW_NORMAL },
@ -436,11 +436,11 @@ CArchMultithreadWindows::setPriorityOfThread(CArchThread thread, int n)
} }
void void
CArchMultithreadWindows::testCancelThread() ArchMultithreadWindows::testCancelThread()
{ {
// find current thread // find current thread
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
CArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); ArchThreadImpl* thread = findNoRef(GetCurrentThreadId());
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
// test cancel on thread // test cancel on thread
@ -448,14 +448,14 @@ CArchMultithreadWindows::testCancelThread()
} }
bool bool
CArchMultithreadWindows::wait(CArchThread target, double timeout) ArchMultithreadWindows::wait(ArchThread target, double timeout)
{ {
assert(target != NULL); assert(target != NULL);
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
// find current thread // find current thread
CArchThreadImpl* self = findNoRef(GetCurrentThreadId()); ArchThreadImpl* self = findNoRef(GetCurrentThreadId());
// ignore wait if trying to wait on ourself // ignore wait if trying to wait on ourself
if (target == self) { if (target == self) {
@ -510,20 +510,20 @@ CArchMultithreadWindows::wait(CArchThread target, double timeout)
} }
bool bool
CArchMultithreadWindows::isSameThread(CArchThread thread1, CArchThread thread2) ArchMultithreadWindows::isSameThread(ArchThread thread1, ArchThread thread2)
{ {
return (thread1 == thread2); return (thread1 == thread2);
} }
bool bool
CArchMultithreadWindows::isExitedThread(CArchThread thread) ArchMultithreadWindows::isExitedThread(ArchThread thread)
{ {
// poll exit event // poll exit event
return (WaitForSingleObject(thread->m_exit, 0) == WAIT_OBJECT_0); return (WaitForSingleObject(thread->m_exit, 0) == WAIT_OBJECT_0);
} }
void* void*
CArchMultithreadWindows::getResultOfThread(CArchThread thread) ArchMultithreadWindows::getResultOfThread(ArchThread thread)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
void* result = thread->m_result; void* result = thread->m_result;
@ -532,13 +532,13 @@ CArchMultithreadWindows::getResultOfThread(CArchThread thread)
} }
IArchMultithread::ThreadID IArchMultithread::ThreadID
CArchMultithreadWindows::getIDOfThread(CArchThread thread) ArchMultithreadWindows::getIDOfThread(ArchThread thread)
{ {
return static_cast<ThreadID>(thread->m_id); return static_cast<ThreadID>(thread->m_id);
} }
void void
CArchMultithreadWindows::setSignalHandler( ArchMultithreadWindows::setSignalHandler(
ESignal signal, SignalFunc func, void* userData) ESignal signal, SignalFunc func, void* userData)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
@ -548,7 +548,7 @@ CArchMultithreadWindows::setSignalHandler(
} }
void void
CArchMultithreadWindows::raiseSignal(ESignal signal) ArchMultithreadWindows::raiseSignal(ESignal signal)
{ {
lockMutex(m_threadMutex); lockMutex(m_threadMutex);
if (m_signalFunc[signal] != NULL) { if (m_signalFunc[signal] != NULL) {
@ -561,26 +561,26 @@ CArchMultithreadWindows::raiseSignal(ESignal signal)
unlockMutex(m_threadMutex); unlockMutex(m_threadMutex);
} }
CArchThreadImpl* ArchThreadImpl*
CArchMultithreadWindows::find(DWORD id) ArchMultithreadWindows::find(DWORD id)
{ {
CArchThreadImpl* impl = findNoRef(id); ArchThreadImpl* impl = findNoRef(id);
if (impl != NULL) { if (impl != NULL) {
refThread(impl); refThread(impl);
} }
return impl; return impl;
} }
CArchThreadImpl* ArchThreadImpl*
CArchMultithreadWindows::findNoRef(DWORD id) ArchMultithreadWindows::findNoRef(DWORD id)
{ {
CArchThreadImpl* impl = findNoRefOrCreate(id); ArchThreadImpl* impl = findNoRefOrCreate(id);
if (impl == NULL) { if (impl == NULL) {
// create thread for calling thread which isn't in our list and // create thread for calling thread which isn't in our list and
// add it to the list. this won't normally happen but it can if // add it to the list. this won't normally happen but it can if
// the system calls us under a new thread, like it does when we // the system calls us under a new thread, like it does when we
// run as a service. // run as a service.
impl = new CArchThreadImpl; impl = new ArchThreadImpl;
impl->m_thread = NULL; impl->m_thread = NULL;
impl->m_id = GetCurrentThreadId(); impl->m_id = GetCurrentThreadId();
insert(impl); insert(impl);
@ -588,11 +588,11 @@ CArchMultithreadWindows::findNoRef(DWORD id)
return impl; return impl;
} }
CArchThreadImpl* ArchThreadImpl*
CArchMultithreadWindows::findNoRefOrCreate(DWORD id) ArchMultithreadWindows::findNoRefOrCreate(DWORD id)
{ {
// linear search // linear search
for (CThreadList::const_iterator index = m_threadList.begin(); for (ThreadList::const_iterator index = m_threadList.begin();
index != m_threadList.end(); ++index) { index != m_threadList.end(); ++index) {
if ((*index)->m_id == id) { if ((*index)->m_id == id) {
return *index; return *index;
@ -602,7 +602,7 @@ CArchMultithreadWindows::findNoRefOrCreate(DWORD id)
} }
void void
CArchMultithreadWindows::insert(CArchThreadImpl* thread) ArchMultithreadWindows::insert(ArchThreadImpl* thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -614,9 +614,9 @@ CArchMultithreadWindows::insert(CArchThreadImpl* thread)
} }
void void
CArchMultithreadWindows::erase(CArchThreadImpl* thread) ArchMultithreadWindows::erase(ArchThreadImpl* thread)
{ {
for (CThreadList::iterator index = m_threadList.begin(); for (ThreadList::iterator index = m_threadList.begin();
index != m_threadList.end(); ++index) { index != m_threadList.end(); ++index) {
if (*index == thread) { if (*index == thread) {
m_threadList.erase(index); m_threadList.erase(index);
@ -626,7 +626,7 @@ CArchMultithreadWindows::erase(CArchThreadImpl* thread)
} }
void void
CArchMultithreadWindows::refThread(CArchThreadImpl* thread) ArchMultithreadWindows::refThread(ArchThreadImpl* thread)
{ {
assert(thread != NULL); assert(thread != NULL);
assert(findNoRefOrCreate(thread->m_id) != NULL); assert(findNoRefOrCreate(thread->m_id) != NULL);
@ -634,7 +634,7 @@ CArchMultithreadWindows::refThread(CArchThreadImpl* thread)
} }
void void
CArchMultithreadWindows::testCancelThreadImpl(CArchThreadImpl* thread) ArchMultithreadWindows::testCancelThreadImpl(ArchThreadImpl* thread)
{ {
assert(thread != NULL); assert(thread != NULL);
@ -658,10 +658,10 @@ CArchMultithreadWindows::testCancelThreadImpl(CArchThreadImpl* thread)
} }
unsigned int __stdcall unsigned int __stdcall
CArchMultithreadWindows::threadFunc(void* vrep) ArchMultithreadWindows::threadFunc(void* vrep)
{ {
// get the thread // get the thread
CArchThreadImpl* thread = reinterpret_cast<CArchThreadImpl*>(vrep); ArchThreadImpl* thread = reinterpret_cast<ArchThreadImpl*>(vrep);
// run thread // run thread
s_instance->doThreadFunc(thread); s_instance->doThreadFunc(thread);
@ -671,7 +671,7 @@ CArchMultithreadWindows::threadFunc(void* vrep)
} }
void void
CArchMultithreadWindows::doThreadFunc(CArchThread thread) ArchMultithreadWindows::doThreadFunc(ArchThread thread)
{ {
// wait for parent to initialize this object // wait for parent to initialize this object
lockMutex(m_threadMutex); lockMutex(m_threadMutex);

View File

@ -24,27 +24,27 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#define ARCH_MULTITHREAD CArchMultithreadWindows #define ARCH_MULTITHREAD ArchMultithreadWindows
class CArchCondImpl { class ArchCondImpl {
public: public:
enum { kSignal = 0, kBroadcast }; enum { kSignal = 0, kBroadcast };
HANDLE m_events[2]; HANDLE m_events[2];
mutable int m_waitCount; mutable int m_waitCount;
CArchMutex m_waitCountMutex; ArchMutex m_waitCountMutex;
}; };
class CArchMutexImpl { class ArchMutexImpl {
public: public:
CRITICAL_SECTION m_mutex; CRITICAL_SECTION m_mutex;
}; };
//! Win32 implementation of IArchMultithread //! Win32 implementation of IArchMultithread
class CArchMultithreadWindows : public IArchMultithread { class ArchMultithreadWindows : public IArchMultithread {
public: public:
CArchMultithreadWindows(); ArchMultithreadWindows();
virtual ~CArchMultithreadWindows(); virtual ~ArchMultithreadWindows();
//! @name manipulators //! @name manipulators
//@{ //@{
@ -57,59 +57,59 @@ public:
HANDLE getCancelEventForCurrentThread(); HANDLE getCancelEventForCurrentThread();
void* getNetworkDataForThread(CArchThread); void* getNetworkDataForThread(ArchThread);
static CArchMultithreadWindows* getInstance(); static ArchMultithreadWindows* getInstance();
//@} //@}
// IArchMultithread overrides // IArchMultithread overrides
virtual CArchCond newCondVar(); virtual ArchCond newCondVar();
virtual void closeCondVar(CArchCond); virtual void closeCondVar(ArchCond);
virtual void signalCondVar(CArchCond); virtual void signalCondVar(ArchCond);
virtual void broadcastCondVar(CArchCond); virtual void broadcastCondVar(ArchCond);
virtual bool waitCondVar(CArchCond, CArchMutex, double timeout); virtual bool waitCondVar(ArchCond, ArchMutex, double timeout);
virtual CArchMutex newMutex(); virtual ArchMutex newMutex();
virtual void closeMutex(CArchMutex); virtual void closeMutex(ArchMutex);
virtual void lockMutex(CArchMutex); virtual void lockMutex(ArchMutex);
virtual void unlockMutex(CArchMutex); virtual void unlockMutex(ArchMutex);
virtual CArchThread newThread(ThreadFunc, void*); virtual ArchThread newThread(ThreadFunc, void*);
virtual CArchThread newCurrentThread(); virtual ArchThread newCurrentThread();
virtual CArchThread copyThread(CArchThread); virtual ArchThread copyThread(ArchThread);
virtual void closeThread(CArchThread); virtual void closeThread(ArchThread);
virtual void cancelThread(CArchThread); virtual void cancelThread(ArchThread);
virtual void setPriorityOfThread(CArchThread, int n); virtual void setPriorityOfThread(ArchThread, int n);
virtual void testCancelThread(); virtual void testCancelThread();
virtual bool wait(CArchThread, double timeout); virtual bool wait(ArchThread, double timeout);
virtual bool isSameThread(CArchThread, CArchThread); virtual bool isSameThread(ArchThread, ArchThread);
virtual bool isExitedThread(CArchThread); virtual bool isExitedThread(ArchThread);
virtual void* getResultOfThread(CArchThread); virtual void* getResultOfThread(ArchThread);
virtual ThreadID getIDOfThread(CArchThread); virtual ThreadID getIDOfThread(ArchThread);
virtual void setSignalHandler(ESignal, SignalFunc, void*); virtual void setSignalHandler(ESignal, SignalFunc, void*);
virtual void raiseSignal(ESignal); virtual void raiseSignal(ESignal);
private: private:
CArchThreadImpl* find(DWORD id); ArchThreadImpl* find(DWORD id);
CArchThreadImpl* findNoRef(DWORD id); ArchThreadImpl* findNoRef(DWORD id);
CArchThreadImpl* findNoRefOrCreate(DWORD id); ArchThreadImpl* findNoRefOrCreate(DWORD id);
void insert(CArchThreadImpl* thread); void insert(ArchThreadImpl* thread);
void erase(CArchThreadImpl* thread); void erase(ArchThreadImpl* thread);
void refThread(CArchThreadImpl* rep); void refThread(ArchThreadImpl* rep);
void testCancelThreadImpl(CArchThreadImpl* rep); void testCancelThreadImpl(ArchThreadImpl* rep);
void doThreadFunc(CArchThread thread); void doThreadFunc(ArchThread thread);
static unsigned int __stdcall threadFunc(void* vrep); static unsigned int __stdcall threadFunc(void* vrep);
private: private:
typedef std::list<CArchThread> CThreadList; typedef std::list<ArchThread> ThreadList;
static CArchMultithreadWindows* s_instance; static ArchMultithreadWindows* s_instance;
CArchMutex m_threadMutex; ArchMutex m_threadMutex;
CThreadList m_threadList; ThreadList m_threadList;
CArchThread m_mainThread; ArchThread m_mainThread;
SignalFunc m_signalFunc[kNUM_SIGNALS]; SignalFunc m_signalFunc[kNUM_SIGNALS];
void* m_signalUserData[kNUM_SIGNALS]; void* m_signalUserData[kNUM_SIGNALS];

View File

@ -82,25 +82,25 @@ netGetProcAddress(HMODULE module, LPCSTR name)
return func; return func;
} }
CArchNetAddressImpl* ArchNetAddressImpl*
CArchNetAddressImpl::alloc(size_t size) ArchNetAddressImpl::alloc(size_t size)
{ {
size_t totalSize = size + ADDR_HDR_SIZE; size_t totalSize = size + ADDR_HDR_SIZE;
CArchNetAddressImpl* addr = (CArchNetAddressImpl*)malloc(totalSize); ArchNetAddressImpl* addr = (ArchNetAddressImpl*)malloc(totalSize);
addr->m_len = (int)size; addr->m_len = (int)size;
return addr; return addr;
} }
// //
// CArchNetworkWinsock // ArchNetworkWinsock
// //
CArchNetworkWinsock::CArchNetworkWinsock() ArchNetworkWinsock::ArchNetworkWinsock()
{ {
} }
CArchNetworkWinsock::~CArchNetworkWinsock() ArchNetworkWinsock::~ArchNetworkWinsock()
{ {
if (s_networkModule != NULL) { if (s_networkModule != NULL) {
WSACleanup_winsock(); WSACleanup_winsock();
@ -111,14 +111,14 @@ CArchNetworkWinsock::~CArchNetworkWinsock()
} }
ARCH->closeMutex(m_mutex); ARCH->closeMutex(m_mutex);
CEventList::iterator it; EventList::iterator it;
for (it = m_unblockEvents.begin(); it != m_unblockEvents.end(); it++) { for (it = m_unblockEvents.begin(); it != m_unblockEvents.end(); it++) {
delete *it; delete *it;
} }
} }
void void
CArchNetworkWinsock::init() ArchNetworkWinsock::init()
{ {
static const char* s_library[] = { "ws2_32.dll" }; static const char* s_library[] = { "ws2_32.dll" };
@ -142,7 +142,7 @@ CArchNetworkWinsock::init()
} }
void void
CArchNetworkWinsock::initModule(HMODULE module) ArchNetworkWinsock::initModule(HMODULE module)
{ {
if (module == NULL) { if (module == NULL) {
throw XArchNetworkSupport(""); throw XArchNetworkSupport("");
@ -199,8 +199,8 @@ CArchNetworkWinsock::initModule(HMODULE module)
s_networkModule = module; s_networkModule = module;
} }
CArchSocket ArchSocket
CArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type) ArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type)
{ {
// create socket // create socket
SOCKET fd = socket_winsock(s_family[family], s_type[type], 0); SOCKET fd = socket_winsock(s_family[family], s_type[type], 0);
@ -216,7 +216,7 @@ CArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type)
} }
// allocate socket object // allocate socket object
CArchSocketImpl* socket = new CArchSocketImpl; ArchSocketImpl* socket = new ArchSocketImpl;
socket->m_socket = fd; socket->m_socket = fd;
socket->m_refCount = 1; socket->m_refCount = 1;
socket->m_event = WSACreateEvent_winsock(); socket->m_event = WSACreateEvent_winsock();
@ -224,8 +224,8 @@ CArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type)
return socket; return socket;
} }
CArchSocket ArchSocket
CArchNetworkWinsock::copySocket(CArchSocket s) ArchNetworkWinsock::copySocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -237,7 +237,7 @@ CArchNetworkWinsock::copySocket(CArchSocket s)
} }
void void
CArchNetworkWinsock::closeSocket(CArchSocket s) ArchNetworkWinsock::closeSocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -262,7 +262,7 @@ CArchNetworkWinsock::closeSocket(CArchSocket s)
} }
void void
CArchNetworkWinsock::closeSocketForRead(CArchSocket s) ArchNetworkWinsock::closeSocketForRead(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -274,7 +274,7 @@ CArchNetworkWinsock::closeSocketForRead(CArchSocket s)
} }
void void
CArchNetworkWinsock::closeSocketForWrite(CArchSocket s) ArchNetworkWinsock::closeSocketForWrite(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -286,7 +286,7 @@ CArchNetworkWinsock::closeSocketForWrite(CArchSocket s)
} }
void void
CArchNetworkWinsock::bindSocket(CArchSocket s, CArchNetAddress addr) ArchNetworkWinsock::bindSocket(ArchSocket s, ArchNetAddress addr)
{ {
assert(s != NULL); assert(s != NULL);
assert(addr != NULL); assert(addr != NULL);
@ -297,7 +297,7 @@ CArchNetworkWinsock::bindSocket(CArchSocket s, CArchNetAddress addr)
} }
void void
CArchNetworkWinsock::listenOnSocket(CArchSocket s) ArchNetworkWinsock::listenOnSocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -307,14 +307,14 @@ CArchNetworkWinsock::listenOnSocket(CArchSocket s)
} }
} }
CArchSocket ArchSocket
CArchNetworkWinsock::acceptSocket(CArchSocket s, CArchNetAddress* addr) ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr)
{ {
assert(s != NULL); assert(s != NULL);
// create new socket and temporary address // create new socket and temporary address
CArchSocketImpl* socket = new CArchSocketImpl; ArchSocketImpl* socket = new ArchSocketImpl;
CArchNetAddress tmp = CArchNetAddressImpl::alloc(sizeof(struct sockaddr)); ArchNetAddress tmp = ArchNetAddressImpl::alloc(sizeof(struct sockaddr));
// accept on socket // accept on socket
SOCKET fd = accept_winsock(s->m_socket, &tmp->m_addr, &tmp->m_len); SOCKET fd = accept_winsock(s->m_socket, &tmp->m_addr, &tmp->m_len);
@ -356,7 +356,7 @@ CArchNetworkWinsock::acceptSocket(CArchSocket s, CArchNetAddress* addr)
} }
bool bool
CArchNetworkWinsock::connectSocket(CArchSocket s, CArchNetAddress addr) ArchNetworkWinsock::connectSocket(ArchSocket s, ArchNetAddress addr)
{ {
assert(s != NULL); assert(s != NULL);
assert(addr != NULL); assert(addr != NULL);
@ -375,7 +375,7 @@ CArchNetworkWinsock::connectSocket(CArchSocket s, CArchNetAddress addr)
} }
int int
CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout) ArchNetworkWinsock::pollSocket(PollEntry pe[], int num, double timeout)
{ {
int i; int i;
DWORD n; DWORD n;
@ -429,8 +429,8 @@ CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout)
} }
// add the unblock event // add the unblock event
CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); ArchMultithreadWindows* mt = ArchMultithreadWindows::getInstance();
CArchThread thread = mt->newCurrentThread(); ArchThread thread = mt->newCurrentThread();
WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread); WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread);
ARCH->closeThread(thread); ARCH->closeThread(thread);
if (unblockEvent == NULL) { if (unblockEvent == NULL) {
@ -527,10 +527,10 @@ CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout)
} }
void void
CArchNetworkWinsock::unblockPollSocket(CArchThread thread) ArchNetworkWinsock::unblockPollSocket(ArchThread thread)
{ {
// set the unblock event // set the unblock event
CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); ArchMultithreadWindows* mt = ArchMultithreadWindows::getInstance();
WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread); WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread);
if (unblockEvent != NULL) { if (unblockEvent != NULL) {
WSASetEvent_winsock(*unblockEvent); WSASetEvent_winsock(*unblockEvent);
@ -538,7 +538,7 @@ CArchNetworkWinsock::unblockPollSocket(CArchThread thread)
} }
size_t size_t
CArchNetworkWinsock::readSocket(CArchSocket s, void* buf, size_t len) ArchNetworkWinsock::readSocket(ArchSocket s, void* buf, size_t len)
{ {
assert(s != NULL); assert(s != NULL);
@ -554,7 +554,7 @@ CArchNetworkWinsock::readSocket(CArchSocket s, void* buf, size_t len)
} }
size_t size_t
CArchNetworkWinsock::writeSocket(CArchSocket s, const void* buf, size_t len) ArchNetworkWinsock::writeSocket(ArchSocket s, const void* buf, size_t len)
{ {
assert(s != NULL); assert(s != NULL);
@ -574,7 +574,7 @@ CArchNetworkWinsock::writeSocket(CArchSocket s, const void* buf, size_t len)
} }
void void
CArchNetworkWinsock::throwErrorOnSocket(CArchSocket s) ArchNetworkWinsock::throwErrorOnSocket(ArchSocket s)
{ {
assert(s != NULL); assert(s != NULL);
@ -593,7 +593,7 @@ CArchNetworkWinsock::throwErrorOnSocket(CArchSocket s)
} }
void void
CArchNetworkWinsock::setBlockingOnSocket(SOCKET s, bool blocking) ArchNetworkWinsock::setBlockingOnSocket(SOCKET s, bool blocking)
{ {
assert(s != 0); assert(s != 0);
@ -604,7 +604,7 @@ CArchNetworkWinsock::setBlockingOnSocket(SOCKET s, bool blocking)
} }
bool bool
CArchNetworkWinsock::setNoDelayOnSocket(CArchSocket s, bool noDelay) ArchNetworkWinsock::setNoDelayOnSocket(ArchSocket s, bool noDelay)
{ {
assert(s != NULL); assert(s != NULL);
@ -628,7 +628,7 @@ CArchNetworkWinsock::setNoDelayOnSocket(CArchSocket s, bool noDelay)
} }
bool bool
CArchNetworkWinsock::setReuseAddrOnSocket(CArchSocket s, bool reuse) ArchNetworkWinsock::setReuseAddrOnSocket(ArchSocket s, bool reuse)
{ {
assert(s != NULL); assert(s != NULL);
@ -652,7 +652,7 @@ CArchNetworkWinsock::setReuseAddrOnSocket(CArchSocket s, bool reuse)
} }
std::string std::string
CArchNetworkWinsock::getHostName() ArchNetworkWinsock::getHostName()
{ {
char name[256]; char name[256];
if (gethostname_winsock(name, sizeof(name)) == -1) { if (gethostname_winsock(name, sizeof(name)) == -1) {
@ -664,13 +664,13 @@ CArchNetworkWinsock::getHostName()
return name; return name;
} }
CArchNetAddress ArchNetAddress
CArchNetworkWinsock::newAnyAddr(EAddressFamily family) ArchNetworkWinsock::newAnyAddr(EAddressFamily family)
{ {
CArchNetAddressImpl* addr = NULL; ArchNetAddressImpl* addr = NULL;
switch (family) { switch (family) {
case kINET: { case kINET: {
addr = CArchNetAddressImpl::alloc(sizeof(struct sockaddr_in)); addr = ArchNetAddressImpl::alloc(sizeof(struct sockaddr_in));
struct sockaddr_in* ipAddr = TYPED_ADDR(struct sockaddr_in, addr); struct sockaddr_in* ipAddr = TYPED_ADDR(struct sockaddr_in, addr);
ipAddr->sin_family = AF_INET; ipAddr->sin_family = AF_INET;
ipAddr->sin_port = 0; ipAddr->sin_port = 0;
@ -684,21 +684,21 @@ CArchNetworkWinsock::newAnyAddr(EAddressFamily family)
return addr; return addr;
} }
CArchNetAddress ArchNetAddress
CArchNetworkWinsock::copyAddr(CArchNetAddress addr) ArchNetworkWinsock::copyAddr(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
CArchNetAddressImpl* copy = CArchNetAddressImpl::alloc(addr->m_len); ArchNetAddressImpl* copy = ArchNetAddressImpl::alloc(addr->m_len);
memcpy(TYPED_ADDR(void, copy), TYPED_ADDR(void, addr), addr->m_len); memcpy(TYPED_ADDR(void, copy), TYPED_ADDR(void, addr), addr->m_len);
return copy; return copy;
} }
CArchNetAddress ArchNetAddress
CArchNetworkWinsock::nameToAddr(const std::string& name) ArchNetworkWinsock::nameToAddr(const std::string& name)
{ {
// allocate address // allocate address
CArchNetAddressImpl* addr = NULL; ArchNetAddressImpl* addr = NULL;
// try to convert assuming an IPv4 dot notation address // try to convert assuming an IPv4 dot notation address
struct sockaddr_in inaddr; struct sockaddr_in inaddr;
@ -708,7 +708,7 @@ CArchNetworkWinsock::nameToAddr(const std::string& name)
inaddr.sin_addr.s_addr = inet_addr_winsock(name.c_str()); inaddr.sin_addr.s_addr = inet_addr_winsock(name.c_str());
if (inaddr.sin_addr.s_addr != INADDR_NONE) { if (inaddr.sin_addr.s_addr != INADDR_NONE) {
// it's a dot notation address // it's a dot notation address
addr = CArchNetAddressImpl::alloc(sizeof(struct sockaddr_in)); addr = ArchNetAddressImpl::alloc(sizeof(struct sockaddr_in));
memcpy(TYPED_ADDR(void, addr), &inaddr, addr->m_len); memcpy(TYPED_ADDR(void, addr), &inaddr, addr->m_len);
} }
@ -721,7 +721,7 @@ CArchNetworkWinsock::nameToAddr(const std::string& name)
// copy over address (only IPv4 currently supported) // copy over address (only IPv4 currently supported)
if (info->h_addrtype == AF_INET) { if (info->h_addrtype == AF_INET) {
addr = CArchNetAddressImpl::alloc(sizeof(struct sockaddr_in)); addr = ArchNetAddressImpl::alloc(sizeof(struct sockaddr_in));
memcpy(&inaddr.sin_addr, info->h_addr_list[0], memcpy(&inaddr.sin_addr, info->h_addr_list[0],
sizeof(inaddr.sin_addr)); sizeof(inaddr.sin_addr));
memcpy(TYPED_ADDR(void, addr), &inaddr, addr->m_len); memcpy(TYPED_ADDR(void, addr), &inaddr, addr->m_len);
@ -737,7 +737,7 @@ CArchNetworkWinsock::nameToAddr(const std::string& name)
} }
void void
CArchNetworkWinsock::closeAddr(CArchNetAddress addr) ArchNetworkWinsock::closeAddr(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -745,7 +745,7 @@ CArchNetworkWinsock::closeAddr(CArchNetAddress addr)
} }
std::string std::string
CArchNetworkWinsock::addrToName(CArchNetAddress addr) ArchNetworkWinsock::addrToName(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -762,7 +762,7 @@ CArchNetworkWinsock::addrToName(CArchNetAddress addr)
} }
std::string std::string
CArchNetworkWinsock::addrToString(CArchNetAddress addr) ArchNetworkWinsock::addrToString(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -780,7 +780,7 @@ CArchNetworkWinsock::addrToString(CArchNetAddress addr)
} }
IArchNetwork::EAddressFamily IArchNetwork::EAddressFamily
CArchNetworkWinsock::getAddrFamily(CArchNetAddress addr) ArchNetworkWinsock::getAddrFamily(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -794,7 +794,7 @@ CArchNetworkWinsock::getAddrFamily(CArchNetAddress addr)
} }
void void
CArchNetworkWinsock::setAddrPort(CArchNetAddress addr, int port) ArchNetworkWinsock::setAddrPort(ArchNetAddress addr, int port)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -813,7 +813,7 @@ CArchNetworkWinsock::setAddrPort(CArchNetAddress addr, int port)
} }
int int
CArchNetworkWinsock::getAddrPort(CArchNetAddress addr) ArchNetworkWinsock::getAddrPort(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -831,7 +831,7 @@ CArchNetworkWinsock::getAddrPort(CArchNetAddress addr)
} }
bool bool
CArchNetworkWinsock::isAnyAddr(CArchNetAddress addr) ArchNetworkWinsock::isAnyAddr(ArchNetAddress addr)
{ {
assert(addr != NULL); assert(addr != NULL);
@ -850,14 +850,14 @@ CArchNetworkWinsock::isAnyAddr(CArchNetAddress addr)
} }
bool bool
CArchNetworkWinsock::isEqualAddr(CArchNetAddress a, CArchNetAddress b) ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b)
{ {
return (a == b || (a->m_len == b->m_len && return (a == b || (a->m_len == b->m_len &&
memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0)); memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0));
} }
void void
CArchNetworkWinsock::throwError(int err) ArchNetworkWinsock::throwError(int err)
{ {
switch (err) { switch (err) {
case WSAEACCES: case WSAEACCES:
@ -928,7 +928,7 @@ CArchNetworkWinsock::throwError(int err)
} }
void void
CArchNetworkWinsock::throwNameError(int err) ArchNetworkWinsock::throwNameError(int err)
{ {
switch (err) { switch (err) {
case WSAHOST_NOT_FOUND: case WSAHOST_NOT_FOUND:

View File

@ -30,9 +30,9 @@
#include <Windows.h> #include <Windows.h>
#include <list> #include <list>
#define ARCH_NETWORK CArchNetworkWinsock #define ARCH_NETWORK ArchNetworkWinsock
class CArchSocketImpl { class ArchSocketImpl {
public: public:
SOCKET m_socket; SOCKET m_socket;
int m_refCount; int m_refCount;
@ -40,55 +40,55 @@ public:
bool m_pollWrite; bool m_pollWrite;
}; };
class CArchNetAddressImpl { class ArchNetAddressImpl {
public: public:
static CArchNetAddressImpl* alloc(size_t); static ArchNetAddressImpl* alloc(size_t);
public: public:
int m_len; int m_len;
struct sockaddr m_addr; struct sockaddr m_addr;
}; };
#define ADDR_HDR_SIZE offsetof(CArchNetAddressImpl, m_addr) #define ADDR_HDR_SIZE offsetof(ArchNetAddressImpl, m_addr)
#define TYPED_ADDR(type_, addr_) (reinterpret_cast<type_*>(&addr_->m_addr)) #define TYPED_ADDR(type_, addr_) (reinterpret_cast<type_*>(&addr_->m_addr))
//! Win32 implementation of IArchNetwork //! Win32 implementation of IArchNetwork
class CArchNetworkWinsock : public IArchNetwork { class ArchNetworkWinsock : public IArchNetwork {
public: public:
CArchNetworkWinsock(); ArchNetworkWinsock();
virtual ~CArchNetworkWinsock(); virtual ~ArchNetworkWinsock();
virtual void init(); virtual void init();
// IArchNetwork overrides // IArchNetwork overrides
virtual CArchSocket newSocket(EAddressFamily, ESocketType); virtual ArchSocket newSocket(EAddressFamily, ESocketType);
virtual CArchSocket copySocket(CArchSocket s); virtual ArchSocket copySocket(ArchSocket s);
virtual void closeSocket(CArchSocket s); virtual void closeSocket(ArchSocket s);
virtual void closeSocketForRead(CArchSocket s); virtual void closeSocketForRead(ArchSocket s);
virtual void closeSocketForWrite(CArchSocket s); virtual void closeSocketForWrite(ArchSocket s);
virtual void bindSocket(CArchSocket s, CArchNetAddress addr); virtual void bindSocket(ArchSocket s, ArchNetAddress addr);
virtual void listenOnSocket(CArchSocket s); virtual void listenOnSocket(ArchSocket s);
virtual CArchSocket acceptSocket(CArchSocket s, CArchNetAddress* addr); virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress* addr);
virtual bool connectSocket(CArchSocket s, CArchNetAddress name); virtual bool connectSocket(ArchSocket s, ArchNetAddress name);
virtual int pollSocket(CPollEntry[], int num, double timeout); virtual int pollSocket(PollEntry[], int num, double timeout);
virtual void unblockPollSocket(CArchThread thread); virtual void unblockPollSocket(ArchThread thread);
virtual size_t readSocket(CArchSocket s, void* buf, size_t len); virtual size_t readSocket(ArchSocket s, void* buf, size_t len);
virtual size_t writeSocket(CArchSocket s, virtual size_t writeSocket(ArchSocket s,
const void* buf, size_t len); const void* buf, size_t len);
virtual void throwErrorOnSocket(CArchSocket); virtual void throwErrorOnSocket(ArchSocket);
virtual bool setNoDelayOnSocket(CArchSocket, bool noDelay); virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay);
virtual bool setReuseAddrOnSocket(CArchSocket, bool reuse); virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse);
virtual std::string getHostName(); virtual std::string getHostName();
virtual CArchNetAddress newAnyAddr(EAddressFamily); virtual ArchNetAddress newAnyAddr(EAddressFamily);
virtual CArchNetAddress copyAddr(CArchNetAddress); virtual ArchNetAddress copyAddr(ArchNetAddress);
virtual CArchNetAddress nameToAddr(const std::string&); virtual ArchNetAddress nameToAddr(const std::string&);
virtual void closeAddr(CArchNetAddress); virtual void closeAddr(ArchNetAddress);
virtual std::string addrToName(CArchNetAddress); virtual std::string addrToName(ArchNetAddress);
virtual std::string addrToString(CArchNetAddress); virtual std::string addrToString(ArchNetAddress);
virtual EAddressFamily getAddrFamily(CArchNetAddress); virtual EAddressFamily getAddrFamily(ArchNetAddress);
virtual void setAddrPort(CArchNetAddress, int port); virtual void setAddrPort(ArchNetAddress, int port);
virtual int getAddrPort(CArchNetAddress); virtual int getAddrPort(ArchNetAddress);
virtual bool isAnyAddr(CArchNetAddress); virtual bool isAnyAddr(ArchNetAddress);
virtual bool isEqualAddr(CArchNetAddress, CArchNetAddress); virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress);
private: private:
void initModule(HMODULE); void initModule(HMODULE);
@ -99,8 +99,8 @@ private:
void throwNameError(int); void throwNameError(int);
private: private:
typedef std::list<WSAEVENT> CEventList; typedef std::list<WSAEVENT> EventList;
CArchMutex m_mutex; ArchMutex m_mutex;
CEventList m_unblockEvents; EventList m_unblockEvents;
}; };

View File

@ -32,37 +32,37 @@ typedef int (*initFunc)(void (*sendEvent)(const char*, void*), void (*log)(const
void* g_eventTarget = NULL; void* g_eventTarget = NULL;
IEventQueue* g_events = NULL; IEventQueue* g_events = NULL;
CArchPluginWindows::CArchPluginWindows() ArchPluginWindows::ArchPluginWindows()
{ {
} }
CArchPluginWindows::~CArchPluginWindows() ArchPluginWindows::~ArchPluginWindows()
{ {
} }
void void
CArchPluginWindows::init(void* eventTarget, IEventQueue* events) ArchPluginWindows::init(void* eventTarget, IEventQueue* events)
{ {
g_eventTarget = eventTarget; g_eventTarget = eventTarget;
g_events = events; g_events = events;
CString dir = getPluginsDir(); String dir = getPluginsDir();
LOG((CLOG_DEBUG "plugins dir: %s", dir.c_str())); LOG((CLOG_DEBUG "plugins dir: %s", dir.c_str()));
CString pattern = CString(dir).append("\\*.dll"); String pattern = String(dir).append("\\*.dll");
std::vector<CString> plugins; std::vector<String> plugins;
getFilenames(pattern, plugins); getFilenames(pattern, plugins);
std::vector<CString>::iterator it; std::vector<String>::iterator it;
for (it = plugins.begin(); it != plugins.end(); ++it) for (it = plugins.begin(); it != plugins.end(); ++it)
load(*it); load(*it);
} }
void void
CArchPluginWindows::load(const CString& dllFilename) ArchPluginWindows::load(const String& dllFilename)
{ {
LOG((CLOG_DEBUG "loading plugin: %s", dllFilename.c_str())); LOG((CLOG_DEBUG "loading plugin: %s", dllFilename.c_str()));
CString path = CString(getPluginsDir()).append("\\").append(dllFilename); String path = String(getPluginsDir()).append("\\").append(dllFilename);
HINSTANCE library = LoadLibrary(path.c_str()); HINSTANCE library = LoadLibrary(path.c_str());
if (library == NULL) if (library == NULL)
throw XArch(new XArchEvalWindows); throw XArch(new XArchEvalWindows);
@ -71,18 +71,18 @@ CArchPluginWindows::load(const CString& dllFilename)
initPlugin(&sendEvent, &log); initPlugin(&sendEvent, &log);
} }
CString String
CArchPluginWindows::getModuleDir() ArchPluginWindows::getModuleDir()
{ {
TCHAR c_modulePath[MAX_PATH]; TCHAR c_modulePath[MAX_PATH];
if (GetModuleFileName(NULL, c_modulePath, MAX_PATH) == 0) { if (GetModuleFileName(NULL, c_modulePath, MAX_PATH) == 0) {
throw XArch(new XArchEvalWindows); throw XArch(new XArchEvalWindows);
} }
CString modulePath(c_modulePath); String modulePath(c_modulePath);
size_t lastSlash = modulePath.find_last_of("\\"); size_t lastSlash = modulePath.find_last_of("\\");
if (lastSlash != CString::npos) { if (lastSlash != String::npos) {
return modulePath.substr(0, lastSlash); return modulePath.substr(0, lastSlash);
} }
@ -90,7 +90,7 @@ CArchPluginWindows::getModuleDir()
} }
void void
CArchPluginWindows::getFilenames(const CString& pattern, std::vector<CString>& filenames) ArchPluginWindows::getFilenames(const String& pattern, std::vector<String>& filenames)
{ {
WIN32_FIND_DATA data; WIN32_FIND_DATA data;
HANDLE find = FindFirstFile(pattern.c_str(), &data); HANDLE find = FindFirstFile(pattern.c_str(), &data);
@ -107,7 +107,7 @@ CArchPluginWindows::getFilenames(const CString& pattern, std::vector<CString>& f
FindClose(find); FindClose(find);
} }
CString CArchPluginWindows::getPluginsDir() String ArchPluginWindows::getPluginsDir()
{ {
return getModuleDir().append("\\").append(PLUGINS_DIR); return getModuleDir().append("\\").append(PLUGINS_DIR);
} }
@ -116,8 +116,8 @@ void
sendEvent(const char* eventName, void* data) sendEvent(const char* eventName, void* data)
{ {
LOG((CLOG_DEBUG5 "plugin sending event")); LOG((CLOG_DEBUG5 "plugin sending event"));
CEvent::Type type = g_events->getRegisteredType(eventName); Event::Type type = g_events->getRegisteredType(eventName);
g_events->addEvent(CEvent(type, g_eventTarget, data)); g_events->addEvent(Event(type, g_eventTarget, data));
} }
void void

View File

@ -23,25 +23,25 @@
#include <vector> #include <vector>
#define ARCH_PLUGIN CArchPluginWindows #define ARCH_PLUGIN ArchPluginWindows
class CScreen; class Screen;
class IEventQueue; class IEventQueue;
//! Windows implementation of IArchPlugin //! Windows implementation of IArchPlugin
class CArchPluginWindows : public IArchPlugin { class ArchPluginWindows : public IArchPlugin {
public: public:
CArchPluginWindows(); ArchPluginWindows();
virtual ~CArchPluginWindows(); virtual ~ArchPluginWindows();
// IArchPlugin overrides // IArchPlugin overrides
void init(void* eventTarget, IEventQueue* events); void init(void* eventTarget, IEventQueue* events);
private: private:
CString getModuleDir(); String getModuleDir();
void getFilenames(const CString& pattern, std::vector<CString>& filenames); void getFilenames(const String& pattern, std::vector<String>& filenames);
void load(const CString& dllPath); void load(const String& dllPath);
CString getPluginsDir(); String getPluginsDir();
}; };
void sendEvent(const char* text, void* data); void sendEvent(const char* text, void* data);

View File

@ -21,21 +21,21 @@
#include "arch/win32/ArchMultithreadWindows.h" #include "arch/win32/ArchMultithreadWindows.h"
// //
// CArchSleepWindows // ArchSleepWindows
// //
CArchSleepWindows::CArchSleepWindows() ArchSleepWindows::ArchSleepWindows()
{ {
// do nothing // do nothing
} }
CArchSleepWindows::~CArchSleepWindows() ArchSleepWindows::~ArchSleepWindows()
{ {
// do nothing // do nothing
} }
void void
CArchSleepWindows::sleep(double timeout) ArchSleepWindows::sleep(double timeout)
{ {
ARCH->testCancelThread(); ARCH->testCancelThread();
if (timeout < 0.0) { if (timeout < 0.0) {
@ -46,7 +46,7 @@ CArchSleepWindows::sleep(double timeout)
// works if we're using the windows multithread object but // works if we're using the windows multithread object but
// this is windows so that's pretty certain; we'll get a // this is windows so that's pretty certain; we'll get a
// link error if we're not, though. // link error if we're not, though.
CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); ArchMultithreadWindows* mt = ArchMultithreadWindows::getInstance();
if (mt != NULL) { if (mt != NULL) {
HANDLE cancelEvent = mt->getCancelEventForCurrentThread(); HANDLE cancelEvent = mt->getCancelEventForCurrentThread();
WaitForSingleObject(cancelEvent, (DWORD)(1000.0 * timeout)); WaitForSingleObject(cancelEvent, (DWORD)(1000.0 * timeout));

View File

@ -20,13 +20,13 @@
#include "arch/IArchSleep.h" #include "arch/IArchSleep.h"
#define ARCH_SLEEP CArchSleepWindows #define ARCH_SLEEP ArchSleepWindows
//! Win32 implementation of IArchSleep //! Win32 implementation of IArchSleep
class CArchSleepWindows : public IArchSleep { class ArchSleepWindows : public IArchSleep {
public: public:
CArchSleepWindows(); ArchSleepWindows();
virtual ~CArchSleepWindows(); virtual ~ArchSleepWindows();
// IArchSleep overrides // IArchSleep overrides
virtual void sleep(double timeout); virtual void sleep(double timeout);

View File

@ -23,7 +23,7 @@
#include <stdio.h> #include <stdio.h>
// //
// CArchStringWindows // ArchStringWindows
// //
#include "arch/multibyte.h" #include "arch/multibyte.h"
@ -31,16 +31,16 @@
#define ARCH_VSNPRINTF _vsnprintf #define ARCH_VSNPRINTF _vsnprintf
#include "arch/vsnprintf.h" #include "arch/vsnprintf.h"
CArchStringWindows::CArchStringWindows() ArchStringWindows::ArchStringWindows()
{ {
} }
CArchStringWindows::~CArchStringWindows() ArchStringWindows::~ArchStringWindows()
{ {
} }
IArchString::EWideCharEncoding IArchString::EWideCharEncoding
CArchStringWindows::getWideCharEncoding() ArchStringWindows::getWideCharEncoding()
{ {
return kUTF16; return kUTF16;
} }

View File

@ -20,13 +20,13 @@
#include "arch/IArchString.h" #include "arch/IArchString.h"
#define ARCH_STRING CArchStringWindows #define ARCH_STRING ArchStringWindows
//! Win32 implementation of IArchString //! Win32 implementation of IArchString
class CArchStringWindows : public IArchString { class ArchStringWindows : public IArchString {
public: public:
CArchStringWindows(); ArchStringWindows();
virtual ~CArchStringWindows(); virtual ~ArchStringWindows();
// IArchString overrides // IArchString overrides
virtual EWideCharEncoding virtual EWideCharEncoding

View File

@ -30,21 +30,21 @@ static const char* s_settingsKeyNames[] = {
}; };
// //
// CArchSystemWindows // ArchSystemWindows
// //
CArchSystemWindows::CArchSystemWindows() ArchSystemWindows::ArchSystemWindows()
{ {
// do nothing // do nothing
} }
CArchSystemWindows::~CArchSystemWindows() ArchSystemWindows::~ArchSystemWindows()
{ {
// do nothing // do nothing
} }
std::string std::string
CArchSystemWindows::getOSName() const ArchSystemWindows::getOSName() const
{ {
#if WINVER >= _WIN32_WINNT_WIN2K #if WINVER >= _WIN32_WINNT_WIN2K
OSVERSIONINFOEX info; OSVERSIONINFOEX info;
@ -96,7 +96,7 @@ CArchSystemWindows::getOSName() const
} }
std::string std::string
CArchSystemWindows::getPlatformName() const ArchSystemWindows::getPlatformName() const
{ {
#ifdef _X86_ #ifdef _X86_
if(isWOW64()) if(isWOW64())
@ -113,26 +113,26 @@ CArchSystemWindows::getPlatformName() const
} }
std::string std::string
CArchSystemWindows::setting(const std::string& valueName) const ArchSystemWindows::setting(const std::string& valueName) const
{ {
HKEY key = CArchMiscWindows::openKey(HKEY_LOCAL_MACHINE, s_settingsKeyNames); HKEY key = ArchMiscWindows::openKey(HKEY_LOCAL_MACHINE, s_settingsKeyNames);
if (key == NULL) if (key == NULL)
return ""; return "";
return CArchMiscWindows::readValueString(key, valueName.c_str()); return ArchMiscWindows::readValueString(key, valueName.c_str());
} }
void void
CArchSystemWindows::setting(const std::string& valueName, const std::string& valueString) const ArchSystemWindows::setting(const std::string& valueName, const std::string& valueString) const
{ {
HKEY key = CArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_settingsKeyNames); HKEY key = ArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_settingsKeyNames);
if (key == NULL) if (key == NULL)
throw XArch(std::string("could not access registry key: ") + valueName); throw XArch(std::string("could not access registry key: ") + valueName);
CArchMiscWindows::setValue(key, valueName.c_str(), valueString.c_str()); ArchMiscWindows::setValue(key, valueName.c_str(), valueString.c_str());
} }
bool bool
CArchSystemWindows::isWOW64() const ArchSystemWindows::isWOW64() const
{ {
#if WINVER >= _WIN32_WINNT_WINXP #if WINVER >= _WIN32_WINNT_WINXP
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);

View File

@ -20,13 +20,13 @@
#include "arch/IArchSystem.h" #include "arch/IArchSystem.h"
#define ARCH_SYSTEM CArchSystemWindows #define ARCH_SYSTEM ArchSystemWindows
//! Win32 implementation of IArchString //! Win32 implementation of IArchString
class CArchSystemWindows : public IArchSystem { class ArchSystemWindows : public IArchSystem {
public: public:
CArchSystemWindows(); ArchSystemWindows();
virtual ~CArchSystemWindows(); virtual ~ArchSystemWindows();
// IArchSystem overrides // IArchSystem overrides
virtual std::string getOSName() const; virtual std::string getOSName() const;

View File

@ -33,19 +33,19 @@ static const UINT kNotifyReceiver = WM_USER + 13;
static const UINT kFirstReceiverID = WM_USER + 14; static const UINT kFirstReceiverID = WM_USER + 14;
// //
// CArchTaskBarWindows // ArchTaskBarWindows
// //
CArchTaskBarWindows* CArchTaskBarWindows::s_instance = NULL; ArchTaskBarWindows* ArchTaskBarWindows::s_instance = NULL;
CArchTaskBarWindows::CArchTaskBarWindows() : ArchTaskBarWindows::ArchTaskBarWindows() :
m_nextID(kFirstReceiverID) m_nextID(kFirstReceiverID)
{ {
// save the singleton instance // save the singleton instance
s_instance = this; s_instance = this;
} }
CArchTaskBarWindows::~CArchTaskBarWindows() ArchTaskBarWindows::~ArchTaskBarWindows()
{ {
if (m_thread != NULL) { if (m_thread != NULL) {
PostMessage(m_hwnd, WM_QUIT, 0, 0); PostMessage(m_hwnd, WM_QUIT, 0, 0);
@ -58,7 +58,7 @@ CArchTaskBarWindows::~CArchTaskBarWindows()
} }
void void
CArchTaskBarWindows::init() ArchTaskBarWindows::init()
{ {
// we need a mutex // we need a mutex
m_mutex = ARCH->newMutex(); m_mutex = ARCH->newMutex();
@ -77,7 +77,7 @@ CArchTaskBarWindows::init()
// create a window on the current desktop with the current // create a window on the current desktop with the current
// thread then the current thread won't be able to switch // thread then the current thread won't be able to switch
// desktops if it needs to. // desktops if it needs to.
m_thread = ARCH->newThread(&CArchTaskBarWindows::threadEntry, this); m_thread = ARCH->newThread(&ArchTaskBarWindows::threadEntry, this);
// wait for child thread // wait for child thread
while (!m_ready) { while (!m_ready) {
@ -89,19 +89,19 @@ CArchTaskBarWindows::init()
} }
void void
CArchTaskBarWindows::addDialog(HWND hwnd) ArchTaskBarWindows::addDialog(HWND hwnd)
{ {
CArchMiscWindows::addDialog(hwnd); ArchMiscWindows::addDialog(hwnd);
} }
void void
CArchTaskBarWindows::removeDialog(HWND hwnd) ArchTaskBarWindows::removeDialog(HWND hwnd)
{ {
CArchMiscWindows::removeDialog(hwnd); ArchMiscWindows::removeDialog(hwnd);
} }
void void
CArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver) ArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver)
{ {
// ignore bogus receiver // ignore bogus receiver
if (receiver == NULL) { if (receiver == NULL) {
@ -109,10 +109,10 @@ CArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver)
} }
// add receiver if necessary // add receiver if necessary
CReceiverToInfoMap::iterator index = m_receivers.find(receiver); ReceiverToInfoMap::iterator index = m_receivers.find(receiver);
if (index == m_receivers.end()) { if (index == m_receivers.end()) {
// add it, creating a new message ID for it // add it, creating a new message ID for it
CReceiverInfo info; ReceiverInfo info;
info.m_id = getNextID(); info.m_id = getNextID();
index = m_receivers.insert(std::make_pair(receiver, info)).first; index = m_receivers.insert(std::make_pair(receiver, info)).first;
@ -125,10 +125,10 @@ CArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver)
} }
void void
CArchTaskBarWindows::removeReceiver(IArchTaskBarReceiver* receiver) ArchTaskBarWindows::removeReceiver(IArchTaskBarReceiver* receiver)
{ {
// find receiver // find receiver
CReceiverToInfoMap::iterator index = m_receivers.find(receiver); ReceiverToInfoMap::iterator index = m_receivers.find(receiver);
if (index == m_receivers.end()) { if (index == m_receivers.end()) {
return; return;
} }
@ -145,10 +145,10 @@ CArchTaskBarWindows::removeReceiver(IArchTaskBarReceiver* receiver)
} }
void void
CArchTaskBarWindows::updateReceiver(IArchTaskBarReceiver* receiver) ArchTaskBarWindows::updateReceiver(IArchTaskBarReceiver* receiver)
{ {
// find receiver // find receiver
CReceiverToInfoMap::const_iterator index = m_receivers.find(receiver); ReceiverToInfoMap::const_iterator index = m_receivers.find(receiver);
if (index == m_receivers.end()) { if (index == m_receivers.end()) {
return; return;
} }
@ -158,7 +158,7 @@ CArchTaskBarWindows::updateReceiver(IArchTaskBarReceiver* receiver)
} }
UINT UINT
CArchTaskBarWindows::getNextID() ArchTaskBarWindows::getNextID()
{ {
if (m_oldIDs.empty()) { if (m_oldIDs.empty()) {
return m_nextID++; return m_nextID++;
@ -169,13 +169,13 @@ CArchTaskBarWindows::getNextID()
} }
void void
CArchTaskBarWindows::recycleID(UINT id) ArchTaskBarWindows::recycleID(UINT id)
{ {
m_oldIDs.push_back(id); m_oldIDs.push_back(id);
} }
void void
CArchTaskBarWindows::addIcon(UINT id) ArchTaskBarWindows::addIcon(UINT id)
{ {
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
CIDToReceiverMap::const_iterator index = m_idTable.find(id); CIDToReceiverMap::const_iterator index = m_idTable.find(id);
@ -186,7 +186,7 @@ CArchTaskBarWindows::addIcon(UINT id)
} }
void void
CArchTaskBarWindows::removeIcon(UINT id) ArchTaskBarWindows::removeIcon(UINT id)
{ {
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
removeIconNoLock(id); removeIconNoLock(id);
@ -194,7 +194,7 @@ CArchTaskBarWindows::removeIcon(UINT id)
} }
void void
CArchTaskBarWindows::updateIcon(UINT id) ArchTaskBarWindows::updateIcon(UINT id)
{ {
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
CIDToReceiverMap::const_iterator index = m_idTable.find(id); CIDToReceiverMap::const_iterator index = m_idTable.find(id);
@ -205,10 +205,10 @@ CArchTaskBarWindows::updateIcon(UINT id)
} }
void void
CArchTaskBarWindows::addAllIcons() ArchTaskBarWindows::addAllIcons()
{ {
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
for (CReceiverToInfoMap::const_iterator index = m_receivers.begin(); for (ReceiverToInfoMap::const_iterator index = m_receivers.begin();
index != m_receivers.end(); ++index) { index != m_receivers.end(); ++index) {
modifyIconNoLock(index, NIM_ADD); modifyIconNoLock(index, NIM_ADD);
} }
@ -216,10 +216,10 @@ CArchTaskBarWindows::addAllIcons()
} }
void void
CArchTaskBarWindows::removeAllIcons() ArchTaskBarWindows::removeAllIcons()
{ {
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
for (CReceiverToInfoMap::const_iterator index = m_receivers.begin(); for (ReceiverToInfoMap::const_iterator index = m_receivers.begin();
index != m_receivers.end(); ++index) { index != m_receivers.end(); ++index) {
removeIconNoLock(index->second.m_id); removeIconNoLock(index->second.m_id);
} }
@ -227,8 +227,8 @@ CArchTaskBarWindows::removeAllIcons()
} }
void void
CArchTaskBarWindows::modifyIconNoLock( ArchTaskBarWindows::modifyIconNoLock(
CReceiverToInfoMap::const_iterator index, DWORD taskBarMessage) ReceiverToInfoMap::const_iterator index, DWORD taskBarMessage)
{ {
// get receiver // get receiver
UINT id = index->second.m_id; UINT id = index->second.m_id;
@ -274,7 +274,7 @@ CArchTaskBarWindows::modifyIconNoLock(
} }
void void
CArchTaskBarWindows::removeIconNoLock(UINT id) ArchTaskBarWindows::removeIconNoLock(UINT id)
{ {
NOTIFYICONDATA data; NOTIFYICONDATA data;
data.cbSize = sizeof(NOTIFYICONDATA); data.cbSize = sizeof(NOTIFYICONDATA);
@ -286,7 +286,7 @@ CArchTaskBarWindows::removeIconNoLock(UINT id)
} }
void void
CArchTaskBarWindows::handleIconMessage( ArchTaskBarWindows::handleIconMessage(
IArchTaskBarReceiver* receiver, LPARAM lParam) IArchTaskBarReceiver* receiver, LPARAM lParam)
{ {
// process message // process message
@ -317,7 +317,7 @@ CArchTaskBarWindows::handleIconMessage(
} }
bool bool
CArchTaskBarWindows::processDialogs(MSG* msg) ArchTaskBarWindows::processDialogs(MSG* msg)
{ {
// only one thread can be in this method on any particular object // only one thread can be in this method on any particular object
// at any given time. that's not a problem since only our event // at any given time. that's not a problem since only our event
@ -329,7 +329,7 @@ CArchTaskBarWindows::processDialogs(MSG* msg)
m_dialogs.erase(false); m_dialogs.erase(false);
// merge added dialogs into the dialog list // merge added dialogs into the dialog list
for (CDialogs::const_iterator index = m_addedDialogs.begin(); for (Dialogs::const_iterator index = m_addedDialogs.begin();
index != m_addedDialogs.end(); ++index) { index != m_addedDialogs.end(); ++index) {
m_dialogs.insert(std::make_pair(index->first, index->second)); m_dialogs.insert(std::make_pair(index->first, index->second));
} }
@ -344,7 +344,7 @@ CArchTaskBarWindows::processDialogs(MSG* msg)
// removeDialog() don't change the map itself (just the // removeDialog() don't change the map itself (just the
// values of some elements). // values of some elements).
ARCH->lockMutex(m_mutex); ARCH->lockMutex(m_mutex);
for (CDialogs::const_iterator index = m_dialogs.begin(); for (Dialogs::const_iterator index = m_dialogs.begin();
index != m_dialogs.end(); ++index) { index != m_dialogs.end(); ++index) {
if (index->second) { if (index->second) {
ARCH->unlockMutex(m_mutex); ARCH->unlockMutex(m_mutex);
@ -360,7 +360,7 @@ CArchTaskBarWindows::processDialogs(MSG* msg)
} }
LRESULT LRESULT
CArchTaskBarWindows::wndProc(HWND hwnd, ArchTaskBarWindows::wndProc(HWND hwnd,
UINT msg, WPARAM wParam, LPARAM lParam) UINT msg, WPARAM wParam, LPARAM lParam)
{ {
switch (msg) { switch (msg) {
@ -399,16 +399,16 @@ CArchTaskBarWindows::wndProc(HWND hwnd,
} }
LRESULT CALLBACK LRESULT CALLBACK
CArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg, ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
// if msg is WM_NCCREATE, extract the CArchTaskBarWindows* and put // if msg is WM_NCCREATE, extract the ArchTaskBarWindows* and put
// it in the extra window data then forward the call. // it in the extra window data then forward the call.
CArchTaskBarWindows* self = NULL; ArchTaskBarWindows* self = NULL;
if (msg == WM_NCCREATE) { if (msg == WM_NCCREATE) {
CREATESTRUCT* createInfo; CREATESTRUCT* createInfo;
createInfo = reinterpret_cast<CREATESTRUCT*>(lParam); createInfo = reinterpret_cast<CREATESTRUCT*>(lParam);
self = reinterpret_cast<CArchTaskBarWindows*>( self = reinterpret_cast<ArchTaskBarWindows*>(
createInfo->lpCreateParams); createInfo->lpCreateParams);
SetWindowLong(hwnd, 0, reinterpret_cast<LONG>(self)); SetWindowLong(hwnd, 0, reinterpret_cast<LONG>(self));
} }
@ -416,7 +416,7 @@ CArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
// get the extra window data and forward the call // get the extra window data and forward the call
LONG data = GetWindowLong(hwnd, 0); LONG data = GetWindowLong(hwnd, 0);
if (data != 0) { if (data != 0) {
self = reinterpret_cast<CArchTaskBarWindows*>( self = reinterpret_cast<ArchTaskBarWindows*>(
reinterpret_cast<void*>(data)); reinterpret_cast<void*>(data));
} }
} }
@ -431,7 +431,7 @@ CArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
} }
void void
CArchTaskBarWindows::threadMainLoop() ArchTaskBarWindows::threadMainLoop()
{ {
// register the task bar restart message // register the task bar restart message
m_taskBarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); m_taskBarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
@ -440,9 +440,9 @@ CArchTaskBarWindows::threadMainLoop()
WNDCLASSEX classInfo; WNDCLASSEX classInfo;
classInfo.cbSize = sizeof(classInfo); classInfo.cbSize = sizeof(classInfo);
classInfo.style = CS_NOCLOSE; classInfo.style = CS_NOCLOSE;
classInfo.lpfnWndProc = &CArchTaskBarWindows::staticWndProc; classInfo.lpfnWndProc = &ArchTaskBarWindows::staticWndProc;
classInfo.cbClsExtra = 0; classInfo.cbClsExtra = 0;
classInfo.cbWndExtra = sizeof(CArchTaskBarWindows*); classInfo.cbWndExtra = sizeof(ArchTaskBarWindows*);
classInfo.hInstance = instanceWin32(); classInfo.hInstance = instanceWin32();
classInfo.hIcon = NULL; classInfo.hIcon = NULL;
classInfo.hCursor = NULL; classInfo.hCursor = NULL;
@ -491,13 +491,13 @@ CArchTaskBarWindows::threadMainLoop()
} }
void* void*
CArchTaskBarWindows::threadEntry(void* self) ArchTaskBarWindows::threadEntry(void* self)
{ {
reinterpret_cast<CArchTaskBarWindows*>(self)->threadMainLoop(); reinterpret_cast<ArchTaskBarWindows*>(self)->threadMainLoop();
return NULL; return NULL;
} }
HINSTANCE CArchTaskBarWindows::instanceWin32() HINSTANCE ArchTaskBarWindows::instanceWin32()
{ {
return CArchMiscWindows::instanceWin32(); return ArchMiscWindows::instanceWin32();
} }

View File

@ -26,13 +26,13 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#define ARCH_TASKBAR CArchTaskBarWindows #define ARCH_TASKBAR ArchTaskBarWindows
//! Win32 implementation of IArchTaskBar //! Win32 implementation of IArchTaskBar
class CArchTaskBarWindows : public IArchTaskBar { class ArchTaskBarWindows : public IArchTaskBar {
public: public:
CArchTaskBarWindows(); ArchTaskBarWindows();
virtual ~CArchTaskBarWindows(); virtual ~ArchTaskBarWindows();
virtual void init(); virtual void init();
@ -56,15 +56,15 @@ public:
virtual void updateReceiver(IArchTaskBarReceiver*); virtual void updateReceiver(IArchTaskBarReceiver*);
private: private:
class CReceiverInfo { class ReceiverInfo {
public: public:
UINT m_id; UINT m_id;
}; };
typedef std::map<IArchTaskBarReceiver*, CReceiverInfo> CReceiverToInfoMap; typedef std::map<IArchTaskBarReceiver*, ReceiverInfo> ReceiverToInfoMap;
typedef std::map<UINT, CReceiverToInfoMap::iterator> CIDToReceiverMap; typedef std::map<UINT, ReceiverToInfoMap::iterator> CIDToReceiverMap;
typedef std::vector<UINT> CIDStack; typedef std::vector<UINT> CIDStack;
typedef std::map<HWND, bool> CDialogs; typedef std::map<HWND, bool> Dialogs;
UINT getNextID(); UINT getNextID();
void recycleID(UINT); void recycleID(UINT);
@ -74,7 +74,7 @@ private:
void updateIcon(UINT); void updateIcon(UINT);
void addAllIcons(); void addAllIcons();
void removeAllIcons(); void removeAllIcons();
void modifyIconNoLock(CReceiverToInfoMap::const_iterator, void modifyIconNoLock(ReceiverToInfoMap::const_iterator,
DWORD taskBarMessage); DWORD taskBarMessage);
void removeIconNoLock(UINT id); void removeIconNoLock(UINT id);
void handleIconMessage(IArchTaskBarReceiver*, LPARAM); void handleIconMessage(IArchTaskBarReceiver*, LPARAM);
@ -89,26 +89,26 @@ private:
HINSTANCE instanceWin32(); HINSTANCE instanceWin32();
private: private:
static CArchTaskBarWindows* s_instance; static ArchTaskBarWindows* s_instance;
// multithread data // multithread data
CArchMutex m_mutex; ArchMutex m_mutex;
CArchCond m_condVar; ArchCond m_condVar;
bool m_ready; bool m_ready;
int m_result; int m_result;
CArchThread m_thread; ArchThread m_thread;
// child thread data // child thread data
HWND m_hwnd; HWND m_hwnd;
UINT m_taskBarRestart; UINT m_taskBarRestart;
// shared data // shared data
CReceiverToInfoMap m_receivers; ReceiverToInfoMap m_receivers;
CIDToReceiverMap m_idTable; CIDToReceiverMap m_idTable;
CIDStack m_oldIDs; CIDStack m_oldIDs;
UINT m_nextID; UINT m_nextID;
// dialogs // dialogs
CDialogs m_dialogs; Dialogs m_dialogs;
CDialogs m_addedDialogs; Dialogs m_addedDialogs;
}; };

View File

@ -41,10 +41,10 @@ static PTimeGetTime s_tgt = NULL;
// //
// CArchTimeWindows // ArchTimeWindows
// //
CArchTimeWindows::CArchTimeWindows() ArchTimeWindows::ArchTimeWindows()
{ {
assert(s_freq == 0.0 || s_mmInstance == NULL); assert(s_freq == 0.0 || s_mmInstance == NULL);
@ -61,7 +61,7 @@ CArchTimeWindows::CArchTimeWindows()
} }
} }
CArchTimeWindows::~CArchTimeWindows() ArchTimeWindows::~ArchTimeWindows()
{ {
s_freq = 0.0; s_freq = 0.0;
if (s_mmInstance == NULL) { if (s_mmInstance == NULL) {
@ -72,7 +72,7 @@ CArchTimeWindows::~CArchTimeWindows()
} }
double double
CArchTimeWindows::time() ArchTimeWindows::time()
{ {
// get time. we try three ways, in order of descending precision // get time. we try three ways, in order of descending precision
if (s_freq != 0.0) { if (s_freq != 0.0) {

View File

@ -20,13 +20,13 @@
#include "arch/IArchTime.h" #include "arch/IArchTime.h"
#define ARCH_TIME CArchTimeWindows #define ARCH_TIME ArchTimeWindows
//! Win32 implementation of IArchTime //! Win32 implementation of IArchTime
class CArchTimeWindows : public IArchTime { class ArchTimeWindows : public IArchTime {
public: public:
CArchTimeWindows(); ArchTimeWindows();
virtual ~CArchTimeWindows(); virtual ~ArchTimeWindows();
// IArchTime overrides // IArchTime overrides
virtual double time(); virtual double time();

View File

@ -20,10 +20,10 @@
#include "base/EventQueue.h" #include "base/EventQueue.h"
// //
// CEvent // Event
// //
CEvent::CEvent() : Event::Event() :
m_type(kUnknown), m_type(kUnknown),
m_target(NULL), m_target(NULL),
m_data(NULL), m_data(NULL),
@ -33,7 +33,7 @@ CEvent::CEvent() :
// do nothing // 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_type(type),
m_target(target), m_target(target),
m_data(data), m_data(data),
@ -43,38 +43,38 @@ CEvent::CEvent(Type type, void* target, void* data, Flags flags) :
// do nothing // do nothing
} }
CEvent::Type Event::Type
CEvent::getType() const Event::getType() const
{ {
return m_type; return m_type;
} }
void* void*
CEvent::getTarget() const Event::getTarget() const
{ {
return m_target; return m_target;
} }
void* void*
CEvent::getData() const Event::getData() const
{ {
return m_data; return m_data;
} }
CEventData* EventData*
CEvent::getDataObject() const Event::getDataObject() const
{ {
return m_dataObject; return m_dataObject;
} }
CEvent::Flags Event::Flags
CEvent::getFlags() const Event::getFlags() const
{ {
return m_flags; return m_flags;
} }
void void
CEvent::deleteData(const CEvent& event) Event::deleteData(const Event& event)
{ {
switch (event.getType()) { switch (event.getType()) {
case kUnknown: case kUnknown:
@ -93,7 +93,7 @@ CEvent::deleteData(const CEvent& event)
} }
void void
CEvent::setDataObject(CEventData* dataObject) Event::setDataObject(EventData* dataObject)
{ {
assert(m_dataObject == nullptr); assert(m_dataObject == nullptr);
m_dataObject = dataObject; m_dataObject = dataObject;

View File

@ -21,17 +21,17 @@
#include "common/basic_types.h" #include "common/basic_types.h"
#include "common/stdmap.h" #include "common/stdmap.h"
class CEventData { class EventData {
public: public:
CEventData() { } EventData() { }
virtual ~CEventData() { } virtual ~EventData() { }
}; };
//! Event //! 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: public:
typedef UInt32 Type; typedef UInt32 Type;
enum { enum {
@ -49,9 +49,9 @@ public:
kDontFreeData = 0x02 //!< Don't free data in deleteData 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(), The \p data must be POD (plain old data) allocated by malloc(),
which means it cannot have a constructor, destructor or be 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 target is the intended recipient of the event.
\p flags is any combination of \c Flags. \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); Flags flags = kNone);
//! @name manipulators //! @name manipulators
@ -70,14 +70,14 @@ public:
/*! /*!
Deletes event data for the given event (using free()). Deletes event data for the given event (using free()).
*/ */
static void deleteData(const CEvent&); static void deleteData(const Event&);
//! Set data (non-POD) //! Set data (non-POD)
/*! /*!
Set non-POD (non plain old data), where delete is called when the event Set non-POD (non plain old data), where delete is called when the event
is deleted, and the destructor is called. is deleted, and the destructor is called.
*/ */
void setDataObject(CEventData* dataObject); void setDataObject(EventData* dataObject);
//@} //@}
//! @name accessors //! @name accessors
@ -107,7 +107,7 @@ public:
\c getData() is that when delete is called on this data, so non-POD \c getData() is that when delete is called on this data, so non-POD
(non plain old data) dtor is called. (non plain old data) dtor is called.
*/ */
CEventData* getDataObject() const; EventData* getDataObject() const;
//! Get event flags //! Get event flags
/*! /*!
@ -122,5 +122,5 @@ private:
void* m_target; void* m_target;
void* m_data; void* m_data;
Flags m_flags; Flags m_flags;
CEventData* m_dataObject; EventData* m_dataObject;
}; };

View File

@ -28,21 +28,21 @@
#include "base/Log.h" #include "base/Log.h"
#include "base/XBase.h" #include "base/XBase.h"
EVENT_TYPE_ACCESSOR(CClient) EVENT_TYPE_ACCESSOR(Client)
EVENT_TYPE_ACCESSOR(IStream) EVENT_TYPE_ACCESSOR(IStream)
EVENT_TYPE_ACCESSOR(CIpcClient) EVENT_TYPE_ACCESSOR(IpcClient)
EVENT_TYPE_ACCESSOR(CIpcClientProxy) EVENT_TYPE_ACCESSOR(IpcClientProxy)
EVENT_TYPE_ACCESSOR(CIpcServer) EVENT_TYPE_ACCESSOR(IpcServer)
EVENT_TYPE_ACCESSOR(CIpcServerProxy) EVENT_TYPE_ACCESSOR(IpcServerProxy)
EVENT_TYPE_ACCESSOR(IDataSocket) EVENT_TYPE_ACCESSOR(IDataSocket)
EVENT_TYPE_ACCESSOR(IListenSocket) EVENT_TYPE_ACCESSOR(IListenSocket)
EVENT_TYPE_ACCESSOR(ISocket) EVENT_TYPE_ACCESSOR(ISocket)
EVENT_TYPE_ACCESSOR(COSXScreen) EVENT_TYPE_ACCESSOR(OSXScreen)
EVENT_TYPE_ACCESSOR(CClientListener) EVENT_TYPE_ACCESSOR(ClientListener)
EVENT_TYPE_ACCESSOR(CClientProxy) EVENT_TYPE_ACCESSOR(ClientProxy)
EVENT_TYPE_ACCESSOR(CClientProxyUnknown) EVENT_TYPE_ACCESSOR(ClientProxyUnknown)
EVENT_TYPE_ACCESSOR(CServer) EVENT_TYPE_ACCESSOR(Server)
EVENT_TYPE_ACCESSOR(CServerApp) EVENT_TYPE_ACCESSOR(ServerApp)
EVENT_TYPE_ACCESSOR(IKeyState) EVENT_TYPE_ACCESSOR(IKeyState)
EVENT_TYPE_ACCESSOR(IPrimaryScreen) EVENT_TYPE_ACCESSOR(IPrimaryScreen)
EVENT_TYPE_ACCESSOR(IScreen) EVENT_TYPE_ACCESSOR(IScreen)
@ -50,89 +50,89 @@ EVENT_TYPE_ACCESSOR(IScreen)
// interrupt handler. this just adds a quit event to the queue. // interrupt handler. this just adds a quit event to the queue.
static static
void void
interrupt(CArch::ESignal, void* data) interrupt(Arch::ESignal, void* data)
{ {
CEventQueue* events = reinterpret_cast<CEventQueue*>(data); EventQueue* events = reinterpret_cast<EventQueue*>(data);
events->addEvent(CEvent(CEvent::kQuit)); events->addEvent(Event(Event::kQuit));
} }
// //
// CEventQueue // EventQueue
// //
CEventQueue::CEventQueue() : EventQueue::EventQueue() :
m_systemTarget(0), m_systemTarget(0),
m_nextType(CEvent::kLast), m_nextType(Event::kLast),
m_typesForCClient(NULL), m_typesForClient(NULL),
m_typesForIStream(NULL), m_typesForIStream(NULL),
m_typesForCIpcClient(NULL), m_typesForIpcClient(NULL),
m_typesForCIpcClientProxy(NULL), m_typesForIpcClientProxy(NULL),
m_typesForCIpcServer(NULL), m_typesForIpcServer(NULL),
m_typesForCIpcServerProxy(NULL), m_typesForIpcServerProxy(NULL),
m_typesForIDataSocket(NULL), m_typesForIDataSocket(NULL),
m_typesForIListenSocket(NULL), m_typesForIListenSocket(NULL),
m_typesForISocket(NULL), m_typesForISocket(NULL),
m_typesForCOSXScreen(NULL), m_typesForOSXScreen(NULL),
m_typesForCClientListener(NULL), m_typesForClientListener(NULL),
m_typesForCClientProxy(NULL), m_typesForClientProxy(NULL),
m_typesForCClientProxyUnknown(NULL), m_typesForClientProxyUnknown(NULL),
m_typesForCServer(NULL), m_typesForServer(NULL),
m_typesForCServerApp(NULL), m_typesForServerApp(NULL),
m_typesForIKeyState(NULL), m_typesForIKeyState(NULL),
m_typesForIPrimaryScreen(NULL), m_typesForIPrimaryScreen(NULL),
m_typesForIScreen(NULL), m_typesForIScreen(NULL),
m_readyMutex(new CMutex), m_readyMutex(new Mutex),
m_readyCondVar(new CCondVar<bool>(m_readyMutex, false)) m_readyCondVar(new CondVar<bool>(m_readyMutex, false))
{ {
m_mutex = ARCH->newMutex(); m_mutex = ARCH->newMutex();
ARCH->setSignalHandler(CArch::kINTERRUPT, &interrupt, this); ARCH->setSignalHandler(Arch::kINTERRUPT, &interrupt, this);
ARCH->setSignalHandler(CArch::kTERMINATE, &interrupt, this); ARCH->setSignalHandler(Arch::kTERMINATE, &interrupt, this);
m_buffer = new CSimpleEventQueueBuffer; m_buffer = new SimpleEventQueueBuffer;
} }
CEventQueue::~CEventQueue() EventQueue::~EventQueue()
{ {
delete m_buffer; delete m_buffer;
delete m_readyCondVar; delete m_readyCondVar;
delete m_readyMutex; delete m_readyMutex;
ARCH->setSignalHandler(CArch::kINTERRUPT, NULL, NULL); ARCH->setSignalHandler(Arch::kINTERRUPT, NULL, NULL);
ARCH->setSignalHandler(CArch::kTERMINATE, NULL, NULL); ARCH->setSignalHandler(Arch::kTERMINATE, NULL, NULL);
ARCH->closeMutex(m_mutex); ARCH->closeMutex(m_mutex);
} }
void void
CEventQueue::loop() EventQueue::loop()
{ {
m_buffer->init(); m_buffer->init();
{ {
CLock lock(m_readyMutex); Lock lock(m_readyMutex);
*m_readyCondVar = true; *m_readyCondVar = true;
m_readyCondVar->signal(); m_readyCondVar->signal();
} }
LOG((CLOG_DEBUG "event queue is ready")); LOG((CLOG_DEBUG "event queue is ready"));
while (!m_pending.empty()) { while (!m_pending.empty()) {
LOG((CLOG_DEBUG "add pending events to buffer")); LOG((CLOG_DEBUG "add pending events to buffer"));
CEvent& event = m_pending.front(); Event& event = m_pending.front();
addEventToBuffer(event); addEventToBuffer(event);
m_pending.pop(); m_pending.pop();
} }
CEvent event; Event event;
getEvent(event); getEvent(event);
while (event.getType() != CEvent::kQuit) { while (event.getType() != Event::kQuit) {
dispatchEvent(event); dispatchEvent(event);
CEvent::deleteData(event); Event::deleteData(event);
getEvent(event); getEvent(event);
} }
} }
CEvent::Type Event::Type
CEventQueue::registerTypeOnce(CEvent::Type& type, const char* name) EventQueue::registerTypeOnce(Event::Type& type, const char* name)
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
if (type == CEvent::kUnknown) { if (type == Event::kUnknown) {
m_typeMap.insert(std::make_pair(m_nextType, name)); m_typeMap.insert(std::make_pair(m_nextType, name));
m_nameMap.insert(std::make_pair(name, m_nextType)); m_nameMap.insert(std::make_pair(name, m_nextType));
LOG((CLOG_DEBUG1 "registered event type %s as %d", 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* const char*
CEventQueue::getTypeName(CEvent::Type type) EventQueue::getTypeName(Event::Type type)
{ {
switch (type) { switch (type) {
case CEvent::kUnknown: case Event::kUnknown:
return "nil"; return "nil";
case CEvent::kQuit: case Event::kQuit:
return "quit"; return "quit";
case CEvent::kSystem: case Event::kSystem:
return "system"; return "system";
case CEvent::kTimer: case Event::kTimer:
return "timer"; return "timer";
default: default:
CTypeMap::const_iterator i = m_typeMap.find(type); TypeMap::const_iterator i = m_typeMap.find(type);
if (i == m_typeMap.end()) { if (i == m_typeMap.end()) {
return "<unknown>"; return "<unknown>";
} }
@ -169,9 +169,9 @@ CEventQueue::getTypeName(CEvent::Type type)
} }
void void
CEventQueue::adoptBuffer(IEventQueueBuffer* buffer) EventQueue::adoptBuffer(IEventQueueBuffer* buffer)
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
LOG((CLOG_DEBUG "adopting new buffer")); LOG((CLOG_DEBUG "adopting new buffer"));
@ -183,8 +183,8 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer)
// discard old buffer and old events // discard old buffer and old events
delete m_buffer; delete m_buffer;
for (CEventTable::iterator i = m_events.begin(); i != m_events.end(); ++i) { for (EventTable::iterator i = m_events.begin(); i != m_events.end(); ++i) {
CEvent::deleteData(i->second); Event::deleteData(i->second);
} }
m_events.clear(); m_events.clear();
m_oldEventIDs.clear(); m_oldEventIDs.clear();
@ -192,14 +192,14 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer)
// use new buffer // use new buffer
m_buffer = buffer; m_buffer = buffer;
if (m_buffer == NULL) { if (m_buffer == NULL) {
m_buffer = new CSimpleEventQueueBuffer; m_buffer = new SimpleEventQueueBuffer;
} }
} }
bool bool
CEventQueue::getEvent(CEvent& event, double timeout) EventQueue::getEvent(Event& event, double timeout)
{ {
CStopwatch timer(true); Stopwatch timer(true);
retry: retry:
// if no events are waiting then handle timers and then wait // if no events are waiting then handle timers and then wait
while (m_buffer->isEmpty()) { while (m_buffer->isEmpty()) {
@ -244,7 +244,7 @@ retry:
case IEventQueueBuffer::kUser: case IEventQueueBuffer::kUser:
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
event = removeEvent(dataID); event = removeEvent(dataID);
return true; return true;
} }
@ -256,12 +256,12 @@ retry:
} }
bool bool
CEventQueue::dispatchEvent(const CEvent& event) EventQueue::dispatchEvent(const Event& event)
{ {
void* target = event.getTarget(); void* target = event.getTarget();
IEventJob* job = getHandler(event.getType(), target); IEventJob* job = getHandler(event.getType(), target);
if (job == NULL) { if (job == NULL) {
job = getHandler(CEvent::kUnknown, target); job = getHandler(Event::kUnknown, target);
} }
if (job != NULL) { if (job != NULL) {
job->run(event); job->run(event);
@ -271,22 +271,22 @@ CEventQueue::dispatchEvent(const CEvent& event)
} }
void void
CEventQueue::addEvent(const CEvent& event) EventQueue::addEvent(const Event& event)
{ {
// discard bogus event types // discard bogus event types
switch (event.getType()) { switch (event.getType()) {
case CEvent::kUnknown: case Event::kUnknown:
case CEvent::kSystem: case Event::kSystem:
case CEvent::kTimer: case Event::kTimer:
return; return;
default: default:
break; break;
} }
if ((event.getFlags() & CEvent::kDeliverImmediately) != 0) { if ((event.getFlags() & Event::kDeliverImmediately) != 0) {
dispatchEvent(event); dispatchEvent(event);
CEvent::deleteData(event); Event::deleteData(event);
} }
else if (!(*m_readyCondVar)) { else if (!(*m_readyCondVar)) {
m_pending.push(event); m_pending.push(event);
@ -297,9 +297,9 @@ CEventQueue::addEvent(const CEvent& event)
} }
void 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 // store the event's data locally
UInt32 eventID = saveEvent(event); UInt32 eventID = saveEvent(event);
@ -308,60 +308,60 @@ CEventQueue::addEventToBuffer(const CEvent& event)
if (!m_buffer->addEvent(eventID)) { if (!m_buffer->addEvent(eventID)) {
// failed to send event // failed to send event
removeEvent(eventID); removeEvent(eventID);
CEvent::deleteData(event); Event::deleteData(event);
} }
} }
CEventQueueTimer* EventQueueTimer*
CEventQueue::newTimer(double duration, void* target) EventQueue::newTimer(double duration, void* target)
{ {
assert(duration > 0.0); assert(duration > 0.0);
CEventQueueTimer* timer = m_buffer->newTimer(duration, false); EventQueueTimer* timer = m_buffer->newTimer(duration, false);
if (target == NULL) { if (target == NULL) {
target = timer; target = timer;
} }
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
m_timers.insert(timer); m_timers.insert(timer);
// initial duration is requested duration plus whatever's on // initial duration is requested duration plus whatever's on
// the clock currently because the latter will be subtracted // the clock currently because the latter will be subtracted
// the next time we check for timers. // 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)); duration + m_time.getTime(), target, false));
return timer; return timer;
} }
CEventQueueTimer* EventQueueTimer*
CEventQueue::newOneShotTimer(double duration, void* target) EventQueue::newOneShotTimer(double duration, void* target)
{ {
assert(duration > 0.0); assert(duration > 0.0);
CEventQueueTimer* timer = m_buffer->newTimer(duration, true); EventQueueTimer* timer = m_buffer->newTimer(duration, true);
if (target == NULL) { if (target == NULL) {
target = timer; target = timer;
} }
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
m_timers.insert(timer); m_timers.insert(timer);
// initial duration is requested duration plus whatever's on // initial duration is requested duration plus whatever's on
// the clock currently because the latter will be subtracted // the clock currently because the latter will be subtracted
// the next time we check for timers. // 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)); duration + m_time.getTime(), target, true));
return timer; return timer;
} }
void void
CEventQueue::deleteTimer(CEventQueueTimer* timer) EventQueue::deleteTimer(EventQueueTimer* timer)
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
for (CTimerQueue::iterator index = m_timerQueue.begin(); for (TimerQueue::iterator index = m_timerQueue.begin();
index != m_timerQueue.end(); ++index) { index != m_timerQueue.end(); ++index) {
if (index->getTimer() == timer) { if (index->getTimer() == timer) {
m_timerQueue.erase(index); m_timerQueue.erase(index);
break; break;
} }
} }
CTimers::iterator index = m_timers.find(timer); Timers::iterator index = m_timers.find(timer);
if (index != m_timers.end()) { if (index != m_timers.end()) {
m_timers.erase(index); m_timers.erase(index);
} }
@ -369,24 +369,24 @@ CEventQueue::deleteTimer(CEventQueueTimer* timer)
} }
void 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]; IEventJob*& job = m_handlers[target][type];
delete job; delete job;
job = handler; job = handler;
} }
void void
CEventQueue::removeHandler(CEvent::Type type, void* target) EventQueue::removeHandler(Event::Type type, void* target)
{ {
IEventJob* handler = NULL; IEventJob* handler = NULL;
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
CHandlerTable::iterator index = m_handlers.find(target); HandlerTable::iterator index = m_handlers.find(target);
if (index != m_handlers.end()) { if (index != m_handlers.end()) {
CTypeHandlerTable& typeHandlers = index->second; TypeHandlerTable& typeHandlers = index->second;
CTypeHandlerTable::iterator index2 = typeHandlers.find(type); TypeHandlerTable::iterator index2 = typeHandlers.find(type);
if (index2 != typeHandlers.end()) { if (index2 != typeHandlers.end()) {
handler = index2->second; handler = index2->second;
typeHandlers.erase(index2); typeHandlers.erase(index2);
@ -397,16 +397,16 @@ CEventQueue::removeHandler(CEvent::Type type, void* target)
} }
void void
CEventQueue::removeHandlers(void* target) EventQueue::removeHandlers(void* target)
{ {
std::vector<IEventJob*> handlers; std::vector<IEventJob*> handlers;
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
CHandlerTable::iterator index = m_handlers.find(target); HandlerTable::iterator index = m_handlers.find(target);
if (index != m_handlers.end()) { if (index != m_handlers.end()) {
// copy to handlers array and clear table for target // copy to handlers array and clear table for target
CTypeHandlerTable& typeHandlers = index->second; TypeHandlerTable& typeHandlers = index->second;
for (CTypeHandlerTable::iterator index2 = typeHandlers.begin(); for (TypeHandlerTable::iterator index2 = typeHandlers.begin();
index2 != typeHandlers.end(); ++index2) { index2 != typeHandlers.end(); ++index2) {
handlers.push_back(index2->second); handlers.push_back(index2->second);
} }
@ -422,19 +422,19 @@ CEventQueue::removeHandlers(void* target)
} }
bool bool
CEventQueue::isEmpty() const EventQueue::isEmpty() const
{ {
return (m_buffer->isEmpty() && getNextTimerTimeout() != 0.0); return (m_buffer->isEmpty() && getNextTimerTimeout() != 0.0);
} }
IEventJob* IEventJob*
CEventQueue::getHandler(CEvent::Type type, void* target) const EventQueue::getHandler(Event::Type type, void* target) const
{ {
CArchMutexLock lock(m_mutex); ArchMutexLock lock(m_mutex);
CHandlerTable::const_iterator index = m_handlers.find(target); HandlerTable::const_iterator index = m_handlers.find(target);
if (index != m_handlers.end()) { if (index != m_handlers.end()) {
const CTypeHandlerTable& typeHandlers = index->second; const TypeHandlerTable& typeHandlers = index->second;
CTypeHandlerTable::const_iterator index2 = typeHandlers.find(type); TypeHandlerTable::const_iterator index2 = typeHandlers.find(type);
if (index2 != typeHandlers.end()) { if (index2 != typeHandlers.end()) {
return index2->second; return index2->second;
} }
@ -443,7 +443,7 @@ CEventQueue::getHandler(CEvent::Type type, void* target) const
} }
UInt32 UInt32
CEventQueue::saveEvent(const CEvent& event) EventQueue::saveEvent(const Event& event)
{ {
// choose id // choose id
UInt32 id; UInt32 id;
@ -462,17 +462,17 @@ CEventQueue::saveEvent(const CEvent& event)
return id; return id;
} }
CEvent Event
CEventQueue::removeEvent(UInt32 eventID) EventQueue::removeEvent(UInt32 eventID)
{ {
// look up id // look up id
CEventTable::iterator index = m_events.find(eventID); EventTable::iterator index = m_events.find(eventID);
if (index == m_events.end()) { if (index == m_events.end()) {
return CEvent(); return Event();
} }
// get data // get data
CEvent event = index->second; Event event = index->second;
m_events.erase(index); m_events.erase(index);
// save old id for reuse // save old id for reuse
@ -482,7 +482,7 @@ CEventQueue::removeEvent(UInt32 eventID)
} }
bool bool
CEventQueue::hasTimerExpired(CEvent& event) EventQueue::hasTimerExpired(Event& event)
{ {
// return true if there's a timer in the timer priority queue that // return true if there's a timer in the timer priority queue that
// has expired. if returning true then fill in event appropriately // has expired. if returning true then fill in event appropriately
@ -496,7 +496,7 @@ CEventQueue::hasTimerExpired(CEvent& event)
m_time.reset(); m_time.reset();
// countdown elapsed time // countdown elapsed time
for (CTimerQueue::iterator index = m_timerQueue.begin(); for (TimerQueue::iterator index = m_timerQueue.begin();
index != m_timerQueue.end(); ++index) { index != m_timerQueue.end(); ++index) {
(*index) -= time; (*index) -= time;
} }
@ -507,12 +507,12 @@ CEventQueue::hasTimerExpired(CEvent& event)
} }
// remove timer from queue // remove timer from queue
CTimer timer = m_timerQueue.top(); Timer timer = m_timerQueue.top();
m_timerQueue.pop(); m_timerQueue.pop();
// prepare event and reset the timer's clock // prepare event and reset the timer's clock
timer.fillEvent(m_timerEvent); timer.fillEvent(m_timerEvent);
event = CEvent(CEvent::kTimer, timer.getTarget(), &m_timerEvent); event = Event(Event::kTimer, timer.getTarget(), &m_timerEvent);
timer.reset(); timer.reset();
// reinsert timer into queue if it's not a one-shot // reinsert timer into queue if it's not a one-shot
@ -524,7 +524,7 @@ CEventQueue::hasTimerExpired(CEvent& event)
} }
double double
CEventQueue::getNextTimerTimeout() const EventQueue::getNextTimerTimeout() const
{ {
// return -1 if no timers, 0 if the top timer has expired, otherwise // 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 // the time until the top timer in the timer priority queue will
@ -538,28 +538,28 @@ CEventQueue::getNextTimerTimeout() const
return m_timerQueue.top(); return m_timerQueue.top();
} }
CEvent::Type Event::Type
CEventQueue::getRegisteredType(const CString& name) const 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()) if (found != m_nameMap.end())
return found->second; return found->second;
return CEvent::kUnknown; return Event::kUnknown;
} }
void* void*
CEventQueue::getSystemTarget() EventQueue::getSystemTarget()
{ {
// any unique arbitrary pointer will do // any unique arbitrary pointer will do
return &m_systemTarget; return &m_systemTarget;
} }
void void
CEventQueue::waitForReady() const EventQueue::waitForReady() const
{ {
double timeout = ARCH->time() + 10; double timeout = ARCH->time() + 10;
CLock lock(m_readyMutex); Lock lock(m_readyMutex);
while (!m_readyCondVar->wait()) { while (!m_readyCondVar->wait()) {
if(ARCH->time() > timeout) { 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) : double initialTime, void* target, bool oneShot) :
m_timer(timer), m_timer(timer),
m_timeout(timeout), m_timeout(timeout),
@ -583,49 +583,49 @@ CEventQueue::CTimer::CTimer(CEventQueueTimer* timer, double timeout,
assert(m_timeout > 0.0); assert(m_timeout > 0.0);
} }
CEventQueue::CTimer::~CTimer() EventQueue::Timer::~Timer()
{ {
// do nothing // do nothing
} }
void void
CEventQueue::CTimer::reset() EventQueue::Timer::reset()
{ {
m_time = m_timeout; m_time = m_timeout;
} }
CEventQueue::CTimer& EventQueue::Timer&
CEventQueue::CTimer::operator-=(double dt) EventQueue::Timer::operator-=(double dt)
{ {
m_time -= dt; m_time -= dt;
return *this; return *this;
} }
CEventQueue::CTimer::operator double() const EventQueue::Timer::operator double() const
{ {
return m_time; return m_time;
} }
bool bool
CEventQueue::CTimer::isOneShot() const EventQueue::Timer::isOneShot() const
{ {
return m_oneShot; return m_oneShot;
} }
CEventQueueTimer* EventQueueTimer*
CEventQueue::CTimer::getTimer() const EventQueue::Timer::getTimer() const
{ {
return m_timer; return m_timer;
} }
void* void*
CEventQueue::CTimer::getTarget() const EventQueue::Timer::getTarget() const
{ {
return m_target; return m_target;
} }
void void
CEventQueue::CTimer::fillEvent(CTimerEvent& event) const EventQueue::Timer::fillEvent(TimerEvent& event) const
{ {
event.m_timer = m_timer; event.m_timer = m_timer;
event.m_count = 0; event.m_count = 0;
@ -635,7 +635,7 @@ CEventQueue::CTimer::fillEvent(CTimerEvent& event) const
} }
bool bool
CEventQueue::CTimer::operator<(const CTimer& t) const EventQueue::Timer::operator<(const Timer& t) const
{ {
return m_time < t.m_time; return m_time < t.m_time;
} }

View File

@ -29,162 +29,162 @@
#include <queue> #include <queue>
class CMutex; class Mutex;
//! Event queue //! Event queue
/*! /*!
An event queue that implements the platform independent parts and An event queue that implements the platform independent parts and
delegates the platform dependent parts to a subclass. delegates the platform dependent parts to a subclass.
*/ */
class CEventQueue : public IEventQueue { class EventQueue : public IEventQueue {
public: public:
CEventQueue(); EventQueue();
virtual ~CEventQueue(); virtual ~EventQueue();
// IEventQueue overrides // IEventQueue overrides
virtual void loop(); virtual void loop();
virtual void adoptBuffer(IEventQueueBuffer*); virtual void adoptBuffer(IEventQueueBuffer*);
virtual bool getEvent(CEvent& event, double timeout = -1.0); virtual bool getEvent(Event& event, double timeout = -1.0);
virtual bool dispatchEvent(const CEvent& event); virtual bool dispatchEvent(const Event& event);
virtual void addEvent(const CEvent& event); virtual void addEvent(const Event& event);
virtual CEventQueueTimer* virtual EventQueueTimer*
newTimer(double duration, void* target); newTimer(double duration, void* target);
virtual CEventQueueTimer* virtual EventQueueTimer*
newOneShotTimer(double duration, void* target); newOneShotTimer(double duration, void* target);
virtual void deleteTimer(CEventQueueTimer*); virtual void deleteTimer(EventQueueTimer*);
virtual void adoptHandler(CEvent::Type type, virtual void adoptHandler(Event::Type type,
void* target, IEventJob* handler); 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 void removeHandlers(void* target);
virtual CEvent::Type virtual Event::Type
registerTypeOnce(CEvent::Type& type, const char* name); registerTypeOnce(Event::Type& type, const char* name);
virtual bool isEmpty() const; virtual bool isEmpty() const;
virtual IEventJob* getHandler(CEvent::Type type, void* target) const; virtual IEventJob* getHandler(Event::Type type, void* target) const;
virtual const char* getTypeName(CEvent::Type type); virtual const char* getTypeName(Event::Type type);
virtual CEvent::Type virtual Event::Type
getRegisteredType(const CString& name) const; getRegisteredType(const String& name) const;
void* getSystemTarget(); void* getSystemTarget();
virtual void waitForReady() const; virtual void waitForReady() const;
private: private:
UInt32 saveEvent(const CEvent& event); UInt32 saveEvent(const Event& event);
CEvent removeEvent(UInt32 eventID); Event removeEvent(UInt32 eventID);
bool hasTimerExpired(CEvent& event); bool hasTimerExpired(Event& event);
double getNextTimerTimeout() const; double getNextTimerTimeout() const;
void addEventToBuffer(const CEvent& event); void addEventToBuffer(const Event& event);
private: private:
class CTimer { class Timer {
public: public:
CTimer(CEventQueueTimer*, double timeout, double initialTime, Timer(EventQueueTimer*, double timeout, double initialTime,
void* target, bool oneShot); void* target, bool oneShot);
~CTimer(); ~Timer();
void reset(); void reset();
CTimer& operator-=(double); Timer& operator-=(double);
operator double() const; operator double() const;
bool isOneShot() const; bool isOneShot() const;
CEventQueueTimer* EventQueueTimer*
getTimer() const; getTimer() const;
void* getTarget() const; void* getTarget() const;
void fillEvent(CTimerEvent&) const; void fillEvent(TimerEvent&) const;
bool operator<(const CTimer&) const; bool operator<(const Timer&) const;
private: private:
CEventQueueTimer* m_timer; EventQueueTimer* m_timer;
double m_timeout; double m_timeout;
void* m_target; void* m_target;
bool m_oneShot; bool m_oneShot;
double m_time; double m_time;
}; };
typedef std::set<CEventQueueTimer*> CTimers; typedef std::set<EventQueueTimer*> Timers;
typedef CPriorityQueue<CTimer> CTimerQueue; typedef PriorityQueue<Timer> TimerQueue;
typedef std::map<UInt32, CEvent> CEventTable; typedef std::map<UInt32, Event> EventTable;
typedef std::vector<UInt32> CEventIDList; typedef std::vector<UInt32> EventIDList;
typedef std::map<CEvent::Type, const char*> CTypeMap; typedef std::map<Event::Type, const char*> TypeMap;
typedef std::map<CString, CEvent::Type> CNameMap; typedef std::map<String, Event::Type> NameMap;
typedef std::map<CEvent::Type, IEventJob*> CTypeHandlerTable; typedef std::map<Event::Type, IEventJob*> TypeHandlerTable;
typedef std::map<void*, CTypeHandlerTable> CHandlerTable; typedef std::map<void*, TypeHandlerTable> HandlerTable;
int m_systemTarget; int m_systemTarget;
CArchMutex m_mutex; ArchMutex m_mutex;
// registered events // registered events
CEvent::Type m_nextType; Event::Type m_nextType;
CTypeMap m_typeMap; TypeMap m_typeMap;
CNameMap m_nameMap; NameMap m_nameMap;
// buffer of events // buffer of events
IEventQueueBuffer* m_buffer; IEventQueueBuffer* m_buffer;
// saved events // saved events
CEventTable m_events; EventTable m_events;
CEventIDList m_oldEventIDs; EventIDList m_oldEventIDs;
// timers // timers
CStopwatch m_time; Stopwatch m_time;
CTimers m_timers; Timers m_timers;
CTimerQueue m_timerQueue; TimerQueue m_timerQueue;
CTimerEvent m_timerEvent; TimerEvent m_timerEvent;
// event handlers // event handlers
CHandlerTable m_handlers; HandlerTable m_handlers;
public: public:
// //
// Event type providers. // Event type providers.
// //
CClientEvents& forCClient(); ClientEvents& forClient();
IStreamEvents& forIStream(); IStreamEvents& forIStream();
CIpcClientEvents& forCIpcClient(); IpcClientEvents& forIpcClient();
CIpcClientProxyEvents& forCIpcClientProxy(); IpcClientProxyEvents& forIpcClientProxy();
CIpcServerEvents& forCIpcServer(); IpcServerEvents& forIpcServer();
CIpcServerProxyEvents& forCIpcServerProxy(); IpcServerProxyEvents& forIpcServerProxy();
IDataSocketEvents& forIDataSocket(); IDataSocketEvents& forIDataSocket();
IListenSocketEvents& forIListenSocket(); IListenSocketEvents& forIListenSocket();
ISocketEvents& forISocket(); ISocketEvents& forISocket();
COSXScreenEvents& forCOSXScreen(); OSXScreenEvents& forOSXScreen();
CClientListenerEvents& forCClientListener(); ClientListenerEvents& forClientListener();
CClientProxyEvents& forCClientProxy(); ClientProxyEvents& forClientProxy();
CClientProxyUnknownEvents& forCClientProxyUnknown(); ClientProxyUnknownEvents& forClientProxyUnknown();
CServerEvents& forCServer(); ServerEvents& forServer();
CServerAppEvents& forCServerApp(); ServerAppEvents& forServerApp();
IKeyStateEvents& forIKeyState(); IKeyStateEvents& forIKeyState();
IPrimaryScreenEvents& forIPrimaryScreen(); IPrimaryScreenEvents& forIPrimaryScreen();
IScreenEvents& forIScreen(); IScreenEvents& forIScreen();
private: private:
CClientEvents* m_typesForCClient; ClientEvents* m_typesForClient;
IStreamEvents* m_typesForIStream; IStreamEvents* m_typesForIStream;
CIpcClientEvents* m_typesForCIpcClient; IpcClientEvents* m_typesForIpcClient;
CIpcClientProxyEvents* m_typesForCIpcClientProxy; IpcClientProxyEvents* m_typesForIpcClientProxy;
CIpcServerEvents* m_typesForCIpcServer; IpcServerEvents* m_typesForIpcServer;
CIpcServerProxyEvents* m_typesForCIpcServerProxy; IpcServerProxyEvents* m_typesForIpcServerProxy;
IDataSocketEvents* m_typesForIDataSocket; IDataSocketEvents* m_typesForIDataSocket;
IListenSocketEvents* m_typesForIListenSocket; IListenSocketEvents* m_typesForIListenSocket;
ISocketEvents* m_typesForISocket; ISocketEvents* m_typesForISocket;
COSXScreenEvents* m_typesForCOSXScreen; OSXScreenEvents* m_typesForOSXScreen;
CClientListenerEvents* m_typesForCClientListener; ClientListenerEvents* m_typesForClientListener;
CClientProxyEvents* m_typesForCClientProxy; ClientProxyEvents* m_typesForClientProxy;
CClientProxyUnknownEvents* m_typesForCClientProxyUnknown; ClientProxyUnknownEvents* m_typesForClientProxyUnknown;
CServerEvents* m_typesForCServer; ServerEvents* m_typesForServer;
CServerAppEvents* m_typesForCServerApp; ServerAppEvents* m_typesForServerApp;
IKeyStateEvents* m_typesForIKeyState; IKeyStateEvents* m_typesForIKeyState;
IPrimaryScreenEvents* m_typesForIPrimaryScreen; IPrimaryScreenEvents* m_typesForIPrimaryScreen;
IScreenEvents* m_typesForIScreen; IScreenEvents* m_typesForIScreen;
CMutex* m_readyMutex; Mutex* m_readyMutex;
CCondVar<bool>* m_readyCondVar; CondVar<bool>* m_readyCondVar;
std::queue<CEvent> m_pending; std::queue<Event> m_pending;
}; };
#define EVENT_TYPE_ACCESSOR(type_) \ #define EVENT_TYPE_ACCESSOR(type_) \
type_##Events& \ type_##Events& \
CEventQueue::for##type_() { \ EventQueue::for##type_() { \
if (m_typesFor##type_ == NULL) { \ if (m_typesFor##type_ == NULL) { \
m_typesFor##type_ = new type_##Events(); \ m_typesFor##type_ = new type_##Events(); \
m_typesFor##type_->setEvents(dynamic_cast<IEventQueue*>(this)); \ m_typesFor##type_->setEvents(dynamic_cast<IEventQueue*>(this)); \

View File

@ -21,31 +21,31 @@
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>
CEventTypes::CEventTypes() : EventTypes::EventTypes() :
m_events(NULL) m_events(NULL)
{ {
} }
IEventQueue* IEventQueue*
CEventTypes::getEvents() const EventTypes::getEvents() const
{ {
assert(m_events != NULL); assert(m_events != NULL);
return m_events; return m_events;
} }
void void
CEventTypes::setEvents(IEventQueue* events) EventTypes::setEvents(IEventQueue* events)
{ {
m_events = events; m_events = events;
} }
// //
// CClient // Client
// //
REGISTER_EVENT(CClient, connected) REGISTER_EVENT(Client, connected)
REGISTER_EVENT(CClient, connectionFailed) REGISTER_EVENT(Client, connectionFailed)
REGISTER_EVENT(CClient, disconnected) REGISTER_EVENT(Client, disconnected)
// //
// IStream // IStream
@ -58,24 +58,24 @@ REGISTER_EVENT(IStream, inputShutdown)
REGISTER_EVENT(IStream, outputShutdown) REGISTER_EVENT(IStream, outputShutdown)
// //
// CIpcClient // IpcClient
// //
REGISTER_EVENT(CIpcClient, connected) REGISTER_EVENT(IpcClient, connected)
REGISTER_EVENT(CIpcClient, messageReceived) REGISTER_EVENT(IpcClient, messageReceived)
// //
// CIpcClientProxy // IpcClientProxy
// //
REGISTER_EVENT(CIpcClientProxy, messageReceived) REGISTER_EVENT(IpcClientProxy, messageReceived)
REGISTER_EVENT(CIpcClientProxy, disconnected) REGISTER_EVENT(IpcClientProxy, disconnected)
// //
// CIpcServerProxy // IpcServerProxy
// //
REGISTER_EVENT(CIpcServerProxy, messageReceived) REGISTER_EVENT(IpcServerProxy, messageReceived)
// //
// IDataSocket // IDataSocket
@ -97,52 +97,52 @@ REGISTER_EVENT(IListenSocket, connecting)
REGISTER_EVENT(ISocket, disconnected) 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(ClientProxy, ready)
REGISTER_EVENT(CClientProxy, disconnected) REGISTER_EVENT(ClientProxy, disconnected)
REGISTER_EVENT(CClientProxy, clipboardChanged) REGISTER_EVENT(ClientProxy, clipboardChanged)
// //
// CClientProxyUnknown // ClientProxyUnknown
// //
REGISTER_EVENT(CClientProxyUnknown, success) REGISTER_EVENT(ClientProxyUnknown, success)
REGISTER_EVENT(CClientProxyUnknown, failure) REGISTER_EVENT(ClientProxyUnknown, failure)
// //
// CServer // Server
// //
REGISTER_EVENT(CServer, error) REGISTER_EVENT(Server, error)
REGISTER_EVENT(CServer, connected) REGISTER_EVENT(Server, connected)
REGISTER_EVENT(CServer, disconnected) REGISTER_EVENT(Server, disconnected)
REGISTER_EVENT(CServer, switchToScreen) REGISTER_EVENT(Server, switchToScreen)
REGISTER_EVENT(CServer, switchInDirection) REGISTER_EVENT(Server, switchInDirection)
REGISTER_EVENT(CServer, keyboardBroadcast) REGISTER_EVENT(Server, keyboardBroadcast)
REGISTER_EVENT(CServer, lockCursorToScreen) REGISTER_EVENT(Server, lockCursorToScreen)
REGISTER_EVENT(CServer, screenSwitched) REGISTER_EVENT(Server, screenSwitched)
// //
// CServerApp // ServerApp
// //
REGISTER_EVENT(CServerApp, reloadConfig) REGISTER_EVENT(ServerApp, reloadConfig)
REGISTER_EVENT(CServerApp, forceReconnect) REGISTER_EVENT(ServerApp, forceReconnect)
REGISTER_EVENT(CServerApp, resetServer) REGISTER_EVENT(ServerApp, resetServer)
// //
// IKeyState // IKeyState
@ -181,8 +181,8 @@ REGISTER_EVENT(IScreen, fileChunkSending)
REGISTER_EVENT(IScreen, fileRecieveCompleted) REGISTER_EVENT(IScreen, fileRecieveCompleted)
// //
// CIpcServer // IpcServer
// //
REGISTER_EVENT(CIpcServer, clientConnected) REGISTER_EVENT(IpcServer, clientConnected)
REGISTER_EVENT(CIpcServer, messageReceived) REGISTER_EVENT(IpcServer, messageReceived)

View File

@ -21,9 +21,9 @@
class IEventQueue; class IEventQueue;
class CEventTypes { class EventTypes {
public: public:
CEventTypes(); EventTypes();
void setEvents(IEventQueue* events); void setEvents(IEventQueue* events);
protected: protected:
@ -34,18 +34,18 @@ private:
}; };
#define REGISTER_EVENT(type_, name_) \ #define REGISTER_EVENT(type_, name_) \
CEvent::Type \ Event::Type \
type_##Events::name_() \ type_##Events::name_() \
{ \ { \
return getEvents()->registerTypeOnce(m_##name_, __FUNCTION__); \ return getEvents()->registerTypeOnce(m_##name_, __FUNCTION__); \
} }
class CClientEvents : public CEventTypes { class ClientEvents : public EventTypes {
public: public:
CClientEvents() : ClientEvents() :
m_connected(CEvent::kUnknown), m_connected(Event::kUnknown),
m_connectionFailed(CEvent::kUnknown), m_connectionFailed(Event::kUnknown),
m_disconnected(CEvent::kUnknown) { } m_disconnected(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -55,14 +55,14 @@ public:
Returns the connected event type. This is sent when the client has Returns the connected event type. This is sent when the client has
successfully connected to the server. successfully connected to the server.
*/ */
CEvent::Type connected(); Event::Type connected();
//! Get connection failed event type //! Get connection failed event type
/*! /*!
Returns the connection failed event type. This is sent when the 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 //! Get disconnected event type
/*! /*!
@ -70,24 +70,24 @@ public:
has disconnected from the server (and only after having successfully has disconnected from the server (and only after having successfully
connected). connected).
*/ */
CEvent::Type disconnected(); Event::Type disconnected();
//@} //@}
private: private:
CEvent::Type m_connected; Event::Type m_connected;
CEvent::Type m_connectionFailed; Event::Type m_connectionFailed;
CEvent::Type m_disconnected; Event::Type m_disconnected;
}; };
class IStreamEvents : public CEventTypes { class IStreamEvents : public EventTypes {
public: public:
IStreamEvents() : IStreamEvents() :
m_inputReady(CEvent::kUnknown), m_inputReady(Event::kUnknown),
m_outputFlushed(CEvent::kUnknown), m_outputFlushed(Event::kUnknown),
m_outputError(CEvent::kUnknown), m_outputError(Event::kUnknown),
m_inputShutdown(CEvent::kUnknown), m_inputShutdown(Event::kUnknown),
m_outputShutdown(CEvent::kUnknown) { } m_outputShutdown(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -97,7 +97,7 @@ public:
Returns the input ready event type. A stream sends this event Returns the input ready event type. A stream sends this event
when \c read() will return with data. when \c read() will return with data.
*/ */
CEvent::Type inputReady(); Event::Type inputReady();
//! Get output flushed event type //! Get output flushed event type
/*! /*!
@ -107,14 +107,14 @@ public:
\c close() will not discard any data and \c flush() will return \c close() will not discard any data and \c flush() will return
immediately. immediately.
*/ */
CEvent::Type outputFlushed(); Event::Type outputFlushed();
//! Get output error event type //! Get output error event type
/*! /*!
Returns the output error event type. A stream sends this event Returns the output error event type. A stream sends this event
when a write has failed. when a write has failed.
*/ */
CEvent::Type outputError(); Event::Type outputError();
//! Get input shutdown event type //! Get input shutdown event type
/*! /*!
@ -122,7 +122,7 @@ public:
input side of the stream has shutdown. When the input has input side of the stream has shutdown. When the input has
shutdown, no more data will ever be available to read. shutdown, no more data will ever be available to read.
*/ */
CEvent::Type inputShutdown(); Event::Type inputShutdown();
//! Get output shutdown event type //! Get output shutdown event type
/*! /*!
@ -131,106 +131,106 @@ public:
shutdown, no more data can ever be written to the stream. Any shutdown, no more data can ever be written to the stream. Any
attempt to do so will generate a output error event. attempt to do so will generate a output error event.
*/ */
CEvent::Type outputShutdown(); Event::Type outputShutdown();
//@} //@}
private: private:
CEvent::Type m_inputReady; Event::Type m_inputReady;
CEvent::Type m_outputFlushed; Event::Type m_outputFlushed;
CEvent::Type m_outputError; Event::Type m_outputError;
CEvent::Type m_inputShutdown; Event::Type m_inputShutdown;
CEvent::Type m_outputShutdown; Event::Type m_outputShutdown;
}; };
class CIpcClientEvents : public CEventTypes { class IpcClientEvents : public EventTypes {
public: public:
CIpcClientEvents() : IpcClientEvents() :
m_connected(CEvent::kUnknown), m_connected(Event::kUnknown),
m_messageReceived(CEvent::kUnknown) { } m_messageReceived(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
//! Raised when the socket is connected. //! Raised when the socket is connected.
CEvent::Type connected(); Event::Type connected();
//! Raised when a message is received. //! Raised when a message is received.
CEvent::Type messageReceived(); Event::Type messageReceived();
//@} //@}
private: private:
CEvent::Type m_connected; Event::Type m_connected;
CEvent::Type m_messageReceived; Event::Type m_messageReceived;
}; };
class CIpcClientProxyEvents : public CEventTypes { class IpcClientProxyEvents : public EventTypes {
public: public:
CIpcClientProxyEvents() : IpcClientProxyEvents() :
m_messageReceived(CEvent::kUnknown), m_messageReceived(Event::kUnknown),
m_disconnected(CEvent::kUnknown) { } m_disconnected(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
//! Raised when the server receives a message from a client. //! Raised when the server receives a message from a client.
CEvent::Type messageReceived(); Event::Type messageReceived();
//! Raised when the client disconnects from the server. //! Raised when the client disconnects from the server.
CEvent::Type disconnected(); Event::Type disconnected();
//@} //@}
private: private:
CEvent::Type m_messageReceived; Event::Type m_messageReceived;
CEvent::Type m_disconnected; Event::Type m_disconnected;
}; };
class CIpcServerEvents : public CEventTypes { class IpcServerEvents : public EventTypes {
public: public:
CIpcServerEvents() : IpcServerEvents() :
m_clientConnected(CEvent::kUnknown), m_clientConnected(Event::kUnknown),
m_messageReceived(CEvent::kUnknown) { } m_messageReceived(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
//! Raised when we have created the client proxy. //! Raised when we have created the client proxy.
CEvent::Type clientConnected(); Event::Type clientConnected();
//! Raised when a message is received through a client proxy. //! Raised when a message is received through a client proxy.
CEvent::Type messageReceived(); Event::Type messageReceived();
//@} //@}
private: private:
CEvent::Type m_clientConnected; Event::Type m_clientConnected;
CEvent::Type m_messageReceived; Event::Type m_messageReceived;
}; };
class CIpcServerProxyEvents : public CEventTypes { class IpcServerProxyEvents : public EventTypes {
public: public:
CIpcServerProxyEvents() : IpcServerProxyEvents() :
m_messageReceived(CEvent::kUnknown) { } m_messageReceived(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
//! Raised when the client receives a message from the server. //! Raised when the client receives a message from the server.
CEvent::Type messageReceived(); Event::Type messageReceived();
//@} //@}
private: private:
CEvent::Type m_messageReceived; Event::Type m_messageReceived;
}; };
class IDataSocketEvents : public CEventTypes { class IDataSocketEvents : public EventTypes {
public: public:
IDataSocketEvents() : IDataSocketEvents() :
m_connected(CEvent::kUnknown), m_connected(Event::kUnknown),
m_connectionFailed(CEvent::kUnknown) { } m_connectionFailed(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -240,27 +240,27 @@ public:
Returns the socket connected event type. A socket sends this Returns the socket connected event type. A socket sends this
event when a remote connection has been established. event when a remote connection has been established.
*/ */
CEvent::Type connected(); Event::Type connected();
//! Get connection failed event type //! Get connection failed event type
/*! /*!
Returns the socket connection failed event type. A socket sends Returns the socket connection failed event type. A socket sends
this event when an attempt to connect to a remote port has failed. 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: private:
CEvent::Type m_connected; Event::Type m_connected;
CEvent::Type m_connectionFailed; Event::Type m_connectionFailed;
}; };
class IListenSocketEvents : public CEventTypes { class IListenSocketEvents : public EventTypes {
public: public:
IListenSocketEvents() : IListenSocketEvents() :
m_connecting(CEvent::kUnknown) { } m_connecting(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -270,18 +270,18 @@ public:
Returns the socket connecting event type. A socket sends this Returns the socket connecting event type. A socket sends this
event when a remote connection is waiting to be accepted. event when a remote connection is waiting to be accepted.
*/ */
CEvent::Type connecting(); Event::Type connecting();
//@} //@}
private: private:
CEvent::Type m_connecting; Event::Type m_connecting;
}; };
class ISocketEvents : public CEventTypes { class ISocketEvents : public EventTypes {
public: public:
ISocketEvents() : ISocketEvents() :
m_disconnected(CEvent::kUnknown) { } m_disconnected(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -292,34 +292,34 @@ public:
event when the remote side of the socket has disconnected or event when the remote side of the socket has disconnected or
shutdown both input and output. shutdown both input and output.
*/ */
CEvent::Type disconnected(); Event::Type disconnected();
//@} //@}
private: private:
CEvent::Type m_disconnected; Event::Type m_disconnected;
}; };
class COSXScreenEvents : public CEventTypes { class OSXScreenEvents : public EventTypes {
public: public:
COSXScreenEvents() : OSXScreenEvents() :
m_confirmSleep(CEvent::kUnknown) { } m_confirmSleep(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
CEvent::Type confirmSleep(); Event::Type confirmSleep();
//@} //@}
private: private:
CEvent::Type m_confirmSleep; Event::Type m_confirmSleep;
}; };
class CClientListenerEvents : public CEventTypes { class ClientListenerEvents : public EventTypes {
public: public:
CClientListenerEvents() : ClientListenerEvents() :
m_connected(CEvent::kUnknown) { } m_connected(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -329,20 +329,20 @@ public:
Returns the connected event type. This is sent whenever a Returns the connected event type. This is sent whenever a
a client connects. a client connects.
*/ */
CEvent::Type connected(); Event::Type connected();
//@} //@}
private: private:
CEvent::Type m_connected; Event::Type m_connected;
}; };
class CClientProxyEvents : public CEventTypes { class ClientProxyEvents : public EventTypes {
public: public:
CClientProxyEvents() : ClientProxyEvents() :
m_ready(CEvent::kUnknown), m_ready(Event::kUnknown),
m_disconnected(CEvent::kUnknown), m_disconnected(Event::kUnknown),
m_clipboardChanged(CEvent::kUnknown) { } m_clipboardChanged(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -353,36 +353,36 @@ public:
completed the initial handshake. Until it is sent, the client is completed the initial handshake. Until it is sent, the client is
not fully connected. not fully connected.
*/ */
CEvent::Type ready(); Event::Type ready();
//! Get disconnect event type //! Get disconnect event type
/*! /*!
Returns the disconnect event type. This is sent when the client Returns the disconnect event type. This is sent when the client
disconnects or is disconnected. The target is getEventTarget(). disconnects or is disconnected. The target is getEventTarget().
*/ */
CEvent::Type disconnected(); Event::Type disconnected();
//! Get clipboard changed event type //! Get clipboard changed event type
/*! /*!
Returns the clipboard changed event type. This is sent whenever the Returns the clipboard changed event type. This is sent whenever the
contents of the clipboard has changed. The data is a pointer to a contents of the clipboard has changed. The data is a pointer to a
IScreen::CClipboardInfo. IScreen::ClipboardInfo.
*/ */
CEvent::Type clipboardChanged(); Event::Type clipboardChanged();
//@} //@}
private: private:
CEvent::Type m_ready; Event::Type m_ready;
CEvent::Type m_disconnected; Event::Type m_disconnected;
CEvent::Type m_clipboardChanged; Event::Type m_clipboardChanged;
}; };
class CClientProxyUnknownEvents : public CEventTypes { class ClientProxyUnknownEvents : public EventTypes {
public: public:
CClientProxyUnknownEvents() : ClientProxyUnknownEvents() :
m_success(CEvent::kUnknown), m_success(Event::kUnknown),
m_failure(CEvent::kUnknown) { } m_failure(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -392,33 +392,33 @@ public:
Returns the success event type. This is sent when the client has Returns the success event type. This is sent when the client has
correctly responded to the hello message. The target is this. correctly responded to the hello message. The target is this.
*/ */
CEvent::Type success(); Event::Type success();
//! Get failure event type //! Get failure event type
/*! /*!
Returns the failure event type. This is sent when a client fails Returns the failure event type. This is sent when a client fails
to correctly respond to the hello message. The target is this. to correctly respond to the hello message. The target is this.
*/ */
CEvent::Type failure(); Event::Type failure();
//@} //@}
private: private:
CEvent::Type m_success; Event::Type m_success;
CEvent::Type m_failure; Event::Type m_failure;
}; };
class CServerEvents : public CEventTypes { class ServerEvents : public EventTypes {
public: public:
CServerEvents() : ServerEvents() :
m_error(CEvent::kUnknown), m_error(Event::kUnknown),
m_connected(CEvent::kUnknown), m_connected(Event::kUnknown),
m_disconnected(CEvent::kUnknown), m_disconnected(Event::kUnknown),
m_switchToScreen(CEvent::kUnknown), m_switchToScreen(Event::kUnknown),
m_switchInDirection(CEvent::kUnknown), m_switchInDirection(Event::kUnknown),
m_keyboardBroadcast(CEvent::kUnknown), m_keyboardBroadcast(Event::kUnknown),
m_lockCursorToScreen(CEvent::kUnknown), m_lockCursorToScreen(Event::kUnknown),
m_screenSwitched(CEvent::kUnknown) { } m_screenSwitched(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -428,208 +428,208 @@ public:
Returns the error event type. This is sent when the server fails Returns the error event type. This is sent when the server fails
for some reason. for some reason.
*/ */
CEvent::Type error(); Event::Type error();
//! Get connected event type //! Get connected event type
/*! /*!
Returns the connected event type. This is sent when a client screen 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. indicates the connected screen.
*/ */
CEvent::Type connected(); Event::Type connected();
//! Get disconnected event type //! Get disconnected event type
/*! /*!
Returns the disconnected event type. This is sent when all the Returns the disconnected event type. This is sent when all the
clients have disconnected. clients have disconnected.
*/ */
CEvent::Type disconnected(); Event::Type disconnected();
//! Get switch to screen event type //! Get switch to screen event type
/*! /*!
Returns the switch to screen event type. The server responds to this 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. that indicates the target screen.
*/ */
CEvent::Type switchToScreen(); Event::Type switchToScreen();
//! Get switch in direction event type //! Get switch in direction event type
/*! /*!
Returns the switch in direction event type. The server responds to this 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. that indicates the target direction.
*/ */
CEvent::Type switchInDirection(); Event::Type switchInDirection();
//! Get keyboard broadcast event type //! Get keyboard broadcast event type
/*! /*!
Returns the keyboard broadcast event type. The server responds Returns the keyboard broadcast event type. The server responds
to this by turning on keyboard broadcasting or turning it off. The 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 //! Get lock cursor event type
/*! /*!
Returns the lock cursor event type. The server responds to this Returns the lock cursor event type. The server responds to this
by locking the cursor to the active screen or unlocking it. The 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 //! Get screen switched event type
/*! /*!
Returns the screen switched event type. This is raised when the Returns the screen switched event type. This is raised when the
screen has been switched to a client. screen has been switched to a client.
*/ */
CEvent::Type screenSwitched(); Event::Type screenSwitched();
//@} //@}
private: private:
CEvent::Type m_error; Event::Type m_error;
CEvent::Type m_connected; Event::Type m_connected;
CEvent::Type m_disconnected; Event::Type m_disconnected;
CEvent::Type m_switchToScreen; Event::Type m_switchToScreen;
CEvent::Type m_switchInDirection; Event::Type m_switchInDirection;
CEvent::Type m_keyboardBroadcast; Event::Type m_keyboardBroadcast;
CEvent::Type m_lockCursorToScreen; Event::Type m_lockCursorToScreen;
CEvent::Type m_screenSwitched; Event::Type m_screenSwitched;
}; };
class CServerAppEvents : public CEventTypes { class ServerAppEvents : public EventTypes {
public: public:
CServerAppEvents() : ServerAppEvents() :
m_reloadConfig(CEvent::kUnknown), m_reloadConfig(Event::kUnknown),
m_forceReconnect(CEvent::kUnknown), m_forceReconnect(Event::kUnknown),
m_resetServer(CEvent::kUnknown) { } m_resetServer(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
CEvent::Type reloadConfig(); Event::Type reloadConfig();
CEvent::Type forceReconnect(); Event::Type forceReconnect();
CEvent::Type resetServer(); Event::Type resetServer();
//@} //@}
private: private:
CEvent::Type m_reloadConfig; Event::Type m_reloadConfig;
CEvent::Type m_forceReconnect; Event::Type m_forceReconnect;
CEvent::Type m_resetServer; Event::Type m_resetServer;
}; };
class IKeyStateEvents : public CEventTypes { class IKeyStateEvents : public EventTypes {
public: public:
IKeyStateEvents() : IKeyStateEvents() :
m_keyDown(CEvent::kUnknown), m_keyDown(Event::kUnknown),
m_keyUp(CEvent::kUnknown), m_keyUp(Event::kUnknown),
m_keyRepeat(CEvent::kUnknown) { } m_keyRepeat(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
//! Get key down event type. Event data is CKeyInfo*, count == 1. //! Get key down event type. Event data is KeyInfo*, count == 1.
CEvent::Type keyDown(); Event::Type keyDown();
//! Get key up event type. Event data is CKeyInfo*, count == 1. //! Get key up event type. Event data is KeyInfo*, count == 1.
CEvent::Type keyUp(); Event::Type keyUp();
//! Get key repeat event type. Event data is CKeyInfo*. //! Get key repeat event type. Event data is KeyInfo*.
CEvent::Type keyRepeat(); Event::Type keyRepeat();
//@} //@}
private: private:
CEvent::Type m_keyDown; Event::Type m_keyDown;
CEvent::Type m_keyUp; Event::Type m_keyUp;
CEvent::Type m_keyRepeat; Event::Type m_keyRepeat;
}; };
class IPrimaryScreenEvents : public CEventTypes { class IPrimaryScreenEvents : public EventTypes {
public: public:
IPrimaryScreenEvents() : IPrimaryScreenEvents() :
m_buttonDown(CEvent::kUnknown), m_buttonDown(Event::kUnknown),
m_buttonUp(CEvent::kUnknown), m_buttonUp(Event::kUnknown),
m_motionOnPrimary(CEvent::kUnknown), m_motionOnPrimary(Event::kUnknown),
m_motionOnSecondary(CEvent::kUnknown), m_motionOnSecondary(Event::kUnknown),
m_wheel(CEvent::kUnknown), m_wheel(Event::kUnknown),
m_screensaverActivated(CEvent::kUnknown), m_screensaverActivated(Event::kUnknown),
m_screensaverDeactivated(CEvent::kUnknown), m_screensaverDeactivated(Event::kUnknown),
m_hotKeyDown(CEvent::kUnknown), m_hotKeyDown(Event::kUnknown),
m_hotKeyUp(CEvent::kUnknown), m_hotKeyUp(Event::kUnknown),
m_fakeInputBegin(CEvent::kUnknown), m_fakeInputBegin(Event::kUnknown),
m_fakeInputEnd(CEvent::kUnknown) { } m_fakeInputEnd(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
//! button down event type. Event data is CButtonInfo*. //! button down event type. Event data is ButtonInfo*.
CEvent::Type buttonDown(); Event::Type buttonDown();
//! button up event type. Event data is CButtonInfo*. //! button up event type. Event data is ButtonInfo*.
CEvent::Type buttonUp(); Event::Type buttonUp();
//! mouse motion on the primary screen event type //! 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 //! 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. absolute coordinates.
*/ */
CEvent::Type motionOnSecondary(); Event::Type motionOnSecondary();
//! mouse wheel event type. Event data is CWheelInfo*. //! mouse wheel event type. Event data is WheelInfo*.
CEvent::Type wheel(); Event::Type wheel();
//! screensaver activated event type //! screensaver activated event type
CEvent::Type screensaverActivated(); Event::Type screensaverActivated();
//! screensaver deactivated event type //! screensaver deactivated event type
CEvent::Type screensaverDeactivated(); Event::Type screensaverDeactivated();
//! hot key down event type. Event data is CHotKeyInfo*. //! hot key down event type. Event data is HotKeyInfo*.
CEvent::Type hotKeyDown(); Event::Type hotKeyDown();
//! hot key up event type. Event data is CHotKeyInfo*. //! hot key up event type. Event data is HotKeyInfo*.
CEvent::Type hotKeyUp(); Event::Type hotKeyUp();
//! start of fake input event type //! start of fake input event type
CEvent::Type fakeInputBegin(); Event::Type fakeInputBegin();
//! end of fake input event type //! end of fake input event type
CEvent::Type fakeInputEnd(); Event::Type fakeInputEnd();
//@} //@}
private: private:
CEvent::Type m_buttonDown; Event::Type m_buttonDown;
CEvent::Type m_buttonUp; Event::Type m_buttonUp;
CEvent::Type m_motionOnPrimary; Event::Type m_motionOnPrimary;
CEvent::Type m_motionOnSecondary; Event::Type m_motionOnSecondary;
CEvent::Type m_wheel; Event::Type m_wheel;
CEvent::Type m_screensaverActivated; Event::Type m_screensaverActivated;
CEvent::Type m_screensaverDeactivated; Event::Type m_screensaverDeactivated;
CEvent::Type m_hotKeyDown; Event::Type m_hotKeyDown;
CEvent::Type m_hotKeyUp; Event::Type m_hotKeyUp;
CEvent::Type m_fakeInputBegin; Event::Type m_fakeInputBegin;
CEvent::Type m_fakeInputEnd; Event::Type m_fakeInputEnd;
}; };
class IScreenEvents : public CEventTypes { class IScreenEvents : public EventTypes {
public: public:
IScreenEvents() : IScreenEvents() :
m_error(CEvent::kUnknown), m_error(Event::kUnknown),
m_shapeChanged(CEvent::kUnknown), m_shapeChanged(Event::kUnknown),
m_clipboardGrabbed(CEvent::kUnknown), m_clipboardGrabbed(Event::kUnknown),
m_suspend(CEvent::kUnknown), m_suspend(Event::kUnknown),
m_resume(CEvent::kUnknown), m_resume(Event::kUnknown),
m_fileChunkSending(CEvent::kUnknown), m_fileChunkSending(Event::kUnknown),
m_fileRecieveCompleted(CEvent::kUnknown) { } m_fileRecieveCompleted(Event::kUnknown) { }
//! @name accessors //! @name accessors
//@{ //@{
@ -639,51 +639,51 @@ public:
Returns the error event type. This is sent whenever the screen has Returns the error event type. This is sent whenever the screen has
failed for some reason (e.g. the X Windows server died). failed for some reason (e.g. the X Windows server died).
*/ */
CEvent::Type error(); Event::Type error();
//! Get shape changed event type //! Get shape changed event type
/*! /*!
Returns the shape changed event type. This is sent whenever the Returns the shape changed event type. This is sent whenever the
screen's shape changes. screen's shape changes.
*/ */
CEvent::Type shapeChanged(); Event::Type shapeChanged();
//! Get clipboard grabbed event type //! Get clipboard grabbed event type
/*! /*!
Returns the clipboard grabbed event type. This is sent whenever the Returns the clipboard grabbed event type. This is sent whenever the
clipboard is grabbed by some other application so we don't own it 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 //! Get suspend event type
/*! /*!
Returns the suspend event type. This is sent whenever the system goes Returns the suspend event type. This is sent whenever the system goes
to sleep or a user session is deactivated (fast user switching). to sleep or a user session is deactivated (fast user switching).
*/ */
CEvent::Type suspend(); Event::Type suspend();
//! Get resume event type //! Get resume event type
/*! /*!
Returns the resume event type. This is sent whenever the system wakes Returns the resume event type. This is sent whenever the system wakes
up or a user session is activated (fast user switching). up or a user session is activated (fast user switching).
*/ */
CEvent::Type resume(); Event::Type resume();
//! Sending a file chunk //! Sending a file chunk
CEvent::Type fileChunkSending(); Event::Type fileChunkSending();
//! Completed receiving a file //! Completed receiving a file
CEvent::Type fileRecieveCompleted(); Event::Type fileRecieveCompleted();
//@} //@}
private: private:
CEvent::Type m_error; Event::Type m_error;
CEvent::Type m_shapeChanged; Event::Type m_shapeChanged;
CEvent::Type m_clipboardGrabbed; Event::Type m_clipboardGrabbed;
CEvent::Type m_suspend; Event::Type m_suspend;
CEvent::Type m_resume; Event::Type m_resume;
CEvent::Type m_fileChunkSending; Event::Type m_fileChunkSending;
CEvent::Type m_fileRecieveCompleted; Event::Type m_fileRecieveCompleted;
}; };

View File

@ -19,24 +19,24 @@
#include "base/FunctionEventJob.h" #include "base/FunctionEventJob.h"
// //
// CFunctionEventJob // FunctionEventJob
// //
CFunctionEventJob::CFunctionEventJob( FunctionEventJob::FunctionEventJob(
void (*func)(const CEvent&, void*), void* arg) : void (*func)(const Event&, void*), void* arg) :
m_func(func), m_func(func),
m_arg(arg) m_arg(arg)
{ {
// do nothing // do nothing
} }
CFunctionEventJob::~CFunctionEventJob() FunctionEventJob::~FunctionEventJob()
{ {
// do nothing // do nothing
} }
void void
CFunctionEventJob::run(const CEvent& event) FunctionEventJob::run(const Event& event)
{ {
if (m_func != NULL) { if (m_func != NULL) {
m_func(event, m_arg); m_func(event, m_arg);

View File

@ -24,16 +24,16 @@
/*! /*!
An event job class that invokes a function. An event job class that invokes a function.
*/ */
class CFunctionEventJob : public IEventJob { class FunctionEventJob : public IEventJob {
public: public:
//! run() invokes \c func(arg) //! run() invokes \c func(arg)
CFunctionEventJob(void (*func)(const CEvent&, void*), void* arg = NULL); FunctionEventJob(void (*func)(const Event&, void*), void* arg = NULL);
virtual ~CFunctionEventJob(); virtual ~FunctionEventJob();
// IEventJob overrides // IEventJob overrides
virtual void run(const CEvent&); virtual void run(const Event&);
private: private:
void (*m_func)(const CEvent&, void*); void (*m_func)(const Event&, void*);
void* m_arg; void* m_arg;
}; };

View File

@ -19,23 +19,23 @@
#include "base/FunctionJob.h" #include "base/FunctionJob.h"
// //
// CFunctionJob // FunctionJob
// //
CFunctionJob::CFunctionJob(void (*func)(void*), void* arg) : FunctionJob::FunctionJob(void (*func)(void*), void* arg) :
m_func(func), m_func(func),
m_arg(arg) m_arg(arg)
{ {
// do nothing // do nothing
} }
CFunctionJob::~CFunctionJob() FunctionJob::~FunctionJob()
{ {
// do nothing // do nothing
} }
void void
CFunctionJob::run() FunctionJob::run()
{ {
if (m_func != NULL) { if (m_func != NULL) {
m_func(m_arg); m_func(m_arg);

View File

@ -24,11 +24,11 @@
/*! /*!
A job class that invokes a function. A job class that invokes a function.
*/ */
class CFunctionJob : public IJob { class FunctionJob : public IJob {
public: public:
//! run() invokes \c func(arg) //! run() invokes \c func(arg)
CFunctionJob(void (*func)(void*), void* arg = NULL); FunctionJob(void (*func)(void*), void* arg = NULL);
virtual ~CFunctionJob(); virtual ~FunctionJob();
// IJob overrides // IJob overrides
virtual void run(); virtual void run();

View File

@ -20,7 +20,7 @@
#include "common/IInterface.h" #include "common/IInterface.h"
class CEvent; class Event;
//! Event handler interface //! Event handler interface
/*! /*!
@ -29,5 +29,5 @@ An event job is an interface for executing a event handler.
class IEventJob : public IInterface { class IEventJob : public IInterface {
public: public:
//! Run the job //! Run the job
virtual void run(const CEvent&) = 0; virtual void run(const Event&) = 0;
}; };

View File

@ -27,40 +27,40 @@ class IEventQueueBuffer;
// Opaque type for timer info. This is defined by subclasses of // Opaque type for timer info. This is defined by subclasses of
// IEventQueueBuffer. // IEventQueueBuffer.
class CEventQueueTimer; class EventQueueTimer;
// Event type registration classes. // Event type registration classes.
class CClientEvents; class ClientEvents;
class IStreamEvents; class IStreamEvents;
class CIpcClientEvents; class IpcClientEvents;
class CIpcClientProxyEvents; class IpcClientProxyEvents;
class CIpcServerEvents; class IpcServerEvents;
class CIpcServerProxyEvents; class IpcServerProxyEvents;
class IDataSocketEvents; class IDataSocketEvents;
class IListenSocketEvents; class IListenSocketEvents;
class ISocketEvents; class ISocketEvents;
class COSXScreenEvents; class OSXScreenEvents;
class CClientListenerEvents; class ClientListenerEvents;
class CClientProxyEvents; class ClientProxyEvents;
class CClientProxyUnknownEvents; class ClientProxyUnknownEvents;
class CServerEvents; class ServerEvents;
class CServerAppEvents; class ServerAppEvents;
class IKeyStateEvents; class IKeyStateEvents;
class IPrimaryScreenEvents; class IPrimaryScreenEvents;
class IScreenEvents; class IScreenEvents;
//! Event queue interface //! 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 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 new events at the end of the queue. Clients can also add and remove
timers which generate events periodically. timers which generate events periodically.
*/ */
class IEventQueue : public IInterface { class IEventQueue : public IInterface {
public: public:
class CTimerEvent { class TimerEvent {
public: public:
CEventQueueTimer* m_timer; //!< The timer EventQueueTimer* m_timer; //!< The timer
UInt32 m_count; //!< Number of repeats UInt32 m_count; //!< Number of repeats
}; };
@ -86,26 +86,26 @@ public:
available then blocks for up to \p timeout seconds, or forever if available then blocks for up to \p timeout seconds, or forever if
\p timeout is negative. Returns true iff an event was available. \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 //! Dispatch an event
/*! /*!
Looks up the dispatcher for the event's target and invokes it. Looks up the dispatcher for the event's target and invokes it.
Returns true iff a dispatcher exists for the target. 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 //! Add event to queue
/*! /*!
Adds \p event to the end of the 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 //! Create a recurring timer
/*! /*!
Creates and returns a timer. An event is returned after \p duration 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 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 the returned timer to \c deleteTimer() (whether or not the timer has
expired) to release the timer. The returned timer event uses the 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 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 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 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 have been put on the queue since the last event for the timer was
removed (or since the timer was added). removed (or since the timer was added).
*/ */
virtual CEventQueueTimer* virtual EventQueueTimer*
newTimer(double duration, void* target) = 0; newTimer(double duration, void* target) = 0;
//! Create a one-shot timer //! Create a one-shot timer
/*! /*!
Creates and returns a one-shot timer. An event is returned when Creates and returns a one-shot timer. An event is returned when
the timer expires and the timer is removed from further handling. the timer expires and the timer is removed from further handling.
When a timer event is returned the data points to a \c CTimerEvent. When a timer event is returned the data points to a \c TimerEvent.
The c_count member of the \c CTimerEvent is always 1. The client 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 must pass the returned timer to \c deleteTimer() (whether or not the
timer has expired) to release the timer. The returned timer event 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 uses the given \p target. If \p target is NULL it uses the returned
timer as the target. timer as the target.
*/ */
virtual CEventQueueTimer* virtual EventQueueTimer*
newOneShotTimer(double duration, newOneShotTimer(double duration,
void* target) = 0; void* target) = 0;
@ -140,7 +140,7 @@ public:
Destroys a previously created timer. The timer is removed from the Destroys a previously created timer. The timer is removed from the
queue and will not generate event, even if the timer has expired. 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 //! 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 of type \p type. If no such handler exists it will use the handler
for \p target and type \p kUnknown if it exists. 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; void* target, IEventJob* handler) = 0;
//! Unregister an event handler for an event type //! 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 Unregisters an event handler for the \p type, \p target pair and
deletes it. 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 //! 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 type id otherwise it is left alone. The final value of \p type
is returned. is returned.
*/ */
virtual CEvent::Type virtual Event::Type
registerTypeOnce(CEvent::Type& type, registerTypeOnce(Event::Type& type,
const char* name) = 0; const char* name) = 0;
//! Wait for event queue to become ready //! 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 Finds and returns the event handler for the \p type, \p target pair
if it exists, otherwise it returns NULL. 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 //! Get name for event
/*! /*!
Returns the name for the event \p type. This is primarily for Returns the name for the event \p type. This is primarily for
debugging. debugging.
*/ */
virtual const char* getTypeName(CEvent::Type type) = 0; virtual const char* getTypeName(Event::Type type) = 0;
//! Get an event type by name //! Get an event type by name
/*! /*!
Returns the registered type for an event for a given 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 //! 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; virtual void* getSystemTarget() = 0;
@ -226,21 +226,21 @@ public:
// Event type providers. // Event type providers.
// //
virtual CClientEvents& forCClient() = 0; virtual ClientEvents& forClient() = 0;
virtual IStreamEvents& forIStream() = 0; virtual IStreamEvents& forIStream() = 0;
virtual CIpcClientEvents& forCIpcClient() = 0; virtual IpcClientEvents& forIpcClient() = 0;
virtual CIpcClientProxyEvents& forCIpcClientProxy() = 0; virtual IpcClientProxyEvents& forIpcClientProxy() = 0;
virtual CIpcServerEvents& forCIpcServer() = 0; virtual IpcServerEvents& forIpcServer() = 0;
virtual CIpcServerProxyEvents& forCIpcServerProxy() = 0; virtual IpcServerProxyEvents& forIpcServerProxy() = 0;
virtual IDataSocketEvents& forIDataSocket() = 0; virtual IDataSocketEvents& forIDataSocket() = 0;
virtual IListenSocketEvents& forIListenSocket() = 0; virtual IListenSocketEvents& forIListenSocket() = 0;
virtual ISocketEvents& forISocket() = 0; virtual ISocketEvents& forISocket() = 0;
virtual COSXScreenEvents& forCOSXScreen() = 0; virtual OSXScreenEvents& forOSXScreen() = 0;
virtual CClientListenerEvents& forCClientListener() = 0; virtual ClientListenerEvents& forClientListener() = 0;
virtual CClientProxyEvents& forCClientProxy() = 0; virtual ClientProxyEvents& forClientProxy() = 0;
virtual CClientProxyUnknownEvents& forCClientProxyUnknown() = 0; virtual ClientProxyUnknownEvents& forClientProxyUnknown() = 0;
virtual CServerEvents& forCServer() = 0; virtual ServerEvents& forServer() = 0;
virtual CServerAppEvents& forCServerApp() = 0; virtual ServerAppEvents& forServerApp() = 0;
virtual IKeyStateEvents& forIKeyState() = 0; virtual IKeyStateEvents& forIKeyState() = 0;
virtual IPrimaryScreenEvents& forIPrimaryScreen() = 0; virtual IPrimaryScreenEvents& forIPrimaryScreen() = 0;
virtual IScreenEvents& forIScreen() = 0; virtual IScreenEvents& forIScreen() = 0;

Some files were not shown because too many files have changed in this diff Show More