From e8e156f0e26b4da1ba69c93d657feb5bfc92f016 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Tue, 11 Nov 2014 13:51:47 +0000 Subject: [PATCH] dropped "c" prefix from class names --- .../MSWindowsClientTaskBarReceiver.cpp | 20 +- .../synergyc/MSWindowsClientTaskBarReceiver.h | 12 +- src/cmd/synergyc/OSXClientTaskBarReceiver.cpp | 22 +- src/cmd/synergyc/OSXClientTaskBarReceiver.h | 10 +- .../XWindowsClientTaskBarReceiver.cpp | 6 +- .../synergyc/XWindowsClientTaskBarReceiver.h | 8 +- src/cmd/synergyc/synergyc.cpp | 10 +- src/cmd/synergyd/synergyd.cpp | 4 +- .../MSWindowsPortableTaskBarReceiver.cpp | 26 +- .../MSWindowsPortableTaskBarReceiver.h | 12 +- .../synergyp/OSXPortableTaskBarReceiver.cpp | 20 +- src/cmd/synergyp/OSXPortableTaskBarReceiver.h | 10 +- .../XWindowsPortableTaskBarReceiver.cpp | 4 +- .../XWindowsPortableTaskBarReceiver.h | 8 +- src/cmd/synergyp/synergyp.cpp | 14 +- .../MSWindowsServerTaskBarReceiver.cpp | 30 +- .../synergys/MSWindowsServerTaskBarReceiver.h | 12 +- src/cmd/synergys/OSXServerTaskBarReceiver.cpp | 22 +- src/cmd/synergys/OSXServerTaskBarReceiver.h | 10 +- .../XWindowsServerTaskBarReceiver.cpp | 6 +- .../synergys/XWindowsServerTaskBarReceiver.h | 8 +- src/cmd/synergys/synergys.cpp | 10 +- src/cmd/syntool/syntool.cpp | 6 +- src/lib/arch/Arch.cpp | 18 +- src/lib/arch/Arch.h | 24 +- src/lib/arch/ArchConsoleStd.cpp | 2 +- src/lib/arch/ArchConsoleStd.h | 6 +- src/lib/arch/ArchDaemonNone.cpp | 22 +- src/lib/arch/ArchDaemonNone.h | 8 +- src/lib/arch/IArchDaemon.h | 8 +- src/lib/arch/IArchMultithread.h | 64 +- src/lib/arch/IArchNetwork.h | 78 +- src/lib/arch/IArchString.cpp | 2 +- src/lib/arch/IArchTaskBarReceiver.h | 2 +- src/lib/arch/unix/ArchConsoleUnix.cpp | 4 +- src/lib/arch/unix/ArchConsoleUnix.h | 8 +- src/lib/arch/unix/ArchDaemonUnix.cpp | 8 +- src/lib/arch/unix/ArchDaemonUnix.h | 8 +- src/lib/arch/unix/ArchFileUnix.cpp | 19 +- src/lib/arch/unix/ArchFileUnix.h | 8 +- src/lib/arch/unix/ArchInternetUnix.cpp | 22 +- src/lib/arch/unix/ArchInternetUnix.h | 8 +- src/lib/arch/unix/ArchLogUnix.cpp | 14 +- src/lib/arch/unix/ArchLogUnix.h | 8 +- src/lib/arch/unix/ArchMultithreadPosix.cpp | 136 ++-- src/lib/arch/unix/ArchMultithreadPosix.h | 80 +-- src/lib/arch/unix/ArchNetworkBSD.cpp | 108 +-- src/lib/arch/unix/ArchNetworkBSD.h | 70 +- src/lib/arch/unix/ArchPluginUnix.cpp | 6 +- src/lib/arch/unix/ArchPluginUnix.h | 8 +- src/lib/arch/unix/ArchSleepUnix.cpp | 8 +- src/lib/arch/unix/ArchSleepUnix.h | 8 +- src/lib/arch/unix/ArchStringUnix.cpp | 8 +- src/lib/arch/unix/ArchStringUnix.h | 8 +- src/lib/arch/unix/ArchSystemUnix.cpp | 14 +- src/lib/arch/unix/ArchSystemUnix.h | 8 +- src/lib/arch/unix/ArchTaskBarXWindows.cpp | 12 +- src/lib/arch/unix/ArchTaskBarXWindows.h | 8 +- src/lib/arch/unix/ArchTimeUnix.cpp | 8 +- src/lib/arch/unix/ArchTimeUnix.h | 8 +- src/lib/arch/win32/ArchConsoleWindows.cpp | 4 +- src/lib/arch/win32/ArchConsoleWindows.h | 8 +- src/lib/arch/win32/ArchDaemonWindows.cpp | 92 +-- src/lib/arch/win32/ArchDaemonWindows.h | 14 +- src/lib/arch/win32/ArchFileWindows.cpp | 18 +- src/lib/arch/win32/ArchFileWindows.h | 8 +- src/lib/arch/win32/ArchInternetWindows.cpp | 60 +- src/lib/arch/win32/ArchInternetWindows.h | 8 +- src/lib/arch/win32/ArchLogWindows.cpp | 14 +- src/lib/arch/win32/ArchLogWindows.h | 8 +- src/lib/arch/win32/ArchMiscWindows.cpp | 116 +-- src/lib/arch/win32/ArchMiscWindows.h | 16 +- src/lib/arch/win32/ArchMultithreadWindows.cpp | 166 ++--- src/lib/arch/win32/ArchMultithreadWindows.h | 84 +-- src/lib/arch/win32/ArchNetworkWinsock.cpp | 116 +-- src/lib/arch/win32/ArchNetworkWinsock.h | 76 +- src/lib/arch/win32/ArchPluginWindows.cpp | 34 +- src/lib/arch/win32/ArchPluginWindows.h | 18 +- src/lib/arch/win32/ArchSleepWindows.cpp | 10 +- src/lib/arch/win32/ArchSleepWindows.h | 8 +- src/lib/arch/win32/ArchStringWindows.cpp | 8 +- src/lib/arch/win32/ArchStringWindows.h | 8 +- src/lib/arch/win32/ArchSystemWindows.cpp | 24 +- src/lib/arch/win32/ArchSystemWindows.h | 8 +- src/lib/arch/win32/ArchTaskBarWindows.cpp | 92 +-- src/lib/arch/win32/ArchTaskBarWindows.h | 32 +- src/lib/arch/win32/ArchTimeWindows.cpp | 8 +- src/lib/arch/win32/ArchTimeWindows.h | 8 +- src/lib/base/Event.cpp | 26 +- src/lib/base/Event.h | 24 +- src/lib/base/EventQueue.cpp | 268 +++---- src/lib/base/EventQueue.h | 150 ++-- src/lib/base/EventTypes.cpp | 84 +-- src/lib/base/EventTypes.h | 450 ++++++------ src/lib/base/FunctionEventJob.cpp | 10 +- src/lib/base/FunctionEventJob.h | 10 +- src/lib/base/FunctionJob.cpp | 8 +- src/lib/base/FunctionJob.h | 6 +- src/lib/base/IEventJob.h | 4 +- src/lib/base/IEventQueue.h | 88 +-- src/lib/base/IEventQueueBuffer.h | 12 +- src/lib/base/ILogOutputter.h | 2 +- src/lib/base/Log.cpp | 54 +- src/lib/base/Log.h | 30 +- src/lib/base/PriorityQueue.h | 10 +- src/lib/base/SimpleEventQueueBuffer.cpp | 32 +- src/lib/base/SimpleEventQueueBuffer.h | 26 +- src/lib/base/Stopwatch.cpp | 24 +- src/lib/base/Stopwatch.h | 6 +- src/lib/base/String.cpp | 34 +- src/lib/base/String.h | 26 +- src/lib/base/TMethodEventJob.h | 10 +- src/lib/base/Unicode.cpp | 100 +-- src/lib/base/Unicode.h | 38 +- src/lib/base/XBase.cpp | 6 +- src/lib/base/XBase.h | 24 +- src/lib/base/log_outputters.cpp | 106 +-- src/lib/base/log_outputters.h | 52 +- src/lib/client/Client.cpp | 258 +++---- src/lib/client/Client.h | 96 +-- src/lib/client/ServerProxy.cpp | 170 ++--- src/lib/client/ServerProxy.h | 28 +- src/lib/io/CryptoMode.cpp | 24 +- src/lib/io/CryptoMode.h | 24 +- src/lib/io/CryptoOptions.cpp | 10 +- src/lib/io/CryptoOptions.h | 14 +- src/lib/io/CryptoStream.cpp | 22 +- src/lib/io/CryptoStream.h | 14 +- src/lib/io/IStreamFilterFactory.h | 4 +- src/lib/io/StreamBuffer.cpp | 16 +- src/lib/io/StreamBuffer.h | 6 +- src/lib/io/StreamFilter.cpp | 40 +- src/lib/io/StreamFilter.h | 10 +- src/lib/io/XIO.cpp | 8 +- src/lib/ipc/IpcClient.cpp | 46 +- src/lib/ipc/IpcClient.h | 26 +- src/lib/ipc/IpcClientProxy.cpp | 68 +- src/lib/ipc/IpcClientProxy.h | 30 +- src/lib/ipc/IpcLogOutputter.cpp | 44 +- src/lib/ipc/IpcLogOutputter.h | 30 +- src/lib/ipc/IpcMessage.cpp | 28 +- src/lib/ipc/IpcMessage.h | 38 +- src/lib/ipc/IpcServer.cpp | 74 +- src/lib/ipc/IpcServer.h | 34 +- src/lib/ipc/IpcServerProxy.cpp | 42 +- src/lib/ipc/IpcServerProxy.h | 18 +- src/lib/mt/CondVar.cpp | 22 +- src/lib/mt/CondVar.h | 56 +- src/lib/mt/Lock.cpp | 8 +- src/lib/mt/Lock.h | 18 +- src/lib/mt/Mutex.cpp | 16 +- src/lib/mt/Mutex.h | 14 +- src/lib/mt/Thread.cpp | 48 +- src/lib/mt/Thread.h | 40 +- src/lib/mt/XMT.cpp | 2 +- src/lib/mt/XThread.h | 2 +- src/lib/net/IDataSocket.h | 10 +- src/lib/net/IListenSocket.h | 2 +- src/lib/net/ISocket.h | 4 +- src/lib/net/ISocketMultiplexerJob.h | 2 +- src/lib/net/NetworkAddress.cpp | 48 +- src/lib/net/NetworkAddress.h | 26 +- src/lib/net/SocketMultiplexer.cpp | 92 +-- src/lib/net/SocketMultiplexer.h | 44 +- src/lib/net/TCPListenSocket.cpp | 12 +- src/lib/net/TCPListenSocket.h | 14 +- src/lib/net/TCPSocket.cpp | 42 +- src/lib/net/TCPSocket.h | 28 +- src/lib/net/TCPSocketFactory.cpp | 2 +- src/lib/net/TCPSocketFactory.h | 6 +- src/lib/net/TSocketMultiplexerMethodJob.h | 10 +- src/lib/net/XSocket.cpp | 14 +- src/lib/net/XSocket.h | 8 +- src/lib/platform/MSWindowsClipboard.cpp | 8 +- src/lib/platform/MSWindowsClipboard.h | 12 +- .../MSWindowsClipboardAnyTextConverter.cpp | 22 +- .../MSWindowsClipboardAnyTextConverter.h | 14 +- .../MSWindowsClipboardBitmapConverter.cpp | 10 +- .../MSWindowsClipboardBitmapConverter.h | 4 +- .../MSWindowsClipboardHTMLConverter.cpp | 42 +- .../MSWindowsClipboardHTMLConverter.h | 6 +- .../MSWindowsClipboardTextConverter.cpp | 16 +- .../MSWindowsClipboardTextConverter.h | 4 +- .../MSWindowsClipboardUTF16Converter.cpp | 16 +- .../MSWindowsClipboardUTF16Converter.h | 4 +- src/lib/platform/MSWindowsDesks.cpp | 48 +- src/lib/platform/MSWindowsDesks.h | 40 +- .../platform/MSWindowsEventQueueBuffer.cpp | 20 +- src/lib/platform/MSWindowsEventQueueBuffer.h | 6 +- src/lib/platform/MSWindowsKeyState.cpp | 42 +- src/lib/platform/MSWindowsKeyState.h | 20 +- src/lib/platform/MSWindowsScreen.cpp | 118 +-- src/lib/platform/MSWindowsScreen.h | 38 +- src/lib/platform/MSWindowsScreenSaver.cpp | 36 +- src/lib/platform/MSWindowsScreenSaver.h | 6 +- src/lib/platform/MSWindowsUtil.cpp | 10 +- src/lib/platform/MSWindowsUtil.h | 4 +- src/lib/platform/MSWindowsWatchdog.cpp | 12 +- src/lib/platform/MSWindowsWatchdog.h | 24 +- src/lib/platform/OSXClipboard.cpp | 44 +- src/lib/platform/OSXClipboard.h | 14 +- .../OSXClipboardAnyBitmapConverter.cpp | 14 +- .../platform/OSXClipboardAnyBitmapConverter.h | 14 +- .../platform/OSXClipboardAnyTextConverter.cpp | 28 +- .../platform/OSXClipboardAnyTextConverter.h | 18 +- src/lib/platform/OSXClipboardBMPConverter.cpp | 24 +- src/lib/platform/OSXClipboardBMPConverter.h | 14 +- .../platform/OSXClipboardHTMLConverter.cpp | 28 +- src/lib/platform/OSXClipboardHTMLConverter.h | 14 +- .../platform/OSXClipboardTextConverter.cpp | 28 +- src/lib/platform/OSXClipboardTextConverter.h | 14 +- .../platform/OSXClipboardUTF16Converter.cpp | 20 +- src/lib/platform/OSXClipboardUTF16Converter.h | 12 +- src/lib/platform/OSXDragSimulator.m | 4 +- src/lib/platform/OSXDragView.h | 2 +- src/lib/platform/OSXDragView.m | 2 +- src/lib/platform/OSXEventQueueBuffer.cpp | 32 +- src/lib/platform/OSXEventQueueBuffer.h | 12 +- src/lib/platform/OSXKeyState.cpp | 112 +-- src/lib/platform/OSXKeyState.h | 38 +- src/lib/platform/OSXScreen.cpp | 366 +++++----- src/lib/platform/OSXScreen.h | 84 +-- src/lib/platform/OSXScreenSaver.cpp | 28 +- src/lib/platform/OSXScreenSaver.h | 6 +- src/lib/platform/XWindowsClipboard.cpp | 134 ++-- src/lib/platform/XWindowsClipboard.h | 60 +- .../XWindowsClipboardAnyBitmapConverter.cpp | 16 +- .../XWindowsClipboardAnyBitmapConverter.h | 10 +- .../XWindowsClipboardBMPConverter.cpp | 14 +- .../platform/XWindowsClipboardBMPConverter.h | 4 +- .../XWindowsClipboardHTMLConverter.cpp | 12 +- .../platform/XWindowsClipboardHTMLConverter.h | 4 +- .../XWindowsClipboardTextConverter.cpp | 14 +- .../platform/XWindowsClipboardTextConverter.h | 4 +- .../XWindowsClipboardUCS2Converter.cpp | 12 +- .../platform/XWindowsClipboardUCS2Converter.h | 4 +- .../XWindowsClipboardUTF8Converter.cpp | 8 +- .../platform/XWindowsClipboardUTF8Converter.h | 4 +- src/lib/platform/XWindowsEventQueueBuffer.cpp | 30 +- src/lib/platform/XWindowsEventQueueBuffer.h | 12 +- src/lib/platform/XWindowsKeyState.cpp | 22 +- src/lib/platform/XWindowsKeyState.h | 18 +- src/lib/platform/XWindowsScreen.cpp | 78 +- src/lib/platform/XWindowsScreen.h | 26 +- src/lib/platform/XWindowsScreenSaver.cpp | 30 +- src/lib/platform/XWindowsScreenSaver.h | 12 +- src/lib/platform/XWindowsUtil.cpp | 62 +- src/lib/platform/XWindowsUtil.h | 38 +- src/lib/server/BaseClientProxy.cpp | 14 +- src/lib/server/BaseClientProxy.h | 12 +- src/lib/server/ClientListener.cpp | 82 +-- src/lib/server/ClientListener.h | 40 +- src/lib/server/ClientProxy.cpp | 18 +- src/lib/server/ClientProxy.h | 8 +- src/lib/server/ClientProxy1_0.cpp | 174 ++--- src/lib/server/ClientProxy1_0.h | 34 +- src/lib/server/ClientProxy1_1.cpp | 20 +- src/lib/server/ClientProxy1_1.h | 6 +- src/lib/server/ClientProxy1_2.cpp | 12 +- src/lib/server/ClientProxy1_2.h | 6 +- src/lib/server/ClientProxy1_3.cpp | 50 +- src/lib/server/ClientProxy1_3.h | 12 +- src/lib/server/ClientProxy1_4.cpp | 32 +- src/lib/server/ClientProxy1_4.h | 12 +- src/lib/server/ClientProxy1_5.cpp | 42 +- src/lib/server/ClientProxy1_5.h | 10 +- src/lib/server/ClientProxyUnknown.cpp | 100 +-- src/lib/server/ClientProxyUnknown.h | 30 +- src/lib/server/Config.cpp | 674 +++++++++--------- src/lib/server/Config.h | 276 +++---- src/lib/server/InputFilter.cpp | 506 ++++++------- src/lib/server/InputFilter.h | 272 +++---- src/lib/server/PrimaryClient.cpp | 74 +- src/lib/server/PrimaryClient.h | 14 +- src/lib/server/Server.cpp | 632 ++++++++-------- src/lib/server/Server.h | 208 +++--- src/lib/synergy/App.cpp | 48 +- src/lib/synergy/App.h | 40 +- src/lib/synergy/AppUtil.cpp | 14 +- src/lib/synergy/AppUtil.h | 10 +- src/lib/synergy/ArgParser.cpp | 50 +- src/lib/synergy/ArgParser.h | 42 +- src/lib/synergy/ArgsBase.cpp | 4 +- src/lib/synergy/ArgsBase.h | 12 +- src/lib/synergy/ClientApp.cpp | 140 ++-- src/lib/synergy/ClientApp.h | 56 +- src/lib/synergy/ClientArgs.cpp | 2 +- src/lib/synergy/ClientArgs.h | 6 +- src/lib/synergy/ClientTaskBarReceiver.cpp | 28 +- src/lib/synergy/ClientTaskBarReceiver.h | 20 +- src/lib/synergy/Clipboard.cpp | 30 +- src/lib/synergy/Clipboard.h | 16 +- src/lib/synergy/DaemonApp.cpp | 76 +- src/lib/synergy/DaemonApp.h | 24 +- src/lib/synergy/DragInformation.cpp | 28 +- src/lib/synergy/DragInformation.h | 28 +- src/lib/synergy/DropHelper.cpp | 4 +- src/lib/synergy/DropHelper.h | 6 +- src/lib/synergy/FileChunker.cpp | 24 +- src/lib/synergy/FileChunker.h | 10 +- src/lib/synergy/IApp.h | 8 +- src/lib/synergy/IClient.h | 4 +- src/lib/synergy/IClipboard.cpp | 12 +- src/lib/synergy/IClipboard.h | 10 +- src/lib/synergy/IKeyState.cpp | 44 +- src/lib/synergy/IKeyState.h | 18 +- src/lib/synergy/IPlatformScreen.h | 16 +- src/lib/synergy/IPrimaryScreen.cpp | 40 +- src/lib/synergy/IPrimaryScreen.h | 20 +- src/lib/synergy/IScreen.h | 2 +- src/lib/synergy/KeyMap.cpp | 144 ++-- src/lib/synergy/KeyMap.h | 56 +- src/lib/synergy/KeyState.cpp | 104 +-- src/lib/synergy/KeyState.h | 38 +- src/lib/synergy/PacketStreamFilter.cpp | 50 +- src/lib/synergy/PacketStreamFilter.h | 14 +- src/lib/synergy/PlatformScreen.cpp | 34 +- src/lib/synergy/PlatformScreen.h | 18 +- src/lib/synergy/PortableTaskBarReceiver.cpp | 28 +- src/lib/synergy/PortableTaskBarReceiver.h | 20 +- src/lib/synergy/ProtocolUtil.cpp | 28 +- src/lib/synergy/ProtocolUtil.h | 10 +- src/lib/synergy/Screen.cpp | 112 +-- src/lib/synergy/Screen.h | 16 +- src/lib/synergy/ServerApp.cpp | 236 +++--- src/lib/synergy/ServerApp.h | 80 +-- src/lib/synergy/ServerArgs.cpp | 2 +- src/lib/synergy/ServerArgs.h | 12 +- src/lib/synergy/ServerTaskBarReceiver.cpp | 32 +- src/lib/synergy/ServerTaskBarReceiver.h | 24 +- src/lib/synergy/ToolApp.cpp | 2 +- src/lib/synergy/ToolApp.h | 2 +- src/lib/synergy/XScreen.cpp | 6 +- src/lib/synergy/XScreen.h | 2 +- src/lib/synergy/XSynergy.cpp | 18 +- src/lib/synergy/XSynergy.h | 20 +- src/lib/synergy/option_types.h | 2 +- src/lib/synergy/protocol_types.h | 2 +- src/lib/synergy/unix/AppUtilUnix.cpp | 10 +- src/lib/synergy/unix/AppUtilUnix.h | 8 +- src/lib/synergy/win32/AppUtilWindows.cpp | 64 +- src/lib/synergy/win32/AppUtilWindows.h | 12 +- src/lib/synwinhk/synwinhk.cpp | 2 +- src/test/global/TestEventQueue.cpp | 18 +- src/test/global/TestEventQueue.h | 10 +- src/test/integtests/Main.cpp | 6 +- .../integtests/arch/ArchInternetTests.cpp | 4 +- src/test/integtests/ipc/IpcTests.cpp | 112 +-- src/test/integtests/net/NetworkTests.cpp | 192 ++--- .../platform/MSWindowsClipboardTests.cpp | 10 +- .../platform/MSWindowsKeyStateTests.cpp | 16 +- .../integtests/platform/OSXClipboardTests.cpp | 70 +- .../integtests/platform/OSXKeyStateTests.cpp | 30 +- .../integtests/platform/OSXScreenTests.cpp | 12 +- .../platform/XWindowsClipboardTests.cpp | 8 +- .../platform/XWindowsKeyStateTests.cpp | 44 +- .../platform/XWindowsScreenSaverTests.cpp | 2 +- .../platform/XWindowsScreenTests.cpp | 2 +- src/test/mock/client/MockClient.h | 6 +- src/test/mock/io/MockCryptoStream.h | 6 +- src/test/mock/io/MockStream.h | 12 +- src/test/mock/server/MockConfig.h | 8 +- src/test/mock/server/MockInputFilter.h | 4 +- src/test/mock/server/MockPrimaryClient.h | 4 +- src/test/mock/server/MockServer.h | 4 +- src/test/mock/synergy/MockApp.h | 8 +- src/test/mock/synergy/MockArgParser.h | 4 +- src/test/mock/synergy/MockEventQueue.h | 50 +- src/test/mock/synergy/MockKeyMap.h | 6 +- src/test/mock/synergy/MockScreen.h | 6 +- src/test/unittests/Main.cpp | 6 +- src/test/unittests/base/StringTests.cpp | 16 +- .../unittests/client/ServerProxyTests.cpp | 22 +- .../unittests/server/ClientProxyTests.cpp | 16 +- src/test/unittests/synergy/ArgParserTests.cpp | 102 +-- .../synergy/ClientArgsParsingTests.cpp | 24 +- src/test/unittests/synergy/ClipboardTests.cpp | 156 ++-- .../unittests/synergy/CryptoStreamTests.cpp | 74 +- .../synergy/GenericArgsParsingTests.cpp | 112 +-- src/test/unittests/synergy/KeyStateTests.cpp | 248 +++---- src/test/unittests/synergy/KeyStateTests.h | 32 +- .../synergy/ServerArgsParsingTests.cpp | 12 +- 382 files changed, 7430 insertions(+), 7423 deletions(-) diff --git a/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.cpp b/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.cpp index 71554327..72f5e29d 100644 --- a/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.cpp +++ b/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.cpp @@ -43,8 +43,8 @@ const UINT CMSWindowsClientTaskBarReceiver::s_stateToIconID[kMaxState] = }; CMSWindowsClientTaskBarReceiver::CMSWindowsClientTaskBarReceiver( - HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer, IEventQueue* events) : - CClientTaskBarReceiver(events), + HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) : + ClientTaskBarReceiver(events), m_appInstance(appInstance), m_window(NULL), m_logBuffer(logBuffer) @@ -229,8 +229,8 @@ CMSWindowsClientTaskBarReceiver::copyLog() const { if (m_logBuffer != NULL) { // collect log buffer - CString data; - for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin(); + String data; + for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin(); index != m_logBuffer->end(); ++index) { data += *index; data += "\n"; @@ -297,14 +297,14 @@ CMSWindowsClientTaskBarReceiver::createWindow() SetWindowLongPtr(m_window, GWL_EXSTYLE, style); // tell the task bar about this dialog - CArchTaskBarWindows::addDialog(m_window); + ArchTaskBarWindows::addDialog(m_window); } void CMSWindowsClientTaskBarReceiver::destroyWindow() { if (m_window != NULL) { - CArchTaskBarWindows::removeDialog(m_window); + ArchTaskBarWindows::removeDialog(m_window); DestroyWindow(m_window); m_window = NULL; } @@ -359,14 +359,14 @@ CMSWindowsClientTaskBarReceiver::staticDlgProc(HWND hwnd, } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { - CArchMiscWindows::setIcons( - (HICON)LoadImage(CArchMiscWindows::instanceWin32(), + ArchMiscWindows::setIcons( + (HICON)LoadImage(ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY), IMAGE_ICON, 32, 32, LR_SHARED), - (HICON)LoadImage(CArchMiscWindows::instanceWin32(), + (HICON)LoadImage(ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY), IMAGE_ICON, 16, 16, LR_SHARED)); diff --git a/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.h b/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.h index dde942e1..c9631e5d 100644 --- a/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.h +++ b/src/cmd/synergyc/MSWindowsClientTaskBarReceiver.h @@ -23,13 +23,13 @@ #define WIN32_LEAN_AND_MEAN #include -class CBufferedLogOutputter; +class BufferedLogOutputter; class IEventQueue; -//! Implementation of CClientTaskBarReceiver for Microsoft Windows -class CMSWindowsClientTaskBarReceiver : public CClientTaskBarReceiver { +//! Implementation of ClientTaskBarReceiver for Microsoft Windows +class CMSWindowsClientTaskBarReceiver : public ClientTaskBarReceiver { public: - CMSWindowsClientTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*, IEventQueue* events); + CMSWindowsClientTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events); virtual ~CMSWindowsClientTaskBarReceiver(); // IArchTaskBarReceiver overrides @@ -42,7 +42,7 @@ public: protected: void copyLog() const; - // CClientTaskBarReceiver overrides + // ClientTaskBarReceiver overrides virtual void onStatusChanged(); private: @@ -62,7 +62,7 @@ private: HWND m_window; HMENU m_menu; HICON m_icon[kMaxState]; - const CBufferedLogOutputter* m_logBuffer; + const BufferedLogOutputter* m_logBuffer; static const UINT s_stateToIconID[]; }; diff --git a/src/cmd/synergyc/OSXClientTaskBarReceiver.cpp b/src/cmd/synergyc/OSXClientTaskBarReceiver.cpp index cb41d659..14eff4d7 100644 --- a/src/cmd/synergyc/OSXClientTaskBarReceiver.cpp +++ b/src/cmd/synergyc/OSXClientTaskBarReceiver.cpp @@ -20,50 +20,50 @@ #include "arch/Arch.h" // -// COSXClientTaskBarReceiver +// OSXClientTaskBarReceiver // -COSXClientTaskBarReceiver::COSXClientTaskBarReceiver( - const CBufferedLogOutputter*, +OSXClientTaskBarReceiver::OSXClientTaskBarReceiver( + const BufferedLogOutputter*, IEventQueue* events) : - CClientTaskBarReceiver(events) + ClientTaskBarReceiver(events) { // add ourself to the task bar ARCH->addReceiver(this); } -COSXClientTaskBarReceiver::~COSXClientTaskBarReceiver() +OSXClientTaskBarReceiver::~OSXClientTaskBarReceiver() { ARCH->removeReceiver(this); } void -COSXClientTaskBarReceiver::showStatus() +OSXClientTaskBarReceiver::showStatus() { // do nothing } void -COSXClientTaskBarReceiver::runMenu(int, int) +OSXClientTaskBarReceiver::runMenu(int, int) { // do nothing } void -COSXClientTaskBarReceiver::primaryAction() +OSXClientTaskBarReceiver::primaryAction() { // do nothing } const IArchTaskBarReceiver::Icon -COSXClientTaskBarReceiver::getIcon() const +OSXClientTaskBarReceiver::getIcon() const { return NULL; } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { - return new COSXClientTaskBarReceiver(logBuffer, events); + return new OSXClientTaskBarReceiver(logBuffer, events); } diff --git a/src/cmd/synergyc/OSXClientTaskBarReceiver.h b/src/cmd/synergyc/OSXClientTaskBarReceiver.h index efe1996e..df3dcfa0 100644 --- a/src/cmd/synergyc/OSXClientTaskBarReceiver.h +++ b/src/cmd/synergyc/OSXClientTaskBarReceiver.h @@ -20,14 +20,14 @@ #include "synergy/ClientTaskBarReceiver.h" -class CBufferedLogOutputter; +class BufferedLogOutputter; class IEventQueue; -//! Implementation of CClientTaskBarReceiver for OS X -class COSXClientTaskBarReceiver : public CClientTaskBarReceiver { +//! Implementation of ClientTaskBarReceiver for OS X +class OSXClientTaskBarReceiver : public ClientTaskBarReceiver { public: - COSXClientTaskBarReceiver(const CBufferedLogOutputter*, IEventQueue* events); - virtual ~COSXClientTaskBarReceiver(); + OSXClientTaskBarReceiver(const BufferedLogOutputter*, IEventQueue* events); + virtual ~OSXClientTaskBarReceiver(); // IArchTaskBarReceiver overrides virtual void showStatus(); diff --git a/src/cmd/synergyc/XWindowsClientTaskBarReceiver.cpp b/src/cmd/synergyc/XWindowsClientTaskBarReceiver.cpp index 9d28fd34..27122324 100644 --- a/src/cmd/synergyc/XWindowsClientTaskBarReceiver.cpp +++ b/src/cmd/synergyc/XWindowsClientTaskBarReceiver.cpp @@ -24,9 +24,9 @@ // CXWindowsClientTaskBarReceiver::CXWindowsClientTaskBarReceiver( - const CBufferedLogOutputter*, + const BufferedLogOutputter*, IEventQueue* events) : - CClientTaskBarReceiver(events) + ClientTaskBarReceiver(events) { // add ourself to the task bar ARCH->addReceiver(this); @@ -62,7 +62,7 @@ CXWindowsClientTaskBarReceiver::getIcon() const } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { return new CXWindowsClientTaskBarReceiver(logBuffer, events); } diff --git a/src/cmd/synergyc/XWindowsClientTaskBarReceiver.h b/src/cmd/synergyc/XWindowsClientTaskBarReceiver.h index 79e3093b..8b76cf10 100644 --- a/src/cmd/synergyc/XWindowsClientTaskBarReceiver.h +++ b/src/cmd/synergyc/XWindowsClientTaskBarReceiver.h @@ -20,14 +20,14 @@ #include "synergy/ClientTaskBarReceiver.h" -class CBufferedLogOutputter; +class BufferedLogOutputter; class IEventQueue; -//! Implementation of CClientTaskBarReceiver for X Windows -class CXWindowsClientTaskBarReceiver : public CClientTaskBarReceiver { +//! Implementation of ClientTaskBarReceiver for X Windows +class CXWindowsClientTaskBarReceiver : public ClientTaskBarReceiver { public: CXWindowsClientTaskBarReceiver( - const CBufferedLogOutputter*, IEventQueue* events); + const BufferedLogOutputter*, IEventQueue* events); virtual ~CXWindowsClientTaskBarReceiver(); // IArchTaskBarReceiver overrides diff --git a/src/cmd/synergyc/synergyc.cpp b/src/cmd/synergyc/synergyc.cpp index 7b3786a4..55662ae2 100644 --- a/src/cmd/synergyc/synergyc.cpp +++ b/src/cmd/synergyc/synergyc.cpp @@ -36,15 +36,15 @@ main(int argc, char** argv) { #if SYSAPI_WIN32 // record window instance for tray icon, etc - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CLog log; - CEventQueue events; + Log log; + EventQueue events; - CClientApp app(&events, createTaskBarReceiver); + ClientApp app(&events, createTaskBarReceiver); return app.run(argc, argv); } diff --git a/src/cmd/synergyd/synergyd.cpp b/src/cmd/synergyd/synergyd.cpp index 5f17633f..79b98f9e 100644 --- a/src/cmd/synergyd/synergyd.cpp +++ b/src/cmd/synergyd/synergyd.cpp @@ -25,7 +25,7 @@ int main(int argc, char** argv) { - CDaemonApp app; + DaemonApp app; return app.run(argc, argv); } @@ -37,7 +37,7 @@ main(int argc, char** argv) int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { - CDaemonApp app; + DaemonApp app; return app.run(__argc, __argv); } diff --git a/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.cpp b/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.cpp index 66d564de..b71342ca 100644 --- a/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.cpp +++ b/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.cpp @@ -42,8 +42,8 @@ const UINT CMSWindowsPortableTaskBarReceiver::s_stateToIconID[kMaxState] = }; CMSWindowsPortableTaskBarReceiver::CMSWindowsPortableTaskBarReceiver( - HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer, IEventQueue* events) : - CPortableTaskBarReceiver(events), + HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) : + PortableTaskBarReceiver(events), m_events(events), m_appInstance(appInstance), m_window(NULL), @@ -181,17 +181,17 @@ CMSWindowsPortableTaskBarReceiver::runMenu(int x, int y) break; case IDC_RELOAD_CONFIG: - m_events->addEvent(CEvent(m_events->forCServerApp().reloadConfig(), + m_events->addEvent(Event(m_events->forCServerApp().reloadConfig(), m_events->getSystemTarget())); break; case IDC_FORCE_RECONNECT: - m_events->addEvent(CEvent(m_events->forCServerApp().forceReconnect(), + m_events->addEvent(Event(m_events->forCServerApp().forceReconnect(), m_events->getSystemTarget())); break; case ID_SYNERGY_RESETSERVER: - m_events->addEvent(CEvent(m_events->forCServerApp().resetServer(), + m_events->addEvent(Event(m_events->forCServerApp().resetServer(), m_events->getSystemTarget())); break; @@ -246,8 +246,8 @@ CMSWindowsPortableTaskBarReceiver::copyLog() const { if (m_logBuffer != NULL) { // collect log buffer - CString data; - for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin(); + String data; + for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin(); index != m_logBuffer->end(); ++index) { data += *index; data += "\n"; @@ -314,14 +314,14 @@ CMSWindowsPortableTaskBarReceiver::createWindow() SetWindowLongPtr(m_window, GWL_EXSTYLE, style); // tell the task bar about this dialog - CArchTaskBarWindows::addDialog(m_window); + ArchTaskBarWindows::addDialog(m_window); } void CMSWindowsPortableTaskBarReceiver::destroyWindow() { if (m_window != NULL) { - CArchTaskBarWindows::removeDialog(m_window); + ArchTaskBarWindows::removeDialog(m_window); DestroyWindow(m_window); m_window = NULL; } @@ -377,14 +377,14 @@ CMSWindowsPortableTaskBarReceiver::staticDlgProc(HWND hwnd, } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { - CArchMiscWindows::setIcons( - (HICON)LoadImage(CArchMiscWindows::instanceWin32(), + ArchMiscWindows::setIcons( + (HICON)LoadImage(ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY), IMAGE_ICON, 32, 32, LR_SHARED), - (HICON)LoadImage(CArchMiscWindows::instanceWin32(), + (HICON)LoadImage(ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY), IMAGE_ICON, 16, 16, LR_SHARED)); diff --git a/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.h b/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.h index df36d222..a380095a 100644 --- a/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.h +++ b/src/cmd/synergyp/MSWindowsPortableTaskBarReceiver.h @@ -23,13 +23,13 @@ #define WIN32_LEAN_AND_MEAN #include -class CBufferedLogOutputter; +class BufferedLogOutputter; class IEventQueue; -//! Implementation of CPortableTaskBarReceiver for Microsoft Windows -class CMSWindowsPortableTaskBarReceiver : public CPortableTaskBarReceiver { +//! Implementation of PortableTaskBarReceiver for Microsoft Windows +class CMSWindowsPortableTaskBarReceiver : public PortableTaskBarReceiver { public: - CMSWindowsPortableTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*, IEventQueue* events); + CMSWindowsPortableTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events); virtual ~CMSWindowsPortableTaskBarReceiver(); // IArchTaskBarReceiver overrides @@ -42,7 +42,7 @@ public: protected: void copyLog() const; - // CPortableTaskBarReceiver overrides + // PortableTaskBarReceiver overrides virtual void onStatusChanged(); private: @@ -62,7 +62,7 @@ private: HWND m_window; HMENU m_menu; HICON m_icon[kMaxState]; - const CBufferedLogOutputter* m_logBuffer; + const BufferedLogOutputter* m_logBuffer; IEventQueue* m_events; static const UINT s_stateToIconID[]; diff --git a/src/cmd/synergyp/OSXPortableTaskBarReceiver.cpp b/src/cmd/synergyp/OSXPortableTaskBarReceiver.cpp index 6497e0a6..d8a9c063 100644 --- a/src/cmd/synergyp/OSXPortableTaskBarReceiver.cpp +++ b/src/cmd/synergyp/OSXPortableTaskBarReceiver.cpp @@ -20,47 +20,47 @@ #include "arch/Arch.h" // -// COSXServerTaskBarReceiver +// OSXServerTaskBarReceiver // -COSXServerTaskBarReceiver::COSXServerTaskBarReceiver( - const CBufferedLogOutputter*) +OSXServerTaskBarReceiver::OSXServerTaskBarReceiver( + const BufferedLogOutputter*) { // add ourself to the task bar ARCH->addReceiver(this); } -COSXServerTaskBarReceiver::~COSXServerTaskBarReceiver() +OSXServerTaskBarReceiver::~OSXServerTaskBarReceiver() { ARCH->removeReceiver(this); } void -COSXServerTaskBarReceiver::showStatus() +OSXServerTaskBarReceiver::showStatus() { // do nothing } void -COSXServerTaskBarReceiver::runMenu(int, int) +OSXServerTaskBarReceiver::runMenu(int, int) { // do nothing } void -COSXServerTaskBarReceiver::primaryAction() +OSXServerTaskBarReceiver::primaryAction() { // do nothing } const IArchTaskBarReceiver::Icon -COSXServerTaskBarReceiver::getIcon() const +OSXServerTaskBarReceiver::getIcon() const { return NULL; } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer) { - return new COSXServerTaskBarReceiver(logBuffer); + return new OSXServerTaskBarReceiver(logBuffer); } diff --git a/src/cmd/synergyp/OSXPortableTaskBarReceiver.h b/src/cmd/synergyp/OSXPortableTaskBarReceiver.h index ab213a32..8b1dceee 100644 --- a/src/cmd/synergyp/OSXPortableTaskBarReceiver.h +++ b/src/cmd/synergyp/OSXPortableTaskBarReceiver.h @@ -20,13 +20,13 @@ #include "synergyp/PortableTaskBarReceiver.h" -class CBufferedLogOutputter; +class BufferedLogOutputter; -//! Implementation of CPortableTaskBarReceiver for OS X -class COSXServerTaskBarReceiver : public CPortableTaskBarReceiver { +//! Implementation of PortableTaskBarReceiver for OS X +class OSXServerTaskBarReceiver : public PortableTaskBarReceiver { public: - COSXServerTaskBarReceiver(const CBufferedLogOutputter*); - virtual ~COSXServerTaskBarReceiver(); + OSXServerTaskBarReceiver(const BufferedLogOutputter*); + virtual ~OSXServerTaskBarReceiver(); // IArchTaskBarReceiver overrides virtual void showStatus(); diff --git a/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.cpp b/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.cpp index 2d1bfc74..183c4736 100644 --- a/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.cpp +++ b/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.cpp @@ -24,7 +24,7 @@ // CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver( - const CBufferedLogOutputter*) + const BufferedLogOutputter*) { // add ourself to the task bar ARCH->addReceiver(this); @@ -60,7 +60,7 @@ CXWindowsServerTaskBarReceiver::getIcon() const } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer) { return new CXWindowsServerTaskBarReceiver(logBuffer); } diff --git a/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.h b/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.h index 6f32efd6..9cb5a1e0 100644 --- a/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.h +++ b/src/cmd/synergyp/XWindowsPortableTaskBarReceiver.h @@ -20,12 +20,12 @@ #include "synergyp/PortableTaskBarReceiver.h" -class CBufferedLogOutputter; +class BufferedLogOutputter; -//! Implementation of CPortableTaskBarReceiver for X Windows -class CXWindowsServerTaskBarReceiver : public CPortableTaskBarReceiver { +//! Implementation of PortableTaskBarReceiver for X Windows +class CXWindowsServerTaskBarReceiver : public PortableTaskBarReceiver { public: - CXWindowsServerTaskBarReceiver(const CBufferedLogOutputter*); + CXWindowsServerTaskBarReceiver(const BufferedLogOutputter*); virtual ~CXWindowsServerTaskBarReceiver(); // IArchTaskBarReceiver overrides diff --git a/src/cmd/synergyp/synergyp.cpp b/src/cmd/synergyp/synergyp.cpp index ce2ec90d..b4ff15c2 100644 --- a/src/cmd/synergyp/synergyp.cpp +++ b/src/cmd/synergyp/synergyp.cpp @@ -39,16 +39,16 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdSh { #if SYSAPI_WIN32 // record window instance for tray icon, etc - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CLog log; - CEventQueue events; + Log log; + EventQueue events; - CLOG->insert(new CMesssageBoxLogOutputter()); + CLOG->insert(new MesssageBoxLogOutputter()); int argc = __argc; char** argv = __argv; @@ -79,11 +79,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdSh } if (server) { - CServerApp app(&events, createTaskBarReceiver); + ServerApp app(&events, createTaskBarReceiver); return app.run(argc, argv); } else if (client) { - CClientApp app(&events, createTaskBarReceiver); + ClientApp app(&events, createTaskBarReceiver); return app.run(argc, argv); } diff --git a/src/cmd/synergys/MSWindowsServerTaskBarReceiver.cpp b/src/cmd/synergys/MSWindowsServerTaskBarReceiver.cpp index 284393b6..187a4180 100644 --- a/src/cmd/synergys/MSWindowsServerTaskBarReceiver.cpp +++ b/src/cmd/synergys/MSWindowsServerTaskBarReceiver.cpp @@ -43,8 +43,8 @@ const UINT CMSWindowsServerTaskBarReceiver::s_stateToIconID[kMaxState] = }; CMSWindowsServerTaskBarReceiver::CMSWindowsServerTaskBarReceiver( - HINSTANCE appInstance, const CBufferedLogOutputter* logBuffer, IEventQueue* events) : - CServerTaskBarReceiver(events), + HINSTANCE appInstance, const BufferedLogOutputter* logBuffer, IEventQueue* events) : + ServerTaskBarReceiver(events), m_events(events), m_appInstance(appInstance), m_window(NULL), @@ -93,7 +93,7 @@ CMSWindowsServerTaskBarReceiver::showStatus() std::string status = getToolTip(); // get the connect clients, if any - const CClients& clients = getClients(); + const Clients& clients = getClients(); // done getting status unlock(); @@ -103,7 +103,7 @@ CMSWindowsServerTaskBarReceiver::showStatus() SendMessage(child, WM_SETTEXT, 0, (LPARAM)status.c_str()); child = GetDlgItem(m_window, IDC_TASKBAR_STATUS_CLIENTS); SendMessage(child, LB_RESETCONTENT, 0, 0); - for (CClients::const_iterator index = clients.begin(); + for (Clients::const_iterator index = clients.begin(); index != clients.end(); ) { const char* client = index->c_str(); if (++index == clients.end()) { @@ -195,17 +195,17 @@ CMSWindowsServerTaskBarReceiver::runMenu(int x, int y) break; case IDC_RELOAD_CONFIG: - m_events->addEvent(CEvent(m_events->forCServerApp().reloadConfig(), + m_events->addEvent(Event(m_events->forCServerApp().reloadConfig(), m_events->getSystemTarget())); break; case IDC_FORCE_RECONNECT: - m_events->addEvent(CEvent(m_events->forCServerApp().forceReconnect(), + m_events->addEvent(Event(m_events->forCServerApp().forceReconnect(), m_events->getSystemTarget())); break; case ID_SYNERGY_RESETSERVER: - m_events->addEvent(CEvent(m_events->forCServerApp().resetServer(), + m_events->addEvent(Event(m_events->forCServerApp().resetServer(), m_events->getSystemTarget())); break; @@ -260,8 +260,8 @@ CMSWindowsServerTaskBarReceiver::copyLog() const { if (m_logBuffer != NULL) { // collect log buffer - CString data; - for (CBufferedLogOutputter::const_iterator index = m_logBuffer->begin(); + String data; + for (BufferedLogOutputter::const_iterator index = m_logBuffer->begin(); index != m_logBuffer->end(); ++index) { data += *index; data += "\n"; @@ -328,14 +328,14 @@ CMSWindowsServerTaskBarReceiver::createWindow() SetWindowLongPtr(m_window, GWL_EXSTYLE, style); // tell the task bar about this dialog - CArchTaskBarWindows::addDialog(m_window); + ArchTaskBarWindows::addDialog(m_window); } void CMSWindowsServerTaskBarReceiver::destroyWindow() { if (m_window != NULL) { - CArchTaskBarWindows::removeDialog(m_window); + ArchTaskBarWindows::removeDialog(m_window); DestroyWindow(m_window); m_window = NULL; } @@ -391,14 +391,14 @@ CMSWindowsServerTaskBarReceiver::staticDlgProc(HWND hwnd, } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { - CArchMiscWindows::setIcons( - (HICON)LoadImage(CArchMiscWindows::instanceWin32(), + ArchMiscWindows::setIcons( + (HICON)LoadImage(ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY), IMAGE_ICON, 32, 32, LR_SHARED), - (HICON)LoadImage(CArchMiscWindows::instanceWin32(), + (HICON)LoadImage(ArchMiscWindows::instanceWin32(), MAKEINTRESOURCE(IDI_SYNERGY), IMAGE_ICON, 16, 16, LR_SHARED)); diff --git a/src/cmd/synergys/MSWindowsServerTaskBarReceiver.h b/src/cmd/synergys/MSWindowsServerTaskBarReceiver.h index 2b4221eb..32f13177 100644 --- a/src/cmd/synergys/MSWindowsServerTaskBarReceiver.h +++ b/src/cmd/synergys/MSWindowsServerTaskBarReceiver.h @@ -23,13 +23,13 @@ #define WIN32_LEAN_AND_MEAN #include -class CBufferedLogOutputter; +class BufferedLogOutputter; class IEventQueue; -//! Implementation of CServerTaskBarReceiver for Microsoft Windows -class CMSWindowsServerTaskBarReceiver : public CServerTaskBarReceiver { +//! Implementation of ServerTaskBarReceiver for Microsoft Windows +class CMSWindowsServerTaskBarReceiver : public ServerTaskBarReceiver { public: - CMSWindowsServerTaskBarReceiver(HINSTANCE, const CBufferedLogOutputter*, IEventQueue* events); + CMSWindowsServerTaskBarReceiver(HINSTANCE, const BufferedLogOutputter*, IEventQueue* events); virtual ~CMSWindowsServerTaskBarReceiver(); // IArchTaskBarReceiver overrides @@ -42,7 +42,7 @@ public: protected: void copyLog() const; - // CServerTaskBarReceiver overrides + // ServerTaskBarReceiver overrides virtual void onStatusChanged(); private: @@ -62,7 +62,7 @@ private: HWND m_window; HMENU m_menu; HICON m_icon[kMaxState]; - const CBufferedLogOutputter* m_logBuffer; + const BufferedLogOutputter* m_logBuffer; IEventQueue* m_events; static const UINT s_stateToIconID[]; diff --git a/src/cmd/synergys/OSXServerTaskBarReceiver.cpp b/src/cmd/synergys/OSXServerTaskBarReceiver.cpp index 354c0dea..2b991033 100644 --- a/src/cmd/synergys/OSXServerTaskBarReceiver.cpp +++ b/src/cmd/synergys/OSXServerTaskBarReceiver.cpp @@ -20,48 +20,48 @@ #include "arch/Arch.h" // -// COSXServerTaskBarReceiver +// OSXServerTaskBarReceiver // -COSXServerTaskBarReceiver::COSXServerTaskBarReceiver( - const CBufferedLogOutputter*, IEventQueue* events) : - CServerTaskBarReceiver(events) +OSXServerTaskBarReceiver::OSXServerTaskBarReceiver( + const BufferedLogOutputter*, IEventQueue* events) : + ServerTaskBarReceiver(events) { // add ourself to the task bar ARCH->addReceiver(this); } -COSXServerTaskBarReceiver::~COSXServerTaskBarReceiver() +OSXServerTaskBarReceiver::~OSXServerTaskBarReceiver() { ARCH->removeReceiver(this); } void -COSXServerTaskBarReceiver::showStatus() +OSXServerTaskBarReceiver::showStatus() { // do nothing } void -COSXServerTaskBarReceiver::runMenu(int, int) +OSXServerTaskBarReceiver::runMenu(int, int) { // do nothing } void -COSXServerTaskBarReceiver::primaryAction() +OSXServerTaskBarReceiver::primaryAction() { // do nothing } const IArchTaskBarReceiver::Icon -COSXServerTaskBarReceiver::getIcon() const +OSXServerTaskBarReceiver::getIcon() const { return NULL; } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { - return new COSXServerTaskBarReceiver(logBuffer, events); + return new OSXServerTaskBarReceiver(logBuffer, events); } diff --git a/src/cmd/synergys/OSXServerTaskBarReceiver.h b/src/cmd/synergys/OSXServerTaskBarReceiver.h index 9a45fc3b..8f0f4349 100644 --- a/src/cmd/synergys/OSXServerTaskBarReceiver.h +++ b/src/cmd/synergys/OSXServerTaskBarReceiver.h @@ -20,13 +20,13 @@ #include "synergy/ServerTaskBarReceiver.h" -class CBufferedLogOutputter; +class BufferedLogOutputter; -//! Implementation of CServerTaskBarReceiver for OS X -class COSXServerTaskBarReceiver : public CServerTaskBarReceiver { +//! Implementation of ServerTaskBarReceiver for OS X +class OSXServerTaskBarReceiver : public ServerTaskBarReceiver { public: - COSXServerTaskBarReceiver(const CBufferedLogOutputter*, IEventQueue* events); - virtual ~COSXServerTaskBarReceiver(); + OSXServerTaskBarReceiver(const BufferedLogOutputter*, IEventQueue* events); + virtual ~OSXServerTaskBarReceiver(); // IArchTaskBarReceiver overrides virtual void showStatus(); diff --git a/src/cmd/synergys/XWindowsServerTaskBarReceiver.cpp b/src/cmd/synergys/XWindowsServerTaskBarReceiver.cpp index be4f1ce4..37f03e38 100644 --- a/src/cmd/synergys/XWindowsServerTaskBarReceiver.cpp +++ b/src/cmd/synergys/XWindowsServerTaskBarReceiver.cpp @@ -24,8 +24,8 @@ // CXWindowsServerTaskBarReceiver::CXWindowsServerTaskBarReceiver( - const CBufferedLogOutputter*, IEventQueue* events) : - CServerTaskBarReceiver(events) + const BufferedLogOutputter*, IEventQueue* events) : + ServerTaskBarReceiver(events) { // add ourself to the task bar ARCH->addReceiver(this); @@ -61,7 +61,7 @@ CXWindowsServerTaskBarReceiver::getIcon() const } IArchTaskBarReceiver* -createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events) +createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events) { return new CXWindowsServerTaskBarReceiver(logBuffer, events); } diff --git a/src/cmd/synergys/XWindowsServerTaskBarReceiver.h b/src/cmd/synergys/XWindowsServerTaskBarReceiver.h index 9fe8b763..528d5936 100644 --- a/src/cmd/synergys/XWindowsServerTaskBarReceiver.h +++ b/src/cmd/synergys/XWindowsServerTaskBarReceiver.h @@ -20,14 +20,14 @@ #include "synergy/ServerTaskBarReceiver.h" -class CBufferedLogOutputter; +class BufferedLogOutputter; class IEventQueue; -//! Implementation of CServerTaskBarReceiver for X Windows -class CXWindowsServerTaskBarReceiver : public CServerTaskBarReceiver { +//! Implementation of ServerTaskBarReceiver for X Windows +class CXWindowsServerTaskBarReceiver : public ServerTaskBarReceiver { public: CXWindowsServerTaskBarReceiver( - const CBufferedLogOutputter*, IEventQueue* events); + const BufferedLogOutputter*, IEventQueue* events); virtual ~CXWindowsServerTaskBarReceiver(); // IArchTaskBarReceiver overrides diff --git a/src/cmd/synergys/synergys.cpp b/src/cmd/synergys/synergys.cpp index 45844ef5..c6183f86 100644 --- a/src/cmd/synergys/synergys.cpp +++ b/src/cmd/synergys/synergys.cpp @@ -36,15 +36,15 @@ main(int argc, char** argv) { #if SYSAPI_WIN32 // record window instance for tray icon, etc - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CLog log; - CEventQueue events; + Log log; + EventQueue events; - CServerApp app(&events, createTaskBarReceiver); + ServerApp app(&events, createTaskBarReceiver); return app.run(argc, argv); } diff --git a/src/cmd/syntool/syntool.cpp b/src/cmd/syntool/syntool.cpp index 57bedd05..b81c9eaf 100644 --- a/src/cmd/syntool/syntool.cpp +++ b/src/cmd/syntool/syntool.cpp @@ -23,12 +23,12 @@ main(int argc, char** argv) { #if SYSAPI_WIN32 // record window instance for tray icon, etc - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CToolApp app; + ToolApp app; return app.run(argc, argv); } diff --git a/src/lib/arch/Arch.cpp b/src/lib/arch/Arch.cpp index 5e672747..3c17a378 100644 --- a/src/lib/arch/Arch.cpp +++ b/src/lib/arch/Arch.cpp @@ -19,36 +19,36 @@ #include "arch/Arch.h" // -// CArch +// Arch // -CArch* CArch::s_instance = NULL; +Arch* Arch::s_instance = NULL; -CArch::CArch() +Arch::Arch() { assert(s_instance == NULL); s_instance = this; } -CArch::~CArch() +Arch::~Arch() { #if SYSAPI_WIN32 - CArchMiscWindows::cleanup(); + ArchMiscWindows::cleanup(); #endif } void -CArch::init() +Arch::init() { ARCH_NETWORK::init(); #if SYSAPI_WIN32 ARCH_TASKBAR::init(); - CArchMiscWindows::init(); + ArchMiscWindows::init(); #endif } -CArch* -CArch::getInstance() +Arch* +Arch::getInstance() { assert(s_instance != NULL); return s_instance; diff --git a/src/lib/arch/Arch.h b/src/lib/arch/Arch.h index b43eff1d..1fc04cf6 100644 --- a/src/lib/arch/Arch.h +++ b/src/lib/arch/Arch.h @@ -72,9 +72,9 @@ /*! \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 /*! @@ -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, typically at the beginning of \c main(). */ -class CArch : public ARCH_CONSOLE, +class Arch : public ARCH_CONSOLE, public ARCH_DAEMON, public ARCH_FILE, public ARCH_LOG, @@ -98,8 +98,8 @@ class CArch : public ARCH_CONSOLE, public ARCH_TASKBAR, public ARCH_TIME { public: - CArch(); - virtual ~CArch(); + Arch(); + virtual ~Arch(); //! Call init on other arch classes. /*! @@ -114,32 +114,32 @@ public: //! 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. */ - static CArch* getInstance(); + static Arch* getInstance(); ARCH_PLUGIN& plugin() const { return (ARCH_PLUGIN&)m_plugin; } ARCH_INTERNET& internet() const { return (ARCH_INTERNET&)m_internet; } private: - static CArch* s_instance; + static Arch* s_instance; ARCH_PLUGIN m_plugin; ARCH_INTERNET m_internet; }; //! Convenience object to lock/unlock an arch mutex -class CArchMutexLock { +class ArchMutexLock { public: - CArchMutexLock(CArchMutex mutex) : m_mutex(mutex) + ArchMutexLock(ArchMutex mutex) : m_mutex(mutex) { ARCH->lockMutex(m_mutex); } - ~CArchMutexLock() + ~ArchMutexLock() { ARCH->unlockMutex(m_mutex); } private: - CArchMutex m_mutex; + ArchMutex m_mutex; }; diff --git a/src/lib/arch/ArchConsoleStd.cpp b/src/lib/arch/ArchConsoleStd.cpp index 4e88a117..bd3f7beb 100644 --- a/src/lib/arch/ArchConsoleStd.cpp +++ b/src/lib/arch/ArchConsoleStd.cpp @@ -22,7 +22,7 @@ #include void -CArchConsoleStd::writeConsole(ELevel level, const char* str) +ArchConsoleStd::writeConsole(ELevel level, const char* str) { if ((level >= kFATAL) && (level <= kWARNING)) std::cerr << str << std::endl; diff --git a/src/lib/arch/ArchConsoleStd.h b/src/lib/arch/ArchConsoleStd.h index ac9e28b8..90343881 100644 --- a/src/lib/arch/ArchConsoleStd.h +++ b/src/lib/arch/ArchConsoleStd.h @@ -21,10 +21,10 @@ #include "arch/IArchConsole.h" //! Cross platform implementation of IArchConsole -class CArchConsoleStd : public IArchConsole { +class ArchConsoleStd : public IArchConsole { public: - CArchConsoleStd() { } - virtual ~CArchConsoleStd() { } + ArchConsoleStd() { } + virtual ~ArchConsoleStd() { } // IArchConsole overrides virtual void openConsole(const char* title) { } diff --git a/src/lib/arch/ArchDaemonNone.cpp b/src/lib/arch/ArchDaemonNone.cpp index 47e589a3..914fc557 100644 --- a/src/lib/arch/ArchDaemonNone.cpp +++ b/src/lib/arch/ArchDaemonNone.cpp @@ -19,21 +19,21 @@ #include "arch/ArchDaemonNone.h" // -// CArchDaemonNone +// ArchDaemonNone // -CArchDaemonNone::CArchDaemonNone() +ArchDaemonNone::ArchDaemonNone() { // do nothing } -CArchDaemonNone::~CArchDaemonNone() +ArchDaemonNone::~ArchDaemonNone() { // do nothing } void -CArchDaemonNone::installDaemon(const char*, +ArchDaemonNone::installDaemon(const char*, const char*, const char*, const char*, @@ -43,13 +43,13 @@ CArchDaemonNone::installDaemon(const char*, } void -CArchDaemonNone::uninstallDaemon(const char*) +ArchDaemonNone::uninstallDaemon(const char*) { // do nothing } 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 // do any daemonizing. @@ -57,29 +57,29 @@ CArchDaemonNone::daemonize(const char* name, DaemonFunc func) } bool -CArchDaemonNone::canInstallDaemon(const char*) +ArchDaemonNone::canInstallDaemon(const char*) { return false; } bool -CArchDaemonNone::isDaemonInstalled(const char*) +ArchDaemonNone::isDaemonInstalled(const char*) { return false; } void -CArchDaemonNone::installDaemon() +ArchDaemonNone::installDaemon() { } void -CArchDaemonNone::uninstallDaemon() +ArchDaemonNone::uninstallDaemon() { } std::string -CArchDaemonNone::commandLine() const +ArchDaemonNone::commandLine() const { return ""; } diff --git a/src/lib/arch/ArchDaemonNone.h b/src/lib/arch/ArchDaemonNone.h index 765b15b6..af7dbd5a 100644 --- a/src/lib/arch/ArchDaemonNone.h +++ b/src/lib/arch/ArchDaemonNone.h @@ -20,7 +20,7 @@ #include "arch/IArchDaemon.h" -#define ARCH_DAEMON CArchDaemonNone +#define ARCH_DAEMON ArchDaemonNone //! 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 function and returns its result. */ -class CArchDaemonNone : public IArchDaemon { +class ArchDaemonNone : public IArchDaemon { public: - CArchDaemonNone(); - virtual ~CArchDaemonNone(); + ArchDaemonNone(); + virtual ~ArchDaemonNone(); // IArchDaemon overrides virtual void installDaemon(const char* name, diff --git a/src/lib/arch/IArchDaemon.h b/src/lib/arch/IArchDaemon.h index 1d63cbf5..0d02c614 100644 --- a/src/lib/arch/IArchDaemon.h +++ b/src/lib/arch/IArchDaemon.h @@ -86,16 +86,16 @@ public: Becomes a service. Argument 0 is the name of the service and the rest are the arguments passed to StartService(). \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() - 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 - \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() 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() returns. \c func or \c runFunc can call - \c CArchMiscWindows::daemonFailed() to indicate startup failure. + \c ArchMiscWindows::daemonFailed() to indicate startup failure. */ virtual int daemonize(const char* name, DaemonFunc func) = 0; diff --git a/src/lib/arch/IArchMultithread.h b/src/lib/arch/IArchMultithread.h index 31c56179..77145798 100644 --- a/src/lib/arch/IArchMultithread.h +++ b/src/lib/arch/IArchMultithread.h @@ -21,47 +21,47 @@ #include "common/IInterface.h" /*! -\class CArchCondImpl +\class ArchCondImpl \brief Internal condition variable data. An architecture dependent type holding the necessary data for a condition variable. */ -class CArchCondImpl; +class ArchCondImpl; /*! -\var CArchCond +\var ArchCond \brief Opaque condition variable type. An opaque type representing a condition variable. */ -typedef CArchCondImpl* CArchCond; +typedef ArchCondImpl* ArchCond; /*! -\class CArchMutexImpl +\class ArchMutexImpl \brief Internal mutex data. An architecture dependent type holding the necessary data for a mutex. */ -class CArchMutexImpl; +class ArchMutexImpl; /*! -\var CArchMutex +\var ArchMutex \brief Opaque mutex type. An opaque type representing a mutex. */ -typedef CArchMutexImpl* CArchMutex; +typedef ArchMutexImpl* ArchMutex; /*! -\class CArchThreadImpl +\class ArchThreadImpl \brief Internal thread data. An architecture dependent type holding the necessary data for a thread. */ -class CArchThreadImpl; +class ArchThreadImpl; /*! -\var CArchThread +\var ArchThread \brief Opaque thread type. An opaque type representing a thread. */ -typedef CArchThreadImpl* CArchThread; +typedef ArchThreadImpl* ArchThread; //! Interface for architecture dependent multithreading /*! @@ -100,22 +100,22 @@ public: /*! The condition variable is an opaque data type. */ - virtual CArchCond newCondVar() = 0; + virtual ArchCond newCondVar() = 0; //! Destroy a condition variable - virtual void closeCondVar(CArchCond) = 0; + virtual void closeCondVar(ArchCond) = 0; //! Signal a condition variable /*! Signalling a condition variable releases one waiting thread. */ - virtual void signalCondVar(CArchCond) = 0; + virtual void signalCondVar(ArchCond) = 0; //! Broadcast a condition variable /*! Broadcasting a condition variable releases all waiting threads. */ - virtual void broadcastCondVar(CArchCond) = 0; + virtual void broadcastCondVar(ArchCond) = 0; //! Wait on a condition variable /*! @@ -128,7 +128,7 @@ public: (Cancellation point) */ - virtual bool waitCondVar(CArchCond, CArchMutex, double timeout) = 0; + virtual bool waitCondVar(ArchCond, ArchMutex, double timeout) = 0; // // mutex methods @@ -140,16 +140,16 @@ public: when it already holds a lock on that mutex. The mutex is an opaque data type. */ - virtual CArchMutex newMutex() = 0; + virtual ArchMutex newMutex() = 0; //! Destroy a mutex - virtual void closeMutex(CArchMutex) = 0; + virtual void closeMutex(ArchMutex) = 0; //! Lock a mutex - virtual void lockMutex(CArchMutex) = 0; + virtual void lockMutex(ArchMutex) = 0; //! Unlock a mutex - virtual void unlockMutex(CArchMutex) = 0; + virtual void unlockMutex(ArchMutex) = 0; // // thread methods @@ -160,19 +160,19 @@ public: 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. */ - virtual CArchThread newThread(ThreadFunc func, void* userData) = 0; + virtual ArchThread newThread(ThreadFunc func, void* userData) = 0; //! Get a reference to the calling thread /*! Returns a thread representing the current (i.e. calling) thread. */ - virtual CArchThread newCurrentThread() = 0; + virtual ArchThread newCurrentThread() = 0; //! Copy a thread object /*! 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 /*! @@ -181,7 +181,7 @@ public: Use cancelThread() and waitThread() to stop a thread and wait for it to exit. */ - virtual void closeThread(CArchThread) = 0; + virtual void closeThread(ArchThread) = 0; //! Force a thread to exit /*! @@ -191,7 +191,7 @@ public: must always let cancellation go to completion but may take as long as necessary to clean up. */ - virtual void cancelThread(CArchThread thread) = 0; + virtual void cancelThread(ArchThread thread) = 0; //! Change thread priority /*! @@ -199,7 +199,7 @@ public: the thread has a lower priority and if negative a higher priority. 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 /*! @@ -220,20 +220,20 @@ public: (Cancellation point) */ - virtual bool wait(CArchThread thread, double timeout) = 0; + virtual bool wait(ArchThread thread, double timeout) = 0; //! Compare threads /*! Returns true iff two thread objects refer to the same thread. Note that comparing thread objects directly is meaningless. */ - virtual bool isSameThread(CArchThread, CArchThread) = 0; + virtual bool isSameThread(ArchThread, ArchThread) = 0; //! Test if thread 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 /*! @@ -242,7 +242,7 @@ public: (Cancellation point) */ - virtual void* getResultOfThread(CArchThread thread) = 0; + virtual void* getResultOfThread(ArchThread thread) = 0; //! Returns an ID for a thread /*! @@ -251,7 +251,7 @@ public: However, clients should us isSameThread() to compare thread objects instead of comparing IDs. */ - virtual ThreadID getIDOfThread(CArchThread thread) = 0; + virtual ThreadID getIDOfThread(ArchThread thread) = 0; //! Set the interrupt handler /*! diff --git a/src/lib/arch/IArchNetwork.h b/src/lib/arch/IArchNetwork.h index 98056fb4..f353a785 100644 --- a/src/lib/arch/IArchNetwork.h +++ b/src/lib/arch/IArchNetwork.h @@ -21,37 +21,37 @@ #include "common/IInterface.h" #include "common/stdstring.h" -class CArchThreadImpl; -typedef CArchThreadImpl* CArchThread; +class ArchThreadImpl; +typedef ArchThreadImpl* ArchThread; /*! -\class CArchSocketImpl +\class ArchSocketImpl \brief Internal socket data. An architecture dependent type holding the necessary data for a socket. */ -class CArchSocketImpl; +class ArchSocketImpl; /*! -\var CArchSocket +\var ArchSocket \brief Opaque socket type. An opaque type representing a socket. */ -typedef CArchSocketImpl* CArchSocket; +typedef ArchSocketImpl* ArchSocket; /*! -\class CArchNetAddressImpl +\class ArchNetAddressImpl \brief Internal network address data. An architecture dependent type holding the necessary data for a network address. */ -class CArchNetAddressImpl; +class ArchNetAddressImpl; /*! -\var CArchNetAddress +\var ArchNetAddress \brief Opaque network address type. An opaque type representing a network address. */ -typedef CArchNetAddressImpl* CArchNetAddress; +typedef ArchNetAddressImpl* ArchNetAddress; //! Interface for architecture dependent networking /*! @@ -85,10 +85,10 @@ public: }; //! A socket query for \c poll() - class CPollEntry { + class PollEntry { public: //! The socket to query - CArchSocket m_socket; + ArchSocket m_socket; //! The events to query for /*! @@ -108,13 +108,13 @@ public: /*! The socket is an opaque data type. */ - virtual CArchSocket newSocket(EAddressFamily, ESocketType) = 0; + virtual ArchSocket newSocket(EAddressFamily, ESocketType) = 0; //! Copy a socket object /*! 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 /*! @@ -122,31 +122,31 @@ public: the object referred to until there are no remaining references for the socket. */ - virtual void closeSocket(CArchSocket s) = 0; + virtual void closeSocket(ArchSocket s) = 0; //! Close socket for further reads /*! 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 /*! 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 /*! 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 /*! 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 /*! @@ -158,7 +158,7 @@ public: it's not in the listening state and it's connected. Returns NULL 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 /*! @@ -169,7 +169,7 @@ public: socket for writing to detect when the connection finally succeeds or fails. */ - virtual bool connectSocket(CArchSocket s, CArchNetAddress addr) = 0; + virtual bool connectSocket(ArchSocket s, ArchNetAddress addr) = 0; //! Check socket state /*! @@ -186,7 +186,7 @@ public: (Cancellation point) */ - virtual int pollSocket(CPollEntry[], int num, double timeout) = 0; + virtual int pollSocket(PollEntry[], int num, double timeout) = 0; //! Unblock thread in pollSocket() /*! @@ -194,7 +194,7 @@ public: call may return before the thread is unblocked. If the thread is 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 /*! @@ -203,7 +203,7 @@ public: if not enough data is available. Returns 0 if the remote end has 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 /*! @@ -212,7 +212,7 @@ public: \c len if the remote end disconnected or the internal buffers fill up. */ - virtual size_t writeSocket(CArchSocket s, + virtual size_t writeSocket(ArchSocket s, const void* buf, size_t len) = 0; //! Check error on socket @@ -220,61 +220,61 @@ public: If the socket \c s is in an error state then throws an appropriate XArchNetwork exception. */ - virtual void throwErrorOnSocket(CArchSocket s) = 0; + virtual void throwErrorOnSocket(ArchSocket s) = 0; //! Turn Nagle algorithm on or off on socket /*! Set socket to send messages immediately (true) or to collect small 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 /*! Allows the address this socket is bound to to be reused while in the 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 virtual std::string getHostName() = 0; //! Create an "any" network address - virtual CArchNetAddress newAnyAddr(EAddressFamily) = 0; + virtual ArchNetAddress newAnyAddr(EAddressFamily) = 0; //! Copy a network address - virtual CArchNetAddress copyAddr(CArchNetAddress) = 0; + virtual ArchNetAddress copyAddr(ArchNetAddress) = 0; //! 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 - virtual void closeAddr(CArchNetAddress) = 0; + virtual void closeAddr(ArchNetAddress) = 0; //! 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 - virtual std::string addrToString(CArchNetAddress) = 0; + virtual std::string addrToString(ArchNetAddress) = 0; //! Get an address's family - virtual EAddressFamily getAddrFamily(CArchNetAddress) = 0; + virtual EAddressFamily getAddrFamily(ArchNetAddress) = 0; //! 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 - virtual int getAddrPort(CArchNetAddress) = 0; + virtual int getAddrPort(ArchNetAddress) = 0; //! Test addresses for equality - virtual bool isEqualAddr(CArchNetAddress, CArchNetAddress) = 0; + virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress) = 0; //! Test for the "any" address /*! Returns true if \c addr is the "any" address. \c newAnyAddr() returns an "any" address. */ - virtual bool isAnyAddr(CArchNetAddress addr) = 0; + virtual bool isAnyAddr(ArchNetAddress addr) = 0; //@} diff --git a/src/lib/arch/IArchString.cpp b/src/lib/arch/IArchString.cpp index a31dad63..18a86c3e 100644 --- a/src/lib/arch/IArchString.cpp +++ b/src/lib/arch/IArchString.cpp @@ -24,7 +24,7 @@ #include #include -static CArchMutex s_mutex = NULL; +static ArchMutex s_mutex = NULL; // // use C library non-reentrant multibyte conversion with mutex diff --git a/src/lib/arch/IArchTaskBarReceiver.h b/src/lib/arch/IArchTaskBarReceiver.h index 0ce1a946..ac035a35 100644 --- a/src/lib/arch/IArchTaskBarReceiver.h +++ b/src/lib/arch/IArchTaskBarReceiver.h @@ -90,7 +90,7 @@ public: */ 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() {} diff --git a/src/lib/arch/unix/ArchConsoleUnix.cpp b/src/lib/arch/unix/ArchConsoleUnix.cpp index c1a26c8b..d89c4b5b 100644 --- a/src/lib/arch/unix/ArchConsoleUnix.cpp +++ b/src/lib/arch/unix/ArchConsoleUnix.cpp @@ -18,6 +18,6 @@ #include "arch/unix/ArchConsoleUnix.h" -CArchConsoleUnix::CArchConsoleUnix() { } +ArchConsoleUnix::ArchConsoleUnix() { } -CArchConsoleUnix::~CArchConsoleUnix() { } +ArchConsoleUnix::~ArchConsoleUnix() { } diff --git a/src/lib/arch/unix/ArchConsoleUnix.h b/src/lib/arch/unix/ArchConsoleUnix.h index 50470ae2..3450a517 100644 --- a/src/lib/arch/unix/ArchConsoleUnix.h +++ b/src/lib/arch/unix/ArchConsoleUnix.h @@ -20,10 +20,10 @@ #include "arch/ArchConsoleStd.h" -#define ARCH_CONSOLE CArchConsoleUnix +#define ARCH_CONSOLE ArchConsoleUnix -class CArchConsoleUnix : public CArchConsoleStd { +class ArchConsoleUnix : public ArchConsoleStd { public: - CArchConsoleUnix(); - virtual ~CArchConsoleUnix(); + ArchConsoleUnix(); + virtual ~ArchConsoleUnix(); }; diff --git a/src/lib/arch/unix/ArchDaemonUnix.cpp b/src/lib/arch/unix/ArchDaemonUnix.cpp index f6418947..40cbde90 100644 --- a/src/lib/arch/unix/ArchDaemonUnix.cpp +++ b/src/lib/arch/unix/ArchDaemonUnix.cpp @@ -29,15 +29,15 @@ #include // -// CArchDaemonUnix +// ArchDaemonUnix // -CArchDaemonUnix::CArchDaemonUnix() +ArchDaemonUnix::ArchDaemonUnix() { // do nothing } -CArchDaemonUnix::~CArchDaemonUnix() +ArchDaemonUnix::~ArchDaemonUnix() { // do nothing } @@ -67,7 +67,7 @@ bool alreadyDaemonized() { #endif int -CArchDaemonUnix::daemonize(const char* name, DaemonFunc func) +ArchDaemonUnix::daemonize(const char* name, DaemonFunc func) { #ifdef __APPLE__ if (alreadyDaemonized()) diff --git a/src/lib/arch/unix/ArchDaemonUnix.h b/src/lib/arch/unix/ArchDaemonUnix.h index 381b658e..c817397f 100644 --- a/src/lib/arch/unix/ArchDaemonUnix.h +++ b/src/lib/arch/unix/ArchDaemonUnix.h @@ -21,13 +21,13 @@ #include "arch/ArchDaemonNone.h" #undef ARCH_DAEMON -#define ARCH_DAEMON CArchDaemonUnix +#define ARCH_DAEMON ArchDaemonUnix //! Unix implementation of IArchDaemon -class CArchDaemonUnix : public CArchDaemonNone { +class ArchDaemonUnix : public ArchDaemonNone { public: - CArchDaemonUnix(); - virtual ~CArchDaemonUnix(); + ArchDaemonUnix(); + virtual ~ArchDaemonUnix(); // IArchDaemon overrides virtual int daemonize(const char* name, DaemonFunc func); diff --git a/src/lib/arch/unix/ArchFileUnix.cpp b/src/lib/arch/unix/ArchFileUnix.cpp index 7b2117c2..d0688216 100644 --- a/src/lib/arch/unix/ArchFileUnix.cpp +++ b/src/lib/arch/unix/ArchFileUnix.cpp @@ -25,21 +25,21 @@ #include // -// CArchFileUnix +// ArchFileUnix // -CArchFileUnix::CArchFileUnix() +ArchFileUnix::ArchFileUnix() { // do nothing } -CArchFileUnix::~CArchFileUnix() +ArchFileUnix::~ArchFileUnix() { // do nothing } const char* -CArchFileUnix::getBasename(const char* pathname) +ArchFileUnix::getBasename(const char* pathname) { if (pathname == NULL) { return NULL; @@ -55,7 +55,7 @@ CArchFileUnix::getBasename(const char* pathname) } std::string -CArchFileUnix::getUserDirectory() +ArchFileUnix::getUserDirectory() { char* buffer = NULL; std::string dir; @@ -83,13 +83,12 @@ CArchFileUnix::getUserDirectory() } std::string -CArchFileUnix::getSystemDirectory() +ArchFileUnix::getSystemDirectory() { return "/etc"; } -std::string -CArchFileUnix::getInstalledDirectory() +ArchFileUnix::getInstalledDirectory() { #if WINAPI_XWINDOWS return "/bin"; @@ -99,13 +98,13 @@ CArchFileUnix::getInstalledDirectory() } std::string -CArchFileUnix::getLogDirectory() +ArchFileUnix::getLogDirectory() { return "/var/log"; } std::string -CArchFileUnix::concatPath(const std::string& prefix, +ArchFileUnix::concatPath(const std::string& prefix, const std::string& suffix) { std::string path; diff --git a/src/lib/arch/unix/ArchFileUnix.h b/src/lib/arch/unix/ArchFileUnix.h index 92d08f31..5ee9e22e 100644 --- a/src/lib/arch/unix/ArchFileUnix.h +++ b/src/lib/arch/unix/ArchFileUnix.h @@ -20,13 +20,13 @@ #include "arch/IArchFile.h" -#define ARCH_FILE CArchFileUnix +#define ARCH_FILE ArchFileUnix //! Unix implementation of IArchFile -class CArchFileUnix : public IArchFile { +class ArchFileUnix : public IArchFile { public: - CArchFileUnix(); - virtual ~CArchFileUnix(); + ArchFileUnix(); + virtual ~ArchFileUnix(); // IArchFile overrides virtual const char* getBasename(const char* pathname); diff --git a/src/lib/arch/unix/ArchInternetUnix.cpp b/src/lib/arch/unix/ArchInternetUnix.cpp index 6f832f53..1a142970 100644 --- a/src/lib/arch/unix/ArchInternetUnix.cpp +++ b/src/lib/arch/unix/ArchInternetUnix.cpp @@ -28,26 +28,26 @@ class CurlFacade { public: CurlFacade(); ~CurlFacade(); - CString get(const CString& url); - CString urlEncode(const CString& url); + String get(const String& url); + String urlEncode(const String& url); private: CURL* m_curl; }; // -// CArchInternetUnix +// ArchInternetUnix // -CString -CArchInternetUnix::get(const CString& url) +String +ArchInternetUnix::get(const String& url) { CurlFacade curl; return curl.get(url); } -CString -CArchInternetUnix::urlEncode(const CString& url) +String +ArchInternetUnix::urlEncode(const String& url) { CurlFacade curl; return curl.urlEncode(url); @@ -87,8 +87,8 @@ CurlFacade::~CurlFacade() curl_global_cleanup(); } -CString -CurlFacade::get(const CString& url) +String +CurlFacade::get(const String& url) { curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, curlWriteCallback); @@ -110,8 +110,8 @@ CurlFacade::get(const CString& url) return result; } -CString -CurlFacade::urlEncode(const CString& url) +String +CurlFacade::urlEncode(const String& url) { char* resultCStr = curl_easy_escape(m_curl, url.c_str(), 0); diff --git a/src/lib/arch/unix/ArchInternetUnix.h b/src/lib/arch/unix/ArchInternetUnix.h index 2e70a500..fa7fa43a 100644 --- a/src/lib/arch/unix/ArchInternetUnix.h +++ b/src/lib/arch/unix/ArchInternetUnix.h @@ -17,12 +17,12 @@ #pragma once -#define ARCH_INTERNET CArchInternetUnix +#define ARCH_INTERNET ArchInternetUnix #include "base/String.h" -class CArchInternetUnix { +class ArchInternetUnix { public: - CString get(const CString& url); - CString urlEncode(const CString& url); + String get(const String& url); + String urlEncode(const String& url); }; diff --git a/src/lib/arch/unix/ArchLogUnix.cpp b/src/lib/arch/unix/ArchLogUnix.cpp index 3d376f5a..6c8e4623 100644 --- a/src/lib/arch/unix/ArchLogUnix.cpp +++ b/src/lib/arch/unix/ArchLogUnix.cpp @@ -21,39 +21,39 @@ #include // -// CArchLogUnix +// ArchLogUnix // -CArchLogUnix::CArchLogUnix() +ArchLogUnix::ArchLogUnix() { // do nothing } -CArchLogUnix::~CArchLogUnix() +ArchLogUnix::~ArchLogUnix() { // do nothing } void -CArchLogUnix::openLog(const char* name) +ArchLogUnix::openLog(const char* name) { openlog(name, 0, LOG_DAEMON); } void -CArchLogUnix::closeLog() +ArchLogUnix::closeLog() { closelog(); } void -CArchLogUnix::showLog(bool) +ArchLogUnix::showLog(bool) { // do nothing } void -CArchLogUnix::writeLog(ELevel level, const char* msg) +ArchLogUnix::writeLog(ELevel level, const char* msg) { // convert level int priority; diff --git a/src/lib/arch/unix/ArchLogUnix.h b/src/lib/arch/unix/ArchLogUnix.h index 7d13edd4..4376f09e 100644 --- a/src/lib/arch/unix/ArchLogUnix.h +++ b/src/lib/arch/unix/ArchLogUnix.h @@ -20,13 +20,13 @@ #include "arch/IArchLog.h" -#define ARCH_LOG CArchLogUnix +#define ARCH_LOG ArchLogUnix //! Unix implementation of IArchLog -class CArchLogUnix : public IArchLog { +class ArchLogUnix : public IArchLog { public: - CArchLogUnix(); - virtual ~CArchLogUnix(); + ArchLogUnix(); + virtual ~ArchLogUnix(); // IArchLog overrides virtual void openLog(const char* name); diff --git a/src/lib/arch/unix/ArchMultithreadPosix.cpp b/src/lib/arch/unix/ArchMultithreadPosix.cpp index b3683c9c..6b492238 100644 --- a/src/lib/arch/unix/ArchMultithreadPosix.cpp +++ b/src/lib/arch/unix/ArchMultithreadPosix.cpp @@ -59,12 +59,12 @@ setSignalSet(sigset_t* sigset) } // -// CArchThreadImpl +// ArchThreadImpl // -class CArchThreadImpl { +class ArchThreadImpl { public: - CArchThreadImpl(); + ArchThreadImpl(); public: int m_refCount; @@ -79,7 +79,7 @@ public: void* m_networkData; }; -CArchThreadImpl::CArchThreadImpl() : +ArchThreadImpl::ArchThreadImpl() : m_refCount(1), m_id(0), 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_nextID(0) { @@ -119,7 +119,7 @@ CArchMultithreadPosix::CArchMultithreadPosix() : // create thread for calling (main) thread and add it to our // 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(); insert(m_mainThread); @@ -149,7 +149,7 @@ CArchMultithreadPosix::CArchMultithreadPosix() : pthread_sigmask(SIG_BLOCK, &sigset, NULL); } -CArchMultithreadPosix::~CArchMultithreadPosix() +ArchMultithreadPosix::~ArchMultithreadPosix() { assert(s_instance != NULL); @@ -158,16 +158,16 @@ CArchMultithreadPosix::~CArchMultithreadPosix() } void -CArchMultithreadPosix::setNetworkDataForCurrentThread(void* data) +ArchMultithreadPosix::setNetworkDataForCurrentThread(void* data) { lockMutex(m_threadMutex); - CArchThreadImpl* thread = find(pthread_self()); + ArchThreadImpl* thread = find(pthread_self()); thread->m_networkData = data; unlockMutex(m_threadMutex); } void* -CArchMultithreadPosix::getNetworkDataForThread(CArchThread thread) +ArchMultithreadPosix::getNetworkDataForThread(ArchThread thread) { lockMutex(m_threadMutex); void* data = thread->m_networkData; @@ -175,16 +175,16 @@ CArchMultithreadPosix::getNetworkDataForThread(CArchThread thread) return data; } -CArchMultithreadPosix* -CArchMultithreadPosix::getInstance() +ArchMultithreadPosix* +ArchMultithreadPosix::getInstance() { return s_instance; } -CArchCond -CArchMultithreadPosix::newCondVar() +ArchCond +ArchMultithreadPosix::newCondVar() { - CArchCondImpl* cond = new CArchCondImpl; + ArchCondImpl* cond = new ArchCondImpl; int status = pthread_cond_init(&cond->m_cond, NULL); (void)status; assert(status == 0); @@ -192,7 +192,7 @@ CArchMultithreadPosix::newCondVar() } void -CArchMultithreadPosix::closeCondVar(CArchCond cond) +ArchMultithreadPosix::closeCondVar(ArchCond cond) { int status = pthread_cond_destroy(&cond->m_cond); (void)status; @@ -201,7 +201,7 @@ CArchMultithreadPosix::closeCondVar(CArchCond cond) } void -CArchMultithreadPosix::signalCondVar(CArchCond cond) +ArchMultithreadPosix::signalCondVar(ArchCond cond) { int status = pthread_cond_signal(&cond->m_cond); (void)status; @@ -209,7 +209,7 @@ CArchMultithreadPosix::signalCondVar(CArchCond cond) } void -CArchMultithreadPosix::broadcastCondVar(CArchCond cond) +ArchMultithreadPosix::broadcastCondVar(ArchCond cond) { int status = pthread_cond_broadcast(&cond->m_cond); (void)status; @@ -217,8 +217,8 @@ CArchMultithreadPosix::broadcastCondVar(CArchCond cond) } bool -CArchMultithreadPosix::waitCondVar(CArchCond cond, - CArchMutex mutex, double timeout) +ArchMultithreadPosix::waitCondVar(ArchCond cond, + ArchMutex mutex, double timeout) { // we can't wait on a condition variable and also wake it up for // cancellation since we don't use posix cancellation. so we @@ -272,20 +272,20 @@ CArchMultithreadPosix::waitCondVar(CArchCond cond, } } -CArchMutex -CArchMultithreadPosix::newMutex() +ArchMutex +ArchMultithreadPosix::newMutex() { pthread_mutexattr_t attr; int status = pthread_mutexattr_init(&attr); assert(status == 0); - CArchMutexImpl* mutex = new CArchMutexImpl; + ArchMutexImpl* mutex = new ArchMutexImpl; status = pthread_mutex_init(&mutex->m_mutex, &attr); assert(status == 0); return mutex; } void -CArchMultithreadPosix::closeMutex(CArchMutex mutex) +ArchMultithreadPosix::closeMutex(ArchMutex mutex) { int status = pthread_mutex_destroy(&mutex->m_mutex); (void)status; @@ -294,7 +294,7 @@ CArchMultithreadPosix::closeMutex(CArchMutex mutex) } void -CArchMultithreadPosix::lockMutex(CArchMutex mutex) +ArchMultithreadPosix::lockMutex(ArchMutex mutex) { int status = pthread_mutex_lock(&mutex->m_mutex); @@ -318,7 +318,7 @@ CArchMultithreadPosix::lockMutex(CArchMutex mutex) } void -CArchMultithreadPosix::unlockMutex(CArchMutex mutex) +ArchMultithreadPosix::unlockMutex(ArchMutex mutex) { int status = pthread_mutex_unlock(&mutex->m_mutex); @@ -337,8 +337,8 @@ CArchMultithreadPosix::unlockMutex(CArchMutex mutex) } } -CArchThread -CArchMultithreadPosix::newThread(ThreadFunc func, void* data) +ArchThread +ArchMultithreadPosix::newThread(ThreadFunc func, void* data) { assert(func != NULL); @@ -359,7 +359,7 @@ CArchMultithreadPosix::newThread(ThreadFunc func, void* data) lockMutex(m_threadMutex); // create thread impl for new thread - CArchThreadImpl* thread = new CArchThreadImpl; + ArchThreadImpl* thread = new ArchThreadImpl; thread->m_func = func; thread->m_userData = data; @@ -369,7 +369,7 @@ CArchMultithreadPosix::newThread(ThreadFunc func, void* data) int status = pthread_attr_init(&attr); if (status == 0) { status = pthread_create(&thread->m_thread, &attr, - &CArchMultithreadPosix::threadFunc, thread); + &ArchMultithreadPosix::threadFunc, thread); pthread_attr_destroy(&attr); } @@ -393,18 +393,18 @@ CArchMultithreadPosix::newThread(ThreadFunc func, void* data) return thread; } -CArchThread -CArchMultithreadPosix::newCurrentThread() +ArchThread +ArchMultithreadPosix::newCurrentThread() { lockMutex(m_threadMutex); - CArchThreadImpl* thread = find(pthread_self()); + ArchThreadImpl* thread = find(pthread_self()); unlockMutex(m_threadMutex); assert(thread != NULL); return thread; } void -CArchMultithreadPosix::closeThread(CArchThread thread) +ArchMultithreadPosix::closeThread(ArchThread thread) { assert(thread != NULL); @@ -426,15 +426,15 @@ CArchMultithreadPosix::closeThread(CArchThread thread) } } -CArchThread -CArchMultithreadPosix::copyThread(CArchThread thread) +ArchThread +ArchMultithreadPosix::copyThread(ArchThread thread) { refThread(thread); return thread; } void -CArchMultithreadPosix::cancelThread(CArchThread thread) +ArchMultithreadPosix::cancelThread(ArchThread thread) { assert(thread != NULL); @@ -454,7 +454,7 @@ CArchMultithreadPosix::cancelThread(CArchThread thread) } void -CArchMultithreadPosix::setPriorityOfThread(CArchThread thread, int /*n*/) +ArchMultithreadPosix::setPriorityOfThread(ArchThread thread, int /*n*/) { assert(thread != NULL); @@ -462,11 +462,11 @@ CArchMultithreadPosix::setPriorityOfThread(CArchThread thread, int /*n*/) } void -CArchMultithreadPosix::testCancelThread() +ArchMultithreadPosix::testCancelThread() { // find current thread lockMutex(m_threadMutex); - CArchThreadImpl* thread = findNoRef(pthread_self()); + ArchThreadImpl* thread = findNoRef(pthread_self()); unlockMutex(m_threadMutex); // test cancel on thread @@ -474,14 +474,14 @@ CArchMultithreadPosix::testCancelThread() } bool -CArchMultithreadPosix::wait(CArchThread target, double timeout) +ArchMultithreadPosix::wait(ArchThread target, double timeout) { assert(target != NULL); lockMutex(m_threadMutex); // find current thread - CArchThreadImpl* self = findNoRef(pthread_self()); + ArchThreadImpl* self = findNoRef(pthread_self()); // ignore wait if trying to wait on ourself if (target == self) { @@ -530,13 +530,13 @@ CArchMultithreadPosix::wait(CArchThread target, double timeout) } bool -CArchMultithreadPosix::isSameThread(CArchThread thread1, CArchThread thread2) +ArchMultithreadPosix::isSameThread(ArchThread thread1, ArchThread thread2) { return (thread1 == thread2); } bool -CArchMultithreadPosix::isExitedThread(CArchThread thread) +ArchMultithreadPosix::isExitedThread(ArchThread thread) { lockMutex(m_threadMutex); bool exited = thread->m_exited; @@ -545,7 +545,7 @@ CArchMultithreadPosix::isExitedThread(CArchThread thread) } void* -CArchMultithreadPosix::getResultOfThread(CArchThread thread) +ArchMultithreadPosix::getResultOfThread(ArchThread thread) { lockMutex(m_threadMutex); void* result = thread->m_result; @@ -554,13 +554,13 @@ CArchMultithreadPosix::getResultOfThread(CArchThread thread) } IArchMultithread::ThreadID -CArchMultithreadPosix::getIDOfThread(CArchThread thread) +ArchMultithreadPosix::getIDOfThread(ArchThread thread) { return thread->m_id; } void -CArchMultithreadPosix::setSignalHandler( +ArchMultithreadPosix::setSignalHandler( ESignal signal, SignalFunc func, void* userData) { lockMutex(m_threadMutex); @@ -570,7 +570,7 @@ CArchMultithreadPosix::setSignalHandler( } void -CArchMultithreadPosix::raiseSignal(ESignal signal) +ArchMultithreadPosix::raiseSignal(ESignal signal) { lockMutex(m_threadMutex); if (m_signalFunc[signal] != NULL) { @@ -584,7 +584,7 @@ CArchMultithreadPosix::raiseSignal(ESignal signal) } void -CArchMultithreadPosix::startSignalHandler() +ArchMultithreadPosix::startSignalHandler() { // set signal mask. the main thread blocks these signals and // the signal handler thread will listen for them. @@ -600,7 +600,7 @@ CArchMultithreadPosix::startSignalHandler() int status = pthread_attr_init(&attr); if (status == 0) { status = pthread_create(&m_signalThread, &attr, - &CArchMultithreadPosix::threadSignalHandler, + &ArchMultithreadPosix::threadSignalHandler, NULL); pthread_attr_destroy(&attr); } @@ -611,21 +611,21 @@ CArchMultithreadPosix::startSignalHandler() } } -CArchThreadImpl* -CArchMultithreadPosix::find(pthread_t thread) +ArchThreadImpl* +ArchMultithreadPosix::find(pthread_t thread) { - CArchThreadImpl* impl = findNoRef(thread); + ArchThreadImpl* impl = findNoRef(thread); if (impl != NULL) { refThread(impl); } return impl; } -CArchThreadImpl* -CArchMultithreadPosix::findNoRef(pthread_t thread) +ArchThreadImpl* +ArchMultithreadPosix::findNoRef(pthread_t thread) { // linear search - for (CThreadList::const_iterator index = m_threadList.begin(); + for (ThreadList::const_iterator index = m_threadList.begin(); index != m_threadList.end(); ++index) { if ((*index)->m_thread == thread) { return *index; @@ -635,7 +635,7 @@ CArchMultithreadPosix::findNoRef(pthread_t thread) } void -CArchMultithreadPosix::insert(CArchThreadImpl* thread) +ArchMultithreadPosix::insert(ArchThreadImpl* thread) { assert(thread != NULL); @@ -653,9 +653,9 @@ CArchMultithreadPosix::insert(CArchThreadImpl* thread) } 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) { if (*index == thread) { m_threadList.erase(index); @@ -665,7 +665,7 @@ CArchMultithreadPosix::erase(CArchThreadImpl* thread) } void -CArchMultithreadPosix::refThread(CArchThreadImpl* thread) +ArchMultithreadPosix::refThread(ArchThreadImpl* thread) { assert(thread != NULL); assert(findNoRef(thread->m_thread) != NULL); @@ -673,7 +673,7 @@ CArchMultithreadPosix::refThread(CArchThreadImpl* thread) } void -CArchMultithreadPosix::testCancelThreadImpl(CArchThreadImpl* thread) +ArchMultithreadPosix::testCancelThreadImpl(ArchThreadImpl* thread) { assert(thread != NULL); @@ -694,10 +694,10 @@ CArchMultithreadPosix::testCancelThreadImpl(CArchThreadImpl* thread) } void* -CArchMultithreadPosix::threadFunc(void* vrep) +ArchMultithreadPosix::threadFunc(void* vrep) { // get the thread - CArchThreadImpl* thread = reinterpret_cast(vrep); + ArchThreadImpl* thread = reinterpret_cast(vrep); // setup pthreads pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); @@ -711,7 +711,7 @@ CArchMultithreadPosix::threadFunc(void* vrep) } void -CArchMultithreadPosix::doThreadFunc(CArchThread thread) +ArchMultithreadPosix::doThreadFunc(ArchThread thread) { // default priority is slightly below normal setPriorityOfThread(thread, 1); @@ -749,13 +749,13 @@ CArchMultithreadPosix::doThreadFunc(CArchThread thread) } void -CArchMultithreadPosix::threadCancel(int) +ArchMultithreadPosix::threadCancel(int) { // do nothing } void* -CArchMultithreadPosix::threadSignalHandler(void*) +ArchMultithreadPosix::threadSignalHandler(void*) { // detach pthread_detach(pthread_self()); diff --git a/src/lib/arch/unix/ArchMultithreadPosix.h b/src/lib/arch/unix/ArchMultithreadPosix.h index 809a1016..28baacff 100644 --- a/src/lib/arch/unix/ArchMultithreadPosix.h +++ b/src/lib/arch/unix/ArchMultithreadPosix.h @@ -23,23 +23,23 @@ #include -#define ARCH_MULTITHREAD CArchMultithreadPosix +#define ARCH_MULTITHREAD ArchMultithreadPosix -class CArchCondImpl { +class ArchCondImpl { public: pthread_cond_t m_cond; }; -class CArchMutexImpl { +class ArchMutexImpl { public: pthread_mutex_t m_mutex; }; //! Posix implementation of IArchMultithread -class CArchMultithreadPosix : public IArchMultithread { +class ArchMultithreadPosix : public IArchMultithread { public: - CArchMultithreadPosix(); - virtual ~CArchMultithreadPosix(); + ArchMultithreadPosix(); + virtual ~ArchMultithreadPosix(); //! @name manipulators //@{ @@ -50,63 +50,63 @@ public: //! @name accessors //@{ - void* getNetworkDataForThread(CArchThread); + void* getNetworkDataForThread(ArchThread); - static CArchMultithreadPosix* getInstance(); + static ArchMultithreadPosix* getInstance(); //@} // IArchMultithread overrides - virtual CArchCond newCondVar(); - virtual void closeCondVar(CArchCond); - virtual void signalCondVar(CArchCond); - virtual void broadcastCondVar(CArchCond); - virtual bool waitCondVar(CArchCond, CArchMutex, double timeout); - virtual CArchMutex newMutex(); - virtual void closeMutex(CArchMutex); - virtual void lockMutex(CArchMutex); - virtual void unlockMutex(CArchMutex); - virtual CArchThread newThread(ThreadFunc, void*); - virtual CArchThread newCurrentThread(); - virtual CArchThread copyThread(CArchThread); - virtual void closeThread(CArchThread); - virtual void cancelThread(CArchThread); - virtual void setPriorityOfThread(CArchThread, int n); + virtual ArchCond newCondVar(); + virtual void closeCondVar(ArchCond); + virtual void signalCondVar(ArchCond); + virtual void broadcastCondVar(ArchCond); + virtual bool waitCondVar(ArchCond, ArchMutex, double timeout); + virtual ArchMutex newMutex(); + virtual void closeMutex(ArchMutex); + virtual void lockMutex(ArchMutex); + virtual void unlockMutex(ArchMutex); + virtual ArchThread newThread(ThreadFunc, void*); + virtual ArchThread newCurrentThread(); + virtual ArchThread copyThread(ArchThread); + virtual void closeThread(ArchThread); + virtual void cancelThread(ArchThread); + virtual void setPriorityOfThread(ArchThread, int n); virtual void testCancelThread(); - virtual bool wait(CArchThread, double timeout); - virtual bool isSameThread(CArchThread, CArchThread); - virtual bool isExitedThread(CArchThread); - virtual void* getResultOfThread(CArchThread); - virtual ThreadID getIDOfThread(CArchThread); + virtual bool wait(ArchThread, double timeout); + virtual bool isSameThread(ArchThread, ArchThread); + virtual bool isExitedThread(ArchThread); + virtual void* getResultOfThread(ArchThread); + virtual ThreadID getIDOfThread(ArchThread); virtual void setSignalHandler(ESignal, SignalFunc, void*); virtual void raiseSignal(ESignal); private: void startSignalHandler(); - CArchThreadImpl* find(pthread_t thread); - CArchThreadImpl* findNoRef(pthread_t thread); - void insert(CArchThreadImpl* thread); - void erase(CArchThreadImpl* thread); + ArchThreadImpl* find(pthread_t thread); + ArchThreadImpl* findNoRef(pthread_t thread); + void insert(ArchThreadImpl* thread); + void erase(ArchThreadImpl* thread); - void refThread(CArchThreadImpl* rep); - void testCancelThreadImpl(CArchThreadImpl* rep); + void refThread(ArchThreadImpl* rep); + void testCancelThreadImpl(ArchThreadImpl* rep); - void doThreadFunc(CArchThread thread); + void doThreadFunc(ArchThread thread); static void* threadFunc(void* vrep); static void threadCancel(int); static void* threadSignalHandler(void* vrep); private: - typedef std::list CThreadList; + typedef std::list ThreadList; - static CArchMultithreadPosix* s_instance; + static ArchMultithreadPosix* s_instance; bool m_newThreadCalled; - CArchMutex m_threadMutex; - CArchThread m_mainThread; - CThreadList m_threadList; + ArchMutex m_threadMutex; + ArchThread m_mainThread; + ThreadList m_threadList; ThreadID m_nextID; pthread_t m_signalThread; diff --git a/src/lib/arch/unix/ArchNetworkBSD.cpp b/src/lib/arch/unix/ArchNetworkBSD.cpp index 33e913d8..a9f2e5ba 100644 --- a/src/lib/arch/unix/ArchNetworkBSD.cpp +++ b/src/lib/arch/unix/ArchNetworkBSD.cpp @@ -83,27 +83,27 @@ inet_aton(const char* cp, struct in_addr* inp) #endif // -// CArchNetworkBSD +// ArchNetworkBSD // -CArchNetworkBSD::CArchNetworkBSD() +ArchNetworkBSD::ArchNetworkBSD() { } -CArchNetworkBSD::~CArchNetworkBSD() +ArchNetworkBSD::~ArchNetworkBSD() { ARCH->closeMutex(m_mutex); } void -CArchNetworkBSD::init() +ArchNetworkBSD::init() { // create mutex to make some calls thread safe m_mutex = ARCH->newMutex(); } -CArchSocket -CArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type) +ArchSocket +ArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type) { // create socket int fd = socket(s_family[family], s_type[type], 0); @@ -119,14 +119,14 @@ CArchNetworkBSD::newSocket(EAddressFamily family, ESocketType type) } // allocate socket object - CArchSocketImpl* newSocket = new CArchSocketImpl; + ArchSocketImpl* newSocket = new ArchSocketImpl; newSocket->m_fd = fd; newSocket->m_refCount = 1; return newSocket; } -CArchSocket -CArchNetworkBSD::copySocket(CArchSocket s) +ArchSocket +ArchNetworkBSD::copySocket(ArchSocket s) { assert(s != NULL); @@ -138,7 +138,7 @@ CArchNetworkBSD::copySocket(CArchSocket s) } void -CArchNetworkBSD::closeSocket(CArchSocket s) +ArchNetworkBSD::closeSocket(ArchSocket s) { assert(s != NULL); @@ -162,7 +162,7 @@ CArchNetworkBSD::closeSocket(CArchSocket s) } void -CArchNetworkBSD::closeSocketForRead(CArchSocket s) +ArchNetworkBSD::closeSocketForRead(ArchSocket s) { assert(s != NULL); @@ -174,7 +174,7 @@ CArchNetworkBSD::closeSocketForRead(CArchSocket s) } void -CArchNetworkBSD::closeSocketForWrite(CArchSocket s) +ArchNetworkBSD::closeSocketForWrite(ArchSocket s) { assert(s != NULL); @@ -186,7 +186,7 @@ CArchNetworkBSD::closeSocketForWrite(CArchSocket s) } void -CArchNetworkBSD::bindSocket(CArchSocket s, CArchNetAddress addr) +ArchNetworkBSD::bindSocket(ArchSocket s, ArchNetAddress addr) { assert(s != NULL); assert(addr != NULL); @@ -197,7 +197,7 @@ CArchNetworkBSD::bindSocket(CArchSocket s, CArchNetAddress addr) } void -CArchNetworkBSD::listenOnSocket(CArchSocket s) +ArchNetworkBSD::listenOnSocket(ArchSocket s) { assert(s != NULL); @@ -207,20 +207,20 @@ CArchNetworkBSD::listenOnSocket(CArchSocket s) } } -CArchSocket -CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr) +ArchSocket +ArchNetworkBSD::acceptSocket(ArchSocket s, ArchNetAddress* addr) { assert(s != NULL); // if user passed NULL in addr then use scratch space - CArchNetAddress dummy; + ArchNetAddress dummy; if (addr == NULL) { addr = &dummy; } // create new socket and address - CArchSocketImpl* newSocket = new CArchSocketImpl; - *addr = new CArchNetAddressImpl; + ArchSocketImpl* newSocket = new ArchSocketImpl; + *addr = new ArchNetAddressImpl; // accept on socket ACCEPT_TYPE_ARG3 len = (ACCEPT_TYPE_ARG3)((*addr)->m_len); @@ -261,7 +261,7 @@ CArchNetworkBSD::acceptSocket(CArchSocket s, CArchNetAddress* addr) } bool -CArchNetworkBSD::connectSocket(CArchSocket s, CArchNetAddress addr) +ArchNetworkBSD::connectSocket(ArchSocket s, ArchNetAddress addr) { assert(s != NULL); assert(addr != NULL); @@ -281,7 +281,7 @@ CArchNetworkBSD::connectSocket(CArchSocket s, CArchNetAddress addr) #if HAVE_POLL int -CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) +ArchNetworkBSD::pollSocket(PollEntry pe[], int num, double timeout) { assert(pe != NULL || num == 0); @@ -373,7 +373,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) #else int -CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) +ArchNetworkBSD::pollSocket(PollEntry pe[], int num, double timeout) { int i, n; @@ -497,7 +497,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) #endif void -CArchNetworkBSD::unblockPollSocket(CArchThread thread) +ArchNetworkBSD::unblockPollSocket(ArchThread thread) { const int* unblockPipe = getUnblockPipeForThread(thread); if (unblockPipe != NULL) { @@ -509,7 +509,7 @@ CArchNetworkBSD::unblockPollSocket(CArchThread thread) } size_t -CArchNetworkBSD::readSocket(CArchSocket s, void* buf, size_t len) +ArchNetworkBSD::readSocket(ArchSocket s, void* buf, size_t len) { assert(s != NULL); @@ -524,7 +524,7 @@ CArchNetworkBSD::readSocket(CArchSocket s, void* buf, size_t len) } 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); @@ -539,7 +539,7 @@ CArchNetworkBSD::writeSocket(CArchSocket s, const void* buf, size_t len) } void -CArchNetworkBSD::throwErrorOnSocket(CArchSocket s) +ArchNetworkBSD::throwErrorOnSocket(ArchSocket s) { assert(s != NULL); @@ -558,7 +558,7 @@ CArchNetworkBSD::throwErrorOnSocket(CArchSocket s) } void -CArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking) +ArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking) { assert(fd != -1); @@ -578,7 +578,7 @@ CArchNetworkBSD::setBlockingOnSocket(int fd, bool blocking) } bool -CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay) +ArchNetworkBSD::setNoDelayOnSocket(ArchSocket s, bool noDelay) { assert(s != NULL); @@ -601,7 +601,7 @@ CArchNetworkBSD::setNoDelayOnSocket(CArchSocket s, bool noDelay) } bool -CArchNetworkBSD::setReuseAddrOnSocket(CArchSocket s, bool reuse) +ArchNetworkBSD::setReuseAddrOnSocket(ArchSocket s, bool reuse) { assert(s != NULL); @@ -624,7 +624,7 @@ CArchNetworkBSD::setReuseAddrOnSocket(CArchSocket s, bool reuse) } std::string -CArchNetworkBSD::getHostName() +ArchNetworkBSD::getHostName() { char name[256]; if (gethostname(name, sizeof(name)) == -1) { @@ -636,11 +636,11 @@ CArchNetworkBSD::getHostName() return name; } -CArchNetAddress -CArchNetworkBSD::newAnyAddr(EAddressFamily family) +ArchNetAddress +ArchNetworkBSD::newAnyAddr(EAddressFamily family) { // allocate address - CArchNetAddressImpl* addr = new CArchNetAddressImpl; + ArchNetAddressImpl* addr = new ArchNetAddressImpl; // fill it in switch (family) { @@ -662,20 +662,20 @@ CArchNetworkBSD::newAnyAddr(EAddressFamily family) return addr; } -CArchNetAddress -CArchNetworkBSD::copyAddr(CArchNetAddress addr) +ArchNetAddress +ArchNetworkBSD::copyAddr(ArchNetAddress addr) { assert(addr != NULL); // allocate and copy address - return new CArchNetAddressImpl(*addr); + return new ArchNetAddressImpl(*addr); } -CArchNetAddress -CArchNetworkBSD::nameToAddr(const std::string& name) +ArchNetAddress +ArchNetworkBSD::nameToAddr(const std::string& name) { // allocate address - CArchNetAddressImpl* addr = new CArchNetAddressImpl; + ArchNetAddressImpl* addr = new ArchNetAddressImpl; // try to convert assuming an IPv4 dot notation address struct sockaddr_in inaddr; @@ -723,7 +723,7 @@ CArchNetworkBSD::nameToAddr(const std::string& name) } void -CArchNetworkBSD::closeAddr(CArchNetAddress addr) +ArchNetworkBSD::closeAddr(ArchNetAddress addr) { assert(addr != NULL); @@ -731,7 +731,7 @@ CArchNetworkBSD::closeAddr(CArchNetAddress addr) } std::string -CArchNetworkBSD::addrToName(CArchNetAddress addr) +ArchNetworkBSD::addrToName(ArchNetAddress addr) { assert(addr != NULL); @@ -755,7 +755,7 @@ CArchNetworkBSD::addrToName(CArchNetAddress addr) } std::string -CArchNetworkBSD::addrToString(CArchNetAddress addr) +ArchNetworkBSD::addrToString(ArchNetAddress addr) { assert(addr != NULL); @@ -776,7 +776,7 @@ CArchNetworkBSD::addrToString(CArchNetAddress addr) } IArchNetwork::EAddressFamily -CArchNetworkBSD::getAddrFamily(CArchNetAddress addr) +ArchNetworkBSD::getAddrFamily(ArchNetAddress addr) { assert(addr != NULL); @@ -790,7 +790,7 @@ CArchNetworkBSD::getAddrFamily(CArchNetAddress addr) } void -CArchNetworkBSD::setAddrPort(CArchNetAddress addr, int port) +ArchNetworkBSD::setAddrPort(ArchNetAddress addr, int port) { assert(addr != NULL); @@ -809,7 +809,7 @@ CArchNetworkBSD::setAddrPort(CArchNetAddress addr, int port) } int -CArchNetworkBSD::getAddrPort(CArchNetAddress addr) +ArchNetworkBSD::getAddrPort(ArchNetAddress addr) { assert(addr != NULL); @@ -827,7 +827,7 @@ CArchNetworkBSD::getAddrPort(CArchNetAddress addr) } bool -CArchNetworkBSD::isAnyAddr(CArchNetAddress addr) +ArchNetworkBSD::isAnyAddr(ArchNetAddress addr) { assert(addr != NULL); @@ -846,26 +846,26 @@ CArchNetworkBSD::isAnyAddr(CArchNetAddress addr) } bool -CArchNetworkBSD::isEqualAddr(CArchNetAddress a, CArchNetAddress b) +ArchNetworkBSD::isEqualAddr(ArchNetAddress a, ArchNetAddress b) { return (a->m_len == b->m_len && memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0); } const int* -CArchNetworkBSD::getUnblockPipe() +ArchNetworkBSD::getUnblockPipe() { - CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance(); - CArchThread thread = mt->newCurrentThread(); + ArchMultithreadPosix* mt = ArchMultithreadPosix::getInstance(); + ArchThread thread = mt->newCurrentThread(); const int* p = getUnblockPipeForThread(thread); ARCH->closeThread(thread); return p; } const int* -CArchNetworkBSD::getUnblockPipeForThread(CArchThread thread) +ArchNetworkBSD::getUnblockPipeForThread(ArchThread thread) { - CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance(); + ArchMultithreadPosix* mt = ArchMultithreadPosix::getInstance(); int* unblockPipe = (int*)mt->getNetworkDataForThread(thread); if (unblockPipe == NULL) { unblockPipe = new int[2]; @@ -888,7 +888,7 @@ CArchNetworkBSD::getUnblockPipeForThread(CArchThread thread) } void -CArchNetworkBSD::throwError(int err) +ArchNetworkBSD::throwError(int err) { switch (err) { case EINTR: @@ -960,7 +960,7 @@ CArchNetworkBSD::throwError(int err) } void -CArchNetworkBSD::throwNameError(int err) +ArchNetworkBSD::throwNameError(int err) { static const char* s_msg[] = { "The specified host is unknown", diff --git a/src/lib/arch/unix/ArchNetworkBSD.h b/src/lib/arch/unix/ArchNetworkBSD.h index f9bbdfce..888ee194 100644 --- a/src/lib/arch/unix/ArchNetworkBSD.h +++ b/src/lib/arch/unix/ArchNetworkBSD.h @@ -37,17 +37,17 @@ typedef int socklen_t; // compatible so we always use it. typedef char optval_t; -#define ARCH_NETWORK CArchNetworkBSD +#define ARCH_NETWORK ArchNetworkBSD -class CArchSocketImpl { +class ArchSocketImpl { public: int m_fd; int m_refCount; }; -class CArchNetAddressImpl { +class ArchNetAddressImpl { public: - CArchNetAddressImpl() : m_len(sizeof(m_addr)) { } + ArchNetAddressImpl() : m_len(sizeof(m_addr)) { } public: struct sockaddr m_addr; @@ -55,50 +55,50 @@ public: }; //! Berkeley (BSD) sockets implementation of IArchNetwork -class CArchNetworkBSD : public IArchNetwork { +class ArchNetworkBSD : public IArchNetwork { public: - CArchNetworkBSD(); - virtual ~CArchNetworkBSD(); + ArchNetworkBSD(); + virtual ~ArchNetworkBSD(); virtual void init(); // IArchNetwork overrides - virtual CArchSocket newSocket(EAddressFamily, ESocketType); - virtual CArchSocket copySocket(CArchSocket s); virtual void closeSocket(CArchSocket s); - virtual void closeSocketForRead(CArchSocket s); - virtual void closeSocketForWrite(CArchSocket s); - virtual void bindSocket(CArchSocket s, CArchNetAddress addr); - virtual void listenOnSocket(CArchSocket s); - virtual CArchSocket acceptSocket(CArchSocket s, CArchNetAddress* addr); - virtual bool connectSocket(CArchSocket s, CArchNetAddress name); - virtual int pollSocket(CPollEntry[], int num, double timeout); - virtual void unblockPollSocket(CArchThread thread); - virtual size_t readSocket(CArchSocket s, void* buf, size_t len); - virtual size_t writeSocket(CArchSocket s, + virtual ArchSocket newSocket(EAddressFamily, ESocketType); + virtual ArchSocket copySocket(ArchSocket s); virtual void closeSocket(ArchSocket s); + virtual void closeSocketForRead(ArchSocket s); + virtual void closeSocketForWrite(ArchSocket s); + virtual void bindSocket(ArchSocket s, ArchNetAddress addr); + virtual void listenOnSocket(ArchSocket s); + virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress* addr); + virtual bool connectSocket(ArchSocket s, ArchNetAddress name); + virtual int pollSocket(PollEntry[], int num, double timeout); + virtual void unblockPollSocket(ArchThread thread); + virtual size_t readSocket(ArchSocket s, void* buf, size_t len); + virtual size_t writeSocket(ArchSocket s, const void* buf, size_t len); - virtual void throwErrorOnSocket(CArchSocket); - virtual bool setNoDelayOnSocket(CArchSocket, bool noDelay); - virtual bool setReuseAddrOnSocket(CArchSocket, bool reuse); + virtual void throwErrorOnSocket(ArchSocket); + virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay); + virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse); virtual std::string getHostName(); - virtual CArchNetAddress newAnyAddr(EAddressFamily); - virtual CArchNetAddress copyAddr(CArchNetAddress); - virtual CArchNetAddress nameToAddr(const std::string&); - virtual void closeAddr(CArchNetAddress); - virtual std::string addrToName(CArchNetAddress); - virtual std::string addrToString(CArchNetAddress); - virtual EAddressFamily getAddrFamily(CArchNetAddress); - virtual void setAddrPort(CArchNetAddress, int port); - virtual int getAddrPort(CArchNetAddress); - virtual bool isAnyAddr(CArchNetAddress); - virtual bool isEqualAddr(CArchNetAddress, CArchNetAddress); + virtual ArchNetAddress newAnyAddr(EAddressFamily); + virtual ArchNetAddress copyAddr(ArchNetAddress); + virtual ArchNetAddress nameToAddr(const std::string&); + virtual void closeAddr(ArchNetAddress); + virtual std::string addrToName(ArchNetAddress); + virtual std::string addrToString(ArchNetAddress); + virtual EAddressFamily getAddrFamily(ArchNetAddress); + virtual void setAddrPort(ArchNetAddress, int port); + virtual int getAddrPort(ArchNetAddress); + virtual bool isAnyAddr(ArchNetAddress); + virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress); private: const int* getUnblockPipe(); - const int* getUnblockPipeForThread(CArchThread); + const int* getUnblockPipeForThread(ArchThread); void setBlockingOnSocket(int fd, bool blocking); void throwError(int); void throwNameError(int); private: - CArchMutex m_mutex; + ArchMutex m_mutex; }; diff --git a/src/lib/arch/unix/ArchPluginUnix.cpp b/src/lib/arch/unix/ArchPluginUnix.cpp index 5eb7dd78..89fce579 100644 --- a/src/lib/arch/unix/ArchPluginUnix.cpp +++ b/src/lib/arch/unix/ArchPluginUnix.cpp @@ -18,15 +18,15 @@ #include "arch/unix/ArchPluginUnix.h" -CArchPluginUnix::CArchPluginUnix() +ArchPluginUnix::ArchPluginUnix() { } -CArchPluginUnix::~CArchPluginUnix() +ArchPluginUnix::~ArchPluginUnix() { } void -CArchPluginUnix::init(void* eventTarget, IEventQueue* events) +ArchPluginUnix::init(void* eventTarget, IEventQueue* events) { } diff --git a/src/lib/arch/unix/ArchPluginUnix.h b/src/lib/arch/unix/ArchPluginUnix.h index cdaa5053..5e0fa775 100644 --- a/src/lib/arch/unix/ArchPluginUnix.h +++ b/src/lib/arch/unix/ArchPluginUnix.h @@ -20,15 +20,15 @@ #include "arch/IArchPlugin.h" -#define ARCH_PLUGIN CArchPluginUnix +#define ARCH_PLUGIN ArchPluginUnix class IEventQueue; //! Unix implementation of IArchPlugin -class CArchPluginUnix : public IArchPlugin { +class ArchPluginUnix : public IArchPlugin { public: - CArchPluginUnix(); - virtual ~CArchPluginUnix(); + ArchPluginUnix(); + virtual ~ArchPluginUnix(); // IArchPlugin overrides void init(void* eventTarget, IEventQueue* events); diff --git a/src/lib/arch/unix/ArchSleepUnix.cpp b/src/lib/arch/unix/ArchSleepUnix.cpp index 96823ec3..581a3fde 100644 --- a/src/lib/arch/unix/ArchSleepUnix.cpp +++ b/src/lib/arch/unix/ArchSleepUnix.cpp @@ -43,21 +43,21 @@ #endif // -// CArchSleepUnix +// ArchSleepUnix // -CArchSleepUnix::CArchSleepUnix() +ArchSleepUnix::ArchSleepUnix() { // do nothing } -CArchSleepUnix::~CArchSleepUnix() +ArchSleepUnix::~ArchSleepUnix() { // do nothing } void -CArchSleepUnix::sleep(double timeout) +ArchSleepUnix::sleep(double timeout) { ARCH->testCancelThread(); if (timeout < 0.0) { diff --git a/src/lib/arch/unix/ArchSleepUnix.h b/src/lib/arch/unix/ArchSleepUnix.h index 342cc2c8..302189f3 100644 --- a/src/lib/arch/unix/ArchSleepUnix.h +++ b/src/lib/arch/unix/ArchSleepUnix.h @@ -20,13 +20,13 @@ #include "arch/IArchSleep.h" -#define ARCH_SLEEP CArchSleepUnix +#define ARCH_SLEEP ArchSleepUnix //! Unix implementation of IArchSleep -class CArchSleepUnix : public IArchSleep { +class ArchSleepUnix : public IArchSleep { public: - CArchSleepUnix(); - virtual ~CArchSleepUnix(); + ArchSleepUnix(); + virtual ~ArchSleepUnix(); // IArchSleep overrides virtual void sleep(double timeout); diff --git a/src/lib/arch/unix/ArchStringUnix.cpp b/src/lib/arch/unix/ArchStringUnix.cpp index 91e6918f..1b08ab5c 100644 --- a/src/lib/arch/unix/ArchStringUnix.cpp +++ b/src/lib/arch/unix/ArchStringUnix.cpp @@ -21,22 +21,22 @@ #include // -// CArchStringUnix +// ArchStringUnix // #include "arch/multibyte.h" #include "arch/vsnprintf.h" -CArchStringUnix::CArchStringUnix() +ArchStringUnix::ArchStringUnix() { } -CArchStringUnix::~CArchStringUnix() +ArchStringUnix::~ArchStringUnix() { } IArchString::EWideCharEncoding -CArchStringUnix::getWideCharEncoding() +ArchStringUnix::getWideCharEncoding() { return kUCS4; } diff --git a/src/lib/arch/unix/ArchStringUnix.h b/src/lib/arch/unix/ArchStringUnix.h index fd98a9f8..d404a14e 100644 --- a/src/lib/arch/unix/ArchStringUnix.h +++ b/src/lib/arch/unix/ArchStringUnix.h @@ -20,13 +20,13 @@ #include "arch/IArchString.h" -#define ARCH_STRING CArchStringUnix +#define ARCH_STRING ArchStringUnix //! Unix implementation of IArchString -class CArchStringUnix : public IArchString { +class ArchStringUnix : public IArchString { public: - CArchStringUnix(); - virtual ~CArchStringUnix(); + ArchStringUnix(); + virtual ~ArchStringUnix(); // IArchString overrides virtual EWideCharEncoding diff --git a/src/lib/arch/unix/ArchSystemUnix.cpp b/src/lib/arch/unix/ArchSystemUnix.cpp index 8c8a7846..d27dc04c 100644 --- a/src/lib/arch/unix/ArchSystemUnix.cpp +++ b/src/lib/arch/unix/ArchSystemUnix.cpp @@ -21,21 +21,21 @@ #include // -// CArchSystemUnix +// ArchSystemUnix // -CArchSystemUnix::CArchSystemUnix() +ArchSystemUnix::ArchSystemUnix() { // do nothing } -CArchSystemUnix::~CArchSystemUnix() +ArchSystemUnix::~ArchSystemUnix() { // do nothing } std::string -CArchSystemUnix::getOSName() const +ArchSystemUnix::getOSName() const { #if defined(HAVE_SYS_UTSNAME_H) struct utsname info; @@ -53,7 +53,7 @@ CArchSystemUnix::getOSName() const } std::string -CArchSystemUnix::getPlatformName() const +ArchSystemUnix::getPlatformName() const { #if defined(HAVE_SYS_UTSNAME_H) struct utsname info; @@ -65,12 +65,12 @@ CArchSystemUnix::getPlatformName() const } std::string -CArchSystemUnix::setting(const std::string&) const +ArchSystemUnix::setting(const std::string&) const { return ""; } void -CArchSystemUnix::setting(const std::string&, const std::string&) const +ArchSystemUnix::setting(const std::string&, const std::string&) const { } diff --git a/src/lib/arch/unix/ArchSystemUnix.h b/src/lib/arch/unix/ArchSystemUnix.h index d4ea1965..ca6b98b6 100644 --- a/src/lib/arch/unix/ArchSystemUnix.h +++ b/src/lib/arch/unix/ArchSystemUnix.h @@ -20,13 +20,13 @@ #include "arch/IArchSystem.h" -#define ARCH_SYSTEM CArchSystemUnix +#define ARCH_SYSTEM ArchSystemUnix //! Unix implementation of IArchString -class CArchSystemUnix : public IArchSystem { +class ArchSystemUnix : public IArchSystem { public: - CArchSystemUnix(); - virtual ~CArchSystemUnix(); + ArchSystemUnix(); + virtual ~ArchSystemUnix(); // IArchSystem overrides virtual std::string getOSName() const; diff --git a/src/lib/arch/unix/ArchTaskBarXWindows.cpp b/src/lib/arch/unix/ArchTaskBarXWindows.cpp index 97657a6b..6b496083 100644 --- a/src/lib/arch/unix/ArchTaskBarXWindows.cpp +++ b/src/lib/arch/unix/ArchTaskBarXWindows.cpp @@ -19,33 +19,33 @@ #include "arch/unix/ArchTaskBarXWindows.h" // -// CArchTaskBarXWindows +// ArchTaskBarXWindows // -CArchTaskBarXWindows::CArchTaskBarXWindows() +ArchTaskBarXWindows::ArchTaskBarXWindows() { // do nothing } -CArchTaskBarXWindows::~CArchTaskBarXWindows() +ArchTaskBarXWindows::~ArchTaskBarXWindows() { // do nothing } void -CArchTaskBarXWindows::addReceiver(IArchTaskBarReceiver* /*receiver*/) +ArchTaskBarXWindows::addReceiver(IArchTaskBarReceiver* /*receiver*/) { // do nothing } void -CArchTaskBarXWindows::removeReceiver(IArchTaskBarReceiver* /*receiver*/) +ArchTaskBarXWindows::removeReceiver(IArchTaskBarReceiver* /*receiver*/) { // do nothing } void -CArchTaskBarXWindows::updateReceiver(IArchTaskBarReceiver* /*receiver*/) +ArchTaskBarXWindows::updateReceiver(IArchTaskBarReceiver* /*receiver*/) { // do nothing } diff --git a/src/lib/arch/unix/ArchTaskBarXWindows.h b/src/lib/arch/unix/ArchTaskBarXWindows.h index e593c110..b9379347 100644 --- a/src/lib/arch/unix/ArchTaskBarXWindows.h +++ b/src/lib/arch/unix/ArchTaskBarXWindows.h @@ -20,13 +20,13 @@ #include "arch/IArchTaskBar.h" -#define ARCH_TASKBAR CArchTaskBarXWindows +#define ARCH_TASKBAR ArchTaskBarXWindows //! X11 implementation of IArchTaskBar -class CArchTaskBarXWindows : public IArchTaskBar { +class ArchTaskBarXWindows : public IArchTaskBar { public: - CArchTaskBarXWindows(); - virtual ~CArchTaskBarXWindows(); + ArchTaskBarXWindows(); + virtual ~ArchTaskBarXWindows(); // IArchTaskBar overrides virtual void addReceiver(IArchTaskBarReceiver*); diff --git a/src/lib/arch/unix/ArchTimeUnix.cpp b/src/lib/arch/unix/ArchTimeUnix.cpp index 443e1c00..ec688bf2 100644 --- a/src/lib/arch/unix/ArchTimeUnix.cpp +++ b/src/lib/arch/unix/ArchTimeUnix.cpp @@ -30,21 +30,21 @@ #endif // -// CArchTimeUnix +// ArchTimeUnix // -CArchTimeUnix::CArchTimeUnix() +ArchTimeUnix::ArchTimeUnix() { // do nothing } -CArchTimeUnix::~CArchTimeUnix() +ArchTimeUnix::~ArchTimeUnix() { // do nothing } double -CArchTimeUnix::time() +ArchTimeUnix::time() { struct timeval t; gettimeofday(&t, NULL); diff --git a/src/lib/arch/unix/ArchTimeUnix.h b/src/lib/arch/unix/ArchTimeUnix.h index 47f89b98..be030e59 100644 --- a/src/lib/arch/unix/ArchTimeUnix.h +++ b/src/lib/arch/unix/ArchTimeUnix.h @@ -20,13 +20,13 @@ #include "arch/IArchTime.h" -#define ARCH_TIME CArchTimeUnix +#define ARCH_TIME ArchTimeUnix //! Generic Unix implementation of IArchTime -class CArchTimeUnix : public IArchTime { +class ArchTimeUnix : public IArchTime { public: - CArchTimeUnix(); - virtual ~CArchTimeUnix(); + ArchTimeUnix(); + virtual ~ArchTimeUnix(); // IArchTime overrides virtual double time(); diff --git a/src/lib/arch/win32/ArchConsoleWindows.cpp b/src/lib/arch/win32/ArchConsoleWindows.cpp index d00ef4a4..bf5a7866 100644 --- a/src/lib/arch/win32/ArchConsoleWindows.cpp +++ b/src/lib/arch/win32/ArchConsoleWindows.cpp @@ -18,6 +18,6 @@ #include "arch/win32/ArchConsoleWindows.h" -CArchConsoleWindows::CArchConsoleWindows() { } +ArchConsoleWindows::ArchConsoleWindows() { } -CArchConsoleWindows::~CArchConsoleWindows() { } +ArchConsoleWindows::~ArchConsoleWindows() { } diff --git a/src/lib/arch/win32/ArchConsoleWindows.h b/src/lib/arch/win32/ArchConsoleWindows.h index 2db1ae8d..2bc11c6c 100644 --- a/src/lib/arch/win32/ArchConsoleWindows.h +++ b/src/lib/arch/win32/ArchConsoleWindows.h @@ -20,10 +20,10 @@ #include "arch/ArchConsoleStd.h" -#define ARCH_CONSOLE CArchConsoleWindows +#define ARCH_CONSOLE ArchConsoleWindows -class CArchConsoleWindows : public CArchConsoleStd { +class ArchConsoleWindows : public ArchConsoleStd { public: - CArchConsoleWindows(); - virtual ~CArchConsoleWindows(); + ArchConsoleWindows(); + virtual ~ArchConsoleWindows(); }; diff --git a/src/lib/arch/win32/ArchDaemonWindows.cpp b/src/lib/arch/win32/ArchDaemonWindows.cpp index 6e5d33e0..fc0396d6 100644 --- a/src/lib/arch/win32/ArchDaemonWindows.cpp +++ b/src/lib/arch/win32/ArchDaemonWindows.cpp @@ -25,31 +25,31 @@ #include // -// CArchDaemonWindows +// ArchDaemonWindows // -CArchDaemonWindows* CArchDaemonWindows::s_daemon = NULL; +ArchDaemonWindows* ArchDaemonWindows::s_daemon = NULL; -CArchDaemonWindows::CArchDaemonWindows() : +ArchDaemonWindows::ArchDaemonWindows() : m_daemonThreadID(0) { m_quitMessage = RegisterWindowMessage("SynergyDaemonExit"); } -CArchDaemonWindows::~CArchDaemonWindows() +ArchDaemonWindows::~ArchDaemonWindows() { // do nothing } int -CArchDaemonWindows::runDaemon(RunFunc runFunc) +ArchDaemonWindows::runDaemon(RunFunc runFunc) { assert(s_daemon != NULL); return s_daemon->doRunDaemon(runFunc); } void -CArchDaemonWindows::daemonRunning(bool running) +ArchDaemonWindows::daemonRunning(bool running) { if (s_daemon != NULL) { s_daemon->doDaemonRunning(running); @@ -57,7 +57,7 @@ CArchDaemonWindows::daemonRunning(bool running) } UINT -CArchDaemonWindows::getDaemonQuitMessage() +ArchDaemonWindows::getDaemonQuitMessage() { if (s_daemon != NULL) { return s_daemon->doGetDaemonQuitMessage(); @@ -68,14 +68,14 @@ CArchDaemonWindows::getDaemonQuitMessage() } void -CArchDaemonWindows::daemonFailed(int result) +ArchDaemonWindows::daemonFailed(int result) { assert(s_daemon != NULL); throw XArchDaemonRunFailed(result); } void -CArchDaemonWindows::installDaemon(const char* name, +ArchDaemonWindows::installDaemon(const char* name, const char* description, const char* pathname, const char* commandLine, @@ -122,7 +122,7 @@ CArchDaemonWindows::installDaemon(const char* name, // open the registry key for this service HKEY key = openNTServicesKey(); - key = CArchMiscWindows::addKey(key, name); + key = ArchMiscWindows::addKey(key, name); if (key == NULL) { // can't open key DWORD err = GetLastError(); @@ -136,14 +136,14 @@ CArchDaemonWindows::installDaemon(const char* name, } // set the description - CArchMiscWindows::setValue(key, _T("Description"), description); + ArchMiscWindows::setValue(key, _T("Description"), description); // set command line - key = CArchMiscWindows::addKey(key, _T("Parameters")); + key = ArchMiscWindows::addKey(key, _T("Parameters")); if (key == NULL) { // can't open key DWORD err = GetLastError(); - CArchMiscWindows::closeKey(key); + ArchMiscWindows::closeKey(key); try { uninstallDaemon(name); } @@ -152,21 +152,21 @@ CArchDaemonWindows::installDaemon(const char* name, } throw XArchDaemonInstallFailed(new XArchEvalWindows(err)); } - CArchMiscWindows::setValue(key, _T("CommandLine"), commandLine); + ArchMiscWindows::setValue(key, _T("CommandLine"), commandLine); // done with registry - CArchMiscWindows::closeKey(key); + ArchMiscWindows::closeKey(key); } void -CArchDaemonWindows::uninstallDaemon(const char* name) +ArchDaemonWindows::uninstallDaemon(const char* name) { // remove parameters for this service. ignore failures. HKEY key = openNTServicesKey(); - key = CArchMiscWindows::openKey(key, name); + key = ArchMiscWindows::openKey(key, name); if (key != NULL) { - CArchMiscWindows::deleteKey(key, _T("Parameters")); - CArchMiscWindows::closeKey(key); + ArchMiscWindows::deleteKey(key, _T("Parameters")); + ArchMiscWindows::closeKey(key); } // open service manager @@ -223,7 +223,7 @@ CArchDaemonWindows::uninstallDaemon(const char* name) } int -CArchDaemonWindows::daemonize(const char* name, DaemonFunc func) +ArchDaemonWindows::daemonize(const char* name, DaemonFunc func) { assert(name != NULL); assert(func != NULL); @@ -234,7 +234,7 @@ CArchDaemonWindows::daemonize(const char* name, DaemonFunc func) // construct the service entry SERVICE_TABLE_ENTRY entry[2]; entry[0].lpServiceName = const_cast(name); - entry[0].lpServiceProc = &CArchDaemonWindows::serviceMainEntry; + entry[0].lpServiceProc = &ArchDaemonWindows::serviceMainEntry; entry[1].lpServiceName = NULL; entry[1].lpServiceProc = NULL; @@ -252,7 +252,7 @@ CArchDaemonWindows::daemonize(const char* name, DaemonFunc func) } bool -CArchDaemonWindows::canInstallDaemon(const char* /*name*/) +ArchDaemonWindows::canInstallDaemon(const char* /*name*/) { // check if we can open service manager for 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 HKEY key = openNTServicesKey(); - CArchMiscWindows::closeKey(key); + ArchMiscWindows::closeKey(key); return (key != NULL); } bool -CArchDaemonWindows::isDaemonInstalled(const char* name) +ArchDaemonWindows::isDaemonInstalled(const char* name) { // open service manager SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ); @@ -290,7 +290,7 @@ CArchDaemonWindows::isDaemonInstalled(const char* name) } HKEY -CArchDaemonWindows::openNTServicesKey() +ArchDaemonWindows::openNTServicesKey() { static const char* s_keyNames[] = { _T("SYSTEM"), @@ -299,11 +299,11 @@ CArchDaemonWindows::openNTServicesKey() NULL }; - return CArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_keyNames); + return ArchMiscWindows::addKey(HKEY_LOCAL_MACHINE, s_keyNames); } bool -CArchDaemonWindows::isRunState(DWORD state) +ArchDaemonWindows::isRunState(DWORD state) { switch (state) { case SERVICE_START_PENDING: @@ -317,7 +317,7 @@ CArchDaemonWindows::isRunState(DWORD state) } int -CArchDaemonWindows::doRunDaemon(RunFunc run) +ArchDaemonWindows::doRunDaemon(RunFunc run) { // should only be called from DaemonFunc assert(m_serviceMutex != NULL); @@ -370,7 +370,7 @@ CArchDaemonWindows::doRunDaemon(RunFunc run) } void -CArchDaemonWindows::doDaemonRunning(bool running) +ArchDaemonWindows::doDaemonRunning(bool running) { ARCH->lockMutex(m_serviceMutex); if (running) { @@ -382,19 +382,19 @@ CArchDaemonWindows::doDaemonRunning(bool running) } UINT -CArchDaemonWindows::doGetDaemonQuitMessage() +ArchDaemonWindows::doGetDaemonQuitMessage() { return m_quitMessage; } void -CArchDaemonWindows::setStatus(DWORD state) +ArchDaemonWindows::setStatus(DWORD state) { setStatus(state, 0, 0); } void -CArchDaemonWindows::setStatus(DWORD state, DWORD step, DWORD waitHint) +ArchDaemonWindows::setStatus(DWORD state, DWORD step, DWORD waitHint) { assert(s_daemon != NULL); @@ -413,7 +413,7 @@ CArchDaemonWindows::setStatus(DWORD state, DWORD step, DWORD waitHint) } void -CArchDaemonWindows::setStatusError(DWORD error) +ArchDaemonWindows::setStatusError(DWORD error) { assert(s_daemon != NULL); @@ -432,7 +432,7 @@ CArchDaemonWindows::setStatusError(DWORD error) } void -CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn) +ArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn) { typedef std::vector ArgList; typedef std::vector Arguments; @@ -444,7 +444,7 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn) // register our service handler function m_statusHandle = RegisterServiceCtrlHandler(argv[0], - &CArchDaemonWindows::serviceHandlerEntry); + &ArchDaemonWindows::serviceHandlerEntry); if (m_statusHandle == 0) { // cannot start as service m_daemonResult = -1; @@ -466,10 +466,10 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn) if (argc <= 1) { // read command line HKEY key = openNTServicesKey(); - key = CArchMiscWindows::openKey(key, argvIn[0]); - key = CArchMiscWindows::openKey(key, _T("Parameters")); + key = ArchMiscWindows::openKey(key, argvIn[0]); + key = ArchMiscWindows::openKey(key, _T("Parameters")); if (key != NULL) { - commandLine = CArchMiscWindows::readValueString(key, + commandLine = ArchMiscWindows::readValueString(key, _T("CommandLine")); } @@ -553,13 +553,13 @@ CArchDaemonWindows::serviceMain(DWORD argc, LPTSTR* argvIn) } void WINAPI -CArchDaemonWindows::serviceMainEntry(DWORD argc, LPTSTR* argv) +ArchDaemonWindows::serviceMainEntry(DWORD argc, LPTSTR* argv) { s_daemon->serviceMain(argc, argv); } void -CArchDaemonWindows::serviceHandler(DWORD ctrl) +ArchDaemonWindows::serviceHandler(DWORD ctrl) { assert(m_serviceMutex != NULL); assert(m_serviceCondVar != NULL); @@ -616,13 +616,13 @@ CArchDaemonWindows::serviceHandler(DWORD ctrl) } void WINAPI -CArchDaemonWindows::serviceHandlerEntry(DWORD ctrl) +ArchDaemonWindows::serviceHandlerEntry(DWORD ctrl) { s_daemon->serviceHandler(ctrl); } void -CArchDaemonWindows::start(const char* name) +ArchDaemonWindows::start(const char* name) { // open service manager SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ); @@ -646,7 +646,7 @@ CArchDaemonWindows::start(const char* name) } void -CArchDaemonWindows::stop(const char* name) +ArchDaemonWindows::stop(const char* name) { // open service manager SC_HANDLE mgr = OpenSCManager(NULL, NULL, GENERIC_READ); @@ -675,12 +675,12 @@ CArchDaemonWindows::stop(const char* name) } void -CArchDaemonWindows::installDaemon() +ArchDaemonWindows::installDaemon() { // install default daemon if not already installed. if (!isDaemonInstalled(DEFAULT_DAEMON_NAME)) { 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. std::stringstream ss; @@ -695,7 +695,7 @@ CArchDaemonWindows::installDaemon() } void -CArchDaemonWindows::uninstallDaemon() +ArchDaemonWindows::uninstallDaemon() { // remove legacy services if installed. if (isDaemonInstalled(LEGACY_SERVER_DAEMON_NAME)) { diff --git a/src/lib/arch/win32/ArchDaemonWindows.h b/src/lib/arch/win32/ArchDaemonWindows.h index a51dcc94..d940d3de 100644 --- a/src/lib/arch/win32/ArchDaemonWindows.h +++ b/src/lib/arch/win32/ArchDaemonWindows.h @@ -26,15 +26,15 @@ #include #include -#define ARCH_DAEMON CArchDaemonWindows +#define ARCH_DAEMON ArchDaemonWindows //! Win32 implementation of IArchDaemon -class CArchDaemonWindows : public IArchDaemon { +class ArchDaemonWindows : public IArchDaemon { public: typedef int (*RunFunc)(void); - CArchDaemonWindows(); - virtual ~CArchDaemonWindows(); + ArchDaemonWindows(); + virtual ~ArchDaemonWindows(); //! Run the daemon /*! @@ -120,10 +120,10 @@ private: }; private: - static CArchDaemonWindows* s_daemon; + static ArchDaemonWindows* s_daemon; - CArchMutex m_serviceMutex; - CArchCond m_serviceCondVar; + ArchMutex m_serviceMutex; + ArchCond m_serviceCondVar; DWORD m_serviceState; bool m_serviceHandlerWaiting; bool m_serviceRunning; diff --git a/src/lib/arch/win32/ArchFileWindows.cpp b/src/lib/arch/win32/ArchFileWindows.cpp index 3428e220..b99ea6ea 100644 --- a/src/lib/arch/win32/ArchFileWindows.cpp +++ b/src/lib/arch/win32/ArchFileWindows.cpp @@ -25,21 +25,21 @@ #include // -// CArchFileWindows +// ArchFileWindows // -CArchFileWindows::CArchFileWindows() +ArchFileWindows::ArchFileWindows() { // do nothing } -CArchFileWindows::~CArchFileWindows() +ArchFileWindows::~ArchFileWindows() { // do nothing } const char* -CArchFileWindows::getBasename(const char* pathname) +ArchFileWindows::getBasename(const char* pathname) { if (pathname == NULL) { return NULL; @@ -64,7 +64,7 @@ CArchFileWindows::getBasename(const char* pathname) } std::string -CArchFileWindows::getUserDirectory() +ArchFileWindows::getUserDirectory() { // try %HOMEPATH% TCHAR dir[MAX_PATH]; @@ -108,7 +108,7 @@ CArchFileWindows::getUserDirectory() } std::string -CArchFileWindows::getSystemDirectory() +ArchFileWindows::getSystemDirectory() { // get windows directory char dir[MAX_PATH]; @@ -122,7 +122,7 @@ CArchFileWindows::getSystemDirectory() } std::string -CArchFileWindows::getInstalledDirectory() +ArchFileWindows::getInstalledDirectory() { char fileNameBuffer[MAX_PATH]; GetModuleFileName(NULL, fileNameBuffer, MAX_PATH); @@ -134,13 +134,13 @@ CArchFileWindows::getInstalledDirectory() } std::string -CArchFileWindows::getLogDirectory() +ArchFileWindows::getLogDirectory() { return getInstalledDirectory(); } std::string -CArchFileWindows::concatPath(const std::string& prefix, +ArchFileWindows::concatPath(const std::string& prefix, const std::string& suffix) { std::string path; diff --git a/src/lib/arch/win32/ArchFileWindows.h b/src/lib/arch/win32/ArchFileWindows.h index 6ba44ec0..2e5b940a 100644 --- a/src/lib/arch/win32/ArchFileWindows.h +++ b/src/lib/arch/win32/ArchFileWindows.h @@ -20,13 +20,13 @@ #include "arch/IArchFile.h" -#define ARCH_FILE CArchFileWindows +#define ARCH_FILE ArchFileWindows //! Win32 implementation of IArchFile -class CArchFileWindows : public IArchFile { +class ArchFileWindows : public IArchFile { public: - CArchFileWindows(); - virtual ~CArchFileWindows(); + ArchFileWindows(); + virtual ~ArchFileWindows(); // IArchFile overrides virtual const char* getBasename(const char* pathname); diff --git a/src/lib/arch/win32/ArchInternetWindows.cpp b/src/lib/arch/win32/ArchInternetWindows.cpp index c19aed22..2f594b16 100644 --- a/src/lib/arch/win32/ArchInternetWindows.cpp +++ b/src/lib/arch/win32/ArchInternetWindows.cpp @@ -24,20 +24,20 @@ #include #include -struct CWinINetUrl { - CString m_scheme; - CString m_host; - CString m_path; +struct WinINetUrl { + String m_scheme; + String m_host; + String m_path; INTERNET_PORT m_port; DWORD m_flags; }; -class CWinINetRequest { +class WinINetRequest { public: - CWinINetRequest(const CString& url); - ~CWinINetRequest(); + WinINetRequest(const String& url); + ~WinINetRequest(); - CString send(); + String send(); void openSession(); void connect(); void openRequest(); @@ -46,23 +46,23 @@ private: HINTERNET m_session; HINTERNET m_connect; HINTERNET m_request; - CWinINetUrl m_url; + WinINetUrl m_url; bool m_used; }; // -// CArchInternetWindows +// ArchInternetWindows // -CString -CArchInternetWindows::get(const CString& url) +String +ArchInternetWindows::get(const String& url) { - CWinINetRequest request(url); + WinINetRequest request(url); return request.send(); } -CString -CArchInternetWindows::urlEncode(const CString& url) +String +ArchInternetWindows::urlEncode(const String& url) { TCHAR buffer[1024]; DWORD bufferSize = sizeof(buffer); @@ -71,7 +71,7 @@ CArchInternetWindows::urlEncode(const CString& url) throw XArch(new XArchEvalWindows()); } - CString result(buffer); + String result(buffer); // the win32 url encoding funcitons are pretty useless (to us) and only // 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_connect(NULL), m_request(NULL), @@ -97,7 +97,7 @@ CWinINetRequest::CWinINetRequest(const CString& url) : { } -CWinINetRequest::~CWinINetRequest() +WinINetRequest::~WinINetRequest() { if (m_request != NULL) { InternetCloseHandle(m_request); @@ -112,8 +112,8 @@ CWinINetRequest::~CWinINetRequest() } } -CString -CWinINetRequest::send() +String +WinINetRequest::send() { if (m_used) { throw XArch("class is one time use."); @@ -124,7 +124,7 @@ CWinINetRequest::send() connect(); 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)) { throw XArch(new XArchEvalWindows()); } @@ -143,7 +143,7 @@ CWinINetRequest::send() } void -CWinINetRequest::openSession() +WinINetRequest::openSession() { std::stringstream userAgent; userAgent << "Synergy "; @@ -162,7 +162,7 @@ CWinINetRequest::openSession() } void -CWinINetRequest::connect() +WinINetRequest::connect() { m_connect = InternetConnect( m_session, @@ -180,7 +180,7 @@ CWinINetRequest::connect() } void -CWinINetRequest::openRequest() +WinINetRequest::openRequest() { m_request = HttpOpenRequest( m_connect, @@ -200,10 +200,10 @@ CWinINetRequest::openRequest() // 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. // this works fine with simple urls, but doesn't consider the full url spec. -static CWinINetUrl -parseUrl(const CString& url) +static WinINetUrl +parseUrl(const String& url) { - CWinINetUrl parsed; + WinINetUrl parsed; size_t schemeEnd = url.find("://"); size_t hostEnd = url.find('/', schemeEnd + 3); @@ -215,7 +215,7 @@ parseUrl(const CString& url) parsed.m_port = INTERNET_DEFAULT_HTTP_PORT; 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_flags = INTERNET_FLAG_SECURE; } diff --git a/src/lib/arch/win32/ArchInternetWindows.h b/src/lib/arch/win32/ArchInternetWindows.h index 661d0964..135c43a1 100644 --- a/src/lib/arch/win32/ArchInternetWindows.h +++ b/src/lib/arch/win32/ArchInternetWindows.h @@ -17,12 +17,12 @@ #pragma once -#define ARCH_INTERNET CArchInternetWindows +#define ARCH_INTERNET ArchInternetWindows #include "base/String.h" -class CArchInternetWindows { +class ArchInternetWindows { public: - CString get(const CString& url); - CString urlEncode(const CString& url); + String get(const String& url); + String urlEncode(const String& url); }; diff --git a/src/lib/arch/win32/ArchLogWindows.cpp b/src/lib/arch/win32/ArchLogWindows.cpp index 16fea305..ad607593 100644 --- a/src/lib/arch/win32/ArchLogWindows.cpp +++ b/src/lib/arch/win32/ArchLogWindows.cpp @@ -22,21 +22,21 @@ #include // -// CArchLogWindows +// ArchLogWindows // -CArchLogWindows::CArchLogWindows() : m_eventLog(NULL) +ArchLogWindows::ArchLogWindows() : m_eventLog(NULL) { // do nothing } -CArchLogWindows::~CArchLogWindows() +ArchLogWindows::~ArchLogWindows() { // do nothing } void -CArchLogWindows::openLog(const char* name) +ArchLogWindows::openLog(const char* name) { if (m_eventLog == NULL) { m_eventLog = RegisterEventSource(NULL, name); @@ -44,7 +44,7 @@ CArchLogWindows::openLog(const char* name) } void -CArchLogWindows::closeLog() +ArchLogWindows::closeLog() { if (m_eventLog != NULL) { DeregisterEventSource(m_eventLog); @@ -53,13 +53,13 @@ CArchLogWindows::closeLog() } void -CArchLogWindows::showLog(bool) +ArchLogWindows::showLog(bool) { // do nothing } void -CArchLogWindows::writeLog(ELevel level, const char* msg) +ArchLogWindows::writeLog(ELevel level, const char* msg) { if (m_eventLog != NULL) { // convert priority diff --git a/src/lib/arch/win32/ArchLogWindows.h b/src/lib/arch/win32/ArchLogWindows.h index 8fe362c8..60c97fd0 100644 --- a/src/lib/arch/win32/ArchLogWindows.h +++ b/src/lib/arch/win32/ArchLogWindows.h @@ -23,13 +23,13 @@ #define WIN32_LEAN_AND_MEAN #include -#define ARCH_LOG CArchLogWindows +#define ARCH_LOG ArchLogWindows //! Win32 implementation of IArchLog -class CArchLogWindows : public IArchLog { +class ArchLogWindows : public IArchLog { public: - CArchLogWindows(); - virtual ~CArchLogWindows(); + ArchLogWindows(); + virtual ~ArchLogWindows(); // IArchLog overrides virtual void openLog(const char* name); diff --git a/src/lib/arch/win32/ArchMiscWindows.cpp b/src/lib/arch/win32/ArchMiscWindows.cpp index d71b0cd1..db299bf7 100644 --- a/src/lib/arch/win32/ArchMiscWindows.cpp +++ b/src/lib/arch/win32/ArchMiscWindows.cpp @@ -41,92 +41,92 @@ typedef DWORD EXECUTION_STATE; // -// CArchMiscWindows +// ArchMiscWindows // -CArchMiscWindows::CDialogs* CArchMiscWindows::s_dialogs = NULL; -DWORD CArchMiscWindows::s_busyState = 0; -CArchMiscWindows::STES_t CArchMiscWindows::s_stes = NULL; -HICON CArchMiscWindows::s_largeIcon = NULL; -HICON CArchMiscWindows::s_smallIcon = NULL; -HINSTANCE CArchMiscWindows::s_instanceWin32 = NULL; +ArchMiscWindows::Dialogs* ArchMiscWindows::s_dialogs = NULL; +DWORD ArchMiscWindows::s_busyState = 0; +ArchMiscWindows::STES_t ArchMiscWindows::s_stes = NULL; +HICON ArchMiscWindows::s_largeIcon = NULL; +HICON ArchMiscWindows::s_smallIcon = NULL; +HINSTANCE ArchMiscWindows::s_instanceWin32 = NULL; void -CArchMiscWindows::cleanup() +ArchMiscWindows::cleanup() { delete s_dialogs; } void -CArchMiscWindows::init() +ArchMiscWindows::init() { - s_dialogs = new CDialogs; + s_dialogs = new Dialogs; } void -CArchMiscWindows::setIcons(HICON largeIcon, HICON smallIcon) +ArchMiscWindows::setIcons(HICON largeIcon, HICON smallIcon) { s_largeIcon = largeIcon; s_smallIcon = smallIcon; } void -CArchMiscWindows::getIcons(HICON& largeIcon, HICON& smallIcon) +ArchMiscWindows::getIcons(HICON& largeIcon, HICON& smallIcon) { largeIcon = s_largeIcon; smallIcon = s_smallIcon; } int -CArchMiscWindows::runDaemon(RunFunc runFunc) +ArchMiscWindows::runDaemon(RunFunc runFunc) { - return CArchDaemonWindows::runDaemon(runFunc); + return ArchDaemonWindows::runDaemon(runFunc); } void -CArchMiscWindows::daemonRunning(bool running) +ArchMiscWindows::daemonRunning(bool running) { - CArchDaemonWindows::daemonRunning(running); + ArchDaemonWindows::daemonRunning(running); } void -CArchMiscWindows::daemonFailed(int result) +ArchMiscWindows::daemonFailed(int result) { - CArchDaemonWindows::daemonFailed(result); + ArchDaemonWindows::daemonFailed(result); } UINT -CArchMiscWindows::getDaemonQuitMessage() +ArchMiscWindows::getDaemonQuitMessage() { - return CArchDaemonWindows::getDaemonQuitMessage(); + return ArchDaemonWindows::getDaemonQuitMessage(); } HKEY -CArchMiscWindows::openKey(HKEY key, const TCHAR* keyName) +ArchMiscWindows::openKey(HKEY key, const TCHAR* keyName) { return openKey(key, keyName, false); } HKEY -CArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames) +ArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames) { return openKey(key, keyNames, false); } HKEY -CArchMiscWindows::addKey(HKEY key, const TCHAR* keyName) +ArchMiscWindows::addKey(HKEY key, const TCHAR* keyName) { return openKey(key, keyName, true); } HKEY -CArchMiscWindows::addKey(HKEY key, const TCHAR* const* keyNames) +ArchMiscWindows::addKey(HKEY key, const TCHAR* const* keyNames) { return openKey(key, keyNames, true); } HKEY -CArchMiscWindows::openKey(HKEY key, const TCHAR* keyName, bool create) +ArchMiscWindows::openKey(HKEY key, const TCHAR* keyName, bool create) { // ignore if parent is NULL if (key == NULL) { @@ -154,7 +154,7 @@ CArchMiscWindows::openKey(HKEY key, const TCHAR* keyName, bool create) } 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) { // open next key @@ -164,7 +164,7 @@ CArchMiscWindows::openKey(HKEY key, const TCHAR* const* keyNames, bool create) } void -CArchMiscWindows::closeKey(HKEY key) +ArchMiscWindows::closeKey(HKEY key) { assert(key != NULL); if (key==NULL) return; @@ -172,7 +172,7 @@ CArchMiscWindows::closeKey(HKEY key) } void -CArchMiscWindows::deleteKey(HKEY key, const TCHAR* name) +ArchMiscWindows::deleteKey(HKEY key, const TCHAR* name) { assert(key != NULL); assert(name != NULL); @@ -181,7 +181,7 @@ CArchMiscWindows::deleteKey(HKEY key, const TCHAR* name) } void -CArchMiscWindows::deleteValue(HKEY key, const TCHAR* name) +ArchMiscWindows::deleteValue(HKEY key, const TCHAR* name) { assert(key != NULL); assert(name != NULL); @@ -190,7 +190,7 @@ CArchMiscWindows::deleteValue(HKEY key, const TCHAR* name) } bool -CArchMiscWindows::hasValue(HKEY key, const TCHAR* name) +ArchMiscWindows::hasValue(HKEY key, const TCHAR* name) { DWORD type; 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)); } -CArchMiscWindows::EValueType -CArchMiscWindows::typeOfValue(HKEY key, const TCHAR* name) +ArchMiscWindows::EValueType +ArchMiscWindows::typeOfValue(HKEY key, const TCHAR* name) { DWORD type; LONG result = RegQueryValueEx(key, name, 0, &type, NULL, NULL); @@ -222,7 +222,7 @@ CArchMiscWindows::typeOfValue(HKEY key, const TCHAR* name) } void -CArchMiscWindows::setValue(HKEY key, +ArchMiscWindows::setValue(HKEY key, const TCHAR* name, const std::string& value) { assert(key != NULL); @@ -233,7 +233,7 @@ CArchMiscWindows::setValue(HKEY key, } void -CArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value) +ArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value) { assert(key != NULL); if(key ==NULL) return; // TODO: throw exception @@ -243,7 +243,7 @@ CArchMiscWindows::setValue(HKEY key, const TCHAR* name, DWORD value) } void -CArchMiscWindows::setValueBinary(HKEY key, +ArchMiscWindows::setValueBinary(HKEY key, const TCHAR* name, const std::string& value) { assert(key != NULL); @@ -255,7 +255,7 @@ CArchMiscWindows::setValueBinary(HKEY key, } 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 DWORD actualType; @@ -292,19 +292,19 @@ CArchMiscWindows::readBinaryOrString(HKEY key, const TCHAR* name, DWORD type) } std::string -CArchMiscWindows::readValueString(HKEY key, const TCHAR* name) +ArchMiscWindows::readValueString(HKEY key, const TCHAR* name) { return readBinaryOrString(key, name, REG_SZ); } std::string -CArchMiscWindows::readValueBinary(HKEY key, const TCHAR* name) +ArchMiscWindows::readValueBinary(HKEY key, const TCHAR* name) { return readBinaryOrString(key, name, REG_BINARY); } DWORD -CArchMiscWindows::readValueInt(HKEY key, const TCHAR* name) +ArchMiscWindows::readValueInt(HKEY key, const TCHAR* name) { DWORD type; DWORD value; @@ -318,21 +318,21 @@ CArchMiscWindows::readValueInt(HKEY key, const TCHAR* name) } void -CArchMiscWindows::addDialog(HWND hwnd) +ArchMiscWindows::addDialog(HWND hwnd) { s_dialogs->insert(hwnd); } void -CArchMiscWindows::removeDialog(HWND hwnd) +ArchMiscWindows::removeDialog(HWND hwnd) { s_dialogs->erase(hwnd); } 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) { if (IsDialogMessage(*index, msg)) { return true; @@ -342,21 +342,21 @@ CArchMiscWindows::processDialog(MSG* msg) } void -CArchMiscWindows::addBusyState(DWORD busyModes) +ArchMiscWindows::addBusyState(DWORD busyModes) { s_busyState |= busyModes; setThreadExecutionState(s_busyState); } void -CArchMiscWindows::removeBusyState(DWORD busyModes) +ArchMiscWindows::removeBusyState(DWORD busyModes) { s_busyState &= ~busyModes; setThreadExecutionState(s_busyState); } void -CArchMiscWindows::setThreadExecutionState(DWORD busyModes) +ArchMiscWindows::setThreadExecutionState(DWORD busyModes) { // look up function dynamically so we work on older systems if (s_stes == NULL) { @@ -366,7 +366,7 @@ CArchMiscWindows::setThreadExecutionState(DWORD busyModes) "SetThreadExecutionState")); } if (s_stes == NULL) { - s_stes = &CArchMiscWindows::dummySetThreadExecutionState; + s_stes = &ArchMiscWindows::dummySetThreadExecutionState; } } @@ -387,14 +387,14 @@ CArchMiscWindows::setThreadExecutionState(DWORD busyModes) } DWORD -CArchMiscWindows::dummySetThreadExecutionState(DWORD) +ArchMiscWindows::dummySetThreadExecutionState(DWORD) { // do nothing return 0; } void -CArchMiscWindows::wakeupDisplay() +ArchMiscWindows::wakeupDisplay() { // We can't use ::setThreadExecutionState here because it sets // ES_CONTINUOUS, which we don't want. @@ -406,7 +406,7 @@ CArchMiscWindows::wakeupDisplay() "SetThreadExecutionState")); } if (s_stes == NULL) { - s_stes = &CArchMiscWindows::dummySetThreadExecutionState; + s_stes = &ArchMiscWindows::dummySetThreadExecutionState; } } @@ -417,9 +417,9 @@ CArchMiscWindows::wakeupDisplay() } bool -CArchMiscWindows::wasLaunchedAsService() +ArchMiscWindows::wasLaunchedAsService() { - CString name; + String name; if (!getParentProcessName(name)) { LOG((CLOG_ERR "cannot determine if process was launched as service")); return false; @@ -429,7 +429,7 @@ CArchMiscWindows::wasLaunchedAsService() } bool -CArchMiscWindows::getParentProcessName(CString &name) +ArchMiscWindows::getParentProcessName(String &name) { PROCESSENTRY32 parentEntry; if (!getParentProcessEntry(parentEntry)){ @@ -442,14 +442,14 @@ CArchMiscWindows::getParentProcessName(CString &name) } BOOL WINAPI -CArchMiscWindows::getSelfProcessEntry(PROCESSENTRY32& entry) +ArchMiscWindows::getSelfProcessEntry(PROCESSENTRY32& entry) { // get entry from current PID return getProcessEntry(entry, GetCurrentProcessId()); } BOOL WINAPI -CArchMiscWindows::getParentProcessEntry(PROCESSENTRY32& entry) +ArchMiscWindows::getParentProcessEntry(PROCESSENTRY32& entry) { // get the current process, so we can get parent PID PROCESSENTRY32 selfEntry; @@ -462,7 +462,7 @@ CArchMiscWindows::getParentProcessEntry(PROCESSENTRY32& entry) } 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 HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); @@ -498,14 +498,14 @@ CArchMiscWindows::getProcessEntry(PROCESSENTRY32& entry, DWORD processID) } HINSTANCE -CArchMiscWindows::instanceWin32() +ArchMiscWindows::instanceWin32() { assert(s_instanceWin32 != NULL); return s_instanceWin32; } void -CArchMiscWindows::setInstanceWin32(HINSTANCE instance) +ArchMiscWindows::setInstanceWin32(HINSTANCE instance) { assert(instance != NULL); s_instanceWin32 = instance; diff --git a/src/lib/arch/win32/ArchMiscWindows.h b/src/lib/arch/win32/ArchMiscWindows.h index 7431409a..b3bb95df 100644 --- a/src/lib/arch/win32/ArchMiscWindows.h +++ b/src/lib/arch/win32/ArchMiscWindows.h @@ -28,7 +28,7 @@ #include //! Miscellaneous win32 functions. -class CArchMiscWindows { +class ArchMiscWindows { public: enum EValueType { kUNKNOWN, @@ -65,25 +65,25 @@ public: //! Run the daemon /*! - Delegates to CArchDaemonWindows. + Delegates to ArchDaemonWindows. */ static int runDaemon(RunFunc runFunc); //! Indicate daemon is in main loop /*! - Delegates to CArchDaemonWindows. + Delegates to ArchDaemonWindows. */ static void daemonRunning(bool running); //! Indicate failure of running daemon /*! - Delegates to CArchDaemonWindows. + Delegates to ArchDaemonWindows. */ static void daemonFailed(int result); //! Get daemon quit message /*! - Delegates to CArchDaemonWindows. + Delegates to ArchDaemonWindows. */ static UINT getDaemonQuitMessage(); @@ -163,7 +163,7 @@ public: static bool wasLaunchedAsService(); //! Returns true if we got the parent process name. - static bool getParentProcessName(CString &name); + static bool getParentProcessName(String &name); static HINSTANCE instanceWin32(); @@ -190,10 +190,10 @@ private: static DWORD WINAPI dummySetThreadExecutionState(DWORD); private: - typedef std::set CDialogs; + typedef std::set Dialogs; typedef DWORD (WINAPI *STES_t)(DWORD); - static CDialogs* s_dialogs; + static Dialogs* s_dialogs; static DWORD s_busyState; static STES_t s_stes; static HICON s_largeIcon; diff --git a/src/lib/arch/win32/ArchMultithreadWindows.cpp b/src/lib/arch/win32/ArchMultithreadWindows.cpp index de374b61..3d1117a0 100644 --- a/src/lib/arch/win32/ArchMultithreadWindows.cpp +++ b/src/lib/arch/win32/ArchMultithreadWindows.cpp @@ -37,13 +37,13 @@ // // -// CArchThreadImpl +// ArchThreadImpl // -class CArchThreadImpl { +class ArchThreadImpl { public: - CArchThreadImpl(); - ~CArchThreadImpl(); + ArchThreadImpl(); + ~ArchThreadImpl(); public: int m_refCount; @@ -58,7 +58,7 @@ public: void* m_networkData; }; -CArchThreadImpl::CArchThreadImpl() : +ArchThreadImpl::ArchThreadImpl() : m_refCount(1), m_thread(NULL), m_id(0), @@ -72,7 +72,7 @@ CArchThreadImpl::CArchThreadImpl() : m_cancel = CreateEvent(NULL, TRUE, FALSE, NULL); } -CArchThreadImpl::~CArchThreadImpl() +ArchThreadImpl::~ArchThreadImpl() { CloseHandle(m_exit); 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); s_instance = this; @@ -101,18 +101,18 @@ CArchMultithreadWindows::CArchMultithreadWindows() // create thread for calling (main) thread and add it to our // 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_id = GetCurrentThreadId(); insert(m_mainThread); } -CArchMultithreadWindows::~CArchMultithreadWindows() +ArchMultithreadWindows::~ArchMultithreadWindows() { s_instance = NULL; // clean up thread list - for (CThreadList::iterator index = m_threadList.begin(); + for (ThreadList::iterator index = m_threadList.begin(); index != m_threadList.end(); ++index) { delete *index; } @@ -122,16 +122,16 @@ CArchMultithreadWindows::~CArchMultithreadWindows() } void -CArchMultithreadWindows::setNetworkDataForCurrentThread(void* data) +ArchMultithreadWindows::setNetworkDataForCurrentThread(void* data) { lockMutex(m_threadMutex); - CArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); + ArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); thread->m_networkData = data; unlockMutex(m_threadMutex); } void* -CArchMultithreadWindows::getNetworkDataForThread(CArchThread thread) +ArchMultithreadWindows::getNetworkDataForThread(ArchThread thread) { lockMutex(m_threadMutex); void* data = thread->m_networkData; @@ -140,27 +140,27 @@ CArchMultithreadWindows::getNetworkDataForThread(CArchThread thread) } HANDLE -CArchMultithreadWindows::getCancelEventForCurrentThread() +ArchMultithreadWindows::getCancelEventForCurrentThread() { lockMutex(m_threadMutex); - CArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); + ArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); unlockMutex(m_threadMutex); return thread->m_cancel; } -CArchMultithreadWindows* -CArchMultithreadWindows::getInstance() +ArchMultithreadWindows* +ArchMultithreadWindows::getInstance() { return s_instance; } -CArchCond -CArchMultithreadWindows::newCondVar() +ArchCond +ArchMultithreadWindows::newCondVar() { - CArchCondImpl* cond = new CArchCondImpl; - cond->m_events[CArchCondImpl::kSignal] = CreateEvent(NULL, + ArchCondImpl* cond = new ArchCondImpl; + cond->m_events[ArchCondImpl::kSignal] = CreateEvent(NULL, FALSE, FALSE, NULL); - cond->m_events[CArchCondImpl::kBroadcast] = CreateEvent(NULL, + cond->m_events[ArchCondImpl::kBroadcast] = CreateEvent(NULL, TRUE, FALSE, NULL); cond->m_waitCountMutex = newMutex(); cond->m_waitCount = 0; @@ -168,16 +168,16 @@ CArchMultithreadWindows::newCondVar() } void -CArchMultithreadWindows::closeCondVar(CArchCond cond) +ArchMultithreadWindows::closeCondVar(ArchCond cond) { - CloseHandle(cond->m_events[CArchCondImpl::kSignal]); - CloseHandle(cond->m_events[CArchCondImpl::kBroadcast]); + CloseHandle(cond->m_events[ArchCondImpl::kSignal]); + CloseHandle(cond->m_events[ArchCondImpl::kBroadcast]); closeMutex(cond->m_waitCountMutex); delete cond; } void -CArchMultithreadWindows::signalCondVar(CArchCond cond) +ArchMultithreadWindows::signalCondVar(ArchCond cond) { // is anybody waiting? lockMutex(cond->m_waitCountMutex); @@ -186,12 +186,12 @@ CArchMultithreadWindows::signalCondVar(CArchCond cond) // wake one thread if anybody is waiting if (hasWaiter) { - SetEvent(cond->m_events[CArchCondImpl::kSignal]); + SetEvent(cond->m_events[ArchCondImpl::kSignal]); } } void -CArchMultithreadWindows::broadcastCondVar(CArchCond cond) +ArchMultithreadWindows::broadcastCondVar(ArchCond cond) { // is anybody waiting? lockMutex(cond->m_waitCountMutex); @@ -200,13 +200,13 @@ CArchMultithreadWindows::broadcastCondVar(CArchCond cond) // wake all threads if anybody is waiting if (hasWaiter) { - SetEvent(cond->m_events[CArchCondImpl::kBroadcast]); + SetEvent(cond->m_events[ArchCondImpl::kBroadcast]); } } bool -CArchMultithreadWindows::waitCondVar(CArchCond cond, - CArchMutex mutex, double timeout) +ArchMultithreadWindows::waitCondVar(ArchCond cond, + ArchMutex mutex, double timeout) { // prepare to wait 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 // for the current thread. HANDLE handles[4]; - handles[0] = cond->m_events[CArchCondImpl::kSignal]; - handles[1] = cond->m_events[CArchCondImpl::kBroadcast]; + handles[0] = cond->m_events[ArchCondImpl::kSignal]; + handles[1] = cond->m_events[ArchCondImpl::kBroadcast]; handles[2] = getCancelEventForCurrentThread(); // update waiter count @@ -248,7 +248,7 @@ CArchMultithreadWindows::waitCondVar(CArchCond cond, // reset the broadcast event if we're the last waiter if (last) { - ResetEvent(cond->m_events[CArchCondImpl::kBroadcast]); + ResetEvent(cond->m_events[ArchCondImpl::kBroadcast]); } // reacquire the mutex @@ -264,40 +264,40 @@ CArchMultithreadWindows::waitCondVar(CArchCond cond, result == WAIT_OBJECT_0 + 1); } -CArchMutex -CArchMultithreadWindows::newMutex() +ArchMutex +ArchMultithreadWindows::newMutex() { - CArchMutexImpl* mutex = new CArchMutexImpl; + ArchMutexImpl* mutex = new ArchMutexImpl; InitializeCriticalSection(&mutex->m_mutex); return mutex; } void -CArchMultithreadWindows::closeMutex(CArchMutex mutex) +ArchMultithreadWindows::closeMutex(ArchMutex mutex) { DeleteCriticalSection(&mutex->m_mutex); delete mutex; } void -CArchMultithreadWindows::lockMutex(CArchMutex mutex) +ArchMultithreadWindows::lockMutex(ArchMutex mutex) { EnterCriticalSection(&mutex->m_mutex); } void -CArchMultithreadWindows::unlockMutex(CArchMutex mutex) +ArchMultithreadWindows::unlockMutex(ArchMutex mutex) { LeaveCriticalSection(&mutex->m_mutex); } -CArchThread -CArchMultithreadWindows::newThread(ThreadFunc func, void* data) +ArchThread +ArchMultithreadWindows::newThread(ThreadFunc func, void* data) { lockMutex(m_threadMutex); // create thread impl for new thread - CArchThreadImpl* thread = new CArchThreadImpl; + ArchThreadImpl* thread = new ArchThreadImpl; thread->m_func = func; thread->m_userData = data; @@ -327,18 +327,18 @@ CArchMultithreadWindows::newThread(ThreadFunc func, void* data) return thread; } -CArchThread -CArchMultithreadWindows::newCurrentThread() +ArchThread +ArchMultithreadWindows::newCurrentThread() { lockMutex(m_threadMutex); - CArchThreadImpl* thread = find(GetCurrentThreadId()); + ArchThreadImpl* thread = find(GetCurrentThreadId()); unlockMutex(m_threadMutex); assert(thread != NULL); return thread; } void -CArchMultithreadWindows::closeThread(CArchThread thread) +ArchMultithreadWindows::closeThread(ArchThread thread) { assert(thread != NULL); @@ -360,15 +360,15 @@ CArchMultithreadWindows::closeThread(CArchThread thread) } } -CArchThread -CArchMultithreadWindows::copyThread(CArchThread thread) +ArchThread +ArchMultithreadWindows::copyThread(ArchThread thread) { refThread(thread); return thread; } void -CArchMultithreadWindows::cancelThread(CArchThread thread) +ArchMultithreadWindows::cancelThread(ArchThread thread) { assert(thread != NULL); @@ -377,14 +377,14 @@ CArchMultithreadWindows::cancelThread(CArchThread thread) } void -CArchMultithreadWindows::setPriorityOfThread(CArchThread thread, int n) +ArchMultithreadWindows::setPriorityOfThread(ArchThread thread, int n) { - struct CPriorityInfo { + struct PriorityInfo { public: DWORD m_class; int m_level; }; - static const CPriorityInfo s_pClass[] = { + static const PriorityInfo s_pClass[] = { { IDLE_PRIORITY_CLASS, THREAD_PRIORITY_IDLE }, { IDLE_PRIORITY_CLASS, THREAD_PRIORITY_LOWEST }, { IDLE_PRIORITY_CLASS, THREAD_PRIORITY_BELOW_NORMAL }, @@ -436,11 +436,11 @@ CArchMultithreadWindows::setPriorityOfThread(CArchThread thread, int n) } void -CArchMultithreadWindows::testCancelThread() +ArchMultithreadWindows::testCancelThread() { // find current thread lockMutex(m_threadMutex); - CArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); + ArchThreadImpl* thread = findNoRef(GetCurrentThreadId()); unlockMutex(m_threadMutex); // test cancel on thread @@ -448,14 +448,14 @@ CArchMultithreadWindows::testCancelThread() } bool -CArchMultithreadWindows::wait(CArchThread target, double timeout) +ArchMultithreadWindows::wait(ArchThread target, double timeout) { assert(target != NULL); lockMutex(m_threadMutex); // find current thread - CArchThreadImpl* self = findNoRef(GetCurrentThreadId()); + ArchThreadImpl* self = findNoRef(GetCurrentThreadId()); // ignore wait if trying to wait on ourself if (target == self) { @@ -510,20 +510,20 @@ CArchMultithreadWindows::wait(CArchThread target, double timeout) } bool -CArchMultithreadWindows::isSameThread(CArchThread thread1, CArchThread thread2) +ArchMultithreadWindows::isSameThread(ArchThread thread1, ArchThread thread2) { return (thread1 == thread2); } bool -CArchMultithreadWindows::isExitedThread(CArchThread thread) +ArchMultithreadWindows::isExitedThread(ArchThread thread) { // poll exit event return (WaitForSingleObject(thread->m_exit, 0) == WAIT_OBJECT_0); } void* -CArchMultithreadWindows::getResultOfThread(CArchThread thread) +ArchMultithreadWindows::getResultOfThread(ArchThread thread) { lockMutex(m_threadMutex); void* result = thread->m_result; @@ -532,13 +532,13 @@ CArchMultithreadWindows::getResultOfThread(CArchThread thread) } IArchMultithread::ThreadID -CArchMultithreadWindows::getIDOfThread(CArchThread thread) +ArchMultithreadWindows::getIDOfThread(ArchThread thread) { return static_cast(thread->m_id); } void -CArchMultithreadWindows::setSignalHandler( +ArchMultithreadWindows::setSignalHandler( ESignal signal, SignalFunc func, void* userData) { lockMutex(m_threadMutex); @@ -548,7 +548,7 @@ CArchMultithreadWindows::setSignalHandler( } void -CArchMultithreadWindows::raiseSignal(ESignal signal) +ArchMultithreadWindows::raiseSignal(ESignal signal) { lockMutex(m_threadMutex); if (m_signalFunc[signal] != NULL) { @@ -561,26 +561,26 @@ CArchMultithreadWindows::raiseSignal(ESignal signal) unlockMutex(m_threadMutex); } -CArchThreadImpl* -CArchMultithreadWindows::find(DWORD id) +ArchThreadImpl* +ArchMultithreadWindows::find(DWORD id) { - CArchThreadImpl* impl = findNoRef(id); + ArchThreadImpl* impl = findNoRef(id); if (impl != NULL) { refThread(impl); } return impl; } -CArchThreadImpl* -CArchMultithreadWindows::findNoRef(DWORD id) +ArchThreadImpl* +ArchMultithreadWindows::findNoRef(DWORD id) { - CArchThreadImpl* impl = findNoRefOrCreate(id); + ArchThreadImpl* impl = findNoRefOrCreate(id); if (impl == NULL) { // 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 // the system calls us under a new thread, like it does when we // run as a service. - impl = new CArchThreadImpl; + impl = new ArchThreadImpl; impl->m_thread = NULL; impl->m_id = GetCurrentThreadId(); insert(impl); @@ -588,11 +588,11 @@ CArchMultithreadWindows::findNoRef(DWORD id) return impl; } -CArchThreadImpl* -CArchMultithreadWindows::findNoRefOrCreate(DWORD id) +ArchThreadImpl* +ArchMultithreadWindows::findNoRefOrCreate(DWORD id) { // linear search - for (CThreadList::const_iterator index = m_threadList.begin(); + for (ThreadList::const_iterator index = m_threadList.begin(); index != m_threadList.end(); ++index) { if ((*index)->m_id == id) { return *index; @@ -602,7 +602,7 @@ CArchMultithreadWindows::findNoRefOrCreate(DWORD id) } void -CArchMultithreadWindows::insert(CArchThreadImpl* thread) +ArchMultithreadWindows::insert(ArchThreadImpl* thread) { assert(thread != NULL); @@ -614,9 +614,9 @@ CArchMultithreadWindows::insert(CArchThreadImpl* thread) } 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) { if (*index == thread) { m_threadList.erase(index); @@ -626,7 +626,7 @@ CArchMultithreadWindows::erase(CArchThreadImpl* thread) } void -CArchMultithreadWindows::refThread(CArchThreadImpl* thread) +ArchMultithreadWindows::refThread(ArchThreadImpl* thread) { assert(thread != NULL); assert(findNoRefOrCreate(thread->m_id) != NULL); @@ -634,7 +634,7 @@ CArchMultithreadWindows::refThread(CArchThreadImpl* thread) } void -CArchMultithreadWindows::testCancelThreadImpl(CArchThreadImpl* thread) +ArchMultithreadWindows::testCancelThreadImpl(ArchThreadImpl* thread) { assert(thread != NULL); @@ -658,10 +658,10 @@ CArchMultithreadWindows::testCancelThreadImpl(CArchThreadImpl* thread) } unsigned int __stdcall -CArchMultithreadWindows::threadFunc(void* vrep) +ArchMultithreadWindows::threadFunc(void* vrep) { // get the thread - CArchThreadImpl* thread = reinterpret_cast(vrep); + ArchThreadImpl* thread = reinterpret_cast(vrep); // run thread s_instance->doThreadFunc(thread); @@ -671,7 +671,7 @@ CArchMultithreadWindows::threadFunc(void* vrep) } void -CArchMultithreadWindows::doThreadFunc(CArchThread thread) +ArchMultithreadWindows::doThreadFunc(ArchThread thread) { // wait for parent to initialize this object lockMutex(m_threadMutex); diff --git a/src/lib/arch/win32/ArchMultithreadWindows.h b/src/lib/arch/win32/ArchMultithreadWindows.h index 35bf7458..c8d92191 100644 --- a/src/lib/arch/win32/ArchMultithreadWindows.h +++ b/src/lib/arch/win32/ArchMultithreadWindows.h @@ -24,27 +24,27 @@ #define WIN32_LEAN_AND_MEAN #include -#define ARCH_MULTITHREAD CArchMultithreadWindows +#define ARCH_MULTITHREAD ArchMultithreadWindows -class CArchCondImpl { +class ArchCondImpl { public: enum { kSignal = 0, kBroadcast }; HANDLE m_events[2]; mutable int m_waitCount; - CArchMutex m_waitCountMutex; + ArchMutex m_waitCountMutex; }; -class CArchMutexImpl { +class ArchMutexImpl { public: CRITICAL_SECTION m_mutex; }; //! Win32 implementation of IArchMultithread -class CArchMultithreadWindows : public IArchMultithread { +class ArchMultithreadWindows : public IArchMultithread { public: - CArchMultithreadWindows(); - virtual ~CArchMultithreadWindows(); + ArchMultithreadWindows(); + virtual ~ArchMultithreadWindows(); //! @name manipulators //@{ @@ -57,59 +57,59 @@ public: HANDLE getCancelEventForCurrentThread(); - void* getNetworkDataForThread(CArchThread); + void* getNetworkDataForThread(ArchThread); - static CArchMultithreadWindows* getInstance(); + static ArchMultithreadWindows* getInstance(); //@} // IArchMultithread overrides - virtual CArchCond newCondVar(); - virtual void closeCondVar(CArchCond); - virtual void signalCondVar(CArchCond); - virtual void broadcastCondVar(CArchCond); - virtual bool waitCondVar(CArchCond, CArchMutex, double timeout); - virtual CArchMutex newMutex(); - virtual void closeMutex(CArchMutex); - virtual void lockMutex(CArchMutex); - virtual void unlockMutex(CArchMutex); - virtual CArchThread newThread(ThreadFunc, void*); - virtual CArchThread newCurrentThread(); - virtual CArchThread copyThread(CArchThread); - virtual void closeThread(CArchThread); - virtual void cancelThread(CArchThread); - virtual void setPriorityOfThread(CArchThread, int n); + virtual ArchCond newCondVar(); + virtual void closeCondVar(ArchCond); + virtual void signalCondVar(ArchCond); + virtual void broadcastCondVar(ArchCond); + virtual bool waitCondVar(ArchCond, ArchMutex, double timeout); + virtual ArchMutex newMutex(); + virtual void closeMutex(ArchMutex); + virtual void lockMutex(ArchMutex); + virtual void unlockMutex(ArchMutex); + virtual ArchThread newThread(ThreadFunc, void*); + virtual ArchThread newCurrentThread(); + virtual ArchThread copyThread(ArchThread); + virtual void closeThread(ArchThread); + virtual void cancelThread(ArchThread); + virtual void setPriorityOfThread(ArchThread, int n); virtual void testCancelThread(); - virtual bool wait(CArchThread, double timeout); - virtual bool isSameThread(CArchThread, CArchThread); - virtual bool isExitedThread(CArchThread); - virtual void* getResultOfThread(CArchThread); - virtual ThreadID getIDOfThread(CArchThread); + virtual bool wait(ArchThread, double timeout); + virtual bool isSameThread(ArchThread, ArchThread); + virtual bool isExitedThread(ArchThread); + virtual void* getResultOfThread(ArchThread); + virtual ThreadID getIDOfThread(ArchThread); virtual void setSignalHandler(ESignal, SignalFunc, void*); virtual void raiseSignal(ESignal); private: - CArchThreadImpl* find(DWORD id); - CArchThreadImpl* findNoRef(DWORD id); - CArchThreadImpl* findNoRefOrCreate(DWORD id); - void insert(CArchThreadImpl* thread); - void erase(CArchThreadImpl* thread); + ArchThreadImpl* find(DWORD id); + ArchThreadImpl* findNoRef(DWORD id); + ArchThreadImpl* findNoRefOrCreate(DWORD id); + void insert(ArchThreadImpl* thread); + void erase(ArchThreadImpl* thread); - void refThread(CArchThreadImpl* rep); - void testCancelThreadImpl(CArchThreadImpl* rep); + void refThread(ArchThreadImpl* rep); + void testCancelThreadImpl(ArchThreadImpl* rep); - void doThreadFunc(CArchThread thread); + void doThreadFunc(ArchThread thread); static unsigned int __stdcall threadFunc(void* vrep); private: - typedef std::list CThreadList; + typedef std::list ThreadList; - static CArchMultithreadWindows* s_instance; + static ArchMultithreadWindows* s_instance; - CArchMutex m_threadMutex; + ArchMutex m_threadMutex; - CThreadList m_threadList; - CArchThread m_mainThread; + ThreadList m_threadList; + ArchThread m_mainThread; SignalFunc m_signalFunc[kNUM_SIGNALS]; void* m_signalUserData[kNUM_SIGNALS]; diff --git a/src/lib/arch/win32/ArchNetworkWinsock.cpp b/src/lib/arch/win32/ArchNetworkWinsock.cpp index 0cdca1e9..5c0eaf63 100644 --- a/src/lib/arch/win32/ArchNetworkWinsock.cpp +++ b/src/lib/arch/win32/ArchNetworkWinsock.cpp @@ -82,25 +82,25 @@ netGetProcAddress(HMODULE module, LPCSTR name) return func; } -CArchNetAddressImpl* -CArchNetAddressImpl::alloc(size_t size) +ArchNetAddressImpl* +ArchNetAddressImpl::alloc(size_t size) { size_t totalSize = size + ADDR_HDR_SIZE; - CArchNetAddressImpl* addr = (CArchNetAddressImpl*)malloc(totalSize); + ArchNetAddressImpl* addr = (ArchNetAddressImpl*)malloc(totalSize); addr->m_len = (int)size; return addr; } // -// CArchNetworkWinsock +// ArchNetworkWinsock // -CArchNetworkWinsock::CArchNetworkWinsock() +ArchNetworkWinsock::ArchNetworkWinsock() { } -CArchNetworkWinsock::~CArchNetworkWinsock() +ArchNetworkWinsock::~ArchNetworkWinsock() { if (s_networkModule != NULL) { WSACleanup_winsock(); @@ -111,14 +111,14 @@ CArchNetworkWinsock::~CArchNetworkWinsock() } ARCH->closeMutex(m_mutex); - CEventList::iterator it; + EventList::iterator it; for (it = m_unblockEvents.begin(); it != m_unblockEvents.end(); it++) { delete *it; } } void -CArchNetworkWinsock::init() +ArchNetworkWinsock::init() { static const char* s_library[] = { "ws2_32.dll" }; @@ -142,7 +142,7 @@ CArchNetworkWinsock::init() } void -CArchNetworkWinsock::initModule(HMODULE module) +ArchNetworkWinsock::initModule(HMODULE module) { if (module == NULL) { throw XArchNetworkSupport(""); @@ -199,8 +199,8 @@ CArchNetworkWinsock::initModule(HMODULE module) s_networkModule = module; } -CArchSocket -CArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type) +ArchSocket +ArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type) { // create socket SOCKET fd = socket_winsock(s_family[family], s_type[type], 0); @@ -216,7 +216,7 @@ CArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type) } // allocate socket object - CArchSocketImpl* socket = new CArchSocketImpl; + ArchSocketImpl* socket = new ArchSocketImpl; socket->m_socket = fd; socket->m_refCount = 1; socket->m_event = WSACreateEvent_winsock(); @@ -224,8 +224,8 @@ CArchNetworkWinsock::newSocket(EAddressFamily family, ESocketType type) return socket; } -CArchSocket -CArchNetworkWinsock::copySocket(CArchSocket s) +ArchSocket +ArchNetworkWinsock::copySocket(ArchSocket s) { assert(s != NULL); @@ -237,7 +237,7 @@ CArchNetworkWinsock::copySocket(CArchSocket s) } void -CArchNetworkWinsock::closeSocket(CArchSocket s) +ArchNetworkWinsock::closeSocket(ArchSocket s) { assert(s != NULL); @@ -262,7 +262,7 @@ CArchNetworkWinsock::closeSocket(CArchSocket s) } void -CArchNetworkWinsock::closeSocketForRead(CArchSocket s) +ArchNetworkWinsock::closeSocketForRead(ArchSocket s) { assert(s != NULL); @@ -274,7 +274,7 @@ CArchNetworkWinsock::closeSocketForRead(CArchSocket s) } void -CArchNetworkWinsock::closeSocketForWrite(CArchSocket s) +ArchNetworkWinsock::closeSocketForWrite(ArchSocket s) { assert(s != NULL); @@ -286,7 +286,7 @@ CArchNetworkWinsock::closeSocketForWrite(CArchSocket s) } void -CArchNetworkWinsock::bindSocket(CArchSocket s, CArchNetAddress addr) +ArchNetworkWinsock::bindSocket(ArchSocket s, ArchNetAddress addr) { assert(s != NULL); assert(addr != NULL); @@ -297,7 +297,7 @@ CArchNetworkWinsock::bindSocket(CArchSocket s, CArchNetAddress addr) } void -CArchNetworkWinsock::listenOnSocket(CArchSocket s) +ArchNetworkWinsock::listenOnSocket(ArchSocket s) { assert(s != NULL); @@ -307,14 +307,14 @@ CArchNetworkWinsock::listenOnSocket(CArchSocket s) } } -CArchSocket -CArchNetworkWinsock::acceptSocket(CArchSocket s, CArchNetAddress* addr) +ArchSocket +ArchNetworkWinsock::acceptSocket(ArchSocket s, ArchNetAddress* addr) { assert(s != NULL); // create new socket and temporary address - CArchSocketImpl* socket = new CArchSocketImpl; - CArchNetAddress tmp = CArchNetAddressImpl::alloc(sizeof(struct sockaddr)); + ArchSocketImpl* socket = new ArchSocketImpl; + ArchNetAddress tmp = ArchNetAddressImpl::alloc(sizeof(struct sockaddr)); // accept on socket SOCKET fd = accept_winsock(s->m_socket, &tmp->m_addr, &tmp->m_len); @@ -356,7 +356,7 @@ CArchNetworkWinsock::acceptSocket(CArchSocket s, CArchNetAddress* addr) } bool -CArchNetworkWinsock::connectSocket(CArchSocket s, CArchNetAddress addr) +ArchNetworkWinsock::connectSocket(ArchSocket s, ArchNetAddress addr) { assert(s != NULL); assert(addr != NULL); @@ -375,7 +375,7 @@ CArchNetworkWinsock::connectSocket(CArchSocket s, CArchNetAddress addr) } int -CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout) +ArchNetworkWinsock::pollSocket(PollEntry pe[], int num, double timeout) { int i; DWORD n; @@ -429,8 +429,8 @@ CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout) } // add the unblock event - CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); - CArchThread thread = mt->newCurrentThread(); + ArchMultithreadWindows* mt = ArchMultithreadWindows::getInstance(); + ArchThread thread = mt->newCurrentThread(); WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread); ARCH->closeThread(thread); if (unblockEvent == NULL) { @@ -527,10 +527,10 @@ CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout) } void -CArchNetworkWinsock::unblockPollSocket(CArchThread thread) +ArchNetworkWinsock::unblockPollSocket(ArchThread thread) { // set the unblock event - CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); + ArchMultithreadWindows* mt = ArchMultithreadWindows::getInstance(); WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread); if (unblockEvent != NULL) { WSASetEvent_winsock(*unblockEvent); @@ -538,7 +538,7 @@ CArchNetworkWinsock::unblockPollSocket(CArchThread thread) } size_t -CArchNetworkWinsock::readSocket(CArchSocket s, void* buf, size_t len) +ArchNetworkWinsock::readSocket(ArchSocket s, void* buf, size_t len) { assert(s != NULL); @@ -554,7 +554,7 @@ CArchNetworkWinsock::readSocket(CArchSocket s, void* buf, size_t len) } 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); @@ -574,7 +574,7 @@ CArchNetworkWinsock::writeSocket(CArchSocket s, const void* buf, size_t len) } void -CArchNetworkWinsock::throwErrorOnSocket(CArchSocket s) +ArchNetworkWinsock::throwErrorOnSocket(ArchSocket s) { assert(s != NULL); @@ -593,7 +593,7 @@ CArchNetworkWinsock::throwErrorOnSocket(CArchSocket s) } void -CArchNetworkWinsock::setBlockingOnSocket(SOCKET s, bool blocking) +ArchNetworkWinsock::setBlockingOnSocket(SOCKET s, bool blocking) { assert(s != 0); @@ -604,7 +604,7 @@ CArchNetworkWinsock::setBlockingOnSocket(SOCKET s, bool blocking) } bool -CArchNetworkWinsock::setNoDelayOnSocket(CArchSocket s, bool noDelay) +ArchNetworkWinsock::setNoDelayOnSocket(ArchSocket s, bool noDelay) { assert(s != NULL); @@ -628,7 +628,7 @@ CArchNetworkWinsock::setNoDelayOnSocket(CArchSocket s, bool noDelay) } bool -CArchNetworkWinsock::setReuseAddrOnSocket(CArchSocket s, bool reuse) +ArchNetworkWinsock::setReuseAddrOnSocket(ArchSocket s, bool reuse) { assert(s != NULL); @@ -652,7 +652,7 @@ CArchNetworkWinsock::setReuseAddrOnSocket(CArchSocket s, bool reuse) } std::string -CArchNetworkWinsock::getHostName() +ArchNetworkWinsock::getHostName() { char name[256]; if (gethostname_winsock(name, sizeof(name)) == -1) { @@ -664,13 +664,13 @@ CArchNetworkWinsock::getHostName() return name; } -CArchNetAddress -CArchNetworkWinsock::newAnyAddr(EAddressFamily family) +ArchNetAddress +ArchNetworkWinsock::newAnyAddr(EAddressFamily family) { - CArchNetAddressImpl* addr = NULL; + ArchNetAddressImpl* addr = NULL; switch (family) { 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); ipAddr->sin_family = AF_INET; ipAddr->sin_port = 0; @@ -684,21 +684,21 @@ CArchNetworkWinsock::newAnyAddr(EAddressFamily family) return addr; } -CArchNetAddress -CArchNetworkWinsock::copyAddr(CArchNetAddress addr) +ArchNetAddress +ArchNetworkWinsock::copyAddr(ArchNetAddress addr) { 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); return copy; } -CArchNetAddress -CArchNetworkWinsock::nameToAddr(const std::string& name) +ArchNetAddress +ArchNetworkWinsock::nameToAddr(const std::string& name) { // allocate address - CArchNetAddressImpl* addr = NULL; + ArchNetAddressImpl* addr = NULL; // try to convert assuming an IPv4 dot notation address 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()); if (inaddr.sin_addr.s_addr != INADDR_NONE) { // 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); } @@ -721,7 +721,7 @@ CArchNetworkWinsock::nameToAddr(const std::string& name) // copy over address (only IPv4 currently supported) 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], sizeof(inaddr.sin_addr)); memcpy(TYPED_ADDR(void, addr), &inaddr, addr->m_len); @@ -737,7 +737,7 @@ CArchNetworkWinsock::nameToAddr(const std::string& name) } void -CArchNetworkWinsock::closeAddr(CArchNetAddress addr) +ArchNetworkWinsock::closeAddr(ArchNetAddress addr) { assert(addr != NULL); @@ -745,7 +745,7 @@ CArchNetworkWinsock::closeAddr(CArchNetAddress addr) } std::string -CArchNetworkWinsock::addrToName(CArchNetAddress addr) +ArchNetworkWinsock::addrToName(ArchNetAddress addr) { assert(addr != NULL); @@ -762,7 +762,7 @@ CArchNetworkWinsock::addrToName(CArchNetAddress addr) } std::string -CArchNetworkWinsock::addrToString(CArchNetAddress addr) +ArchNetworkWinsock::addrToString(ArchNetAddress addr) { assert(addr != NULL); @@ -780,7 +780,7 @@ CArchNetworkWinsock::addrToString(CArchNetAddress addr) } IArchNetwork::EAddressFamily -CArchNetworkWinsock::getAddrFamily(CArchNetAddress addr) +ArchNetworkWinsock::getAddrFamily(ArchNetAddress addr) { assert(addr != NULL); @@ -794,7 +794,7 @@ CArchNetworkWinsock::getAddrFamily(CArchNetAddress addr) } void -CArchNetworkWinsock::setAddrPort(CArchNetAddress addr, int port) +ArchNetworkWinsock::setAddrPort(ArchNetAddress addr, int port) { assert(addr != NULL); @@ -813,7 +813,7 @@ CArchNetworkWinsock::setAddrPort(CArchNetAddress addr, int port) } int -CArchNetworkWinsock::getAddrPort(CArchNetAddress addr) +ArchNetworkWinsock::getAddrPort(ArchNetAddress addr) { assert(addr != NULL); @@ -831,7 +831,7 @@ CArchNetworkWinsock::getAddrPort(CArchNetAddress addr) } bool -CArchNetworkWinsock::isAnyAddr(CArchNetAddress addr) +ArchNetworkWinsock::isAnyAddr(ArchNetAddress addr) { assert(addr != NULL); @@ -850,14 +850,14 @@ CArchNetworkWinsock::isAnyAddr(CArchNetAddress addr) } bool -CArchNetworkWinsock::isEqualAddr(CArchNetAddress a, CArchNetAddress b) +ArchNetworkWinsock::isEqualAddr(ArchNetAddress a, ArchNetAddress b) { return (a == b || (a->m_len == b->m_len && memcmp(&a->m_addr, &b->m_addr, a->m_len) == 0)); } void -CArchNetworkWinsock::throwError(int err) +ArchNetworkWinsock::throwError(int err) { switch (err) { case WSAEACCES: @@ -928,7 +928,7 @@ CArchNetworkWinsock::throwError(int err) } void -CArchNetworkWinsock::throwNameError(int err) +ArchNetworkWinsock::throwNameError(int err) { switch (err) { case WSAHOST_NOT_FOUND: diff --git a/src/lib/arch/win32/ArchNetworkWinsock.h b/src/lib/arch/win32/ArchNetworkWinsock.h index be3ab0bd..9727cbd2 100644 --- a/src/lib/arch/win32/ArchNetworkWinsock.h +++ b/src/lib/arch/win32/ArchNetworkWinsock.h @@ -30,9 +30,9 @@ #include #include -#define ARCH_NETWORK CArchNetworkWinsock +#define ARCH_NETWORK ArchNetworkWinsock -class CArchSocketImpl { +class ArchSocketImpl { public: SOCKET m_socket; int m_refCount; @@ -40,55 +40,55 @@ public: bool m_pollWrite; }; -class CArchNetAddressImpl { +class ArchNetAddressImpl { public: - static CArchNetAddressImpl* alloc(size_t); + static ArchNetAddressImpl* alloc(size_t); public: int m_len; 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(&addr_->m_addr)) //! Win32 implementation of IArchNetwork -class CArchNetworkWinsock : public IArchNetwork { +class ArchNetworkWinsock : public IArchNetwork { public: - CArchNetworkWinsock(); - virtual ~CArchNetworkWinsock(); + ArchNetworkWinsock(); + virtual ~ArchNetworkWinsock(); virtual void init(); // IArchNetwork overrides - virtual CArchSocket newSocket(EAddressFamily, ESocketType); - virtual CArchSocket copySocket(CArchSocket s); - virtual void closeSocket(CArchSocket s); - virtual void closeSocketForRead(CArchSocket s); - virtual void closeSocketForWrite(CArchSocket s); - virtual void bindSocket(CArchSocket s, CArchNetAddress addr); - virtual void listenOnSocket(CArchSocket s); - virtual CArchSocket acceptSocket(CArchSocket s, CArchNetAddress* addr); - virtual bool connectSocket(CArchSocket s, CArchNetAddress name); - virtual int pollSocket(CPollEntry[], int num, double timeout); - virtual void unblockPollSocket(CArchThread thread); - virtual size_t readSocket(CArchSocket s, void* buf, size_t len); - virtual size_t writeSocket(CArchSocket s, + virtual ArchSocket newSocket(EAddressFamily, ESocketType); + virtual ArchSocket copySocket(ArchSocket s); + virtual void closeSocket(ArchSocket s); + virtual void closeSocketForRead(ArchSocket s); + virtual void closeSocketForWrite(ArchSocket s); + virtual void bindSocket(ArchSocket s, ArchNetAddress addr); + virtual void listenOnSocket(ArchSocket s); + virtual ArchSocket acceptSocket(ArchSocket s, ArchNetAddress* addr); + virtual bool connectSocket(ArchSocket s, ArchNetAddress name); + virtual int pollSocket(PollEntry[], int num, double timeout); + virtual void unblockPollSocket(ArchThread thread); + virtual size_t readSocket(ArchSocket s, void* buf, size_t len); + virtual size_t writeSocket(ArchSocket s, const void* buf, size_t len); - virtual void throwErrorOnSocket(CArchSocket); - virtual bool setNoDelayOnSocket(CArchSocket, bool noDelay); - virtual bool setReuseAddrOnSocket(CArchSocket, bool reuse); + virtual void throwErrorOnSocket(ArchSocket); + virtual bool setNoDelayOnSocket(ArchSocket, bool noDelay); + virtual bool setReuseAddrOnSocket(ArchSocket, bool reuse); virtual std::string getHostName(); - virtual CArchNetAddress newAnyAddr(EAddressFamily); - virtual CArchNetAddress copyAddr(CArchNetAddress); - virtual CArchNetAddress nameToAddr(const std::string&); - virtual void closeAddr(CArchNetAddress); - virtual std::string addrToName(CArchNetAddress); - virtual std::string addrToString(CArchNetAddress); - virtual EAddressFamily getAddrFamily(CArchNetAddress); - virtual void setAddrPort(CArchNetAddress, int port); - virtual int getAddrPort(CArchNetAddress); - virtual bool isAnyAddr(CArchNetAddress); - virtual bool isEqualAddr(CArchNetAddress, CArchNetAddress); + virtual ArchNetAddress newAnyAddr(EAddressFamily); + virtual ArchNetAddress copyAddr(ArchNetAddress); + virtual ArchNetAddress nameToAddr(const std::string&); + virtual void closeAddr(ArchNetAddress); + virtual std::string addrToName(ArchNetAddress); + virtual std::string addrToString(ArchNetAddress); + virtual EAddressFamily getAddrFamily(ArchNetAddress); + virtual void setAddrPort(ArchNetAddress, int port); + virtual int getAddrPort(ArchNetAddress); + virtual bool isAnyAddr(ArchNetAddress); + virtual bool isEqualAddr(ArchNetAddress, ArchNetAddress); private: void initModule(HMODULE); @@ -99,8 +99,8 @@ private: void throwNameError(int); private: - typedef std::list CEventList; + typedef std::list EventList; - CArchMutex m_mutex; - CEventList m_unblockEvents; + ArchMutex m_mutex; + EventList m_unblockEvents; }; diff --git a/src/lib/arch/win32/ArchPluginWindows.cpp b/src/lib/arch/win32/ArchPluginWindows.cpp index b4dd7b5c..f5ae85cc 100644 --- a/src/lib/arch/win32/ArchPluginWindows.cpp +++ b/src/lib/arch/win32/ArchPluginWindows.cpp @@ -32,37 +32,37 @@ typedef int (*initFunc)(void (*sendEvent)(const char*, void*), void (*log)(const void* g_eventTarget = NULL; IEventQueue* g_events = NULL; -CArchPluginWindows::CArchPluginWindows() +ArchPluginWindows::ArchPluginWindows() { } -CArchPluginWindows::~CArchPluginWindows() +ArchPluginWindows::~ArchPluginWindows() { } void -CArchPluginWindows::init(void* eventTarget, IEventQueue* events) +ArchPluginWindows::init(void* eventTarget, IEventQueue* events) { g_eventTarget = eventTarget; g_events = events; - CString dir = getPluginsDir(); + String dir = getPluginsDir(); LOG((CLOG_DEBUG "plugins dir: %s", dir.c_str())); - CString pattern = CString(dir).append("\\*.dll"); - std::vector plugins; + String pattern = String(dir).append("\\*.dll"); + std::vector plugins; getFilenames(pattern, plugins); - std::vector::iterator it; + std::vector::iterator it; for (it = plugins.begin(); it != plugins.end(); ++it) load(*it); } void -CArchPluginWindows::load(const CString& dllFilename) +ArchPluginWindows::load(const String& dllFilename) { 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()); if (library == NULL) throw XArch(new XArchEvalWindows); @@ -71,18 +71,18 @@ CArchPluginWindows::load(const CString& dllFilename) initPlugin(&sendEvent, &log); } -CString -CArchPluginWindows::getModuleDir() +String +ArchPluginWindows::getModuleDir() { TCHAR c_modulePath[MAX_PATH]; if (GetModuleFileName(NULL, c_modulePath, MAX_PATH) == 0) { throw XArch(new XArchEvalWindows); } - CString modulePath(c_modulePath); + String modulePath(c_modulePath); size_t lastSlash = modulePath.find_last_of("\\"); - if (lastSlash != CString::npos) { + if (lastSlash != String::npos) { return modulePath.substr(0, lastSlash); } @@ -90,7 +90,7 @@ CArchPluginWindows::getModuleDir() } void -CArchPluginWindows::getFilenames(const CString& pattern, std::vector& filenames) +ArchPluginWindows::getFilenames(const String& pattern, std::vector& filenames) { WIN32_FIND_DATA data; HANDLE find = FindFirstFile(pattern.c_str(), &data); @@ -107,7 +107,7 @@ CArchPluginWindows::getFilenames(const CString& pattern, std::vector& f FindClose(find); } -CString CArchPluginWindows::getPluginsDir() +String ArchPluginWindows::getPluginsDir() { return getModuleDir().append("\\").append(PLUGINS_DIR); } @@ -116,8 +116,8 @@ void sendEvent(const char* eventName, void* data) { LOG((CLOG_DEBUG5 "plugin sending event")); - CEvent::Type type = g_events->getRegisteredType(eventName); - g_events->addEvent(CEvent(type, g_eventTarget, data)); + Event::Type type = g_events->getRegisteredType(eventName); + g_events->addEvent(Event(type, g_eventTarget, data)); } void diff --git a/src/lib/arch/win32/ArchPluginWindows.h b/src/lib/arch/win32/ArchPluginWindows.h index dace6b36..f6cdaacf 100644 --- a/src/lib/arch/win32/ArchPluginWindows.h +++ b/src/lib/arch/win32/ArchPluginWindows.h @@ -23,25 +23,25 @@ #include -#define ARCH_PLUGIN CArchPluginWindows +#define ARCH_PLUGIN ArchPluginWindows -class CScreen; +class Screen; class IEventQueue; //! Windows implementation of IArchPlugin -class CArchPluginWindows : public IArchPlugin { +class ArchPluginWindows : public IArchPlugin { public: - CArchPluginWindows(); - virtual ~CArchPluginWindows(); + ArchPluginWindows(); + virtual ~ArchPluginWindows(); // IArchPlugin overrides void init(void* eventTarget, IEventQueue* events); private: - CString getModuleDir(); - void getFilenames(const CString& pattern, std::vector& filenames); - void load(const CString& dllPath); - CString getPluginsDir(); + String getModuleDir(); + void getFilenames(const String& pattern, std::vector& filenames); + void load(const String& dllPath); + String getPluginsDir(); }; void sendEvent(const char* text, void* data); diff --git a/src/lib/arch/win32/ArchSleepWindows.cpp b/src/lib/arch/win32/ArchSleepWindows.cpp index d299cf15..4d0e1c90 100644 --- a/src/lib/arch/win32/ArchSleepWindows.cpp +++ b/src/lib/arch/win32/ArchSleepWindows.cpp @@ -21,21 +21,21 @@ #include "arch/win32/ArchMultithreadWindows.h" // -// CArchSleepWindows +// ArchSleepWindows // -CArchSleepWindows::CArchSleepWindows() +ArchSleepWindows::ArchSleepWindows() { // do nothing } -CArchSleepWindows::~CArchSleepWindows() +ArchSleepWindows::~ArchSleepWindows() { // do nothing } void -CArchSleepWindows::sleep(double timeout) +ArchSleepWindows::sleep(double timeout) { ARCH->testCancelThread(); if (timeout < 0.0) { @@ -46,7 +46,7 @@ CArchSleepWindows::sleep(double timeout) // works if we're using the windows multithread object but // this is windows so that's pretty certain; we'll get a // link error if we're not, though. - CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); + ArchMultithreadWindows* mt = ArchMultithreadWindows::getInstance(); if (mt != NULL) { HANDLE cancelEvent = mt->getCancelEventForCurrentThread(); WaitForSingleObject(cancelEvent, (DWORD)(1000.0 * timeout)); diff --git a/src/lib/arch/win32/ArchSleepWindows.h b/src/lib/arch/win32/ArchSleepWindows.h index f4004947..72e386ff 100644 --- a/src/lib/arch/win32/ArchSleepWindows.h +++ b/src/lib/arch/win32/ArchSleepWindows.h @@ -20,13 +20,13 @@ #include "arch/IArchSleep.h" -#define ARCH_SLEEP CArchSleepWindows +#define ARCH_SLEEP ArchSleepWindows //! Win32 implementation of IArchSleep -class CArchSleepWindows : public IArchSleep { +class ArchSleepWindows : public IArchSleep { public: - CArchSleepWindows(); - virtual ~CArchSleepWindows(); + ArchSleepWindows(); + virtual ~ArchSleepWindows(); // IArchSleep overrides virtual void sleep(double timeout); diff --git a/src/lib/arch/win32/ArchStringWindows.cpp b/src/lib/arch/win32/ArchStringWindows.cpp index e8bd168d..fc6abfa2 100644 --- a/src/lib/arch/win32/ArchStringWindows.cpp +++ b/src/lib/arch/win32/ArchStringWindows.cpp @@ -23,7 +23,7 @@ #include // -// CArchStringWindows +// ArchStringWindows // #include "arch/multibyte.h" @@ -31,16 +31,16 @@ #define ARCH_VSNPRINTF _vsnprintf #include "arch/vsnprintf.h" -CArchStringWindows::CArchStringWindows() +ArchStringWindows::ArchStringWindows() { } -CArchStringWindows::~CArchStringWindows() +ArchStringWindows::~ArchStringWindows() { } IArchString::EWideCharEncoding -CArchStringWindows::getWideCharEncoding() +ArchStringWindows::getWideCharEncoding() { return kUTF16; } diff --git a/src/lib/arch/win32/ArchStringWindows.h b/src/lib/arch/win32/ArchStringWindows.h index 13c11539..d7e706aa 100644 --- a/src/lib/arch/win32/ArchStringWindows.h +++ b/src/lib/arch/win32/ArchStringWindows.h @@ -20,13 +20,13 @@ #include "arch/IArchString.h" -#define ARCH_STRING CArchStringWindows +#define ARCH_STRING ArchStringWindows //! Win32 implementation of IArchString -class CArchStringWindows : public IArchString { +class ArchStringWindows : public IArchString { public: - CArchStringWindows(); - virtual ~CArchStringWindows(); + ArchStringWindows(); + virtual ~ArchStringWindows(); // IArchString overrides virtual EWideCharEncoding diff --git a/src/lib/arch/win32/ArchSystemWindows.cpp b/src/lib/arch/win32/ArchSystemWindows.cpp index c37a2099..bb7b561c 100644 --- a/src/lib/arch/win32/ArchSystemWindows.cpp +++ b/src/lib/arch/win32/ArchSystemWindows.cpp @@ -30,21 +30,21 @@ static const char* s_settingsKeyNames[] = { }; // -// CArchSystemWindows +// ArchSystemWindows // -CArchSystemWindows::CArchSystemWindows() +ArchSystemWindows::ArchSystemWindows() { // do nothing } -CArchSystemWindows::~CArchSystemWindows() +ArchSystemWindows::~ArchSystemWindows() { // do nothing } std::string -CArchSystemWindows::getOSName() const +ArchSystemWindows::getOSName() const { #if WINVER >= _WIN32_WINNT_WIN2K OSVERSIONINFOEX info; @@ -96,7 +96,7 @@ CArchSystemWindows::getOSName() const } std::string -CArchSystemWindows::getPlatformName() const +ArchSystemWindows::getPlatformName() const { #ifdef _X86_ if(isWOW64()) @@ -113,26 +113,26 @@ CArchSystemWindows::getPlatformName() const } 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) return ""; - return CArchMiscWindows::readValueString(key, valueName.c_str()); + return ArchMiscWindows::readValueString(key, valueName.c_str()); } 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) 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 -CArchSystemWindows::isWOW64() const +ArchSystemWindows::isWOW64() const { #if WINVER >= _WIN32_WINNT_WINXP typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); diff --git a/src/lib/arch/win32/ArchSystemWindows.h b/src/lib/arch/win32/ArchSystemWindows.h index 324165a5..1b2b84f2 100644 --- a/src/lib/arch/win32/ArchSystemWindows.h +++ b/src/lib/arch/win32/ArchSystemWindows.h @@ -20,13 +20,13 @@ #include "arch/IArchSystem.h" -#define ARCH_SYSTEM CArchSystemWindows +#define ARCH_SYSTEM ArchSystemWindows //! Win32 implementation of IArchString -class CArchSystemWindows : public IArchSystem { +class ArchSystemWindows : public IArchSystem { public: - CArchSystemWindows(); - virtual ~CArchSystemWindows(); + ArchSystemWindows(); + virtual ~ArchSystemWindows(); // IArchSystem overrides virtual std::string getOSName() const; diff --git a/src/lib/arch/win32/ArchTaskBarWindows.cpp b/src/lib/arch/win32/ArchTaskBarWindows.cpp index 9c44d985..92679fa2 100644 --- a/src/lib/arch/win32/ArchTaskBarWindows.cpp +++ b/src/lib/arch/win32/ArchTaskBarWindows.cpp @@ -33,19 +33,19 @@ static const UINT kNotifyReceiver = WM_USER + 13; 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) { // save the singleton instance s_instance = this; } -CArchTaskBarWindows::~CArchTaskBarWindows() +ArchTaskBarWindows::~ArchTaskBarWindows() { if (m_thread != NULL) { PostMessage(m_hwnd, WM_QUIT, 0, 0); @@ -58,7 +58,7 @@ CArchTaskBarWindows::~CArchTaskBarWindows() } void -CArchTaskBarWindows::init() +ArchTaskBarWindows::init() { // we need a mutex m_mutex = ARCH->newMutex(); @@ -77,7 +77,7 @@ CArchTaskBarWindows::init() // create a window on the current desktop with the current // thread then the current thread won't be able to switch // desktops if it needs to. - m_thread = ARCH->newThread(&CArchTaskBarWindows::threadEntry, this); + m_thread = ARCH->newThread(&ArchTaskBarWindows::threadEntry, this); // wait for child thread while (!m_ready) { @@ -89,19 +89,19 @@ CArchTaskBarWindows::init() } void -CArchTaskBarWindows::addDialog(HWND hwnd) +ArchTaskBarWindows::addDialog(HWND hwnd) { - CArchMiscWindows::addDialog(hwnd); + ArchMiscWindows::addDialog(hwnd); } void -CArchTaskBarWindows::removeDialog(HWND hwnd) +ArchTaskBarWindows::removeDialog(HWND hwnd) { - CArchMiscWindows::removeDialog(hwnd); + ArchMiscWindows::removeDialog(hwnd); } void -CArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver) +ArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver) { // ignore bogus receiver if (receiver == NULL) { @@ -109,10 +109,10 @@ CArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver) } // add receiver if necessary - CReceiverToInfoMap::iterator index = m_receivers.find(receiver); + ReceiverToInfoMap::iterator index = m_receivers.find(receiver); if (index == m_receivers.end()) { // add it, creating a new message ID for it - CReceiverInfo info; + ReceiverInfo info; info.m_id = getNextID(); index = m_receivers.insert(std::make_pair(receiver, info)).first; @@ -125,10 +125,10 @@ CArchTaskBarWindows::addReceiver(IArchTaskBarReceiver* receiver) } void -CArchTaskBarWindows::removeReceiver(IArchTaskBarReceiver* receiver) +ArchTaskBarWindows::removeReceiver(IArchTaskBarReceiver* receiver) { // find receiver - CReceiverToInfoMap::iterator index = m_receivers.find(receiver); + ReceiverToInfoMap::iterator index = m_receivers.find(receiver); if (index == m_receivers.end()) { return; } @@ -145,10 +145,10 @@ CArchTaskBarWindows::removeReceiver(IArchTaskBarReceiver* receiver) } void -CArchTaskBarWindows::updateReceiver(IArchTaskBarReceiver* receiver) +ArchTaskBarWindows::updateReceiver(IArchTaskBarReceiver* receiver) { // find receiver - CReceiverToInfoMap::const_iterator index = m_receivers.find(receiver); + ReceiverToInfoMap::const_iterator index = m_receivers.find(receiver); if (index == m_receivers.end()) { return; } @@ -158,7 +158,7 @@ CArchTaskBarWindows::updateReceiver(IArchTaskBarReceiver* receiver) } UINT -CArchTaskBarWindows::getNextID() +ArchTaskBarWindows::getNextID() { if (m_oldIDs.empty()) { return m_nextID++; @@ -169,13 +169,13 @@ CArchTaskBarWindows::getNextID() } void -CArchTaskBarWindows::recycleID(UINT id) +ArchTaskBarWindows::recycleID(UINT id) { m_oldIDs.push_back(id); } void -CArchTaskBarWindows::addIcon(UINT id) +ArchTaskBarWindows::addIcon(UINT id) { ARCH->lockMutex(m_mutex); CIDToReceiverMap::const_iterator index = m_idTable.find(id); @@ -186,7 +186,7 @@ CArchTaskBarWindows::addIcon(UINT id) } void -CArchTaskBarWindows::removeIcon(UINT id) +ArchTaskBarWindows::removeIcon(UINT id) { ARCH->lockMutex(m_mutex); removeIconNoLock(id); @@ -194,7 +194,7 @@ CArchTaskBarWindows::removeIcon(UINT id) } void -CArchTaskBarWindows::updateIcon(UINT id) +ArchTaskBarWindows::updateIcon(UINT id) { ARCH->lockMutex(m_mutex); CIDToReceiverMap::const_iterator index = m_idTable.find(id); @@ -205,10 +205,10 @@ CArchTaskBarWindows::updateIcon(UINT id) } void -CArchTaskBarWindows::addAllIcons() +ArchTaskBarWindows::addAllIcons() { 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) { modifyIconNoLock(index, NIM_ADD); } @@ -216,10 +216,10 @@ CArchTaskBarWindows::addAllIcons() } void -CArchTaskBarWindows::removeAllIcons() +ArchTaskBarWindows::removeAllIcons() { 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) { removeIconNoLock(index->second.m_id); } @@ -227,8 +227,8 @@ CArchTaskBarWindows::removeAllIcons() } void -CArchTaskBarWindows::modifyIconNoLock( - CReceiverToInfoMap::const_iterator index, DWORD taskBarMessage) +ArchTaskBarWindows::modifyIconNoLock( + ReceiverToInfoMap::const_iterator index, DWORD taskBarMessage) { // get receiver UINT id = index->second.m_id; @@ -274,7 +274,7 @@ CArchTaskBarWindows::modifyIconNoLock( } void -CArchTaskBarWindows::removeIconNoLock(UINT id) +ArchTaskBarWindows::removeIconNoLock(UINT id) { NOTIFYICONDATA data; data.cbSize = sizeof(NOTIFYICONDATA); @@ -286,7 +286,7 @@ CArchTaskBarWindows::removeIconNoLock(UINT id) } void -CArchTaskBarWindows::handleIconMessage( +ArchTaskBarWindows::handleIconMessage( IArchTaskBarReceiver* receiver, LPARAM lParam) { // process message @@ -317,7 +317,7 @@ CArchTaskBarWindows::handleIconMessage( } bool -CArchTaskBarWindows::processDialogs(MSG* msg) +ArchTaskBarWindows::processDialogs(MSG* msg) { // 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 @@ -329,7 +329,7 @@ CArchTaskBarWindows::processDialogs(MSG* msg) m_dialogs.erase(false); // 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) { 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 // values of some elements). 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) { if (index->second) { ARCH->unlockMutex(m_mutex); @@ -360,7 +360,7 @@ CArchTaskBarWindows::processDialogs(MSG* msg) } LRESULT -CArchTaskBarWindows::wndProc(HWND hwnd, +ArchTaskBarWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -399,16 +399,16 @@ CArchTaskBarWindows::wndProc(HWND hwnd, } LRESULT CALLBACK -CArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg, +ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg, 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. - CArchTaskBarWindows* self = NULL; + ArchTaskBarWindows* self = NULL; if (msg == WM_NCCREATE) { CREATESTRUCT* createInfo; createInfo = reinterpret_cast(lParam); - self = reinterpret_cast( + self = reinterpret_cast( createInfo->lpCreateParams); SetWindowLong(hwnd, 0, reinterpret_cast(self)); } @@ -416,7 +416,7 @@ CArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg, // get the extra window data and forward the call LONG data = GetWindowLong(hwnd, 0); if (data != 0) { - self = reinterpret_cast( + self = reinterpret_cast( reinterpret_cast(data)); } } @@ -431,7 +431,7 @@ CArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg, } void -CArchTaskBarWindows::threadMainLoop() +ArchTaskBarWindows::threadMainLoop() { // register the task bar restart message m_taskBarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); @@ -440,9 +440,9 @@ CArchTaskBarWindows::threadMainLoop() WNDCLASSEX classInfo; classInfo.cbSize = sizeof(classInfo); classInfo.style = CS_NOCLOSE; - classInfo.lpfnWndProc = &CArchTaskBarWindows::staticWndProc; + classInfo.lpfnWndProc = &ArchTaskBarWindows::staticWndProc; classInfo.cbClsExtra = 0; - classInfo.cbWndExtra = sizeof(CArchTaskBarWindows*); + classInfo.cbWndExtra = sizeof(ArchTaskBarWindows*); classInfo.hInstance = instanceWin32(); classInfo.hIcon = NULL; classInfo.hCursor = NULL; @@ -491,13 +491,13 @@ CArchTaskBarWindows::threadMainLoop() } void* -CArchTaskBarWindows::threadEntry(void* self) +ArchTaskBarWindows::threadEntry(void* self) { - reinterpret_cast(self)->threadMainLoop(); + reinterpret_cast(self)->threadMainLoop(); return NULL; } -HINSTANCE CArchTaskBarWindows::instanceWin32() +HINSTANCE ArchTaskBarWindows::instanceWin32() { - return CArchMiscWindows::instanceWin32(); + return ArchMiscWindows::instanceWin32(); } \ No newline at end of file diff --git a/src/lib/arch/win32/ArchTaskBarWindows.h b/src/lib/arch/win32/ArchTaskBarWindows.h index 8fa9e406..309e9b08 100644 --- a/src/lib/arch/win32/ArchTaskBarWindows.h +++ b/src/lib/arch/win32/ArchTaskBarWindows.h @@ -26,13 +26,13 @@ #define WIN32_LEAN_AND_MEAN #include -#define ARCH_TASKBAR CArchTaskBarWindows +#define ARCH_TASKBAR ArchTaskBarWindows //! Win32 implementation of IArchTaskBar -class CArchTaskBarWindows : public IArchTaskBar { +class ArchTaskBarWindows : public IArchTaskBar { public: - CArchTaskBarWindows(); - virtual ~CArchTaskBarWindows(); + ArchTaskBarWindows(); + virtual ~ArchTaskBarWindows(); virtual void init(); @@ -56,15 +56,15 @@ public: virtual void updateReceiver(IArchTaskBarReceiver*); private: - class CReceiverInfo { + class ReceiverInfo { public: UINT m_id; }; - typedef std::map CReceiverToInfoMap; - typedef std::map CIDToReceiverMap; + typedef std::map ReceiverToInfoMap; + typedef std::map CIDToReceiverMap; typedef std::vector CIDStack; - typedef std::map CDialogs; + typedef std::map Dialogs; UINT getNextID(); void recycleID(UINT); @@ -74,7 +74,7 @@ private: void updateIcon(UINT); void addAllIcons(); void removeAllIcons(); - void modifyIconNoLock(CReceiverToInfoMap::const_iterator, + void modifyIconNoLock(ReceiverToInfoMap::const_iterator, DWORD taskBarMessage); void removeIconNoLock(UINT id); void handleIconMessage(IArchTaskBarReceiver*, LPARAM); @@ -89,26 +89,26 @@ private: HINSTANCE instanceWin32(); private: - static CArchTaskBarWindows* s_instance; + static ArchTaskBarWindows* s_instance; // multithread data - CArchMutex m_mutex; - CArchCond m_condVar; + ArchMutex m_mutex; + ArchCond m_condVar; bool m_ready; int m_result; - CArchThread m_thread; + ArchThread m_thread; // child thread data HWND m_hwnd; UINT m_taskBarRestart; // shared data - CReceiverToInfoMap m_receivers; + ReceiverToInfoMap m_receivers; CIDToReceiverMap m_idTable; CIDStack m_oldIDs; UINT m_nextID; // dialogs - CDialogs m_dialogs; - CDialogs m_addedDialogs; + Dialogs m_dialogs; + Dialogs m_addedDialogs; }; diff --git a/src/lib/arch/win32/ArchTimeWindows.cpp b/src/lib/arch/win32/ArchTimeWindows.cpp index 3fe6f9d5..f63ff8d7 100644 --- a/src/lib/arch/win32/ArchTimeWindows.cpp +++ b/src/lib/arch/win32/ArchTimeWindows.cpp @@ -41,10 +41,10 @@ static PTimeGetTime s_tgt = NULL; // -// CArchTimeWindows +// ArchTimeWindows // -CArchTimeWindows::CArchTimeWindows() +ArchTimeWindows::ArchTimeWindows() { assert(s_freq == 0.0 || s_mmInstance == NULL); @@ -61,7 +61,7 @@ CArchTimeWindows::CArchTimeWindows() } } -CArchTimeWindows::~CArchTimeWindows() +ArchTimeWindows::~ArchTimeWindows() { s_freq = 0.0; if (s_mmInstance == NULL) { @@ -72,7 +72,7 @@ CArchTimeWindows::~CArchTimeWindows() } double -CArchTimeWindows::time() +ArchTimeWindows::time() { // get time. we try three ways, in order of descending precision if (s_freq != 0.0) { diff --git a/src/lib/arch/win32/ArchTimeWindows.h b/src/lib/arch/win32/ArchTimeWindows.h index 2b98d237..bfe8f415 100644 --- a/src/lib/arch/win32/ArchTimeWindows.h +++ b/src/lib/arch/win32/ArchTimeWindows.h @@ -20,13 +20,13 @@ #include "arch/IArchTime.h" -#define ARCH_TIME CArchTimeWindows +#define ARCH_TIME ArchTimeWindows //! Win32 implementation of IArchTime -class CArchTimeWindows : public IArchTime { +class ArchTimeWindows : public IArchTime { public: - CArchTimeWindows(); - virtual ~CArchTimeWindows(); + ArchTimeWindows(); + virtual ~ArchTimeWindows(); // IArchTime overrides virtual double time(); diff --git a/src/lib/base/Event.cpp b/src/lib/base/Event.cpp index 7e659b65..9a9627e3 100644 --- a/src/lib/base/Event.cpp +++ b/src/lib/base/Event.cpp @@ -20,10 +20,10 @@ #include "base/EventQueue.h" // -// CEvent +// Event // -CEvent::CEvent() : +Event::Event() : m_type(kUnknown), m_target(NULL), m_data(NULL), @@ -33,7 +33,7 @@ CEvent::CEvent() : // do nothing } -CEvent::CEvent(Type type, void* target, void* data, Flags flags) : +Event::Event(Type type, void* target, void* data, Flags flags) : m_type(type), m_target(target), m_data(data), @@ -43,38 +43,38 @@ CEvent::CEvent(Type type, void* target, void* data, Flags flags) : // do nothing } -CEvent::Type -CEvent::getType() const +Event::Type +Event::getType() const { return m_type; } void* -CEvent::getTarget() const +Event::getTarget() const { return m_target; } void* -CEvent::getData() const +Event::getData() const { return m_data; } -CEventData* -CEvent::getDataObject() const +EventData* +Event::getDataObject() const { return m_dataObject; } -CEvent::Flags -CEvent::getFlags() const +Event::Flags +Event::getFlags() const { return m_flags; } void -CEvent::deleteData(const CEvent& event) +Event::deleteData(const Event& event) { switch (event.getType()) { case kUnknown: @@ -93,7 +93,7 @@ CEvent::deleteData(const CEvent& event) } void -CEvent::setDataObject(CEventData* dataObject) +Event::setDataObject(EventData* dataObject) { assert(m_dataObject == nullptr); m_dataObject = dataObject; diff --git a/src/lib/base/Event.h b/src/lib/base/Event.h index fd9c48c9..334a8b58 100644 --- a/src/lib/base/Event.h +++ b/src/lib/base/Event.h @@ -21,17 +21,17 @@ #include "common/basic_types.h" #include "common/stdmap.h" -class CEventData { +class EventData { public: - CEventData() { } - virtual ~CEventData() { } + EventData() { } + virtual ~EventData() { } }; //! Event /*! -A \c CEvent holds an event type and a pointer to event data. +A \c Event holds an event type and a pointer to event data. */ -class CEvent { +class Event { public: typedef UInt32 Type; enum { @@ -49,9 +49,9 @@ public: kDontFreeData = 0x02 //!< Don't free data in deleteData }; - CEvent(); + Event(); - //! Create \c CEvent with data (POD) + //! Create \c Event with data (POD) /*! The \p data must be POD (plain old data) allocated by malloc(), which means it cannot have a constructor, destructor or be @@ -60,7 +60,7 @@ public: \p target is the intended recipient of the event. \p flags is any combination of \c Flags. */ - CEvent(Type type, void* target = NULL, void* data = NULL, + Event(Type type, void* target = NULL, void* data = NULL, Flags flags = kNone); //! @name manipulators @@ -70,14 +70,14 @@ public: /*! Deletes event data for the given event (using free()). */ - static void deleteData(const CEvent&); + static void deleteData(const Event&); //! Set data (non-POD) /*! Set non-POD (non plain old data), where delete is called when the event is deleted, and the destructor is called. */ - void setDataObject(CEventData* dataObject); + void setDataObject(EventData* dataObject); //@} //! @name accessors @@ -107,7 +107,7 @@ public: \c getData() is that when delete is called on this data, so non-POD (non plain old data) dtor is called. */ - CEventData* getDataObject() const; + EventData* getDataObject() const; //! Get event flags /*! @@ -122,5 +122,5 @@ private: void* m_target; void* m_data; Flags m_flags; - CEventData* m_dataObject; + EventData* m_dataObject; }; diff --git a/src/lib/base/EventQueue.cpp b/src/lib/base/EventQueue.cpp index ce3f8f7e..20e56367 100644 --- a/src/lib/base/EventQueue.cpp +++ b/src/lib/base/EventQueue.cpp @@ -28,21 +28,21 @@ #include "base/Log.h" #include "base/XBase.h" -EVENT_TYPE_ACCESSOR(CClient) +EVENT_TYPE_ACCESSOR(Client) EVENT_TYPE_ACCESSOR(IStream) -EVENT_TYPE_ACCESSOR(CIpcClient) -EVENT_TYPE_ACCESSOR(CIpcClientProxy) -EVENT_TYPE_ACCESSOR(CIpcServer) -EVENT_TYPE_ACCESSOR(CIpcServerProxy) +EVENT_TYPE_ACCESSOR(IpcClient) +EVENT_TYPE_ACCESSOR(IpcClientProxy) +EVENT_TYPE_ACCESSOR(IpcServer) +EVENT_TYPE_ACCESSOR(IpcServerProxy) EVENT_TYPE_ACCESSOR(IDataSocket) EVENT_TYPE_ACCESSOR(IListenSocket) EVENT_TYPE_ACCESSOR(ISocket) -EVENT_TYPE_ACCESSOR(COSXScreen) -EVENT_TYPE_ACCESSOR(CClientListener) -EVENT_TYPE_ACCESSOR(CClientProxy) -EVENT_TYPE_ACCESSOR(CClientProxyUnknown) -EVENT_TYPE_ACCESSOR(CServer) -EVENT_TYPE_ACCESSOR(CServerApp) +EVENT_TYPE_ACCESSOR(OSXScreen) +EVENT_TYPE_ACCESSOR(ClientListener) +EVENT_TYPE_ACCESSOR(ClientProxy) +EVENT_TYPE_ACCESSOR(ClientProxyUnknown) +EVENT_TYPE_ACCESSOR(Server) +EVENT_TYPE_ACCESSOR(ServerApp) EVENT_TYPE_ACCESSOR(IKeyState) EVENT_TYPE_ACCESSOR(IPrimaryScreen) EVENT_TYPE_ACCESSOR(IScreen) @@ -50,89 +50,89 @@ EVENT_TYPE_ACCESSOR(IScreen) // interrupt handler. this just adds a quit event to the queue. static void -interrupt(CArch::ESignal, void* data) +interrupt(Arch::ESignal, void* data) { - CEventQueue* events = reinterpret_cast(data); - events->addEvent(CEvent(CEvent::kQuit)); + EventQueue* events = reinterpret_cast(data); + events->addEvent(Event(Event::kQuit)); } // -// CEventQueue +// EventQueue // -CEventQueue::CEventQueue() : +EventQueue::EventQueue() : m_systemTarget(0), - m_nextType(CEvent::kLast), - m_typesForCClient(NULL), + m_nextType(Event::kLast), + m_typesForClient(NULL), m_typesForIStream(NULL), - m_typesForCIpcClient(NULL), - m_typesForCIpcClientProxy(NULL), - m_typesForCIpcServer(NULL), - m_typesForCIpcServerProxy(NULL), + m_typesForIpcClient(NULL), + m_typesForIpcClientProxy(NULL), + m_typesForIpcServer(NULL), + m_typesForIpcServerProxy(NULL), m_typesForIDataSocket(NULL), m_typesForIListenSocket(NULL), m_typesForISocket(NULL), - m_typesForCOSXScreen(NULL), - m_typesForCClientListener(NULL), - m_typesForCClientProxy(NULL), - m_typesForCClientProxyUnknown(NULL), - m_typesForCServer(NULL), - m_typesForCServerApp(NULL), + m_typesForOSXScreen(NULL), + m_typesForClientListener(NULL), + m_typesForClientProxy(NULL), + m_typesForClientProxyUnknown(NULL), + m_typesForServer(NULL), + m_typesForServerApp(NULL), m_typesForIKeyState(NULL), m_typesForIPrimaryScreen(NULL), m_typesForIScreen(NULL), - m_readyMutex(new CMutex), - m_readyCondVar(new CCondVar(m_readyMutex, false)) + m_readyMutex(new Mutex), + m_readyCondVar(new CondVar(m_readyMutex, false)) { m_mutex = ARCH->newMutex(); - ARCH->setSignalHandler(CArch::kINTERRUPT, &interrupt, this); - ARCH->setSignalHandler(CArch::kTERMINATE, &interrupt, this); - m_buffer = new CSimpleEventQueueBuffer; + ARCH->setSignalHandler(Arch::kINTERRUPT, &interrupt, this); + ARCH->setSignalHandler(Arch::kTERMINATE, &interrupt, this); + m_buffer = new SimpleEventQueueBuffer; } -CEventQueue::~CEventQueue() +EventQueue::~EventQueue() { delete m_buffer; delete m_readyCondVar; delete m_readyMutex; - ARCH->setSignalHandler(CArch::kINTERRUPT, NULL, NULL); - ARCH->setSignalHandler(CArch::kTERMINATE, NULL, NULL); + ARCH->setSignalHandler(Arch::kINTERRUPT, NULL, NULL); + ARCH->setSignalHandler(Arch::kTERMINATE, NULL, NULL); ARCH->closeMutex(m_mutex); } void -CEventQueue::loop() +EventQueue::loop() { m_buffer->init(); { - CLock lock(m_readyMutex); + Lock lock(m_readyMutex); *m_readyCondVar = true; m_readyCondVar->signal(); } LOG((CLOG_DEBUG "event queue is ready")); while (!m_pending.empty()) { LOG((CLOG_DEBUG "add pending events to buffer")); - CEvent& event = m_pending.front(); + Event& event = m_pending.front(); addEventToBuffer(event); m_pending.pop(); } - CEvent event; + Event event; getEvent(event); - while (event.getType() != CEvent::kQuit) { + while (event.getType() != Event::kQuit) { dispatchEvent(event); - CEvent::deleteData(event); + Event::deleteData(event); getEvent(event); } } -CEvent::Type -CEventQueue::registerTypeOnce(CEvent::Type& type, const char* name) +Event::Type +EventQueue::registerTypeOnce(Event::Type& type, const char* name) { - CArchMutexLock lock(m_mutex); - if (type == CEvent::kUnknown) { + ArchMutexLock lock(m_mutex); + if (type == Event::kUnknown) { m_typeMap.insert(std::make_pair(m_nextType, name)); m_nameMap.insert(std::make_pair(name, m_nextType)); LOG((CLOG_DEBUG1 "registered event type %s as %d", name, m_nextType)); @@ -142,23 +142,23 @@ CEventQueue::registerTypeOnce(CEvent::Type& type, const char* name) } const char* -CEventQueue::getTypeName(CEvent::Type type) +EventQueue::getTypeName(Event::Type type) { switch (type) { - case CEvent::kUnknown: + case Event::kUnknown: return "nil"; - case CEvent::kQuit: + case Event::kQuit: return "quit"; - case CEvent::kSystem: + case Event::kSystem: return "system"; - case CEvent::kTimer: + case Event::kTimer: return "timer"; default: - CTypeMap::const_iterator i = m_typeMap.find(type); + TypeMap::const_iterator i = m_typeMap.find(type); if (i == m_typeMap.end()) { return ""; } @@ -169,9 +169,9 @@ CEventQueue::getTypeName(CEvent::Type type) } void -CEventQueue::adoptBuffer(IEventQueueBuffer* buffer) +EventQueue::adoptBuffer(IEventQueueBuffer* buffer) { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); LOG((CLOG_DEBUG "adopting new buffer")); @@ -183,8 +183,8 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer) // discard old buffer and old events delete m_buffer; - for (CEventTable::iterator i = m_events.begin(); i != m_events.end(); ++i) { - CEvent::deleteData(i->second); + for (EventTable::iterator i = m_events.begin(); i != m_events.end(); ++i) { + Event::deleteData(i->second); } m_events.clear(); m_oldEventIDs.clear(); @@ -192,14 +192,14 @@ CEventQueue::adoptBuffer(IEventQueueBuffer* buffer) // use new buffer m_buffer = buffer; if (m_buffer == NULL) { - m_buffer = new CSimpleEventQueueBuffer; + m_buffer = new SimpleEventQueueBuffer; } } bool -CEventQueue::getEvent(CEvent& event, double timeout) +EventQueue::getEvent(Event& event, double timeout) { - CStopwatch timer(true); + Stopwatch timer(true); retry: // if no events are waiting then handle timers and then wait while (m_buffer->isEmpty()) { @@ -244,7 +244,7 @@ retry: case IEventQueueBuffer::kUser: { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); event = removeEvent(dataID); return true; } @@ -256,12 +256,12 @@ retry: } bool -CEventQueue::dispatchEvent(const CEvent& event) +EventQueue::dispatchEvent(const Event& event) { void* target = event.getTarget(); IEventJob* job = getHandler(event.getType(), target); if (job == NULL) { - job = getHandler(CEvent::kUnknown, target); + job = getHandler(Event::kUnknown, target); } if (job != NULL) { job->run(event); @@ -271,22 +271,22 @@ CEventQueue::dispatchEvent(const CEvent& event) } void -CEventQueue::addEvent(const CEvent& event) +EventQueue::addEvent(const Event& event) { // discard bogus event types switch (event.getType()) { - case CEvent::kUnknown: - case CEvent::kSystem: - case CEvent::kTimer: + case Event::kUnknown: + case Event::kSystem: + case Event::kTimer: return; default: break; } - if ((event.getFlags() & CEvent::kDeliverImmediately) != 0) { + if ((event.getFlags() & Event::kDeliverImmediately) != 0) { dispatchEvent(event); - CEvent::deleteData(event); + Event::deleteData(event); } else if (!(*m_readyCondVar)) { m_pending.push(event); @@ -297,9 +297,9 @@ CEventQueue::addEvent(const CEvent& event) } void -CEventQueue::addEventToBuffer(const CEvent& event) +EventQueue::addEventToBuffer(const Event& event) { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); // store the event's data locally UInt32 eventID = saveEvent(event); @@ -308,60 +308,60 @@ CEventQueue::addEventToBuffer(const CEvent& event) if (!m_buffer->addEvent(eventID)) { // failed to send event removeEvent(eventID); - CEvent::deleteData(event); + Event::deleteData(event); } } -CEventQueueTimer* -CEventQueue::newTimer(double duration, void* target) +EventQueueTimer* +EventQueue::newTimer(double duration, void* target) { assert(duration > 0.0); - CEventQueueTimer* timer = m_buffer->newTimer(duration, false); + EventQueueTimer* timer = m_buffer->newTimer(duration, false); if (target == NULL) { target = timer; } - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); m_timers.insert(timer); // initial duration is requested duration plus whatever's on // the clock currently because the latter will be subtracted // the next time we check for timers. - m_timerQueue.push(CTimer(timer, duration, + m_timerQueue.push(Timer(timer, duration, duration + m_time.getTime(), target, false)); return timer; } -CEventQueueTimer* -CEventQueue::newOneShotTimer(double duration, void* target) +EventQueueTimer* +EventQueue::newOneShotTimer(double duration, void* target) { assert(duration > 0.0); - CEventQueueTimer* timer = m_buffer->newTimer(duration, true); + EventQueueTimer* timer = m_buffer->newTimer(duration, true); if (target == NULL) { target = timer; } - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); m_timers.insert(timer); // initial duration is requested duration plus whatever's on // the clock currently because the latter will be subtracted // the next time we check for timers. - m_timerQueue.push(CTimer(timer, duration, + m_timerQueue.push(Timer(timer, duration, duration + m_time.getTime(), target, true)); return timer; } void -CEventQueue::deleteTimer(CEventQueueTimer* timer) +EventQueue::deleteTimer(EventQueueTimer* timer) { - CArchMutexLock lock(m_mutex); - for (CTimerQueue::iterator index = m_timerQueue.begin(); + ArchMutexLock lock(m_mutex); + for (TimerQueue::iterator index = m_timerQueue.begin(); index != m_timerQueue.end(); ++index) { if (index->getTimer() == timer) { m_timerQueue.erase(index); break; } } - CTimers::iterator index = m_timers.find(timer); + Timers::iterator index = m_timers.find(timer); if (index != m_timers.end()) { m_timers.erase(index); } @@ -369,24 +369,24 @@ CEventQueue::deleteTimer(CEventQueueTimer* timer) } void -CEventQueue::adoptHandler(CEvent::Type type, void* target, IEventJob* handler) +EventQueue::adoptHandler(Event::Type type, void* target, IEventJob* handler) { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); IEventJob*& job = m_handlers[target][type]; delete job; job = handler; } void -CEventQueue::removeHandler(CEvent::Type type, void* target) +EventQueue::removeHandler(Event::Type type, void* target) { IEventJob* handler = NULL; { - CArchMutexLock lock(m_mutex); - CHandlerTable::iterator index = m_handlers.find(target); + ArchMutexLock lock(m_mutex); + HandlerTable::iterator index = m_handlers.find(target); if (index != m_handlers.end()) { - CTypeHandlerTable& typeHandlers = index->second; - CTypeHandlerTable::iterator index2 = typeHandlers.find(type); + TypeHandlerTable& typeHandlers = index->second; + TypeHandlerTable::iterator index2 = typeHandlers.find(type); if (index2 != typeHandlers.end()) { handler = index2->second; typeHandlers.erase(index2); @@ -397,16 +397,16 @@ CEventQueue::removeHandler(CEvent::Type type, void* target) } void -CEventQueue::removeHandlers(void* target) +EventQueue::removeHandlers(void* target) { std::vector handlers; { - CArchMutexLock lock(m_mutex); - CHandlerTable::iterator index = m_handlers.find(target); + ArchMutexLock lock(m_mutex); + HandlerTable::iterator index = m_handlers.find(target); if (index != m_handlers.end()) { // copy to handlers array and clear table for target - CTypeHandlerTable& typeHandlers = index->second; - for (CTypeHandlerTable::iterator index2 = typeHandlers.begin(); + TypeHandlerTable& typeHandlers = index->second; + for (TypeHandlerTable::iterator index2 = typeHandlers.begin(); index2 != typeHandlers.end(); ++index2) { handlers.push_back(index2->second); } @@ -422,19 +422,19 @@ CEventQueue::removeHandlers(void* target) } bool -CEventQueue::isEmpty() const +EventQueue::isEmpty() const { return (m_buffer->isEmpty() && getNextTimerTimeout() != 0.0); } IEventJob* -CEventQueue::getHandler(CEvent::Type type, void* target) const +EventQueue::getHandler(Event::Type type, void* target) const { - CArchMutexLock lock(m_mutex); - CHandlerTable::const_iterator index = m_handlers.find(target); + ArchMutexLock lock(m_mutex); + HandlerTable::const_iterator index = m_handlers.find(target); if (index != m_handlers.end()) { - const CTypeHandlerTable& typeHandlers = index->second; - CTypeHandlerTable::const_iterator index2 = typeHandlers.find(type); + const TypeHandlerTable& typeHandlers = index->second; + TypeHandlerTable::const_iterator index2 = typeHandlers.find(type); if (index2 != typeHandlers.end()) { return index2->second; } @@ -443,7 +443,7 @@ CEventQueue::getHandler(CEvent::Type type, void* target) const } UInt32 -CEventQueue::saveEvent(const CEvent& event) +EventQueue::saveEvent(const Event& event) { // choose id UInt32 id; @@ -462,17 +462,17 @@ CEventQueue::saveEvent(const CEvent& event) return id; } -CEvent -CEventQueue::removeEvent(UInt32 eventID) +Event +EventQueue::removeEvent(UInt32 eventID) { // look up id - CEventTable::iterator index = m_events.find(eventID); + EventTable::iterator index = m_events.find(eventID); if (index == m_events.end()) { - return CEvent(); + return Event(); } // get data - CEvent event = index->second; + Event event = index->second; m_events.erase(index); // save old id for reuse @@ -482,7 +482,7 @@ CEventQueue::removeEvent(UInt32 eventID) } bool -CEventQueue::hasTimerExpired(CEvent& event) +EventQueue::hasTimerExpired(Event& event) { // return true if there's a timer in the timer priority queue that // has expired. if returning true then fill in event appropriately @@ -496,7 +496,7 @@ CEventQueue::hasTimerExpired(CEvent& event) m_time.reset(); // countdown elapsed time - for (CTimerQueue::iterator index = m_timerQueue.begin(); + for (TimerQueue::iterator index = m_timerQueue.begin(); index != m_timerQueue.end(); ++index) { (*index) -= time; } @@ -507,12 +507,12 @@ CEventQueue::hasTimerExpired(CEvent& event) } // remove timer from queue - CTimer timer = m_timerQueue.top(); + Timer timer = m_timerQueue.top(); m_timerQueue.pop(); // prepare event and reset the timer's clock timer.fillEvent(m_timerEvent); - event = CEvent(CEvent::kTimer, timer.getTarget(), &m_timerEvent); + event = Event(Event::kTimer, timer.getTarget(), &m_timerEvent); timer.reset(); // reinsert timer into queue if it's not a one-shot @@ -524,7 +524,7 @@ CEventQueue::hasTimerExpired(CEvent& event) } double -CEventQueue::getNextTimerTimeout() const +EventQueue::getNextTimerTimeout() const { // return -1 if no timers, 0 if the top timer has expired, otherwise // the time until the top timer in the timer priority queue will @@ -538,28 +538,28 @@ CEventQueue::getNextTimerTimeout() const return m_timerQueue.top(); } -CEvent::Type -CEventQueue::getRegisteredType(const CString& name) const +Event::Type +EventQueue::getRegisteredType(const String& name) const { - CNameMap::const_iterator found = m_nameMap.find(name); + NameMap::const_iterator found = m_nameMap.find(name); if (found != m_nameMap.end()) return found->second; - return CEvent::kUnknown; + return Event::kUnknown; } void* -CEventQueue::getSystemTarget() +EventQueue::getSystemTarget() { // any unique arbitrary pointer will do return &m_systemTarget; } void -CEventQueue::waitForReady() const +EventQueue::waitForReady() const { double timeout = ARCH->time() + 10; - CLock lock(m_readyMutex); + Lock lock(m_readyMutex); while (!m_readyCondVar->wait()) { if(ARCH->time() > timeout) { @@ -569,10 +569,10 @@ CEventQueue::waitForReady() const } // -// CEventQueue::CTimer +// EventQueue::Timer // -CEventQueue::CTimer::CTimer(CEventQueueTimer* timer, double timeout, +EventQueue::Timer::Timer(EventQueueTimer* timer, double timeout, double initialTime, void* target, bool oneShot) : m_timer(timer), m_timeout(timeout), @@ -583,49 +583,49 @@ CEventQueue::CTimer::CTimer(CEventQueueTimer* timer, double timeout, assert(m_timeout > 0.0); } -CEventQueue::CTimer::~CTimer() +EventQueue::Timer::~Timer() { // do nothing } void -CEventQueue::CTimer::reset() +EventQueue::Timer::reset() { m_time = m_timeout; } -CEventQueue::CTimer& -CEventQueue::CTimer::operator-=(double dt) +EventQueue::Timer& +EventQueue::Timer::operator-=(double dt) { m_time -= dt; return *this; } -CEventQueue::CTimer::operator double() const +EventQueue::Timer::operator double() const { return m_time; } bool -CEventQueue::CTimer::isOneShot() const +EventQueue::Timer::isOneShot() const { return m_oneShot; } -CEventQueueTimer* -CEventQueue::CTimer::getTimer() const +EventQueueTimer* +EventQueue::Timer::getTimer() const { return m_timer; } void* -CEventQueue::CTimer::getTarget() const +EventQueue::Timer::getTarget() const { return m_target; } void -CEventQueue::CTimer::fillEvent(CTimerEvent& event) const +EventQueue::Timer::fillEvent(TimerEvent& event) const { event.m_timer = m_timer; event.m_count = 0; @@ -635,7 +635,7 @@ CEventQueue::CTimer::fillEvent(CTimerEvent& event) const } bool -CEventQueue::CTimer::operator<(const CTimer& t) const +EventQueue::Timer::operator<(const Timer& t) const { return m_time < t.m_time; } diff --git a/src/lib/base/EventQueue.h b/src/lib/base/EventQueue.h index e3a072f1..93d9d970 100644 --- a/src/lib/base/EventQueue.h +++ b/src/lib/base/EventQueue.h @@ -29,162 +29,162 @@ #include -class CMutex; +class Mutex; //! Event queue /*! An event queue that implements the platform independent parts and delegates the platform dependent parts to a subclass. */ -class CEventQueue : public IEventQueue { +class EventQueue : public IEventQueue { public: - CEventQueue(); - virtual ~CEventQueue(); + EventQueue(); + virtual ~EventQueue(); // IEventQueue overrides virtual void loop(); virtual void adoptBuffer(IEventQueueBuffer*); - virtual bool getEvent(CEvent& event, double timeout = -1.0); - virtual bool dispatchEvent(const CEvent& event); - virtual void addEvent(const CEvent& event); - virtual CEventQueueTimer* + virtual bool getEvent(Event& event, double timeout = -1.0); + virtual bool dispatchEvent(const Event& event); + virtual void addEvent(const Event& event); + virtual EventQueueTimer* newTimer(double duration, void* target); - virtual CEventQueueTimer* + virtual EventQueueTimer* newOneShotTimer(double duration, void* target); - virtual void deleteTimer(CEventQueueTimer*); - virtual void adoptHandler(CEvent::Type type, + virtual void deleteTimer(EventQueueTimer*); + virtual void adoptHandler(Event::Type type, void* target, IEventJob* handler); - virtual void removeHandler(CEvent::Type type, void* target); + virtual void removeHandler(Event::Type type, void* target); virtual void removeHandlers(void* target); - virtual CEvent::Type - registerTypeOnce(CEvent::Type& type, const char* name); + virtual Event::Type + registerTypeOnce(Event::Type& type, const char* name); virtual bool isEmpty() const; - virtual IEventJob* getHandler(CEvent::Type type, void* target) const; - virtual const char* getTypeName(CEvent::Type type); - virtual CEvent::Type - getRegisteredType(const CString& name) const; + virtual IEventJob* getHandler(Event::Type type, void* target) const; + virtual const char* getTypeName(Event::Type type); + virtual Event::Type + getRegisteredType(const String& name) const; void* getSystemTarget(); virtual void waitForReady() const; private: - UInt32 saveEvent(const CEvent& event); - CEvent removeEvent(UInt32 eventID); - bool hasTimerExpired(CEvent& event); + UInt32 saveEvent(const Event& event); + Event removeEvent(UInt32 eventID); + bool hasTimerExpired(Event& event); double getNextTimerTimeout() const; - void addEventToBuffer(const CEvent& event); + void addEventToBuffer(const Event& event); private: - class CTimer { + class Timer { public: - CTimer(CEventQueueTimer*, double timeout, double initialTime, + Timer(EventQueueTimer*, double timeout, double initialTime, void* target, bool oneShot); - ~CTimer(); + ~Timer(); void reset(); - CTimer& operator-=(double); + Timer& operator-=(double); operator double() const; bool isOneShot() const; - CEventQueueTimer* + EventQueueTimer* getTimer() const; void* getTarget() const; - void fillEvent(CTimerEvent&) const; + void fillEvent(TimerEvent&) const; - bool operator<(const CTimer&) const; + bool operator<(const Timer&) const; private: - CEventQueueTimer* m_timer; + EventQueueTimer* m_timer; double m_timeout; void* m_target; bool m_oneShot; double m_time; }; - typedef std::set CTimers; - typedef CPriorityQueue CTimerQueue; - typedef std::map CEventTable; - typedef std::vector CEventIDList; - typedef std::map CTypeMap; - typedef std::map CNameMap; - typedef std::map CTypeHandlerTable; - typedef std::map CHandlerTable; + typedef std::set Timers; + typedef PriorityQueue TimerQueue; + typedef std::map EventTable; + typedef std::vector EventIDList; + typedef std::map TypeMap; + typedef std::map NameMap; + typedef std::map TypeHandlerTable; + typedef std::map HandlerTable; int m_systemTarget; - CArchMutex m_mutex; + ArchMutex m_mutex; // registered events - CEvent::Type m_nextType; - CTypeMap m_typeMap; - CNameMap m_nameMap; + Event::Type m_nextType; + TypeMap m_typeMap; + NameMap m_nameMap; // buffer of events IEventQueueBuffer* m_buffer; // saved events - CEventTable m_events; - CEventIDList m_oldEventIDs; + EventTable m_events; + EventIDList m_oldEventIDs; // timers - CStopwatch m_time; - CTimers m_timers; - CTimerQueue m_timerQueue; - CTimerEvent m_timerEvent; + Stopwatch m_time; + Timers m_timers; + TimerQueue m_timerQueue; + TimerEvent m_timerEvent; // event handlers - CHandlerTable m_handlers; + HandlerTable m_handlers; public: // // Event type providers. // - CClientEvents& forCClient(); + ClientEvents& forClient(); IStreamEvents& forIStream(); - CIpcClientEvents& forCIpcClient(); - CIpcClientProxyEvents& forCIpcClientProxy(); - CIpcServerEvents& forCIpcServer(); - CIpcServerProxyEvents& forCIpcServerProxy(); + IpcClientEvents& forIpcClient(); + IpcClientProxyEvents& forIpcClientProxy(); + IpcServerEvents& forIpcServer(); + IpcServerProxyEvents& forIpcServerProxy(); IDataSocketEvents& forIDataSocket(); IListenSocketEvents& forIListenSocket(); ISocketEvents& forISocket(); - COSXScreenEvents& forCOSXScreen(); - CClientListenerEvents& forCClientListener(); - CClientProxyEvents& forCClientProxy(); - CClientProxyUnknownEvents& forCClientProxyUnknown(); - CServerEvents& forCServer(); - CServerAppEvents& forCServerApp(); + OSXScreenEvents& forOSXScreen(); + ClientListenerEvents& forClientListener(); + ClientProxyEvents& forClientProxy(); + ClientProxyUnknownEvents& forClientProxyUnknown(); + ServerEvents& forServer(); + ServerAppEvents& forServerApp(); IKeyStateEvents& forIKeyState(); IPrimaryScreenEvents& forIPrimaryScreen(); IScreenEvents& forIScreen(); private: - CClientEvents* m_typesForCClient; + ClientEvents* m_typesForClient; IStreamEvents* m_typesForIStream; - CIpcClientEvents* m_typesForCIpcClient; - CIpcClientProxyEvents* m_typesForCIpcClientProxy; - CIpcServerEvents* m_typesForCIpcServer; - CIpcServerProxyEvents* m_typesForCIpcServerProxy; + IpcClientEvents* m_typesForIpcClient; + IpcClientProxyEvents* m_typesForIpcClientProxy; + IpcServerEvents* m_typesForIpcServer; + IpcServerProxyEvents* m_typesForIpcServerProxy; IDataSocketEvents* m_typesForIDataSocket; IListenSocketEvents* m_typesForIListenSocket; ISocketEvents* m_typesForISocket; - COSXScreenEvents* m_typesForCOSXScreen; - CClientListenerEvents* m_typesForCClientListener; - CClientProxyEvents* m_typesForCClientProxy; - CClientProxyUnknownEvents* m_typesForCClientProxyUnknown; - CServerEvents* m_typesForCServer; - CServerAppEvents* m_typesForCServerApp; + OSXScreenEvents* m_typesForOSXScreen; + ClientListenerEvents* m_typesForClientListener; + ClientProxyEvents* m_typesForClientProxy; + ClientProxyUnknownEvents* m_typesForClientProxyUnknown; + ServerEvents* m_typesForServer; + ServerAppEvents* m_typesForServerApp; IKeyStateEvents* m_typesForIKeyState; IPrimaryScreenEvents* m_typesForIPrimaryScreen; IScreenEvents* m_typesForIScreen; - CMutex* m_readyMutex; - CCondVar* m_readyCondVar; - std::queue m_pending; + Mutex* m_readyMutex; + CondVar* m_readyCondVar; + std::queue m_pending; }; #define EVENT_TYPE_ACCESSOR(type_) \ type_##Events& \ -CEventQueue::for##type_() { \ +EventQueue::for##type_() { \ if (m_typesFor##type_ == NULL) { \ m_typesFor##type_ = new type_##Events(); \ m_typesFor##type_->setEvents(dynamic_cast(this)); \ diff --git a/src/lib/base/EventTypes.cpp b/src/lib/base/EventTypes.cpp index 312b3f9c..0a9f40d7 100644 --- a/src/lib/base/EventTypes.cpp +++ b/src/lib/base/EventTypes.cpp @@ -21,31 +21,31 @@ #include #include -CEventTypes::CEventTypes() : +EventTypes::EventTypes() : m_events(NULL) { } IEventQueue* -CEventTypes::getEvents() const +EventTypes::getEvents() const { assert(m_events != NULL); return m_events; } void -CEventTypes::setEvents(IEventQueue* events) +EventTypes::setEvents(IEventQueue* events) { m_events = events; } // -// CClient +// Client // -REGISTER_EVENT(CClient, connected) -REGISTER_EVENT(CClient, connectionFailed) -REGISTER_EVENT(CClient, disconnected) +REGISTER_EVENT(Client, connected) +REGISTER_EVENT(Client, connectionFailed) +REGISTER_EVENT(Client, disconnected) // // IStream @@ -58,24 +58,24 @@ REGISTER_EVENT(IStream, inputShutdown) REGISTER_EVENT(IStream, outputShutdown) // -// CIpcClient +// IpcClient // -REGISTER_EVENT(CIpcClient, connected) -REGISTER_EVENT(CIpcClient, messageReceived) +REGISTER_EVENT(IpcClient, connected) +REGISTER_EVENT(IpcClient, messageReceived) // -// CIpcClientProxy +// IpcClientProxy // -REGISTER_EVENT(CIpcClientProxy, messageReceived) -REGISTER_EVENT(CIpcClientProxy, disconnected) +REGISTER_EVENT(IpcClientProxy, messageReceived) +REGISTER_EVENT(IpcClientProxy, disconnected) // -// CIpcServerProxy +// IpcServerProxy // -REGISTER_EVENT(CIpcServerProxy, messageReceived) +REGISTER_EVENT(IpcServerProxy, messageReceived) // // IDataSocket @@ -97,52 +97,52 @@ REGISTER_EVENT(IListenSocket, connecting) REGISTER_EVENT(ISocket, disconnected) // -// COSXScreen +// OSXScreen // -REGISTER_EVENT(COSXScreen, confirmSleep) +REGISTER_EVENT(OSXScreen, confirmSleep) // -// CClientListener +// ClientListener // -REGISTER_EVENT(CClientListener, connected) +REGISTER_EVENT(ClientListener, connected) // -// CClientProxy +// ClientProxy // -REGISTER_EVENT(CClientProxy, ready) -REGISTER_EVENT(CClientProxy, disconnected) -REGISTER_EVENT(CClientProxy, clipboardChanged) +REGISTER_EVENT(ClientProxy, ready) +REGISTER_EVENT(ClientProxy, disconnected) +REGISTER_EVENT(ClientProxy, clipboardChanged) // -// CClientProxyUnknown +// ClientProxyUnknown // -REGISTER_EVENT(CClientProxyUnknown, success) -REGISTER_EVENT(CClientProxyUnknown, failure) +REGISTER_EVENT(ClientProxyUnknown, success) +REGISTER_EVENT(ClientProxyUnknown, failure) // -// CServer +// Server // -REGISTER_EVENT(CServer, error) -REGISTER_EVENT(CServer, connected) -REGISTER_EVENT(CServer, disconnected) -REGISTER_EVENT(CServer, switchToScreen) -REGISTER_EVENT(CServer, switchInDirection) -REGISTER_EVENT(CServer, keyboardBroadcast) -REGISTER_EVENT(CServer, lockCursorToScreen) -REGISTER_EVENT(CServer, screenSwitched) +REGISTER_EVENT(Server, error) +REGISTER_EVENT(Server, connected) +REGISTER_EVENT(Server, disconnected) +REGISTER_EVENT(Server, switchToScreen) +REGISTER_EVENT(Server, switchInDirection) +REGISTER_EVENT(Server, keyboardBroadcast) +REGISTER_EVENT(Server, lockCursorToScreen) +REGISTER_EVENT(Server, screenSwitched) // -// CServerApp +// ServerApp // -REGISTER_EVENT(CServerApp, reloadConfig) -REGISTER_EVENT(CServerApp, forceReconnect) -REGISTER_EVENT(CServerApp, resetServer) +REGISTER_EVENT(ServerApp, reloadConfig) +REGISTER_EVENT(ServerApp, forceReconnect) +REGISTER_EVENT(ServerApp, resetServer) // // IKeyState @@ -181,8 +181,8 @@ REGISTER_EVENT(IScreen, fileChunkSending) REGISTER_EVENT(IScreen, fileRecieveCompleted) // -// CIpcServer +// IpcServer // -REGISTER_EVENT(CIpcServer, clientConnected) -REGISTER_EVENT(CIpcServer, messageReceived) +REGISTER_EVENT(IpcServer, clientConnected) +REGISTER_EVENT(IpcServer, messageReceived) diff --git a/src/lib/base/EventTypes.h b/src/lib/base/EventTypes.h index 5c4d73bc..a67326b1 100644 --- a/src/lib/base/EventTypes.h +++ b/src/lib/base/EventTypes.h @@ -21,9 +21,9 @@ class IEventQueue; -class CEventTypes { +class EventTypes { public: - CEventTypes(); + EventTypes(); void setEvents(IEventQueue* events); protected: @@ -34,18 +34,18 @@ private: }; #define REGISTER_EVENT(type_, name_) \ -CEvent::Type \ +Event::Type \ type_##Events::name_() \ { \ return getEvents()->registerTypeOnce(m_##name_, __FUNCTION__); \ } -class CClientEvents : public CEventTypes { +class ClientEvents : public EventTypes { public: - CClientEvents() : - m_connected(CEvent::kUnknown), - m_connectionFailed(CEvent::kUnknown), - m_disconnected(CEvent::kUnknown) { } + ClientEvents() : + m_connected(Event::kUnknown), + m_connectionFailed(Event::kUnknown), + m_disconnected(Event::kUnknown) { } //! @name accessors //@{ @@ -55,14 +55,14 @@ public: Returns the connected event type. This is sent when the client has successfully connected to the server. */ - CEvent::Type connected(); + Event::Type connected(); //! Get connection failed event type /*! Returns the connection failed event type. This is sent when the - server fails for some reason. The event data is a CFailInfo*. + server fails for some reason. The event data is a FailInfo*. */ - CEvent::Type connectionFailed(); + Event::Type connectionFailed(); //! Get disconnected event type /*! @@ -70,24 +70,24 @@ public: has disconnected from the server (and only after having successfully connected). */ - CEvent::Type disconnected(); + Event::Type disconnected(); //@} private: - CEvent::Type m_connected; - CEvent::Type m_connectionFailed; - CEvent::Type m_disconnected; + Event::Type m_connected; + Event::Type m_connectionFailed; + Event::Type m_disconnected; }; -class IStreamEvents : public CEventTypes { +class IStreamEvents : public EventTypes { public: IStreamEvents() : - m_inputReady(CEvent::kUnknown), - m_outputFlushed(CEvent::kUnknown), - m_outputError(CEvent::kUnknown), - m_inputShutdown(CEvent::kUnknown), - m_outputShutdown(CEvent::kUnknown) { } + m_inputReady(Event::kUnknown), + m_outputFlushed(Event::kUnknown), + m_outputError(Event::kUnknown), + m_inputShutdown(Event::kUnknown), + m_outputShutdown(Event::kUnknown) { } //! @name accessors //@{ @@ -97,7 +97,7 @@ public: Returns the input ready event type. A stream sends this event when \c read() will return with data. */ - CEvent::Type inputReady(); + Event::Type inputReady(); //! Get output flushed event type /*! @@ -107,14 +107,14 @@ public: \c close() will not discard any data and \c flush() will return immediately. */ - CEvent::Type outputFlushed(); + Event::Type outputFlushed(); //! Get output error event type /*! Returns the output error event type. A stream sends this event when a write has failed. */ - CEvent::Type outputError(); + Event::Type outputError(); //! Get input shutdown event type /*! @@ -122,7 +122,7 @@ public: input side of the stream has shutdown. When the input has shutdown, no more data will ever be available to read. */ - CEvent::Type inputShutdown(); + Event::Type inputShutdown(); //! Get output shutdown event type /*! @@ -131,106 +131,106 @@ public: shutdown, no more data can ever be written to the stream. Any attempt to do so will generate a output error event. */ - CEvent::Type outputShutdown(); + Event::Type outputShutdown(); //@} private: - CEvent::Type m_inputReady; - CEvent::Type m_outputFlushed; - CEvent::Type m_outputError; - CEvent::Type m_inputShutdown; - CEvent::Type m_outputShutdown; + Event::Type m_inputReady; + Event::Type m_outputFlushed; + Event::Type m_outputError; + Event::Type m_inputShutdown; + Event::Type m_outputShutdown; }; -class CIpcClientEvents : public CEventTypes { +class IpcClientEvents : public EventTypes { public: - CIpcClientEvents() : - m_connected(CEvent::kUnknown), - m_messageReceived(CEvent::kUnknown) { } + IpcClientEvents() : + m_connected(Event::kUnknown), + m_messageReceived(Event::kUnknown) { } //! @name accessors //@{ //! Raised when the socket is connected. - CEvent::Type connected(); + Event::Type connected(); //! Raised when a message is received. - CEvent::Type messageReceived(); + Event::Type messageReceived(); //@} private: - CEvent::Type m_connected; - CEvent::Type m_messageReceived; + Event::Type m_connected; + Event::Type m_messageReceived; }; -class CIpcClientProxyEvents : public CEventTypes { +class IpcClientProxyEvents : public EventTypes { public: - CIpcClientProxyEvents() : - m_messageReceived(CEvent::kUnknown), - m_disconnected(CEvent::kUnknown) { } + IpcClientProxyEvents() : + m_messageReceived(Event::kUnknown), + m_disconnected(Event::kUnknown) { } //! @name accessors //@{ //! Raised when the server receives a message from a client. - CEvent::Type messageReceived(); + Event::Type messageReceived(); //! Raised when the client disconnects from the server. - CEvent::Type disconnected(); + Event::Type disconnected(); //@} private: - CEvent::Type m_messageReceived; - CEvent::Type m_disconnected; + Event::Type m_messageReceived; + Event::Type m_disconnected; }; -class CIpcServerEvents : public CEventTypes { +class IpcServerEvents : public EventTypes { public: - CIpcServerEvents() : - m_clientConnected(CEvent::kUnknown), - m_messageReceived(CEvent::kUnknown) { } + IpcServerEvents() : + m_clientConnected(Event::kUnknown), + m_messageReceived(Event::kUnknown) { } //! @name accessors //@{ //! Raised when we have created the client proxy. - CEvent::Type clientConnected(); + Event::Type clientConnected(); //! Raised when a message is received through a client proxy. - CEvent::Type messageReceived(); + Event::Type messageReceived(); //@} private: - CEvent::Type m_clientConnected; - CEvent::Type m_messageReceived; + Event::Type m_clientConnected; + Event::Type m_messageReceived; }; -class CIpcServerProxyEvents : public CEventTypes { +class IpcServerProxyEvents : public EventTypes { public: - CIpcServerProxyEvents() : - m_messageReceived(CEvent::kUnknown) { } + IpcServerProxyEvents() : + m_messageReceived(Event::kUnknown) { } //! @name accessors //@{ //! Raised when the client receives a message from the server. - CEvent::Type messageReceived(); + Event::Type messageReceived(); //@} private: - CEvent::Type m_messageReceived; + Event::Type m_messageReceived; }; -class IDataSocketEvents : public CEventTypes { +class IDataSocketEvents : public EventTypes { public: IDataSocketEvents() : - m_connected(CEvent::kUnknown), - m_connectionFailed(CEvent::kUnknown) { } + m_connected(Event::kUnknown), + m_connectionFailed(Event::kUnknown) { } //! @name accessors //@{ @@ -240,27 +240,27 @@ public: Returns the socket connected event type. A socket sends this event when a remote connection has been established. */ - CEvent::Type connected(); + Event::Type connected(); //! Get connection failed event type /*! Returns the socket connection failed event type. A socket sends this event when an attempt to connect to a remote port has failed. - The data is a pointer to a CConnectionFailedInfo. + The data is a pointer to a ConnectionFailedInfo. */ - CEvent::Type connectionFailed(); + Event::Type connectionFailed(); //@} private: - CEvent::Type m_connected; - CEvent::Type m_connectionFailed; + Event::Type m_connected; + Event::Type m_connectionFailed; }; -class IListenSocketEvents : public CEventTypes { +class IListenSocketEvents : public EventTypes { public: IListenSocketEvents() : - m_connecting(CEvent::kUnknown) { } + m_connecting(Event::kUnknown) { } //! @name accessors //@{ @@ -270,18 +270,18 @@ public: Returns the socket connecting event type. A socket sends this event when a remote connection is waiting to be accepted. */ - CEvent::Type connecting(); + Event::Type connecting(); //@} private: - CEvent::Type m_connecting; + Event::Type m_connecting; }; -class ISocketEvents : public CEventTypes { +class ISocketEvents : public EventTypes { public: ISocketEvents() : - m_disconnected(CEvent::kUnknown) { } + m_disconnected(Event::kUnknown) { } //! @name accessors //@{ @@ -292,34 +292,34 @@ public: event when the remote side of the socket has disconnected or shutdown both input and output. */ - CEvent::Type disconnected(); + Event::Type disconnected(); //@} private: - CEvent::Type m_disconnected; + Event::Type m_disconnected; }; -class COSXScreenEvents : public CEventTypes { +class OSXScreenEvents : public EventTypes { public: - COSXScreenEvents() : - m_confirmSleep(CEvent::kUnknown) { } + OSXScreenEvents() : + m_confirmSleep(Event::kUnknown) { } //! @name accessors //@{ - CEvent::Type confirmSleep(); + Event::Type confirmSleep(); //@} private: - CEvent::Type m_confirmSleep; + Event::Type m_confirmSleep; }; -class CClientListenerEvents : public CEventTypes { +class ClientListenerEvents : public EventTypes { public: - CClientListenerEvents() : - m_connected(CEvent::kUnknown) { } + ClientListenerEvents() : + m_connected(Event::kUnknown) { } //! @name accessors //@{ @@ -329,20 +329,20 @@ public: Returns the connected event type. This is sent whenever a a client connects. */ - CEvent::Type connected(); + Event::Type connected(); //@} private: - CEvent::Type m_connected; + Event::Type m_connected; }; -class CClientProxyEvents : public CEventTypes { +class ClientProxyEvents : public EventTypes { public: - CClientProxyEvents() : - m_ready(CEvent::kUnknown), - m_disconnected(CEvent::kUnknown), - m_clipboardChanged(CEvent::kUnknown) { } + ClientProxyEvents() : + m_ready(Event::kUnknown), + m_disconnected(Event::kUnknown), + m_clipboardChanged(Event::kUnknown) { } //! @name accessors //@{ @@ -353,36 +353,36 @@ public: completed the initial handshake. Until it is sent, the client is not fully connected. */ - CEvent::Type ready(); + Event::Type ready(); //! Get disconnect event type /*! Returns the disconnect event type. This is sent when the client disconnects or is disconnected. The target is getEventTarget(). */ - CEvent::Type disconnected(); + Event::Type disconnected(); //! Get clipboard changed event type /*! Returns the clipboard changed event type. This is sent whenever the contents of the clipboard has changed. The data is a pointer to a - IScreen::CClipboardInfo. + IScreen::ClipboardInfo. */ - CEvent::Type clipboardChanged(); + Event::Type clipboardChanged(); //@} private: - CEvent::Type m_ready; - CEvent::Type m_disconnected; - CEvent::Type m_clipboardChanged; + Event::Type m_ready; + Event::Type m_disconnected; + Event::Type m_clipboardChanged; }; -class CClientProxyUnknownEvents : public CEventTypes { +class ClientProxyUnknownEvents : public EventTypes { public: - CClientProxyUnknownEvents() : - m_success(CEvent::kUnknown), - m_failure(CEvent::kUnknown) { } + ClientProxyUnknownEvents() : + m_success(Event::kUnknown), + m_failure(Event::kUnknown) { } //! @name accessors //@{ @@ -392,33 +392,33 @@ public: Returns the success event type. This is sent when the client has correctly responded to the hello message. The target is this. */ - CEvent::Type success(); + Event::Type success(); //! Get failure event type /*! Returns the failure event type. This is sent when a client fails to correctly respond to the hello message. The target is this. */ - CEvent::Type failure(); + Event::Type failure(); //@} private: - CEvent::Type m_success; - CEvent::Type m_failure; + Event::Type m_success; + Event::Type m_failure; }; -class CServerEvents : public CEventTypes { +class ServerEvents : public EventTypes { public: - CServerEvents() : - m_error(CEvent::kUnknown), - m_connected(CEvent::kUnknown), - m_disconnected(CEvent::kUnknown), - m_switchToScreen(CEvent::kUnknown), - m_switchInDirection(CEvent::kUnknown), - m_keyboardBroadcast(CEvent::kUnknown), - m_lockCursorToScreen(CEvent::kUnknown), - m_screenSwitched(CEvent::kUnknown) { } + ServerEvents() : + m_error(Event::kUnknown), + m_connected(Event::kUnknown), + m_disconnected(Event::kUnknown), + m_switchToScreen(Event::kUnknown), + m_switchInDirection(Event::kUnknown), + m_keyboardBroadcast(Event::kUnknown), + m_lockCursorToScreen(Event::kUnknown), + m_screenSwitched(Event::kUnknown) { } //! @name accessors //@{ @@ -428,208 +428,208 @@ public: Returns the error event type. This is sent when the server fails for some reason. */ - CEvent::Type error(); + Event::Type error(); //! Get connected event type /*! Returns the connected event type. This is sent when a client screen - has connected. The event data is a \c CScreenConnectedInfo* that + has connected. The event data is a \c ScreenConnectedInfo* that indicates the connected screen. */ - CEvent::Type connected(); + Event::Type connected(); //! Get disconnected event type /*! Returns the disconnected event type. This is sent when all the clients have disconnected. */ - CEvent::Type disconnected(); + Event::Type disconnected(); //! Get switch to screen event type /*! Returns the switch to screen event type. The server responds to this - by switching screens. The event data is a \c CSwitchToScreenInfo* + by switching screens. The event data is a \c SwitchToScreenInfo* that indicates the target screen. */ - CEvent::Type switchToScreen(); + Event::Type switchToScreen(); //! Get switch in direction event type /*! Returns the switch in direction event type. The server responds to this - by switching screens. The event data is a \c CSwitchInDirectionInfo* + by switching screens. The event data is a \c SwitchInDirectionInfo* that indicates the target direction. */ - CEvent::Type switchInDirection(); + Event::Type switchInDirection(); //! Get keyboard broadcast event type /*! Returns the keyboard broadcast event type. The server responds to this by turning on keyboard broadcasting or turning it off. The - event data is a \c CKeyboardBroadcastInfo*. + event data is a \c KeyboardBroadcastInfo*. */ - CEvent::Type keyboardBroadcast(); + Event::Type keyboardBroadcast(); //! Get lock cursor event type /*! Returns the lock cursor event type. The server responds to this by locking the cursor to the active screen or unlocking it. The - event data is a \c CLockCursorToScreenInfo*. + event data is a \c LockCursorToScreenInfo*. */ - CEvent::Type lockCursorToScreen(); + Event::Type lockCursorToScreen(); //! Get screen switched event type /*! Returns the screen switched event type. This is raised when the screen has been switched to a client. */ - CEvent::Type screenSwitched(); + Event::Type screenSwitched(); //@} private: - CEvent::Type m_error; - CEvent::Type m_connected; - CEvent::Type m_disconnected; - CEvent::Type m_switchToScreen; - CEvent::Type m_switchInDirection; - CEvent::Type m_keyboardBroadcast; - CEvent::Type m_lockCursorToScreen; - CEvent::Type m_screenSwitched; + Event::Type m_error; + Event::Type m_connected; + Event::Type m_disconnected; + Event::Type m_switchToScreen; + Event::Type m_switchInDirection; + Event::Type m_keyboardBroadcast; + Event::Type m_lockCursorToScreen; + Event::Type m_screenSwitched; }; -class CServerAppEvents : public CEventTypes { +class ServerAppEvents : public EventTypes { public: - CServerAppEvents() : - m_reloadConfig(CEvent::kUnknown), - m_forceReconnect(CEvent::kUnknown), - m_resetServer(CEvent::kUnknown) { } + ServerAppEvents() : + m_reloadConfig(Event::kUnknown), + m_forceReconnect(Event::kUnknown), + m_resetServer(Event::kUnknown) { } //! @name accessors //@{ - CEvent::Type reloadConfig(); - CEvent::Type forceReconnect(); - CEvent::Type resetServer(); + Event::Type reloadConfig(); + Event::Type forceReconnect(); + Event::Type resetServer(); //@} private: - CEvent::Type m_reloadConfig; - CEvent::Type m_forceReconnect; - CEvent::Type m_resetServer; + Event::Type m_reloadConfig; + Event::Type m_forceReconnect; + Event::Type m_resetServer; }; -class IKeyStateEvents : public CEventTypes { +class IKeyStateEvents : public EventTypes { public: IKeyStateEvents() : - m_keyDown(CEvent::kUnknown), - m_keyUp(CEvent::kUnknown), - m_keyRepeat(CEvent::kUnknown) { } + m_keyDown(Event::kUnknown), + m_keyUp(Event::kUnknown), + m_keyRepeat(Event::kUnknown) { } //! @name accessors //@{ - //! Get key down event type. Event data is CKeyInfo*, count == 1. - CEvent::Type keyDown(); + //! Get key down event type. Event data is KeyInfo*, count == 1. + Event::Type keyDown(); - //! Get key up event type. Event data is CKeyInfo*, count == 1. - CEvent::Type keyUp(); + //! Get key up event type. Event data is KeyInfo*, count == 1. + Event::Type keyUp(); - //! Get key repeat event type. Event data is CKeyInfo*. - CEvent::Type keyRepeat(); + //! Get key repeat event type. Event data is KeyInfo*. + Event::Type keyRepeat(); //@} private: - CEvent::Type m_keyDown; - CEvent::Type m_keyUp; - CEvent::Type m_keyRepeat; + Event::Type m_keyDown; + Event::Type m_keyUp; + Event::Type m_keyRepeat; }; -class IPrimaryScreenEvents : public CEventTypes { +class IPrimaryScreenEvents : public EventTypes { public: IPrimaryScreenEvents() : - m_buttonDown(CEvent::kUnknown), - m_buttonUp(CEvent::kUnknown), - m_motionOnPrimary(CEvent::kUnknown), - m_motionOnSecondary(CEvent::kUnknown), - m_wheel(CEvent::kUnknown), - m_screensaverActivated(CEvent::kUnknown), - m_screensaverDeactivated(CEvent::kUnknown), - m_hotKeyDown(CEvent::kUnknown), - m_hotKeyUp(CEvent::kUnknown), - m_fakeInputBegin(CEvent::kUnknown), - m_fakeInputEnd(CEvent::kUnknown) { } + m_buttonDown(Event::kUnknown), + m_buttonUp(Event::kUnknown), + m_motionOnPrimary(Event::kUnknown), + m_motionOnSecondary(Event::kUnknown), + m_wheel(Event::kUnknown), + m_screensaverActivated(Event::kUnknown), + m_screensaverDeactivated(Event::kUnknown), + m_hotKeyDown(Event::kUnknown), + m_hotKeyUp(Event::kUnknown), + m_fakeInputBegin(Event::kUnknown), + m_fakeInputEnd(Event::kUnknown) { } //! @name accessors //@{ - //! button down event type. Event data is CButtonInfo*. - CEvent::Type buttonDown(); + //! button down event type. Event data is ButtonInfo*. + Event::Type buttonDown(); - //! button up event type. Event data is CButtonInfo*. - CEvent::Type buttonUp(); + //! button up event type. Event data is ButtonInfo*. + Event::Type buttonUp(); //! mouse motion on the primary screen event type /*! - Event data is CMotionInfo* and the values are an absolute position. + Event data is MotionInfo* and the values are an absolute position. */ - CEvent::Type motionOnPrimary(); + Event::Type motionOnPrimary(); //! mouse motion on a secondary screen event type /*! - Event data is CMotionInfo* and the values are motion deltas not + Event data is MotionInfo* and the values are motion deltas not absolute coordinates. */ - CEvent::Type motionOnSecondary(); + Event::Type motionOnSecondary(); - //! mouse wheel event type. Event data is CWheelInfo*. - CEvent::Type wheel(); + //! mouse wheel event type. Event data is WheelInfo*. + Event::Type wheel(); //! screensaver activated event type - CEvent::Type screensaverActivated(); + Event::Type screensaverActivated(); //! screensaver deactivated event type - CEvent::Type screensaverDeactivated(); + Event::Type screensaverDeactivated(); - //! hot key down event type. Event data is CHotKeyInfo*. - CEvent::Type hotKeyDown(); + //! hot key down event type. Event data is HotKeyInfo*. + Event::Type hotKeyDown(); - //! hot key up event type. Event data is CHotKeyInfo*. - CEvent::Type hotKeyUp(); + //! hot key up event type. Event data is HotKeyInfo*. + Event::Type hotKeyUp(); //! start of fake input event type - CEvent::Type fakeInputBegin(); + Event::Type fakeInputBegin(); //! end of fake input event type - CEvent::Type fakeInputEnd(); + Event::Type fakeInputEnd(); //@} private: - CEvent::Type m_buttonDown; - CEvent::Type m_buttonUp; - CEvent::Type m_motionOnPrimary; - CEvent::Type m_motionOnSecondary; - CEvent::Type m_wheel; - CEvent::Type m_screensaverActivated; - CEvent::Type m_screensaverDeactivated; - CEvent::Type m_hotKeyDown; - CEvent::Type m_hotKeyUp; - CEvent::Type m_fakeInputBegin; - CEvent::Type m_fakeInputEnd; + Event::Type m_buttonDown; + Event::Type m_buttonUp; + Event::Type m_motionOnPrimary; + Event::Type m_motionOnSecondary; + Event::Type m_wheel; + Event::Type m_screensaverActivated; + Event::Type m_screensaverDeactivated; + Event::Type m_hotKeyDown; + Event::Type m_hotKeyUp; + Event::Type m_fakeInputBegin; + Event::Type m_fakeInputEnd; }; -class IScreenEvents : public CEventTypes { +class IScreenEvents : public EventTypes { public: IScreenEvents() : - m_error(CEvent::kUnknown), - m_shapeChanged(CEvent::kUnknown), - m_clipboardGrabbed(CEvent::kUnknown), - m_suspend(CEvent::kUnknown), - m_resume(CEvent::kUnknown), - m_fileChunkSending(CEvent::kUnknown), - m_fileRecieveCompleted(CEvent::kUnknown) { } + m_error(Event::kUnknown), + m_shapeChanged(Event::kUnknown), + m_clipboardGrabbed(Event::kUnknown), + m_suspend(Event::kUnknown), + m_resume(Event::kUnknown), + m_fileChunkSending(Event::kUnknown), + m_fileRecieveCompleted(Event::kUnknown) { } //! @name accessors //@{ @@ -639,51 +639,51 @@ public: Returns the error event type. This is sent whenever the screen has failed for some reason (e.g. the X Windows server died). */ - CEvent::Type error(); + Event::Type error(); //! Get shape changed event type /*! Returns the shape changed event type. This is sent whenever the screen's shape changes. */ - CEvent::Type shapeChanged(); + Event::Type shapeChanged(); //! Get clipboard grabbed event type /*! Returns the clipboard grabbed event type. This is sent whenever the clipboard is grabbed by some other application so we don't own it - anymore. The data is a pointer to a CClipboardInfo. + anymore. The data is a pointer to a ClipboardInfo. */ - CEvent::Type clipboardGrabbed(); + Event::Type clipboardGrabbed(); //! Get suspend event type /*! Returns the suspend event type. This is sent whenever the system goes to sleep or a user session is deactivated (fast user switching). */ - CEvent::Type suspend(); + Event::Type suspend(); //! Get resume event type /*! Returns the resume event type. This is sent whenever the system wakes up or a user session is activated (fast user switching). */ - CEvent::Type resume(); + Event::Type resume(); //! Sending a file chunk - CEvent::Type fileChunkSending(); + Event::Type fileChunkSending(); //! Completed receiving a file - CEvent::Type fileRecieveCompleted(); + Event::Type fileRecieveCompleted(); //@} private: - CEvent::Type m_error; - CEvent::Type m_shapeChanged; - CEvent::Type m_clipboardGrabbed; - CEvent::Type m_suspend; - CEvent::Type m_resume; - CEvent::Type m_fileChunkSending; - CEvent::Type m_fileRecieveCompleted; + Event::Type m_error; + Event::Type m_shapeChanged; + Event::Type m_clipboardGrabbed; + Event::Type m_suspend; + Event::Type m_resume; + Event::Type m_fileChunkSending; + Event::Type m_fileRecieveCompleted; }; diff --git a/src/lib/base/FunctionEventJob.cpp b/src/lib/base/FunctionEventJob.cpp index 923990a4..8a195735 100644 --- a/src/lib/base/FunctionEventJob.cpp +++ b/src/lib/base/FunctionEventJob.cpp @@ -19,24 +19,24 @@ #include "base/FunctionEventJob.h" // -// CFunctionEventJob +// FunctionEventJob // -CFunctionEventJob::CFunctionEventJob( - void (*func)(const CEvent&, void*), void* arg) : +FunctionEventJob::FunctionEventJob( + void (*func)(const Event&, void*), void* arg) : m_func(func), m_arg(arg) { // do nothing } -CFunctionEventJob::~CFunctionEventJob() +FunctionEventJob::~FunctionEventJob() { // do nothing } void -CFunctionEventJob::run(const CEvent& event) +FunctionEventJob::run(const Event& event) { if (m_func != NULL) { m_func(event, m_arg); diff --git a/src/lib/base/FunctionEventJob.h b/src/lib/base/FunctionEventJob.h index 4612bf05..ce3e0f2c 100644 --- a/src/lib/base/FunctionEventJob.h +++ b/src/lib/base/FunctionEventJob.h @@ -24,16 +24,16 @@ /*! An event job class that invokes a function. */ -class CFunctionEventJob : public IEventJob { +class FunctionEventJob : public IEventJob { public: //! run() invokes \c func(arg) - CFunctionEventJob(void (*func)(const CEvent&, void*), void* arg = NULL); - virtual ~CFunctionEventJob(); + FunctionEventJob(void (*func)(const Event&, void*), void* arg = NULL); + virtual ~FunctionEventJob(); // IEventJob overrides - virtual void run(const CEvent&); + virtual void run(const Event&); private: - void (*m_func)(const CEvent&, void*); + void (*m_func)(const Event&, void*); void* m_arg; }; diff --git a/src/lib/base/FunctionJob.cpp b/src/lib/base/FunctionJob.cpp index 7190c2e5..82e3b087 100644 --- a/src/lib/base/FunctionJob.cpp +++ b/src/lib/base/FunctionJob.cpp @@ -19,23 +19,23 @@ #include "base/FunctionJob.h" // -// CFunctionJob +// FunctionJob // -CFunctionJob::CFunctionJob(void (*func)(void*), void* arg) : +FunctionJob::FunctionJob(void (*func)(void*), void* arg) : m_func(func), m_arg(arg) { // do nothing } -CFunctionJob::~CFunctionJob() +FunctionJob::~FunctionJob() { // do nothing } void -CFunctionJob::run() +FunctionJob::run() { if (m_func != NULL) { m_func(m_arg); diff --git a/src/lib/base/FunctionJob.h b/src/lib/base/FunctionJob.h index 3fa1bf38..2628bc3e 100644 --- a/src/lib/base/FunctionJob.h +++ b/src/lib/base/FunctionJob.h @@ -24,11 +24,11 @@ /*! A job class that invokes a function. */ -class CFunctionJob : public IJob { +class FunctionJob : public IJob { public: //! run() invokes \c func(arg) - CFunctionJob(void (*func)(void*), void* arg = NULL); - virtual ~CFunctionJob(); + FunctionJob(void (*func)(void*), void* arg = NULL); + virtual ~FunctionJob(); // IJob overrides virtual void run(); diff --git a/src/lib/base/IEventJob.h b/src/lib/base/IEventJob.h index 0a3adaf4..6d0e1b67 100644 --- a/src/lib/base/IEventJob.h +++ b/src/lib/base/IEventJob.h @@ -20,7 +20,7 @@ #include "common/IInterface.h" -class CEvent; +class Event; //! Event handler interface /*! @@ -29,5 +29,5 @@ An event job is an interface for executing a event handler. class IEventJob : public IInterface { public: //! Run the job - virtual void run(const CEvent&) = 0; + virtual void run(const Event&) = 0; }; diff --git a/src/lib/base/IEventQueue.h b/src/lib/base/IEventQueue.h index c5f81cc8..25186f0a 100644 --- a/src/lib/base/IEventQueue.h +++ b/src/lib/base/IEventQueue.h @@ -27,40 +27,40 @@ class IEventQueueBuffer; // Opaque type for timer info. This is defined by subclasses of // IEventQueueBuffer. -class CEventQueueTimer; +class EventQueueTimer; // Event type registration classes. -class CClientEvents; +class ClientEvents; class IStreamEvents; -class CIpcClientEvents; -class CIpcClientProxyEvents; -class CIpcServerEvents; -class CIpcServerProxyEvents; +class IpcClientEvents; +class IpcClientProxyEvents; +class IpcServerEvents; +class IpcServerProxyEvents; class IDataSocketEvents; class IListenSocketEvents; class ISocketEvents; -class COSXScreenEvents; -class CClientListenerEvents; -class CClientProxyEvents; -class CClientProxyUnknownEvents; -class CServerEvents; -class CServerAppEvents; +class OSXScreenEvents; +class ClientListenerEvents; +class ClientProxyEvents; +class ClientProxyUnknownEvents; +class ServerEvents; +class ServerAppEvents; class IKeyStateEvents; class IPrimaryScreenEvents; class IScreenEvents; //! Event queue interface /*! -An event queue provides a queue of CEvents. Clients can block waiting +An event queue provides a queue of Events. Clients can block waiting on any event becoming available at the head of the queue and can place new events at the end of the queue. Clients can also add and remove timers which generate events periodically. */ class IEventQueue : public IInterface { public: - class CTimerEvent { + class TimerEvent { public: - CEventQueueTimer* m_timer; //!< The timer + EventQueueTimer* m_timer; //!< The timer UInt32 m_count; //!< Number of repeats }; @@ -86,26 +86,26 @@ public: available then blocks for up to \p timeout seconds, or forever if \p timeout is negative. Returns true iff an event was available. */ - virtual bool getEvent(CEvent& event, double timeout = -1.0) = 0; + virtual bool getEvent(Event& event, double timeout = -1.0) = 0; //! Dispatch an event /*! Looks up the dispatcher for the event's target and invokes it. Returns true iff a dispatcher exists for the target. */ - virtual bool dispatchEvent(const CEvent& event) = 0; + virtual bool dispatchEvent(const Event& event) = 0; //! Add event to queue /*! Adds \p event to the end of the queue. */ - virtual void addEvent(const CEvent& event) = 0; + virtual void addEvent(const Event& event) = 0; //! Create a recurring timer /*! Creates and returns a timer. An event is returned after \p duration seconds and the timer is reset to countdown again. When a timer event - is returned the data points to a \c CTimerEvent. The client must pass + is returned the data points to a \c TimerEvent. The client must pass the returned timer to \c deleteTimer() (whether or not the timer has expired) to release the timer. The returned timer event uses the given \p target. If \p target is NULL it uses the returned timer as @@ -113,25 +113,25 @@ public: Events for a single timer don't accumulate in the queue, even if the client reading events can't keep up. Instead, the \c m_count member - of the \c CTimerEvent indicates how many events for the timer would + of the \c TimerEvent indicates how many events for the timer would have been put on the queue since the last event for the timer was removed (or since the timer was added). */ - virtual CEventQueueTimer* + virtual EventQueueTimer* newTimer(double duration, void* target) = 0; //! Create a one-shot timer /*! Creates and returns a one-shot timer. An event is returned when the timer expires and the timer is removed from further handling. - When a timer event is returned the data points to a \c CTimerEvent. - The c_count member of the \c CTimerEvent is always 1. The client + When a timer event is returned the data points to a \c TimerEvent. + The c_count member of the \c TimerEvent is always 1. The client must pass the returned timer to \c deleteTimer() (whether or not the timer has expired) to release the timer. The returned timer event uses the given \p target. If \p target is NULL it uses the returned timer as the target. */ - virtual CEventQueueTimer* + virtual EventQueueTimer* newOneShotTimer(double duration, void* target) = 0; @@ -140,7 +140,7 @@ public: Destroys a previously created timer. The timer is removed from the queue and will not generate event, even if the timer has expired. */ - virtual void deleteTimer(CEventQueueTimer*) = 0; + virtual void deleteTimer(EventQueueTimer*) = 0; //! Register an event handler for an event type /*! @@ -150,7 +150,7 @@ public: of type \p type. If no such handler exists it will use the handler for \p target and type \p kUnknown if it exists. */ - virtual void adoptHandler(CEvent::Type type, + virtual void adoptHandler(Event::Type type, void* target, IEventJob* handler) = 0; //! Unregister an event handler for an event type @@ -158,7 +158,7 @@ public: Unregisters an event handler for the \p type, \p target pair and deletes it. */ - virtual void removeHandler(CEvent::Type type, void* target) = 0; + virtual void removeHandler(Event::Type type, void* target) = 0; //! Unregister all event handlers for an event target /*! @@ -172,8 +172,8 @@ public: type id otherwise it is left alone. The final value of \p type is returned. */ - virtual CEvent::Type - registerTypeOnce(CEvent::Type& type, + virtual Event::Type + registerTypeOnce(Event::Type& type, const char* name) = 0; //! Wait for event queue to become ready @@ -199,24 +199,24 @@ public: Finds and returns the event handler for the \p type, \p target pair if it exists, otherwise it returns NULL. */ - virtual IEventJob* getHandler(CEvent::Type type, void* target) const = 0; + virtual IEventJob* getHandler(Event::Type type, void* target) const = 0; //! Get name for event /*! Returns the name for the event \p type. This is primarily for debugging. */ - virtual const char* getTypeName(CEvent::Type type) = 0; + virtual const char* getTypeName(Event::Type type) = 0; //! Get an event type by name /*! Returns the registered type for an event for a given name. */ - virtual CEvent::Type getRegisteredType(const CString& name) const = 0; + virtual Event::Type getRegisteredType(const String& name) const = 0; //! Get the system event type target /*! - Returns the target to use for dispatching \c CEvent::kSystem events. + Returns the target to use for dispatching \c Event::kSystem events. */ virtual void* getSystemTarget() = 0; @@ -226,21 +226,21 @@ public: // Event type providers. // - virtual CClientEvents& forCClient() = 0; + virtual ClientEvents& forClient() = 0; virtual IStreamEvents& forIStream() = 0; - virtual CIpcClientEvents& forCIpcClient() = 0; - virtual CIpcClientProxyEvents& forCIpcClientProxy() = 0; - virtual CIpcServerEvents& forCIpcServer() = 0; - virtual CIpcServerProxyEvents& forCIpcServerProxy() = 0; + virtual IpcClientEvents& forIpcClient() = 0; + virtual IpcClientProxyEvents& forIpcClientProxy() = 0; + virtual IpcServerEvents& forIpcServer() = 0; + virtual IpcServerProxyEvents& forIpcServerProxy() = 0; virtual IDataSocketEvents& forIDataSocket() = 0; virtual IListenSocketEvents& forIListenSocket() = 0; virtual ISocketEvents& forISocket() = 0; - virtual COSXScreenEvents& forCOSXScreen() = 0; - virtual CClientListenerEvents& forCClientListener() = 0; - virtual CClientProxyEvents& forCClientProxy() = 0; - virtual CClientProxyUnknownEvents& forCClientProxyUnknown() = 0; - virtual CServerEvents& forCServer() = 0; - virtual CServerAppEvents& forCServerApp() = 0; + virtual OSXScreenEvents& forOSXScreen() = 0; + virtual ClientListenerEvents& forClientListener() = 0; + virtual ClientProxyEvents& forClientProxy() = 0; + virtual ClientProxyUnknownEvents& forClientProxyUnknown() = 0; + virtual ServerEvents& forServer() = 0; + virtual ServerAppEvents& forServerApp() = 0; virtual IKeyStateEvents& forIKeyState() = 0; virtual IPrimaryScreenEvents& forIPrimaryScreen() = 0; virtual IScreenEvents& forIScreen() = 0; diff --git a/src/lib/base/IEventQueueBuffer.h b/src/lib/base/IEventQueueBuffer.h index d67c8bce..87d97e16 100644 --- a/src/lib/base/IEventQueueBuffer.h +++ b/src/lib/base/IEventQueueBuffer.h @@ -21,8 +21,8 @@ #include "common/IInterface.h" #include "common/basic_types.h" -class CEvent; -class CEventQueueTimer; +class Event; +class EventQueueTimer; //! Event queue buffer interface /*! @@ -57,11 +57,11 @@ public: Get the next event from the buffer. Return kNone if no event is available. If a system event is next, return kSystem and fill in event. The event data in a system event can point to a static - buffer (because CEvent::deleteData() will not attempt to delete + buffer (because Event::deleteData() will not attempt to delete data in a kSystem event). Otherwise, return kUser and fill in \p dataID with the value passed to \c addEvent(). */ - virtual Type getEvent(CEvent& event, UInt32& dataID) = 0; + virtual Type getEvent(Event& event, UInt32& dataID) = 0; //! Post an event /*! @@ -88,14 +88,14 @@ public: used only by the buffer but it must be a valid object (i.e. not NULL). */ - virtual CEventQueueTimer* + virtual EventQueueTimer* newTimer(double duration, bool oneShot) const = 0; //! Destroy a timer object /*! Destroy a timer object previously returned by \c newTimer(). */ - virtual void deleteTimer(CEventQueueTimer*) const = 0; + virtual void deleteTimer(EventQueueTimer*) const = 0; //@} }; diff --git a/src/lib/base/ILogOutputter.h b/src/lib/base/ILogOutputter.h index f6adbd99..89fdd359 100644 --- a/src/lib/base/ILogOutputter.h +++ b/src/lib/base/ILogOutputter.h @@ -59,7 +59,7 @@ public: //! Write a message with level /*! Writes \c message, which has the given \c level, to a log. - If this method returns true then CLog will stop passing the + If this method returns true then Log will stop passing the message to all outputters in the outputter chain, otherwise it continues. Most implementations should return true. */ diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index 68ea376a..7a5c5fbf 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -54,12 +54,12 @@ static const int g_defaultMaxPriority = kINFO; #endif // -// CLog +// Log // -CLog* CLog::s_log = NULL; +Log* Log::s_log = NULL; -CLog::CLog() +Log::Log() { assert(s_log == NULL); @@ -69,40 +69,40 @@ CLog::CLog() // other initalization m_maxPriority = g_defaultMaxPriority; m_maxNewlineLength = 0; - insert(new CConsoleLogOutputter); + insert(new ConsoleLogOutputter); s_log = this; } -CLog::~CLog() +Log::~Log() { // clean up - for (COutputterList::iterator index = m_outputters.begin(); + for (OutputterList::iterator index = m_outputters.begin(); index != m_outputters.end(); ++index) { delete *index; } - for (COutputterList::iterator index = m_alwaysOutputters.begin(); + for (OutputterList::iterator index = m_alwaysOutputters.begin(); index != m_alwaysOutputters.end(); ++index) { delete *index; } ARCH->closeMutex(m_mutex); } -CLog* -CLog::getInstance() +Log* +Log::getInstance() { assert(s_log != NULL); return s_log; } const char* -CLog::getFilterName() const +Log::getFilterName() const { return getFilterName(getFilter()); } const char* -CLog::getFilterName(int level) const +Log::getFilterName(int level) const { if (level < 0) { return "Message"; @@ -111,7 +111,7 @@ CLog::getFilterName(int level) const } void -CLog::print(const char* file, int line, const char* fmt, ...) +Log::print(const char* file, int line, const char* fmt, ...) { // check if fmt begins with a priority argument ELevel priority = kINFO; @@ -193,11 +193,11 @@ CLog::print(const char* file, int line, const char* fmt, ...) } void -CLog::insert(ILogOutputter* outputter, bool alwaysAtHead) +Log::insert(ILogOutputter* outputter, bool alwaysAtHead) { assert(outputter != NULL); - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); if (alwaysAtHead) { m_alwaysOutputters.push_front(outputter); } @@ -218,18 +218,18 @@ CLog::insert(ILogOutputter* outputter, bool alwaysAtHead) } void -CLog::remove(ILogOutputter* outputter) +Log::remove(ILogOutputter* outputter) { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); m_outputters.remove(outputter); m_alwaysOutputters.remove(outputter); } void -CLog::pop_front(bool alwaysAtHead) +Log::pop_front(bool alwaysAtHead) { - CArchMutexLock lock(m_mutex); - COutputterList* list = alwaysAtHead ? &m_alwaysOutputters : &m_outputters; + ArchMutexLock lock(m_mutex); + OutputterList* list = alwaysAtHead ? &m_alwaysOutputters : &m_outputters; if (!list->empty()) { delete list->front(); list->pop_front(); @@ -237,7 +237,7 @@ CLog::pop_front(bool alwaysAtHead) } bool -CLog::setFilter(const char* maxPriority) +Log::setFilter(const char* maxPriority) { if (maxPriority != NULL) { for (int i = 0; i < g_numPriority; ++i) { @@ -252,29 +252,29 @@ CLog::setFilter(const char* maxPriority) } void -CLog::setFilter(int maxPriority) +Log::setFilter(int maxPriority) { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); m_maxPriority = maxPriority; } int -CLog::getFilter() const +Log::getFilter() const { - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); return m_maxPriority; } void -CLog::output(ELevel priority, char* msg) +Log::output(ELevel priority, char* msg) { assert(priority >= -1 && priority < g_numPriority); assert(msg != NULL); if (!msg) return; - CArchMutexLock lock(m_mutex); + ArchMutexLock lock(m_mutex); - COutputterList::const_iterator i; + OutputterList::const_iterator i; for (i = m_alwaysOutputters.begin(); i != m_alwaysOutputters.end(); ++i) { diff --git a/src/lib/base/Log.h b/src/lib/base/Log.h index d8cc5eee..c2f87850 100644 --- a/src/lib/base/Log.h +++ b/src/lib/base/Log.h @@ -25,11 +25,11 @@ #include -#define CLOG (CLog::getInstance()) +#define CLOG (Log::getInstance()) #define BYE "\nTry `%s --help' for more information." class ILogOutputter; -class CThread; +class Thread; //! Logging facility /*! @@ -38,10 +38,10 @@ It supports multithread safe operation, several message priority levels, filtering by priority, and output redirection. The macros LOG() and LOGC() provide convenient access. */ -class CLog { +class Log { public: - CLog(); - ~CLog(); + Log(); + ~Log(); //! @name manipulators //@{ @@ -116,7 +116,7 @@ public: const char* getFilterName(int level) const; //! Get the singleton instance of the log - static CLog* getInstance(); + static Log* getInstance(); //! Get the console filter level (messages above this are not sent to console). int getConsoleMaxLevel() const { return kDEBUG2; } @@ -127,13 +127,13 @@ private: void output(ELevel priority, char* msg); private: - typedef std::list COutputterList; + typedef std::list OutputterList; - static CLog* s_log; + static Log* s_log; - CArchMutex m_mutex; - COutputterList m_outputters; - COutputterList m_alwaysOutputters; + ArchMutex m_mutex; + OutputterList m_outputters; + OutputterList m_alwaysOutputters; int m_maxNewlineLength; int m_maxPriority; }; @@ -149,13 +149,13 @@ LOG((CLOG_XXX "%d and %d are %s", x, y, x == y ? "equal" : "not equal")); \endcode In particular, notice the double open and close parentheses. Also note that there is no comma after the \c CLOG_XXX. The \c XXX should be -replaced by one of enumerants in \c CLog::ELevel without the leading +replaced by one of enumerants in \c Log::ELevel without the leading \c k. For example, \c CLOG_INFO. The special \c CLOG_PRINT level will not be filtered and is never prefixed by the filename and line number. If \c NOLOGGING is defined during the build then this macro expands to nothing. If \c NDEBUG is defined during the build then it expands to a -call to CLog::print. Otherwise it expands to a call to CLog::printt, +call to Log::print. Otherwise it expands to a call to Log::printt, which includes the filename and line number. */ @@ -168,14 +168,14 @@ LOGC(x == y, (CLOG_XXX "%d and %d are equal", x, y)); \endcode In particular, notice the parentheses around everything after the boolean expression. Also note that there is no comma after the \c CLOG_XXX. -The \c XXX should be replaced by one of enumerants in \c CLog::ELevel +The \c XXX should be replaced by one of enumerants in \c Log::ELevel without the leading \c k. For example, \c CLOG_INFO. The special \c CLOG_PRINT level will not be filtered and is never prefixed by the filename and line number. If \c NOLOGGING is defined during the build then this macro expands to nothing. If \c NDEBUG is not defined during the build then it expands -to a call to CLog::print that prints the filename and line number, +to a call to Log::print that prints the filename and line number, otherwise it expands to a call that doesn't. */ diff --git a/src/lib/base/PriorityQueue.h b/src/lib/base/PriorityQueue.h index 9cefd49a..4af8f2e5 100644 --- a/src/lib/base/PriorityQueue.h +++ b/src/lib/base/PriorityQueue.h @@ -35,7 +35,7 @@ template , #else class Compare = std::greater > #endif -class CPriorityQueue { +class PriorityQueue { public: typedef typename Container::value_type value_type; typedef typename Container::size_type size_type; @@ -43,9 +43,9 @@ public: typedef typename Container::const_iterator const_iterator; typedef Container container_type; - CPriorityQueue() { } - CPriorityQueue(Container& swappedIn) { swap(swappedIn); } - ~CPriorityQueue() { } + PriorityQueue() { } + PriorityQueue(Container& swappedIn) { swap(swappedIn); } + ~PriorityQueue() { } //! @name manipulators //@{ @@ -84,7 +84,7 @@ public: } //! Swap contents with another priority queue - void swap(CPriorityQueue& q) + void swap(PriorityQueue& q) { c.swap(q.c); } diff --git a/src/lib/base/SimpleEventQueueBuffer.cpp b/src/lib/base/SimpleEventQueueBuffer.cpp index 407f8c68..92578a64 100644 --- a/src/lib/base/SimpleEventQueueBuffer.cpp +++ b/src/lib/base/SimpleEventQueueBuffer.cpp @@ -21,27 +21,27 @@ #include "arch/Arch.h" // -// CSimpleEventQueueBuffer +// SimpleEventQueueBuffer // -CSimpleEventQueueBuffer::CSimpleEventQueueBuffer() +SimpleEventQueueBuffer::SimpleEventQueueBuffer() { m_queueMutex = ARCH->newMutex(); m_queueReadyCond = ARCH->newCondVar(); m_queueReady = false; } -CSimpleEventQueueBuffer::~CSimpleEventQueueBuffer() +SimpleEventQueueBuffer::~SimpleEventQueueBuffer() { ARCH->closeCondVar(m_queueReadyCond); ARCH->closeMutex(m_queueMutex); } void -CSimpleEventQueueBuffer::waitForEvent(double timeout) +SimpleEventQueueBuffer::waitForEvent(double timeout) { - CArchMutexLock lock(m_queueMutex); - CStopwatch timer(true); + ArchMutexLock lock(m_queueMutex); + Stopwatch timer(true); while (!m_queueReady) { double timeLeft = timeout; if (timeLeft >= 0.0) { @@ -55,9 +55,9 @@ CSimpleEventQueueBuffer::waitForEvent(double timeout) } IEventQueueBuffer::Type -CSimpleEventQueueBuffer::getEvent(CEvent&, UInt32& dataID) +SimpleEventQueueBuffer::getEvent(Event&, UInt32& dataID) { - CArchMutexLock lock(m_queueMutex); + ArchMutexLock lock(m_queueMutex); if (!m_queueReady) { return kNone; } @@ -68,9 +68,9 @@ CSimpleEventQueueBuffer::getEvent(CEvent&, UInt32& dataID) } bool -CSimpleEventQueueBuffer::addEvent(UInt32 dataID) +SimpleEventQueueBuffer::addEvent(UInt32 dataID) { - CArchMutexLock lock(m_queueMutex); + ArchMutexLock lock(m_queueMutex); m_queue.push_front(dataID); if (!m_queueReady) { m_queueReady = true; @@ -80,20 +80,20 @@ CSimpleEventQueueBuffer::addEvent(UInt32 dataID) } bool -CSimpleEventQueueBuffer::isEmpty() const +SimpleEventQueueBuffer::isEmpty() const { - CArchMutexLock lock(m_queueMutex); + ArchMutexLock lock(m_queueMutex); return !m_queueReady; } -CEventQueueTimer* -CSimpleEventQueueBuffer::newTimer(double, bool) const +EventQueueTimer* +SimpleEventQueueBuffer::newTimer(double, bool) const { - return new CEventQueueTimer; + return new EventQueueTimer; } void -CSimpleEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const +SimpleEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const { delete timer; } diff --git a/src/lib/base/SimpleEventQueueBuffer.h b/src/lib/base/SimpleEventQueueBuffer.h index 5b28db9f..7edcf0bc 100644 --- a/src/lib/base/SimpleEventQueueBuffer.h +++ b/src/lib/base/SimpleEventQueueBuffer.h @@ -26,33 +26,33 @@ /*! An event queue buffer provides a queue of events for an IEventQueue. */ -class CSimpleEventQueueBuffer : public IEventQueueBuffer { +class SimpleEventQueueBuffer : public IEventQueueBuffer { public: - CSimpleEventQueueBuffer(); - ~CSimpleEventQueueBuffer(); + SimpleEventQueueBuffer(); + ~SimpleEventQueueBuffer(); // IEventQueueBuffer overrides void init() { } virtual void waitForEvent(double timeout); - virtual Type getEvent(CEvent& event, UInt32& dataID); + virtual Type getEvent(Event& event, UInt32& dataID); virtual bool addEvent(UInt32 dataID); virtual bool isEmpty() const; - virtual CEventQueueTimer* + virtual EventQueueTimer* newTimer(double duration, bool oneShot) const; - virtual void deleteTimer(CEventQueueTimer*) const; + virtual void deleteTimer(EventQueueTimer*) const; private: - typedef std::deque CEventDeque; + typedef std::deque EventDeque; - CArchMutex m_queueMutex; - CArchCond m_queueReadyCond; + ArchMutex m_queueMutex; + ArchCond m_queueReadyCond; bool m_queueReady; - CEventDeque m_queue; + EventDeque m_queue; }; -class CEventQueueTimer +class EventQueueTimer { public: - CEventQueueTimer() { } - virtual ~CEventQueueTimer() { } + EventQueueTimer() { } + virtual ~EventQueueTimer() { } }; diff --git a/src/lib/base/Stopwatch.cpp b/src/lib/base/Stopwatch.cpp index 43462a57..2bcda671 100644 --- a/src/lib/base/Stopwatch.cpp +++ b/src/lib/base/Stopwatch.cpp @@ -20,10 +20,10 @@ #include "arch/Arch.h" // -// CStopwatch +// Stopwatch // -CStopwatch::CStopwatch(bool triggered) : +Stopwatch::Stopwatch(bool triggered) : m_mark(0.0), m_triggered(triggered), m_stopped(triggered) @@ -33,13 +33,13 @@ CStopwatch::CStopwatch(bool triggered) : } } -CStopwatch::~CStopwatch() +Stopwatch::~Stopwatch() { // do nothing } double -CStopwatch::reset() +Stopwatch::reset() { if (m_stopped) { const double dt = m_mark; @@ -55,7 +55,7 @@ CStopwatch::reset() } void -CStopwatch::stop() +Stopwatch::stop() { if (m_stopped) { return; @@ -67,7 +67,7 @@ CStopwatch::stop() } void -CStopwatch::start() +Stopwatch::start() { m_triggered = false; if (!m_stopped) { @@ -80,14 +80,14 @@ CStopwatch::start() } void -CStopwatch::setTrigger() +Stopwatch::setTrigger() { stop(); m_triggered = true; } double -CStopwatch::getTime() +Stopwatch::getTime() { if (m_triggered) { const double dt = m_mark; @@ -102,19 +102,19 @@ CStopwatch::getTime() } } -CStopwatch::operator double() +Stopwatch::operator double() { return getTime(); } bool -CStopwatch::isStopped() const +Stopwatch::isStopped() const { return m_stopped; } double -CStopwatch::getTime() const +Stopwatch::getTime() const { if (m_stopped) { return m_mark; @@ -124,7 +124,7 @@ CStopwatch::getTime() const } } -CStopwatch::operator double() const +Stopwatch::operator double() const { return getTime(); } diff --git a/src/lib/base/Stopwatch.h b/src/lib/base/Stopwatch.h index fa165630..0ad266a2 100644 --- a/src/lib/base/Stopwatch.h +++ b/src/lib/base/Stopwatch.h @@ -25,14 +25,14 @@ This class measures time intervals. All time interval measurement should use this class. */ -class CStopwatch { +class Stopwatch { public: /*! The default constructor does an implicit reset() or setTrigger(). If triggered == false then the clock starts ticking. */ - CStopwatch(bool triggered = false); - ~CStopwatch(); + Stopwatch(bool triggered = false); + ~Stopwatch(); //! @name manipulators //@{ diff --git a/src/lib/base/String.cpp b/src/lib/base/String.cpp index 5c3dd2b2..2dfe4510 100644 --- a/src/lib/base/String.cpp +++ b/src/lib/base/String.cpp @@ -31,17 +31,17 @@ namespace synergy { namespace string { -CString +String format(const char* fmt, ...) { va_list args; va_start(args, fmt); - CString result = vformat(fmt, args); + String result = vformat(fmt, args); va_end(args); return result; } -CString +String vformat(const char* fmt, va_list args) { // find highest indexed substitution and the locations of substitutions @@ -106,7 +106,7 @@ vformat(const char* fmt, va_list args) } // substitute - CString result; + String result; result.reserve(resultLength); size_t src = 0; for (int i = 0; i < n; ++i) { @@ -119,13 +119,13 @@ vformat(const char* fmt, va_list args) return result; } -CString +String sprintf(const char* fmt, ...) { char tmp[1024]; char* buffer = tmp; int len = (int)(sizeof(tmp) / sizeof(tmp[0])); - CString result; + String result; while (buffer != NULL) { // try printing into the buffer va_list args; @@ -157,12 +157,12 @@ sprintf(const char* fmt, ...) void findReplaceAll( - CString& subject, - const CString& find, - const CString& replace) + String& subject, + const String& find, + const String& replace) { size_t pos = 0; - while ((pos = subject.find(find, pos)) != CString::npos) { + while ((pos = subject.find(find, pos)) != String::npos) { subject.replace(pos, find.length(), replace); pos += replace.length(); } @@ -175,8 +175,8 @@ findReplaceAll( bool CaselessCmp::cmpEqual( - const CString::value_type& a, - const CString::value_type& b) + const String::value_type& a, + const String::value_type& b) { // should use std::tolower but not in all versions of libstdc++ have it return tolower(a) == tolower(b); @@ -184,15 +184,15 @@ CaselessCmp::cmpEqual( bool CaselessCmp::cmpLess( - const CString::value_type& a, - const CString::value_type& b) + const String::value_type& a, + const String::value_type& b) { // should use std::tolower but not in all versions of libstdc++ have it return tolower(a) < tolower(b); } bool -CaselessCmp::less(const CString& a, const CString& b) +CaselessCmp::less(const String& a, const String& b) { return std::lexicographical_compare( a.begin(), a.end(), @@ -201,13 +201,13 @@ CaselessCmp::less(const CString& a, const CString& b) } bool -CaselessCmp::equal(const CString& a, const CString& b) +CaselessCmp::equal(const String& a, const String& b) { return !(less(a, b) || less(b, a)); } bool -CaselessCmp::operator()(const CString& a, const CString& b) const +CaselessCmp::operator()(const String& a, const String& b) const { return less(a, b); } diff --git a/src/lib/base/String.h b/src/lib/base/String.h index ea42217f..89430c0c 100644 --- a/src/lib/base/String.h +++ b/src/lib/base/String.h @@ -24,7 +24,7 @@ #include // use standard C++ string class for our string class -typedef std::string CString; +typedef std::string String; namespace synergy { @@ -44,25 +44,25 @@ characters and conversion specifications introduced by `\%': All arguments in the variable list are const char*. Positional elements are indexed from 1. */ -CString format(const char* fmt, ...); +String format(const char* fmt, ...); //! Format positional arguments /*! Same as format() except takes va_list. */ -CString vformat(const char* fmt, va_list); +String vformat(const char* fmt, va_list); //! Print a string using sprintf-style formatting /*! -Equivalent to sprintf() except the result is returned as a CString. +Equivalent to sprintf() except the result is returned as a String. */ -CString sprintf(const char* fmt, ...); +String sprintf(const char* fmt, ...); //! Find and replace all /*! Finds \c find inside \c subject and replaces it with \c replace */ -void findReplaceAll(CString& subject, const CString& find, const CString& replace); +void findReplaceAll(String& subject, const String& find, const String& replace); //! Case-insensitive comparisons /*! @@ -71,21 +71,21 @@ This class provides case-insensitve comparison functions. class CaselessCmp { public: //! Same as less() - bool operator()(const CString& a, const CString& b) const; + bool operator()(const String& a, const String& b) const; //! Returns true iff \c a is lexicographically less than \c b - static bool less(const CString& a, const CString& b); + static bool less(const String& a, const String& b); //! Returns true iff \c a is lexicographically equal to \c b - static bool equal(const CString& a, const CString& b); + static bool equal(const String& a, const String& b); //! Returns true iff \c a is lexicographically less than \c b - static bool cmpLess(const CString::value_type& a, - const CString::value_type& b); + static bool cmpLess(const String::value_type& a, + const String::value_type& b); //! Returns true iff \c a is lexicographically equal to \c b - static bool cmpEqual(const CString::value_type& a, - const CString::value_type& b); + static bool cmpEqual(const String::value_type& a, + const String::value_type& b); }; } diff --git a/src/lib/base/TMethodEventJob.h b/src/lib/base/TMethodEventJob.h index 83238f1d..2b47aa4b 100644 --- a/src/lib/base/TMethodEventJob.h +++ b/src/lib/base/TMethodEventJob.h @@ -29,23 +29,23 @@ class TMethodEventJob : public IEventJob { public: //! run(event) invokes \c object->method(event, arg) TMethodEventJob(T* object, - void (T::*method)(const CEvent&, void*), + void (T::*method)(const Event&, void*), void* arg = NULL); virtual ~TMethodEventJob(); // IJob overrides - virtual void run(const CEvent&); + virtual void run(const Event&); private: T* m_object; - void (T::*m_method)(const CEvent&, void*); + void (T::*m_method)(const Event&, void*); void* m_arg; }; template inline TMethodEventJob::TMethodEventJob(T* object, - void (T::*method)(const CEvent&, void*), void* arg) : + void (T::*method)(const Event&, void*), void* arg) : m_object(object), m_method(method), m_arg(arg) @@ -63,7 +63,7 @@ TMethodEventJob::~TMethodEventJob() template inline void -TMethodEventJob::run(const CEvent& event) +TMethodEventJob::run(const Event& event) { if (m_object != NULL) { (m_object->*m_method)(event, m_arg); diff --git a/src/lib/base/Unicode.cpp b/src/lib/base/Unicode.cpp index dabf3adb..5739c686 100644 --- a/src/lib/base/Unicode.cpp +++ b/src/lib/base/Unicode.cpp @@ -91,14 +91,14 @@ setError(bool* errors) // -// CUnicode +// Unicode // -UInt32 CUnicode::s_invalid = 0x0000ffff; -UInt32 CUnicode::s_replacement = 0x0000fffd; +UInt32 Unicode::s_invalid = 0x0000ffff; +UInt32 Unicode::s_replacement = 0x0000fffd; bool -CUnicode::isUTF8(const CString& src) +Unicode::isUTF8(const String& src) { // convert and test each character const UInt8* data = reinterpret_cast(src.c_str()); @@ -110,15 +110,15 @@ CUnicode::isUTF8(const CString& src) return true; } -CString -CUnicode::UTF8ToUCS2(const CString& src, bool* errors) +String +Unicode::UTF8ToUCS2(const String& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - CString dst; + String dst; dst.reserve(2 * n); // convert each character @@ -139,15 +139,15 @@ CUnicode::UTF8ToUCS2(const CString& src, bool* errors) return dst; } -CString -CUnicode::UTF8ToUCS4(const CString& src, bool* errors) +String +Unicode::UTF8ToUCS4(const String& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - CString dst; + String dst; dst.reserve(4 * n); // convert each character @@ -163,15 +163,15 @@ CUnicode::UTF8ToUCS4(const CString& src, bool* errors) return dst; } -CString -CUnicode::UTF8ToUTF16(const CString& src, bool* errors) +String +Unicode::UTF8ToUTF16(const String& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - CString dst; + String dst; dst.reserve(2 * n); // convert each character @@ -201,15 +201,15 @@ CUnicode::UTF8ToUTF16(const CString& src, bool* errors) return dst; } -CString -CUnicode::UTF8ToUTF32(const CString& src, bool* errors) +String +Unicode::UTF8ToUTF32(const String& src, bool* errors) { // default to success resetError(errors); // get size of input string and reserve some space in output UInt32 n = (UInt32)src.size(); - CString dst; + String dst; dst.reserve(4 * n); // convert each character @@ -229,8 +229,8 @@ CUnicode::UTF8ToUTF32(const CString& src, bool* errors) return dst; } -CString -CUnicode::UTF8ToText(const CString& src, bool* errors) +String +Unicode::UTF8ToText(const String& src, bool* errors) { // default to success resetError(errors); @@ -243,7 +243,7 @@ CUnicode::UTF8ToText(const CString& src, bool* errors) int len = ARCH->convStringWCToMB(NULL, tmp, size, errors); char* mbs = new char[len + 1]; ARCH->convStringWCToMB(mbs, tmp, size, errors); - CString text(mbs, len); + String text(mbs, len); // clean up delete[] mbs; @@ -252,8 +252,8 @@ CUnicode::UTF8ToText(const CString& src, bool* errors) return text; } -CString -CUnicode::UCS2ToUTF8(const CString& src, bool* errors) +String +Unicode::UCS2ToUTF8(const String& src, bool* errors) { // default to success resetError(errors); @@ -263,8 +263,8 @@ CUnicode::UCS2ToUTF8(const CString& src, bool* errors) return doUCS2ToUTF8(reinterpret_cast(src.data()), n, errors); } -CString -CUnicode::UCS4ToUTF8(const CString& src, bool* errors) +String +Unicode::UCS4ToUTF8(const String& src, bool* errors) { // default to success resetError(errors); @@ -274,8 +274,8 @@ CUnicode::UCS4ToUTF8(const CString& src, bool* errors) return doUCS4ToUTF8(reinterpret_cast(src.data()), n, errors); } -CString -CUnicode::UTF16ToUTF8(const CString& src, bool* errors) +String +Unicode::UTF16ToUTF8(const String& src, bool* errors) { // default to success resetError(errors); @@ -285,8 +285,8 @@ CUnicode::UTF16ToUTF8(const CString& src, bool* errors) return doUTF16ToUTF8(reinterpret_cast(src.data()), n, errors); } -CString -CUnicode::UTF32ToUTF8(const CString& src, bool* errors) +String +Unicode::UTF32ToUTF8(const String& src, bool* errors) { // default to success resetError(errors); @@ -296,8 +296,8 @@ CUnicode::UTF32ToUTF8(const CString& src, bool* errors) return doUTF32ToUTF8(reinterpret_cast(src.data()), n, errors); } -CString -CUnicode::textToUTF8(const CString& src, bool* errors) +String +Unicode::textToUTF8(const String& src, bool* errors) { // default to success resetError(errors); @@ -309,7 +309,7 @@ CUnicode::textToUTF8(const CString& src, bool* errors) ARCH->convStringMBToWC(wcs, src.c_str(), n, errors); // convert to UTF8 - CString utf8 = wideCharToUTF8(wcs, len, errors); + String utf8 = wideCharToUTF8(wcs, len, errors); // clean up delete[] wcs; @@ -318,10 +318,10 @@ CUnicode::textToUTF8(const CString& src, bool* errors) } wchar_t* -CUnicode::UTF8ToWideChar(const CString& src, UInt32& size, bool* errors) +Unicode::UTF8ToWideChar(const String& src, UInt32& size, bool* errors) { // convert to platform's wide character encoding - CString tmp; + String tmp; switch (ARCH->getWideCharEncoding()) { case IArchString::kUCS2: tmp = UTF8ToUCS2(src, errors); @@ -353,12 +353,12 @@ CUnicode::UTF8ToWideChar(const CString& src, UInt32& size, bool* errors) return dst; } -CString -CUnicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors) +String +Unicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors) { // convert from platform's wide character encoding. // note -- this must include a wide nul character (independent of - // the CString's nul character). + // the String's nul character). switch (ARCH->getWideCharEncoding()) { case IArchString::kUCS2: return doUCS2ToUTF8(reinterpret_cast(src), size, errors); @@ -374,15 +374,15 @@ CUnicode::wideCharToUTF8(const wchar_t* src, UInt32 size, bool* errors) default: assert(0 && "unknown wide character encoding"); - return CString(); + return String(); } } -CString -CUnicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors) +String +Unicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - CString dst; + String dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -414,11 +414,11 @@ CUnicode::doUCS2ToUTF8(const UInt8* data, UInt32 n, bool* errors) return dst; } -CString -CUnicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors) +String +Unicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - CString dst; + String dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -450,11 +450,11 @@ CUnicode::doUCS4ToUTF8(const UInt8* data, UInt32 n, bool* errors) return dst; } -CString -CUnicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors) +String +Unicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - CString dst; + String dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -512,11 +512,11 @@ CUnicode::doUTF16ToUTF8(const UInt8* data, UInt32 n, bool* errors) return dst; } -CString -CUnicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors) +String +Unicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors) { // make some space - CString dst; + String dst; dst.reserve(n); // check if first character is 0xfffe or 0xfeff @@ -553,7 +553,7 @@ CUnicode::doUTF32ToUTF8(const UInt8* data, UInt32 n, bool* errors) } UInt32 -CUnicode::fromUTF8(const UInt8*& data, UInt32& n) +Unicode::fromUTF8(const UInt8*& data, UInt32& n) { assert(data != NULL); assert(n != 0); @@ -728,7 +728,7 @@ CUnicode::fromUTF8(const UInt8*& data, UInt32& n) } void -CUnicode::toUTF8(CString& dst, UInt32 c, bool* errors) +Unicode::toUTF8(String& dst, UInt32 c, bool* errors) { UInt8 data[6]; diff --git a/src/lib/base/Unicode.h b/src/lib/base/Unicode.h index 83ef1a98..1100dcfd 100644 --- a/src/lib/base/Unicode.h +++ b/src/lib/base/Unicode.h @@ -26,7 +26,7 @@ This class provides functions for converting between various Unicode encodings and the current locale encoding. */ -class CUnicode { +class Unicode { public: //! @name accessors //@{ @@ -36,7 +36,7 @@ public: Returns true iff the string contains a valid sequence of UTF-8 encoded characters. */ - static bool isUTF8(const CString&); + static bool isUTF8(const String&); //! Convert from UTF-8 to UCS-2 encoding /*! @@ -44,7 +44,7 @@ public: is set to true iff any character could not be encoded in UCS-2. Decoding errors do not set *errors. */ - static CString UTF8ToUCS2(const CString&, bool* errors = NULL); + static String UTF8ToUCS2(const String&, bool* errors = NULL); //! Convert from UTF-8 to UCS-4 encoding /*! @@ -52,7 +52,7 @@ public: is set to true iff any character could not be encoded in UCS-4. Decoding errors do not set *errors. */ - static CString UTF8ToUCS4(const CString&, bool* errors = NULL); + static String UTF8ToUCS4(const String&, bool* errors = NULL); //! Convert from UTF-8 to UTF-16 encoding /*! @@ -60,7 +60,7 @@ public: is set to true iff any character could not be encoded in UTF-16. Decoding errors do not set *errors. */ - static CString UTF8ToUTF16(const CString&, bool* errors = NULL); + static String UTF8ToUTF16(const String&, bool* errors = NULL); //! Convert from UTF-8 to UTF-32 encoding /*! @@ -68,7 +68,7 @@ public: is set to true iff any character could not be encoded in UTF-32. Decoding errors do not set *errors. */ - static CString UTF8ToUTF32(const CString&, bool* errors = NULL); + static String UTF8ToUTF32(const String&, bool* errors = NULL); //! Convert from UTF-8 to the current locale encoding /*! @@ -76,42 +76,42 @@ public: NULL then *errors is set to true iff any character could not be encoded. Decoding errors do not set *errors. */ - static CString UTF8ToText(const CString&, bool* errors = NULL); + static String UTF8ToText(const String&, bool* errors = NULL); //! Convert from UCS-2 to UTF-8 /*! Convert from UCS-2 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static CString UCS2ToUTF8(const CString&, bool* errors = NULL); + static String UCS2ToUTF8(const String&, bool* errors = NULL); //! Convert from UCS-4 to UTF-8 /*! Convert from UCS-4 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static CString UCS4ToUTF8(const CString&, bool* errors = NULL); + static String UCS4ToUTF8(const String&, bool* errors = NULL); //! Convert from UTF-16 to UTF-8 /*! Convert from UTF-16 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static CString UTF16ToUTF8(const CString&, bool* errors = NULL); + static String UTF16ToUTF8(const String&, bool* errors = NULL); //! Convert from UTF-32 to UTF-8 /*! Convert from UTF-32 to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static CString UTF32ToUTF8(const CString&, bool* errors = NULL); + static String UTF32ToUTF8(const String&, bool* errors = NULL); //! Convert from the current locale encoding to UTF-8 /*! Convert from the current locale encoding to UTF-8. If errors is not NULL then *errors is set to true iff any character could not be decoded. */ - static CString textToUTF8(const CString&, bool* errors = NULL); + static String textToUTF8(const String&, bool* errors = NULL); //@} @@ -120,23 +120,23 @@ private: // to the platform). caller must delete[] the returned string. the // string is *not* nul terminated; the length (in characters) is // returned in size. - static wchar_t* UTF8ToWideChar(const CString&, + static wchar_t* UTF8ToWideChar(const String&, UInt32& size, bool* errors); // convert nul terminated wchar_t string (in platform's native // encoding) to UTF8. - static CString wideCharToUTF8(const wchar_t*, + static String wideCharToUTF8(const wchar_t*, UInt32 size, bool* errors); // internal conversion to UTF8 - static CString doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors); - static CString doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors); - static CString doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors); - static CString doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static String doUCS2ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static String doUCS4ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static String doUTF16ToUTF8(const UInt8* src, UInt32 n, bool* errors); + static String doUTF32ToUTF8(const UInt8* src, UInt32 n, bool* errors); // convert characters to/from UTF8 static UInt32 fromUTF8(const UInt8*& src, UInt32& size); - static void toUTF8(CString& dst, UInt32 c, bool* errors); + static void toUTF8(String& dst, UInt32 c, bool* errors); private: static UInt32 s_invalid; diff --git a/src/lib/base/XBase.cpp b/src/lib/base/XBase.cpp index 1c776bcd..3a539ff1 100644 --- a/src/lib/base/XBase.cpp +++ b/src/lib/base/XBase.cpp @@ -32,7 +32,7 @@ XBase::XBase() : // do nothing } -XBase::XBase(const CString& msg) : +XBase::XBase(const String& msg) : std::runtime_error(msg) { // do nothing @@ -54,14 +54,14 @@ XBase::what() const _NOEXCEPT return what; } -CString +String XBase::format(const char* /*id*/, const char* fmt, ...) const throw() { // FIXME -- lookup message string using id as an index. set // fmt to that string if it exists. // format - CString result; + String result; va_list args; va_start(args, fmt); try { diff --git a/src/lib/base/XBase.h b/src/lib/base/XBase.h index 5b4bc82b..f8b9ceca 100644 --- a/src/lib/base/XBase.h +++ b/src/lib/base/XBase.h @@ -30,7 +30,7 @@ public: //! Use getWhat() as the result of what() XBase(); //! Use \c msg as the result of what() - XBase(const CString& msg); + XBase(const String& msg); virtual ~XBase() _NOEXCEPT; //! Reason for exception @@ -38,7 +38,7 @@ public: protected: //! Get a human readable string describing the exception - virtual CString getWhat() const throw() { return ""; } + virtual String getWhat() const throw() { return ""; } //! Format a string /*! @@ -46,47 +46,47 @@ protected: no format can be found, then replaces positional parameters in the format string and returns the result. */ - virtual CString format(const char* id, + virtual String format(const char* id, const char* defaultFormat, ...) const throw(); private: - mutable CString m_what; + mutable String m_what; }; /*! \def XBASE_SUBCLASS Convenience macro to subclass from XBase (or a subclass of it), -providing the c'tor taking a const CString&. getWhat() is not +providing the c'tor taking a const String&. getWhat() is not declared. */ #define XBASE_SUBCLASS(name_, super_) \ class name_ : public super_ { \ public: \ name_() : super_() { } \ - name_(const CString& msg) : super_(msg) { } \ + name_(const String& msg) : super_(msg) { } \ virtual ~name_() _NOEXCEPT { } \ } /*! \def XBASE_SUBCLASS Convenience macro to subclass from XBase (or a subclass of it), -providing the c'tor taking a const CString&. getWhat() must be +providing the c'tor taking a const String&. getWhat() must be implemented. */ #define XBASE_SUBCLASS_WHAT(name_, super_) \ class name_ : public super_ { \ public: \ name_() : super_() { } \ - name_(const CString& msg) : super_(msg) { } \ + name_(const String& msg) : super_(msg) { } \ virtual ~name_() _NOEXCEPT { } \ \ protected: \ - virtual CString getWhat() const throw(); \ + virtual String getWhat() const throw(); \ } /*! \def XBASE_SUBCLASS_FORMAT Convenience macro to subclass from XBase (or a subclass of it), -providing the c'tor taking a const CString&. what() is overridden +providing the c'tor taking a const String&. what() is overridden to call getWhat() when first called; getWhat() can format the error message and can call what() to get the message passed to the c'tor. @@ -98,7 +98,7 @@ private: \ \ public: \ name_() : super_(), m_state(kDone) { } \ - name_(const CString& msg) : super_(msg), m_state(kFirst) { } \ + name_(const String& msg) : super_(msg), m_state(kFirst) { } \ virtual ~name_() _NOEXCEPT { } \ \ virtual const char* what() const _NOEXCEPT \ @@ -117,7 +117,7 @@ public: \ } \ \ protected: \ - virtual CString getWhat() const throw(); \ + virtual String getWhat() const throw(); \ \ private: \ mutable EState m_state; \ diff --git a/src/lib/base/log_outputters.cpp b/src/lib/base/log_outputters.cpp index ab4a5f5e..4c6066c9 100644 --- a/src/lib/base/log_outputters.cpp +++ b/src/lib/base/log_outputters.cpp @@ -23,145 +23,145 @@ #include // -// CStopLogOutputter +// StopLogOutputter // -CStopLogOutputter::CStopLogOutputter() +StopLogOutputter::StopLogOutputter() { // do nothing } -CStopLogOutputter::~CStopLogOutputter() +StopLogOutputter::~StopLogOutputter() { // do nothing } void -CStopLogOutputter::open(const char*) +StopLogOutputter::open(const char*) { // do nothing } void -CStopLogOutputter::close() +StopLogOutputter::close() { // do nothing } void -CStopLogOutputter::show(bool) +StopLogOutputter::show(bool) { // do nothing } bool -CStopLogOutputter::write(ELevel, const char*) +StopLogOutputter::write(ELevel, const char*) { return false; } // -// CConsoleLogOutputter +// ConsoleLogOutputter // -CConsoleLogOutputter::CConsoleLogOutputter() +ConsoleLogOutputter::ConsoleLogOutputter() { } -CConsoleLogOutputter::~CConsoleLogOutputter() +ConsoleLogOutputter::~ConsoleLogOutputter() { } void -CConsoleLogOutputter::open(const char* title) +ConsoleLogOutputter::open(const char* title) { ARCH->openConsole(title); } void -CConsoleLogOutputter::close() +ConsoleLogOutputter::close() { ARCH->closeConsole(); } void -CConsoleLogOutputter::show(bool showIfEmpty) +ConsoleLogOutputter::show(bool showIfEmpty) { ARCH->showConsole(showIfEmpty); } bool -CConsoleLogOutputter::write(ELevel level, const char* msg) +ConsoleLogOutputter::write(ELevel level, const char* msg) { ARCH->writeConsole(level, msg); return true; } void -CConsoleLogOutputter::flush() +ConsoleLogOutputter::flush() { } // -// CSystemLogOutputter +// SystemLogOutputter // -CSystemLogOutputter::CSystemLogOutputter() +SystemLogOutputter::SystemLogOutputter() { // do nothing } -CSystemLogOutputter::~CSystemLogOutputter() +SystemLogOutputter::~SystemLogOutputter() { // do nothing } void -CSystemLogOutputter::open(const char* title) +SystemLogOutputter::open(const char* title) { ARCH->openLog(title); } void -CSystemLogOutputter::close() +SystemLogOutputter::close() { ARCH->closeLog(); } void -CSystemLogOutputter::show(bool showIfEmpty) +SystemLogOutputter::show(bool showIfEmpty) { ARCH->showLog(showIfEmpty); } bool -CSystemLogOutputter::write(ELevel level, const char* msg) +SystemLogOutputter::write(ELevel level, const char* msg) { ARCH->writeLog(level, msg); return true; } // -// CSystemLogger +// SystemLogger // -CSystemLogger::CSystemLogger(const char* title, bool blockConsole) : +SystemLogger::SystemLogger(const char* title, bool blockConsole) : m_stop(NULL) { // redirect log messages if (blockConsole) { - m_stop = new CStopLogOutputter; + m_stop = new StopLogOutputter; CLOG->insert(m_stop); } - m_syslog = new CSystemLogOutputter; + m_syslog = new SystemLogOutputter; m_syslog->open(title); CLOG->insert(m_syslog); } -CSystemLogger::~CSystemLogger() +SystemLogger::~SystemLogger() { CLOG->remove(m_syslog); delete m_syslog; @@ -173,72 +173,72 @@ CSystemLogger::~CSystemLogger() // -// CBufferedLogOutputter +// BufferedLogOutputter // -CBufferedLogOutputter::CBufferedLogOutputter(UInt32 maxBufferSize) : +BufferedLogOutputter::BufferedLogOutputter(UInt32 maxBufferSize) : m_maxBufferSize(maxBufferSize) { // do nothing } -CBufferedLogOutputter::~CBufferedLogOutputter() +BufferedLogOutputter::~BufferedLogOutputter() { // do nothing } -CBufferedLogOutputter::const_iterator -CBufferedLogOutputter::begin() const +BufferedLogOutputter::const_iterator +BufferedLogOutputter::begin() const { return m_buffer.begin(); } -CBufferedLogOutputter::const_iterator -CBufferedLogOutputter::end() const +BufferedLogOutputter::const_iterator +BufferedLogOutputter::end() const { return m_buffer.end(); } void -CBufferedLogOutputter::open(const char*) +BufferedLogOutputter::open(const char*) { // do nothing } void -CBufferedLogOutputter::close() +BufferedLogOutputter::close() { // remove all elements from the buffer m_buffer.clear(); } void -CBufferedLogOutputter::show(bool) +BufferedLogOutputter::show(bool) { // do nothing } bool -CBufferedLogOutputter::write(ELevel, const char* message) +BufferedLogOutputter::write(ELevel, const char* message) { while (m_buffer.size() >= m_maxBufferSize) { m_buffer.pop_front(); } - m_buffer.push_back(CString(message)); + m_buffer.push_back(String(message)); return true; } // -// CFileLogOutputter +// FileLogOutputter // -CFileLogOutputter::CFileLogOutputter(const char* logFile) +FileLogOutputter::FileLogOutputter(const char* logFile) { setLogFilename(logFile); } -CFileLogOutputter::~CFileLogOutputter() +FileLogOutputter::~FileLogOutputter() { } @@ -250,7 +250,7 @@ CFileLogOutputter::setLogFilename(const char* logFile) } bool -CFileLogOutputter::write(ELevel level, const char *message) +FileLogOutputter::write(ELevel level, const char *message) { std::ofstream m_handle; m_handle.open(m_fileName.c_str(), std::fstream::app); @@ -263,48 +263,48 @@ CFileLogOutputter::write(ELevel level, const char *message) } void -CFileLogOutputter::open(const char *title) {} +FileLogOutputter::open(const char *title) {} void -CFileLogOutputter::close() {} +FileLogOutputter::close() {} void -CFileLogOutputter::show(bool showIfEmpty) {} +FileLogOutputter::show(bool showIfEmpty) {} // -// CMesssageBoxLogOutputter +// MesssageBoxLogOutputter // -CMesssageBoxLogOutputter::CMesssageBoxLogOutputter() +MesssageBoxLogOutputter::MesssageBoxLogOutputter() { // do nothing } -CMesssageBoxLogOutputter::~CMesssageBoxLogOutputter() +MesssageBoxLogOutputter::~MesssageBoxLogOutputter() { // do nothing } void -CMesssageBoxLogOutputter::open(const char* title) +MesssageBoxLogOutputter::open(const char* title) { // do nothing } void -CMesssageBoxLogOutputter::close() +MesssageBoxLogOutputter::close() { // do nothing } void -CMesssageBoxLogOutputter::show(bool showIfEmpty) +MesssageBoxLogOutputter::show(bool showIfEmpty) { // do nothing } bool -CMesssageBoxLogOutputter::write(ELevel level, const char* msg) +MesssageBoxLogOutputter::write(ELevel level, const char* msg) { // don't spam user with messages. if (level > kERROR) { diff --git a/src/lib/base/log_outputters.h b/src/lib/base/log_outputters.h index 234fd9c1..e5466c80 100644 --- a/src/lib/base/log_outputters.h +++ b/src/lib/base/log_outputters.h @@ -33,10 +33,10 @@ This outputter performs no output and returns false from \c write(), causing the logger to stop traversing the outputter chain. Insert this to prevent already inserted outputters from writing. */ -class CStopLogOutputter : public ILogOutputter { +class StopLogOutputter : public ILogOutputter { public: - CStopLogOutputter(); - virtual ~CStopLogOutputter(); + StopLogOutputter(); + virtual ~StopLogOutputter(); // ILogOutputter overrides virtual void open(const char* title); @@ -50,10 +50,10 @@ public: This outputter writes output to the console. The level for each message is ignored. */ -class CConsoleLogOutputter : public ILogOutputter { +class ConsoleLogOutputter : public ILogOutputter { public: - CConsoleLogOutputter(); - virtual ~CConsoleLogOutputter(); + ConsoleLogOutputter(); + virtual ~ConsoleLogOutputter(); // ILogOutputter overrides virtual void open(const char* title); @@ -69,10 +69,10 @@ This outputter writes output to the file. The level for each message is ignored. */ -class CFileLogOutputter : public ILogOutputter { +class FileLogOutputter : public ILogOutputter { public: - CFileLogOutputter(const char* logFile); - virtual ~CFileLogOutputter(); + FileLogOutputter(const char* logFile); + virtual ~FileLogOutputter(); // ILogOutputter overrides virtual void open(const char* title); @@ -90,10 +90,10 @@ private: /*! This outputter writes output to the system log. */ -class CSystemLogOutputter : public ILogOutputter { +class SystemLogOutputter : public ILogOutputter { public: - CSystemLogOutputter(); - virtual ~CSystemLogOutputter(); + SystemLogOutputter(); + virtual ~SystemLogOutputter(); // ILogOutputter overrides virtual void open(const char* title); @@ -104,16 +104,16 @@ public: //! Write log to system log only /*! -Creating an object of this type inserts a CStopLogOutputter followed -by a CSystemLogOutputter into CLog. The destructor removes those +Creating an object of this type inserts a StopLogOutputter followed +by a SystemLogOutputter into Log. The destructor removes those outputters. Add one of these to any scope that needs to write to the system log (only) and restore the old outputters when exiting the scope. */ -class CSystemLogger { +class SystemLogger { public: - CSystemLogger(const char* title, bool blockConsole); - ~CSystemLogger(); + SystemLogger(const char* title, bool blockConsole); + ~SystemLogger(); private: ILogOutputter* m_syslog; @@ -124,15 +124,15 @@ private: /*! This outputter records the last N log messages. */ -class CBufferedLogOutputter : public ILogOutputter { +class BufferedLogOutputter : public ILogOutputter { private: - typedef std::deque CBuffer; + typedef std::deque Buffer; public: - typedef CBuffer::const_iterator const_iterator; + typedef Buffer::const_iterator const_iterator; - CBufferedLogOutputter(UInt32 maxBufferSize); - virtual ~CBufferedLogOutputter(); + BufferedLogOutputter(UInt32 maxBufferSize); + virtual ~BufferedLogOutputter(); //! @name accessors //@{ @@ -152,17 +152,17 @@ public: virtual bool write(ELevel level, const char* message); private: UInt32 m_maxBufferSize; - CBuffer m_buffer; + Buffer m_buffer; }; //! Write log to message box /*! The level for each message is ignored. */ -class CMesssageBoxLogOutputter : public ILogOutputter { +class MesssageBoxLogOutputter : public ILogOutputter { public: - CMesssageBoxLogOutputter(); - virtual ~CMesssageBoxLogOutputter(); + MesssageBoxLogOutputter(); + virtual ~MesssageBoxLogOutputter(); // ILogOutputter overrides virtual void open(const char* title); diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index 2d0442d4..e0176548 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -46,16 +46,16 @@ #include // -// CClient +// Client // -CClient::CClient( +Client::Client( IEventQueue* events, - const CString& name, const CNetworkAddress& address, + const String& name, const NetworkAddress& address, ISocketFactory* socketFactory, IStreamFilterFactory* streamFilterFactory, - CScreen* screen, - const CCryptoOptions& crypto, + Screen* screen, + const CryptoOptions& crypto, bool enableDragDrop) : m_mock(false), m_name(name), @@ -83,26 +83,26 @@ CClient::CClient( // register suspend/resume event handlers m_events->adoptHandler(m_events->forIScreen().suspend(), getEventTarget(), - new TMethodEventJob(this, - &CClient::handleSuspend)); + new TMethodEventJob(this, + &Client::handleSuspend)); m_events->adoptHandler(m_events->forIScreen().resume(), getEventTarget(), - new TMethodEventJob(this, - &CClient::handleResume)); + new TMethodEventJob(this, + &Client::handleResume)); if (m_enableDragDrop) { m_events->adoptHandler(m_events->forIScreen().fileChunkSending(), this, - new TMethodEventJob(this, - &CClient::handleFileChunkSending)); + new TMethodEventJob(this, + &Client::handleFileChunkSending)); m_events->adoptHandler(m_events->forIScreen().fileRecieveCompleted(), this, - new TMethodEventJob(this, - &CClient::handleFileRecieveCompleted)); + new TMethodEventJob(this, + &Client::handleFileRecieveCompleted)); } } -CClient::~CClient() +Client::~Client() { if (m_mock) { return; @@ -122,7 +122,7 @@ CClient::~CClient() } void -CClient::connect() +Client::connect() { if (m_stream != NULL) { return; @@ -157,10 +157,10 @@ CClient::connect() if (m_streamFilterFactory != NULL) { m_stream = m_streamFilterFactory->create(m_stream, true); } - m_stream = new CPacketStreamFilter(m_events, m_stream, true); + m_stream = new PacketStreamFilter(m_events, m_stream, true); if (m_crypto.m_mode != kDisabled) { - m_cryptoStream = new CCryptoStream( + m_cryptoStream = new CryptoStream( m_events, m_stream, m_crypto, true); m_stream = m_cryptoStream; } @@ -183,7 +183,7 @@ CClient::connect() } void -CClient::disconnect(const char* msg) +Client::disconnect(const char* msg) { m_connectOnResume = false; cleanupTimer(); @@ -194,20 +194,20 @@ CClient::disconnect(const char* msg) sendConnectionFailedEvent(msg); } else { - sendEvent(m_events->forCClient().disconnected(), NULL); + sendEvent(m_events->forClient().disconnected(), NULL); } } void -CClient::handshakeComplete() +Client::handshakeComplete() { m_ready = true; m_screen->enable(); - sendEvent(m_events->forCClient().connected(), NULL); + sendEvent(m_events->forClient().connected(), NULL); } void -CClient::setDecryptIv(const UInt8* iv) +Client::setDecryptIv(const UInt8* iv) { if (m_cryptoStream != NULL) { m_cryptoStream->setDecryptIv(iv); @@ -215,49 +215,49 @@ CClient::setDecryptIv(const UInt8* iv) } bool -CClient::isConnected() const +Client::isConnected() const { return (m_server != NULL); } bool -CClient::isConnecting() const +Client::isConnecting() const { return (m_timer != NULL); } -CNetworkAddress -CClient::getServerAddress() const +NetworkAddress +Client::getServerAddress() const { return m_serverAddress; } void* -CClient::getEventTarget() const +Client::getEventTarget() const { return m_screen->getEventTarget(); } bool -CClient::getClipboard(ClipboardID id, IClipboard* clipboard) const +Client::getClipboard(ClipboardID id, IClipboard* clipboard) const { return m_screen->getClipboard(id, clipboard); } void -CClient::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const +Client::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const { m_screen->getShape(x, y, w, h); } void -CClient::getCursorPos(SInt32& x, SInt32& y) const +Client::getCursorPos(SInt32& x, SInt32& y) const { m_screen->getCursorPos(x, y); } void -CClient::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool) +Client::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool) { m_active = true; m_screen->mouseMove(xAbs, yAbs); @@ -265,7 +265,7 @@ CClient::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool) } bool -CClient::leave() +Client::leave() { m_screen->leave(); @@ -282,7 +282,7 @@ CClient::leave() } void -CClient::setClipboard(ClipboardID id, const IClipboard* clipboard) +Client::setClipboard(ClipboardID id, const IClipboard* clipboard) { m_screen->setClipboard(id, clipboard); m_ownClipboard[id] = false; @@ -290,7 +290,7 @@ CClient::setClipboard(ClipboardID id, const IClipboard* clipboard) } void -CClient::grabClipboard(ClipboardID id) +Client::grabClipboard(ClipboardID id) { m_screen->grabClipboard(id); m_ownClipboard[id] = false; @@ -298,86 +298,86 @@ CClient::grabClipboard(ClipboardID id) } void -CClient::setClipboardDirty(ClipboardID, bool) +Client::setClipboardDirty(ClipboardID, bool) { assert(0 && "shouldn't be called"); } void -CClient::keyDown(KeyID id, KeyModifierMask mask, KeyButton button) +Client::keyDown(KeyID id, KeyModifierMask mask, KeyButton button) { m_screen->keyDown(id, mask, button); } void -CClient::keyRepeat(KeyID id, KeyModifierMask mask, +Client::keyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) { m_screen->keyRepeat(id, mask, count, button); } void -CClient::keyUp(KeyID id, KeyModifierMask mask, KeyButton button) +Client::keyUp(KeyID id, KeyModifierMask mask, KeyButton button) { m_screen->keyUp(id, mask, button); } void -CClient::mouseDown(ButtonID id) +Client::mouseDown(ButtonID id) { m_screen->mouseDown(id); } void -CClient::mouseUp(ButtonID id) +Client::mouseUp(ButtonID id) { m_screen->mouseUp(id); } void -CClient::mouseMove(SInt32 x, SInt32 y) +Client::mouseMove(SInt32 x, SInt32 y) { m_screen->mouseMove(x, y); } void -CClient::mouseRelativeMove(SInt32 dx, SInt32 dy) +Client::mouseRelativeMove(SInt32 dx, SInt32 dy) { m_screen->mouseRelativeMove(dx, dy); } void -CClient::mouseWheel(SInt32 xDelta, SInt32 yDelta) +Client::mouseWheel(SInt32 xDelta, SInt32 yDelta) { m_screen->mouseWheel(xDelta, yDelta); } void -CClient::screensaver(bool activate) +Client::screensaver(bool activate) { m_screen->screensaver(activate); } void -CClient::resetOptions() +Client::resetOptions() { m_screen->resetOptions(); } void -CClient::setOptions(const COptionsList& options) +Client::setOptions(const OptionsList& options) { m_screen->setOptions(options); } -CString -CClient::getName() const +String +Client::getName() const { return m_name; } void -CClient::sendClipboard(ClipboardID id) +Client::sendClipboard(ClipboardID id) { // note -- m_mutex must be locked on entry assert(m_screen != NULL); @@ -387,7 +387,7 @@ CClient::sendClipboard(ClipboardID id) // clipboard time before getting the data from the screen // as the screen may detect an unchanged clipboard and // avoid copying the data. - CClipboard clipboard; + Clipboard clipboard; if (clipboard.open(m_timeClipboard[id])) { clipboard.close(); } @@ -400,7 +400,7 @@ CClient::sendClipboard(ClipboardID id) m_timeClipboard[id] = clipboard.getTime(); // marshall the data - CString data = clipboard.marshall(); + String data = clipboard.marshall(); // save and send data if different or not yet sent if (!m_sentClipboard[id] || data != m_dataClipboard[id]) { @@ -412,24 +412,24 @@ CClient::sendClipboard(ClipboardID id) } void -CClient::sendEvent(CEvent::Type type, void* data) +Client::sendEvent(Event::Type type, void* data) { - m_events->addEvent(CEvent(type, getEventTarget(), data)); + m_events->addEvent(Event(type, getEventTarget(), data)); } void -CClient::sendConnectionFailedEvent(const char* msg) +Client::sendConnectionFailedEvent(const char* msg) { - CFailInfo* info = new CFailInfo(msg); + FailInfo* info = new FailInfo(msg); info->m_retry = true; - CEvent event(m_events->forCClient().connectionFailed(), getEventTarget(), info, CEvent::kDontFreeData); + Event event(m_events->forClient().connectionFailed(), getEventTarget(), info, Event::kDontFreeData); m_events->addEvent(event); } void -CClient::sendFileChunk(const void* data) +Client::sendFileChunk(const void* data) { - CFileChunker::CFileChunk* fileChunk = reinterpret_cast(const_cast(data)); + FileChunker::FileChunk* fileChunk = reinterpret_cast(const_cast(data)); LOG((CLOG_DEBUG1 "sendFileChunk")); assert(m_server != NULL); @@ -438,77 +438,77 @@ CClient::sendFileChunk(const void* data) } void -CClient::setupConnecting() +Client::setupConnecting() { assert(m_stream != NULL); m_events->adoptHandler(m_events->forIDataSocket().connected(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleConnected)); + new TMethodEventJob(this, + &Client::handleConnected)); m_events->adoptHandler(m_events->forIDataSocket().connectionFailed(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleConnectionFailed)); + new TMethodEventJob(this, + &Client::handleConnectionFailed)); } void -CClient::setupConnection() +Client::setupConnection() { assert(m_stream != NULL); m_events->adoptHandler(m_events->forISocket().disconnected(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleDisconnected)); + new TMethodEventJob(this, + &Client::handleDisconnected)); m_events->adoptHandler(m_events->forIStream().inputReady(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleHello)); + new TMethodEventJob(this, + &Client::handleHello)); m_events->adoptHandler(m_events->forIStream().outputError(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleOutputError)); + new TMethodEventJob(this, + &Client::handleOutputError)); m_events->adoptHandler(m_events->forIStream().inputShutdown(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleDisconnected)); + new TMethodEventJob(this, + &Client::handleDisconnected)); m_events->adoptHandler(m_events->forIStream().outputShutdown(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClient::handleDisconnected)); + new TMethodEventJob(this, + &Client::handleDisconnected)); } void -CClient::setupScreen() +Client::setupScreen() { assert(m_server == NULL); m_ready = false; - m_server = new CServerProxy(this, m_stream, m_events); + m_server = new ServerProxy(this, m_stream, m_events); m_events->adoptHandler(m_events->forIScreen().shapeChanged(), getEventTarget(), - new TMethodEventJob(this, - &CClient::handleShapeChanged)); + new TMethodEventJob(this, + &Client::handleShapeChanged)); m_events->adoptHandler(m_events->forIScreen().clipboardGrabbed(), getEventTarget(), - new TMethodEventJob(this, - &CClient::handleClipboardGrabbed)); + new TMethodEventJob(this, + &Client::handleClipboardGrabbed)); } void -CClient::setupTimer() +Client::setupTimer() { assert(m_timer == NULL); m_timer = m_events->newOneShotTimer(15.0, NULL); - m_events->adoptHandler(CEvent::kTimer, m_timer, - new TMethodEventJob(this, - &CClient::handleConnectTimeout)); + m_events->adoptHandler(Event::kTimer, m_timer, + new TMethodEventJob(this, + &Client::handleConnectTimeout)); } void -CClient::cleanupConnecting() +Client::cleanupConnecting() { if (m_stream != NULL) { m_events->removeHandler(m_events->forIDataSocket().connected(), @@ -519,7 +519,7 @@ CClient::cleanupConnecting() } void -CClient::cleanupConnection() +Client::cleanupConnection() { if (m_stream != NULL) { m_events->removeHandler(m_events->forIStream().inputReady(), @@ -538,7 +538,7 @@ CClient::cleanupConnection() } void -CClient::cleanupScreen() +Client::cleanupScreen() { if (m_server != NULL) { if (m_ready) { @@ -555,17 +555,17 @@ CClient::cleanupScreen() } void -CClient::cleanupTimer() +Client::cleanupTimer() { if (m_timer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_timer); + m_events->removeHandler(Event::kTimer, m_timer); m_events->deleteTimer(m_timer); m_timer = NULL; } } void -CClient::handleConnected(const CEvent&, void*) +Client::handleConnected(const Event&, void*) { LOG((CLOG_DEBUG1 "connected; wait for hello")); cleanupConnecting(); @@ -580,10 +580,10 @@ CClient::handleConnected(const CEvent&, void*) } void -CClient::handleConnectionFailed(const CEvent& event, void*) +Client::handleConnectionFailed(const Event& event, void*) { - IDataSocket::CConnectionFailedInfo* info = - reinterpret_cast(event.getData()); + IDataSocket::ConnectionFailedInfo* info = + reinterpret_cast(event.getData()); cleanupTimer(); cleanupConnecting(); @@ -595,7 +595,7 @@ CClient::handleConnectionFailed(const CEvent& event, void*) } void -CClient::handleConnectTimeout(const CEvent&, void*) +Client::handleConnectTimeout(const Event&, void*) { cleanupTimer(); cleanupConnecting(); @@ -607,37 +607,37 @@ CClient::handleConnectTimeout(const CEvent&, void*) } void -CClient::handleOutputError(const CEvent&, void*) +Client::handleOutputError(const Event&, void*) { cleanupTimer(); cleanupScreen(); cleanupConnection(); LOG((CLOG_WARN "error sending to server")); - sendEvent(m_events->forCClient().disconnected(), NULL); + sendEvent(m_events->forClient().disconnected(), NULL); } void -CClient::handleDisconnected(const CEvent&, void*) +Client::handleDisconnected(const Event&, void*) { cleanupTimer(); cleanupScreen(); cleanupConnection(); LOG((CLOG_DEBUG1 "disconnected")); - sendEvent(m_events->forCClient().disconnected(), NULL); + sendEvent(m_events->forClient().disconnected(), NULL); } void -CClient::handleShapeChanged(const CEvent&, void*) +Client::handleShapeChanged(const Event&, void*) { LOG((CLOG_DEBUG "resolution changed")); m_server->onInfoChanged(); } void -CClient::handleClipboardGrabbed(const CEvent& event, void*) +Client::handleClipboardGrabbed(const Event& event, void*) { - const IScreen::CClipboardInfo* info = - reinterpret_cast(event.getData()); + const IScreen::ClipboardInfo* info = + reinterpret_cast(event.getData()); // grab ownership m_server->onGrabClipboard(info->m_id); @@ -655,10 +655,10 @@ CClient::handleClipboardGrabbed(const CEvent& event, void*) } void -CClient::handleHello(const CEvent&, void*) +Client::handleHello(const Event&, void*) { SInt16 major, minor; - if (!CProtocolUtil::readf(m_stream, kMsgHello, &major, &minor)) { + if (!ProtocolUtil::readf(m_stream, kMsgHello, &major, &minor)) { sendConnectionFailedEvent("Protocol error from server"); cleanupTimer(); cleanupConnection(); @@ -677,7 +677,7 @@ CClient::handleHello(const CEvent&, void*) // say hello back LOG((CLOG_DEBUG1 "say hello version %d.%d", kProtocolMajorVersion, kProtocolMinorVersion)); - CProtocolUtil::writef(m_stream, kMsgHelloBack, + ProtocolUtil::writef(m_stream, kMsgHelloBack, kProtocolMajorVersion, kProtocolMinorVersion, &m_name); @@ -689,13 +689,13 @@ CClient::handleHello(const CEvent&, void*) // receive another event for already pending messages so we fake // one. if (m_stream->isReady()) { - m_events->addEvent(CEvent(m_events->forIStream().inputReady(), + m_events->addEvent(Event(m_events->forIStream().inputReady(), m_stream->getEventTarget())); } } void -CClient::handleSuspend(const CEvent&, void*) +Client::handleSuspend(const Event&, void*) { LOG((CLOG_INFO "suspend")); m_suspended = true; @@ -705,7 +705,7 @@ CClient::handleSuspend(const CEvent&, void*) } void -CClient::handleResume(const CEvent&, void*) +Client::handleResume(const Event&, void*) { LOG((CLOG_INFO "resume")); m_suspended = false; @@ -716,30 +716,30 @@ CClient::handleResume(const CEvent&, void*) } void -CClient::handleFileChunkSending(const CEvent& event, void*) +Client::handleFileChunkSending(const Event& event, void*) { sendFileChunk(event.getData()); } void -CClient::handleFileRecieveCompleted(const CEvent& event, void*) +Client::handleFileRecieveCompleted(const Event& event, void*) { onFileRecieveCompleted(); } void -CClient::onFileRecieveCompleted() +Client::onFileRecieveCompleted() { if (isReceivedFileSizeValid()) { - m_writeToDropDirThread = new CThread( - new TMethodJob( - this, &CClient::writeToDropDirThread)); + m_writeToDropDirThread = new Thread( + new TMethodJob( + this, &Client::writeToDropDirThread)); } } void -CClient::writeToDropDirThread(void*) +Client::writeToDropDirThread(void*) { LOG((CLOG_DEBUG "starting write to drop dir thread")); @@ -747,63 +747,63 @@ CClient::writeToDropDirThread(void*) ARCH->sleep(.1f); } - CDropHelper::writeToDir(m_screen->getDropTarget(), m_dragFileList, + DropHelper::writeToDir(m_screen->getDropTarget(), m_dragFileList, m_receivedFileData); } void -CClient::clearReceivedFileData() +Client::clearReceivedFileData() { m_receivedFileData.clear(); } void -CClient::setExpectedFileSize(CString data) +Client::setExpectedFileSize(String data) { std::istringstream iss(data); iss >> m_expectedFileSize; } void -CClient::fileChunkReceived(CString data) +Client::fileChunkReceived(String data) { m_receivedFileData += data; } void -CClient::dragInfoReceived(UInt32 fileNum, CString data) +Client::dragInfoReceived(UInt32 fileNum, String data) { if (!m_enableDragDrop) { LOG((CLOG_DEBUG "drag drop not enabled, ignoring drag info.")); return; } - CDragInformation::parseDragInfo(m_dragFileList, fileNum, data); + DragInformation::parseDragInfo(m_dragFileList, fileNum, data); m_screen->startDraggingFiles(m_dragFileList); } bool -CClient::isReceivedFileSizeValid() +Client::isReceivedFileSizeValid() { return m_expectedFileSize == m_receivedFileData.size(); } void -CClient::sendFileToServer(const char* filename) +Client::sendFileToServer(const char* filename) { - m_sendFileThread = new CThread( - new TMethodJob( - this, &CClient::sendFileThread, + m_sendFileThread = new Thread( + new TMethodJob( + this, &Client::sendFileThread, reinterpret_cast(const_cast(filename)))); } void -CClient::sendFileThread(void* filename) +Client::sendFileThread(void* filename) { try { char* name = reinterpret_cast(filename); - CFileChunker::sendFileChunks(name, m_events, this); + FileChunker::sendFileChunks(name, m_events, this); } catch (std::runtime_error error) { LOG((CLOG_ERR "failed sending file chunks: %s", error.what())); @@ -813,7 +813,7 @@ CClient::sendFileThread(void* filename) } void -CClient::sendDragInfo(UInt32 fileCount, CString& info, size_t size) +Client::sendDragInfo(UInt32 fileCount, String& info, size_t size) { m_server->sendDragInfo(fileCount, info.c_str(), size); } diff --git a/src/lib/client/Client.h b/src/lib/client/Client.h index 4995da64..a1957927 100644 --- a/src/lib/client/Client.h +++ b/src/lib/client/Client.h @@ -27,28 +27,28 @@ #include "io/CryptoOptions.h" #include "base/EventTypes.h" -class CEventQueueTimer; -class CScreen; -class CServerProxy; +class EventQueueTimer; +class Screen; +class ServerProxy; class IDataSocket; class ISocketFactory; namespace synergy { class IStream; } class IStreamFilterFactory; class IEventQueue; -class CCryptoStream; -class CThread; +class CryptoStream; +class Thread; //! Synergy client /*! This class implements the top-level client algorithms for synergy. */ -class CClient : public IClient, public INode { +class Client : public IClient, public INode { public: - class CFailInfo { + class FailInfo { public: - CFailInfo(const char* what) : m_retry(false), m_what(what) { } + FailInfo(const char* what) : m_retry(false), m_what(what) { } bool m_retry; - CString m_what; + String m_what; }; public: @@ -57,17 +57,17 @@ public: as its name and \p address as the server's address and \p factory to create the socket. \p screen is the local screen. */ - CClient(IEventQueue* events, - const CString& name, const CNetworkAddress& address, + Client(IEventQueue* events, + const String& name, const NetworkAddress& address, ISocketFactory* socketFactory, IStreamFilterFactory* streamFilterFactory, - CScreen* screen, - const CCryptoOptions& crypto, + Screen* screen, + const CryptoOptions& crypto, bool enableDragDrop); - ~CClient(); + ~Client(); #ifdef TEST_ENV - CClient() : m_mock(true) { } + Client() : m_mock(true) { } #endif //! @name manipulators @@ -99,19 +99,19 @@ public: void clearReceivedFileData(); //! Set the expected size of receiving file - void setExpectedFileSize(CString data); + void setExpectedFileSize(String data); //! Received a chunk of file data - void fileChunkReceived(CString data); + void fileChunkReceived(String data); //! Received drag information - void dragInfoReceived(UInt32 fileNum, CString data); + void dragInfoReceived(UInt32 fileNum, String data); //! Create a new thread and use it to send file to Server void sendFileToServer(const char* filename); //! Send dragging file information back to server - void sendDragInfo(UInt32 fileCount, CString& info, size_t size); + void sendDragInfo(UInt32 fileCount, String& info, size_t size); //@} //! @name accessors @@ -135,7 +135,7 @@ public: Returns the address of the server the client is connected (or wants to connect) to. */ - CNetworkAddress getServerAddress() const; + NetworkAddress getServerAddress() const; //! Return true if recieved file size is valid bool isReceivedFileSizeValid(); @@ -171,12 +171,12 @@ public: virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta); virtual void screensaver(bool activate); virtual void resetOptions(); - virtual void setOptions(const COptionsList& options); - virtual CString getName() const; + virtual void setOptions(const OptionsList& options); + virtual String getName() const; private: void sendClipboard(ClipboardID); - void sendEvent(CEvent::Type, void*); + void sendEvent(Event::Type, void*); void sendConnectionFailedEvent(const char* msg); void sendFileChunk(const void* data); void sendFileThread(void*); @@ -189,32 +189,32 @@ private: void cleanupConnection(); void cleanupScreen(); void cleanupTimer(); - void handleConnected(const CEvent&, void*); - void handleConnectionFailed(const CEvent&, void*); - void handleConnectTimeout(const CEvent&, void*); - void handleOutputError(const CEvent&, void*); - void handleDisconnected(const CEvent&, void*); - void handleShapeChanged(const CEvent&, void*); - void handleClipboardGrabbed(const CEvent&, void*); - void handleHello(const CEvent&, void*); - void handleSuspend(const CEvent& event, void*); - void handleResume(const CEvent& event, void*); - void handleFileChunkSending(const CEvent&, void*); - void handleFileRecieveCompleted(const CEvent&, void*); + void handleConnected(const Event&, void*); + void handleConnectionFailed(const Event&, void*); + void handleConnectTimeout(const Event&, void*); + void handleOutputError(const Event&, void*); + void handleDisconnected(const Event&, void*); + void handleShapeChanged(const Event&, void*); + void handleClipboardGrabbed(const Event&, void*); + void handleHello(const Event&, void*); + void handleSuspend(const Event& event, void*); + void handleResume(const Event& event, void*); + void handleFileChunkSending(const Event&, void*); + void handleFileRecieveCompleted(const Event&, void*); void onFileRecieveCompleted(); public: bool m_mock; private: - CString m_name; - CNetworkAddress m_serverAddress; + String m_name; + NetworkAddress m_serverAddress; ISocketFactory* m_socketFactory; IStreamFilterFactory* m_streamFilterFactory; - CScreen* m_screen; + Screen* m_screen; synergy::IStream* m_stream; - CEventQueueTimer* m_timer; - CServerProxy* m_server; + EventQueueTimer* m_timer; + ServerProxy* m_server; bool m_ready; bool m_active; bool m_suspended; @@ -222,15 +222,15 @@ private: bool m_ownClipboard[kClipboardEnd]; bool m_sentClipboard[kClipboardEnd]; IClipboard::Time m_timeClipboard[kClipboardEnd]; - CString m_dataClipboard[kClipboardEnd]; + String m_dataClipboard[kClipboardEnd]; IEventQueue* m_events; - CCryptoStream* m_cryptoStream; - CCryptoOptions m_crypto; + CryptoStream* m_cryptoStream; + CryptoOptions m_crypto; std::size_t m_expectedFileSize; - CString m_receivedFileData; - CDragFileList m_dragFileList; - CString m_dragFileExt; - CThread* m_sendFileThread; - CThread* m_writeToDropDirThread; + String m_receivedFileData; + DragFileList m_dragFileList; + String m_dragFileExt; + Thread* m_sendFileThread; + Thread* m_writeToDropDirThread; bool m_enableDragDrop; }; diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp index af6b441a..1bdb6d05 100644 --- a/src/lib/client/ServerProxy.cpp +++ b/src/lib/client/ServerProxy.cpp @@ -33,12 +33,12 @@ #include // -// CServerProxy +// ServerProxy // -const UInt16 CServerProxy::m_intervalThreshold = 1; +const UInt16 ServerProxy::m_intervalThreshold = 1; -CServerProxy::CServerProxy(CClient* client, synergy::IStream* stream, IEventQueue* events) : +ServerProxy::ServerProxy(Client* client, synergy::IStream* stream, IEventQueue* events) : m_client(client), m_stream(stream), m_seqNum(0), @@ -51,7 +51,7 @@ CServerProxy::CServerProxy(CClient* client, synergy::IStream* stream, IEventQueu m_ignoreMouse(false), m_keepAliveAlarm(0.0), m_keepAliveAlarmTimer(NULL), - m_parser(&CServerProxy::parseHandshakeMessage), + m_parser(&ServerProxy::parseHandshakeMessage), m_events(events), m_stopwatch(true), m_elapsedTime(0), @@ -67,14 +67,14 @@ CServerProxy::CServerProxy(CClient* client, synergy::IStream* stream, IEventQueu // handle data on stream m_events->adoptHandler(m_events->forIStream().inputReady(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CServerProxy::handleData)); + new TMethodEventJob(this, + &ServerProxy::handleData)); // send heartbeat setKeepAliveRate(kKeepAliveRate); } -CServerProxy::~CServerProxy() +ServerProxy::~ServerProxy() { setKeepAliveRate(-1.0); m_events->removeHandler(m_events->forIStream().inputReady(), @@ -82,31 +82,31 @@ CServerProxy::~CServerProxy() } void -CServerProxy::resetKeepAliveAlarm() +ServerProxy::resetKeepAliveAlarm() { if (m_keepAliveAlarmTimer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_keepAliveAlarmTimer); + m_events->removeHandler(Event::kTimer, m_keepAliveAlarmTimer); m_events->deleteTimer(m_keepAliveAlarmTimer); m_keepAliveAlarmTimer = NULL; } if (m_keepAliveAlarm > 0.0) { m_keepAliveAlarmTimer = m_events->newOneShotTimer(m_keepAliveAlarm, NULL); - m_events->adoptHandler(CEvent::kTimer, m_keepAliveAlarmTimer, - new TMethodEventJob(this, - &CServerProxy::handleKeepAliveAlarm)); + m_events->adoptHandler(Event::kTimer, m_keepAliveAlarmTimer, + new TMethodEventJob(this, + &ServerProxy::handleKeepAliveAlarm)); } } void -CServerProxy::setKeepAliveRate(double rate) +ServerProxy::setKeepAliveRate(double rate) { m_keepAliveAlarm = rate * kKeepAlivesUntilDeath; resetKeepAliveAlarm(); } void -CServerProxy::handleData(const CEvent&, void*) +ServerProxy::handleData(const Event&, void*) { // handle messages until there are no more. first read message code. UInt8 code[4]; @@ -141,8 +141,8 @@ CServerProxy::handleData(const CEvent&, void*) flushCompressedMouse(); } -CServerProxy::EResult -CServerProxy::parseHandshakeMessage(const UInt8* code) +ServerProxy::EResult +ServerProxy::parseHandshakeMessage(const UInt8* code) { if (memcmp(code, kMsgQInfo, 4) == 0) { queryInfo(); @@ -156,7 +156,7 @@ CServerProxy::parseHandshakeMessage(const UInt8* code) setOptions(); // handshake is complete - m_parser = &CServerProxy::parseMessage; + m_parser = &ServerProxy::parseMessage; m_client->handshakeComplete(); } @@ -166,7 +166,7 @@ CServerProxy::parseHandshakeMessage(const UInt8* code) else if (memcmp(code, kMsgCKeepAlive, 4) == 0) { // echo keep alives and reset alarm - CProtocolUtil::writef(m_stream, kMsgCKeepAlive); + ProtocolUtil::writef(m_stream, kMsgCKeepAlive); resetKeepAliveAlarm(); } @@ -183,7 +183,7 @@ CServerProxy::parseHandshakeMessage(const UInt8* code) else if (memcmp(code, kMsgEIncompatible, 4) == 0) { SInt32 major, minor; - CProtocolUtil::readf(m_stream, + ProtocolUtil::readf(m_stream, kMsgEIncompatible + 4, &major, &minor); LOG((CLOG_ERR "server has incompatible version %d.%d", major, minor)); m_client->disconnect("server has incompatible version"); @@ -214,8 +214,8 @@ CServerProxy::parseHandshakeMessage(const UInt8* code) return kOkay; } -CServerProxy::EResult -CServerProxy::parseMessage(const UInt8* code) +ServerProxy::EResult +ServerProxy::parseMessage(const UInt8* code) { if (memcmp(code, kMsgDMouseMove, 4) == 0) { mouseMove(); @@ -251,7 +251,7 @@ CServerProxy::parseMessage(const UInt8* code) else if (memcmp(code, kMsgCKeepAlive, 4) == 0) { // echo keep alives and reset alarm - CProtocolUtil::writef(m_stream, kMsgCKeepAlive); + ProtocolUtil::writef(m_stream, kMsgCKeepAlive); resetKeepAliveAlarm(); } @@ -328,20 +328,20 @@ CServerProxy::parseMessage(const UInt8* code) // on a data packet. we provide that packet here. i don't // know why a delayed ACK should cause the server to wait since // TCP_NODELAY is enabled. - CProtocolUtil::writef(m_stream, kMsgCNoop); + ProtocolUtil::writef(m_stream, kMsgCNoop); return kOkay; } void -CServerProxy::handleKeepAliveAlarm(const CEvent&, void*) +ServerProxy::handleKeepAliveAlarm(const Event&, void*) { LOG((CLOG_NOTE "server is dead")); m_client->disconnect("server is not responding"); } void -CServerProxy::onInfoChanged() +ServerProxy::onInfoChanged() { // ignore mouse motion until we receive acknowledgment of our info // change message. @@ -352,23 +352,23 @@ CServerProxy::onInfoChanged() } bool -CServerProxy::onGrabClipboard(ClipboardID id) +ServerProxy::onGrabClipboard(ClipboardID id) { LOG((CLOG_DEBUG1 "sending clipboard %d changed", id)); - CProtocolUtil::writef(m_stream, kMsgCClipboard, id, m_seqNum); + ProtocolUtil::writef(m_stream, kMsgCClipboard, id, m_seqNum); return true; } void -CServerProxy::onClipboardChanged(ClipboardID id, const IClipboard* clipboard) +ServerProxy::onClipboardChanged(ClipboardID id, const IClipboard* clipboard) { - CString data = IClipboard::marshall(clipboard); + String data = IClipboard::marshall(clipboard); LOG((CLOG_DEBUG1 "sending clipboard %d seqnum=%d, size=%d", id, m_seqNum, data.size())); - CProtocolUtil::writef(m_stream, kMsgDClipboard, id, m_seqNum, &data); + ProtocolUtil::writef(m_stream, kMsgDClipboard, id, m_seqNum, &data); } void -CServerProxy::flushCompressedMouse() +ServerProxy::flushCompressedMouse() { if (m_compressMouse) { m_compressMouse = false; @@ -383,17 +383,17 @@ CServerProxy::flushCompressedMouse() } void -CServerProxy::sendInfo(const CClientInfo& info) +ServerProxy::sendInfo(const ClientInfo& info) { LOG((CLOG_DEBUG1 "sending info shape=%d,%d %dx%d", info.m_x, info.m_y, info.m_w, info.m_h)); - CProtocolUtil::writef(m_stream, kMsgDInfo, + ProtocolUtil::writef(m_stream, kMsgDInfo, info.m_x, info.m_y, info.m_w, info.m_h, 0, info.m_mx, info.m_my); } KeyID -CServerProxy::translateKey(KeyID id) const +ServerProxy::translateKey(KeyID id) const { static const KeyID s_translationTable[kKeyModifierIDLast][2] = { { kKeyNone, kKeyNone }, @@ -473,7 +473,7 @@ CServerProxy::translateKey(KeyID id) const } KeyModifierMask -CServerProxy::translateModifierMask(KeyModifierMask mask) const +ServerProxy::translateModifierMask(KeyModifierMask mask) const { static const KeyModifierMask s_masks[kKeyModifierIDLast] = { 0x0000, @@ -513,13 +513,13 @@ CServerProxy::translateModifierMask(KeyModifierMask mask) const } void -CServerProxy::enter() +ServerProxy::enter() { // parse SInt16 x, y; UInt16 mask; UInt32 seqNum; - CProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask); + ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask); LOG((CLOG_DEBUG1 "recv enter, %d,%d %d %04x", x, y, seqNum, mask)); // discard old compressed mouse motion, if any @@ -534,7 +534,7 @@ CServerProxy::enter() } void -CServerProxy::leave() +ServerProxy::leave() { // parse LOG((CLOG_DEBUG1 "recv leave")); @@ -547,13 +547,13 @@ CServerProxy::leave() } void -CServerProxy::setClipboard() +ServerProxy::setClipboard() { // parse ClipboardID id; UInt32 seqNum; - CString data; - CProtocolUtil::readf(m_stream, kMsgDClipboard + 4, &id, &seqNum, &data); + String data; + ProtocolUtil::readf(m_stream, kMsgDClipboard + 4, &id, &seqNum, &data); LOG((CLOG_DEBUG "recv clipboard %d size=%d", id, data.size())); // validate @@ -562,18 +562,18 @@ CServerProxy::setClipboard() } // forward - CClipboard clipboard; + Clipboard clipboard; clipboard.unmarshall(data, 0); m_client->setClipboard(id, &clipboard); } void -CServerProxy::grabClipboard() +ServerProxy::grabClipboard() { // parse ClipboardID id; UInt32 seqNum; - CProtocolUtil::readf(m_stream, kMsgCClipboard + 4, &id, &seqNum); + ProtocolUtil::readf(m_stream, kMsgCClipboard + 4, &id, &seqNum); LOG((CLOG_DEBUG "recv grab clipboard %d", id)); // validate @@ -586,14 +586,14 @@ CServerProxy::grabClipboard() } void -CServerProxy::keyDown() +ServerProxy::keyDown() { // get mouse up to date flushCompressedMouse(); // parse UInt16 id, mask, button; - CProtocolUtil::readf(m_stream, kMsgDKeyDown + 4, &id, &mask, &button); + ProtocolUtil::readf(m_stream, kMsgDKeyDown + 4, &id, &mask, &button); LOG((CLOG_DEBUG1 "recv key down id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button)); // translate @@ -609,14 +609,14 @@ CServerProxy::keyDown() } void -CServerProxy::keyRepeat() +ServerProxy::keyRepeat() { // get mouse up to date flushCompressedMouse(); // parse UInt16 id, mask, count, button; - CProtocolUtil::readf(m_stream, kMsgDKeyRepeat + 4, + ProtocolUtil::readf(m_stream, kMsgDKeyRepeat + 4, &id, &mask, &count, &button); LOG((CLOG_DEBUG1 "recv key repeat id=0x%08x, mask=0x%04x, count=%d, button=0x%04x", id, mask, count, button)); @@ -633,14 +633,14 @@ CServerProxy::keyRepeat() } void -CServerProxy::keyUp() +ServerProxy::keyUp() { // get mouse up to date flushCompressedMouse(); // parse UInt16 id, mask, button; - CProtocolUtil::readf(m_stream, kMsgDKeyUp + 4, &id, &mask, &button); + ProtocolUtil::readf(m_stream, kMsgDKeyUp + 4, &id, &mask, &button); LOG((CLOG_DEBUG1 "recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button)); // translate @@ -656,14 +656,14 @@ CServerProxy::keyUp() } void -CServerProxy::mouseDown() +ServerProxy::mouseDown() { // get mouse up to date flushCompressedMouse(); // parse SInt8 id; - CProtocolUtil::readf(m_stream, kMsgDMouseDown + 4, &id); + ProtocolUtil::readf(m_stream, kMsgDMouseDown + 4, &id); LOG((CLOG_DEBUG1 "recv mouse down id=%d", id)); // forward @@ -671,14 +671,14 @@ CServerProxy::mouseDown() } void -CServerProxy::mouseUp() +ServerProxy::mouseUp() { // get mouse up to date flushCompressedMouse(); // parse SInt8 id; - CProtocolUtil::readf(m_stream, kMsgDMouseUp + 4, &id); + ProtocolUtil::readf(m_stream, kMsgDMouseUp + 4, &id); LOG((CLOG_DEBUG1 "recv mouse up id=%d", id)); // forward @@ -686,12 +686,12 @@ CServerProxy::mouseUp() } void -CServerProxy::mouseMove() +ServerProxy::mouseMove() { // parse bool ignore; SInt16 x, y; - CProtocolUtil::readf(m_stream, kMsgDMouseMove + 4, &x, &y); + ProtocolUtil::readf(m_stream, kMsgDMouseMove + 4, &x, &y); // note if we should ignore the move ignore = m_ignoreMouse; @@ -719,12 +719,12 @@ CServerProxy::mouseMove() } void -CServerProxy::mouseRelativeMove() +ServerProxy::mouseRelativeMove() { // parse bool ignore; SInt16 dx, dy; - CProtocolUtil::readf(m_stream, kMsgDMouseRelMove + 4, &dx, &dy); + ProtocolUtil::readf(m_stream, kMsgDMouseRelMove + 4, &dx, &dy); // note if we should ignore the move ignore = m_ignoreMouse; @@ -749,14 +749,14 @@ CServerProxy::mouseRelativeMove() } void -CServerProxy::mouseWheel() +ServerProxy::mouseWheel() { // get mouse up to date flushCompressedMouse(); // parse SInt16 xDelta, yDelta; - CProtocolUtil::readf(m_stream, kMsgDMouseWheel + 4, &xDelta, &yDelta); + ProtocolUtil::readf(m_stream, kMsgDMouseWheel + 4, &xDelta, &yDelta); LOG((CLOG_DEBUG2 "recv mouse wheel %+d,%+d", xDelta, yDelta)); // forward @@ -764,11 +764,11 @@ CServerProxy::mouseWheel() } void -CServerProxy::cryptoIv() +ServerProxy::cryptoIv() { // parse - CString s; - CProtocolUtil::readf(m_stream, kMsgDCryptoIv + 4, &s); + String s; + ProtocolUtil::readf(m_stream, kMsgDCryptoIv + 4, &s); LOG((CLOG_DEBUG2 "recv crypto iv size=%i", s.size())); // forward @@ -776,11 +776,11 @@ CServerProxy::cryptoIv() } void -CServerProxy::screensaver() +ServerProxy::screensaver() { // parse SInt8 on; - CProtocolUtil::readf(m_stream, kMsgCScreenSaver + 4, &on); + ProtocolUtil::readf(m_stream, kMsgCScreenSaver + 4, &on); LOG((CLOG_DEBUG1 "recv screen saver on=%d", on)); // forward @@ -788,7 +788,7 @@ CServerProxy::screensaver() } void -CServerProxy::resetOptions() +ServerProxy::resetOptions() { // parse LOG((CLOG_DEBUG1 "recv reset options")); @@ -806,11 +806,11 @@ CServerProxy::resetOptions() } void -CServerProxy::setOptions() +ServerProxy::setOptions() { // parse - COptionsList options; - CProtocolUtil::readf(m_stream, kMsgDSetOptions + 4, &options); + OptionsList options; + ProtocolUtil::readf(m_stream, kMsgDSetOptions + 4, &options); LOG((CLOG_DEBUG1 "recv set options size=%d", options.size())); // forward @@ -850,28 +850,28 @@ CServerProxy::setOptions() } void -CServerProxy::queryInfo() +ServerProxy::queryInfo() { - CClientInfo info; + ClientInfo info; m_client->getShape(info.m_x, info.m_y, info.m_w, info.m_h); m_client->getCursorPos(info.m_mx, info.m_my); sendInfo(info); } void -CServerProxy::infoAcknowledgment() +ServerProxy::infoAcknowledgment() { LOG((CLOG_DEBUG1 "recv info acknowledgment")); m_ignoreMouse = false; } void -CServerProxy::fileChunkReceived() +ServerProxy::fileChunkReceived() { // parse UInt8 mark = 0; - CString content; - CProtocolUtil::readf(m_stream, kMsgDFileTransfer + 4, &mark, &content); + String content; + ProtocolUtil::readf(m_stream, kMsgDFileTransfer + 4, &mark, &content); switch (mark) { case kFileStart: @@ -902,7 +902,7 @@ CServerProxy::fileChunkReceived() break; case kFileEnd: - m_events->addEvent(CEvent(m_events->forIScreen().fileRecieveCompleted(), m_client)); + m_events->addEvent(Event(m_events->forIScreen().fileRecieveCompleted(), m_client)); if (CLOG->getFilter() >= kDEBUG2) { LOG((CLOG_DEBUG2 "file data transfer finished")); m_elapsedTime += m_stopwatch.getTime(); @@ -916,20 +916,20 @@ CServerProxy::fileChunkReceived() } void -CServerProxy::dragInfoReceived() +ServerProxy::dragInfoReceived() { // parse UInt32 fileNum = 0; - CString content; - CProtocolUtil::readf(m_stream, kMsgDDragInfo + 4, &fileNum, &content); + String content; + ProtocolUtil::readf(m_stream, kMsgDDragInfo + 4, &fileNum, &content); m_client->dragInfoReceived(fileNum, content); } void -CServerProxy::fileChunkSending(UInt8 mark, char* data, size_t dataSize) +ServerProxy::fileChunkSending(UInt8 mark, char* data, size_t dataSize) { - CString chunk(data, dataSize); + String chunk(data, dataSize); switch (mark) { case kFileStart: @@ -945,12 +945,12 @@ CServerProxy::fileChunkSending(UInt8 mark, char* data, size_t dataSize) break; } - CProtocolUtil::writef(m_stream, kMsgDFileTransfer, mark, &chunk); + ProtocolUtil::writef(m_stream, kMsgDFileTransfer, mark, &chunk); } void -CServerProxy::sendDragInfo(UInt32 fileCount, const char* info, size_t size) +ServerProxy::sendDragInfo(UInt32 fileCount, const char* info, size_t size) { - CString data(info, size); - CProtocolUtil::writef(m_stream, kMsgDDragInfo, fileCount, &data); + String data(info, size); + ProtocolUtil::writef(m_stream, kMsgDDragInfo, fileCount, &data); } diff --git a/src/lib/client/ServerProxy.h b/src/lib/client/ServerProxy.h index 5fbc90ff..c9230e27 100644 --- a/src/lib/client/ServerProxy.h +++ b/src/lib/client/ServerProxy.h @@ -24,9 +24,9 @@ #include "base/Stopwatch.h" #include "base/String.h" -class CClient; -class CClientInfo; -class CEventQueueTimer; +class Client; +class ClientInfo; +class EventQueueTimer; class IClipboard; namespace synergy { class IStream; } class IEventQueue; @@ -36,14 +36,14 @@ class IEventQueue; This class acts a proxy for the server, converting calls into messages to the server and messages from the server to calls on the client. */ -class CServerProxy { +class ServerProxy { public: /*! Process messages from the server on \p stream and forward to \p client. */ - CServerProxy(CClient* client, synergy::IStream* stream, IEventQueue* events); - ~CServerProxy(); + ServerProxy(Client* client, synergy::IStream* stream, IEventQueue* events); + ~ServerProxy(); //! @name manipulators //@{ @@ -61,7 +61,7 @@ public: void sendDragInfo(UInt32 fileCount, const char* info, size_t size); #ifdef TEST_ENV - void handleDataForTest() { handleData(CEvent(), NULL); } + void handleDataForTest() { handleData(Event(), NULL); } #endif protected: @@ -73,7 +73,7 @@ private: // if compressing mouse motion then send the last motion now void flushCompressedMouse(); - void sendInfo(const CClientInfo&); + void sendInfo(const ClientInfo&); void resetKeepAliveAlarm(); void setKeepAliveRate(double); @@ -83,8 +83,8 @@ private: KeyModifierMask translateModifierMask(KeyModifierMask) const; // event handlers - void handleData(const CEvent&, void*); - void handleKeepAliveAlarm(const CEvent&, void*); + void handleData(const Event&, void*); + void handleKeepAliveAlarm(const Event&, void*); // message handlers void enter(); @@ -109,9 +109,9 @@ private: void dragInfoReceived(); private: - typedef EResult (CServerProxy::*MessageParser)(const UInt8*); + typedef EResult (ServerProxy::*MessageParser)(const UInt8*); - CClient* m_client; + Client* m_client; synergy::IStream* m_stream; UInt32 m_seqNum; @@ -126,12 +126,12 @@ private: KeyModifierID m_modifierTranslationTable[kKeyModifierIDLast]; double m_keepAliveAlarm; - CEventQueueTimer* m_keepAliveAlarmTimer; + EventQueueTimer* m_keepAliveAlarmTimer; MessageParser m_parser; IEventQueue* m_events; - CStopwatch m_stopwatch; + Stopwatch m_stopwatch; double m_elapsedTime; size_t m_receivedDataSize; static const UInt16 m_intervalThreshold; diff --git a/src/lib/io/CryptoMode.cpp b/src/lib/io/CryptoMode.cpp index a9eebaa5..803fa6a8 100644 --- a/src/lib/io/CryptoMode.cpp +++ b/src/lib/io/CryptoMode.cpp @@ -21,7 +21,7 @@ using namespace CryptoPP; -CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) : +CryptoMode::CryptoMode(ECryptoMode mode, bool encryption) : m_mode(mode), m_crypto(NULL), m_encryption(encryption) @@ -29,7 +29,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) : if (m_encryption) { switch (m_mode) { case kCfb: - m_crypto = new CCfbModeEnc; + m_crypto = new CfbModeEnc; break; case kDisabled: @@ -42,7 +42,7 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) : else { switch (m_mode) { case kCfb: - m_crypto = new CCfbModeDec; + m_crypto = new CfbModeDec; break; case kDisabled: @@ -54,47 +54,47 @@ CCryptoMode::CCryptoMode(ECryptoMode mode, bool encryption) : } } -CCryptoMode::~CCryptoMode() +CryptoMode::~CryptoMode() { if (m_crypto == NULL) { return; } if (m_encryption) { - delete reinterpret_cast(m_crypto); + delete reinterpret_cast(m_crypto); } else { - delete reinterpret_cast(m_crypto); + delete reinterpret_cast(m_crypto); } } void -CCryptoMode::processData(byte* out, const byte* in, size_t length) +CryptoMode::processData(byte* out, const byte* in, size_t length) { if (m_crypto == NULL) { return; } if (m_encryption) { - reinterpret_cast(m_crypto)->ProcessData(out, in, length); + reinterpret_cast(m_crypto)->ProcessData(out, in, length); } else { - reinterpret_cast(m_crypto)->ProcessData(out, in, length); + reinterpret_cast(m_crypto)->ProcessData(out, in, length); } } void -CCryptoMode::setKeyWithIv(const byte* key, size_t length, const byte* iv) +CryptoMode::setKeyWithIv(const byte* key, size_t length, const byte* iv) { if (m_crypto == NULL) { return; } if (m_encryption) { - reinterpret_cast(m_crypto)->SetKeyWithIV(key, length, iv); + reinterpret_cast(m_crypto)->SetKeyWithIV(key, length, iv); } else { - reinterpret_cast(m_crypto)->SetKeyWithIV(key, length, iv); + reinterpret_cast(m_crypto)->SetKeyWithIV(key, length, iv); } } diff --git a/src/lib/io/CryptoMode.h b/src/lib/io/CryptoMode.h index 4a5e7483..7236d774 100644 --- a/src/lib/io/CryptoMode.h +++ b/src/lib/io/CryptoMode.h @@ -27,10 +27,10 @@ Polymorphism is tricky in Crypto++, so we encapsulate all crypto modes and switch based on an enum for ctor, dtor and all functions. */ -class CCryptoMode { +class CryptoMode { public: - CCryptoMode(ECryptoMode mode, bool encryption = true); - ~CCryptoMode(); + CryptoMode(ECryptoMode mode, bool encryption = true); + ~CryptoMode(); //! Encrypt or decrypt data void processData(byte* out, const byte* in, size_t length); @@ -39,17 +39,17 @@ public: void setKeyWithIv(const byte* key, size_t length, const byte* iv); private: - typedef CryptoPP::OFB_Mode::Encryption COfbModeEnc; - typedef CryptoPP::CFB_Mode::Encryption CCfbModeEnc; - typedef CryptoPP::CTR_Mode::Encryption CCtrModeEnc; - typedef CryptoPP::GCM::Encryption CGcmModeEnc; + typedef CryptoPP::OFB_Mode::Encryption OfbModeEnc; + typedef CryptoPP::CFB_Mode::Encryption CfbModeEnc; + typedef CryptoPP::CTR_Mode::Encryption CtrModeEnc; + typedef CryptoPP::GCM::Encryption GcmModeEnc; - typedef CryptoPP::OFB_Mode::Decryption COfbModeDec; - typedef CryptoPP::CFB_Mode::Decryption CCfbModeDec; - typedef CryptoPP::CTR_Mode::Decryption CCtrModeDec; - typedef CryptoPP::GCM::Decryption CGcmModeDec; + typedef CryptoPP::OFB_Mode::Decryption OfbModeDec; + typedef CryptoPP::CFB_Mode::Decryption CfbModeDec; + typedef CryptoPP::CTR_Mode::Decryption CtrModeDec; + typedef CryptoPP::GCM::Decryption GcmModeDec; - static ECryptoMode parseMode(CString& mode); + static ECryptoMode parseMode(String& mode); ECryptoMode m_mode; void* m_crypto; diff --git a/src/lib/io/CryptoOptions.cpp b/src/lib/io/CryptoOptions.cpp index 44bcaaf1..b965c333 100644 --- a/src/lib/io/CryptoOptions.cpp +++ b/src/lib/io/CryptoOptions.cpp @@ -18,23 +18,23 @@ #include "io/CryptoOptions.h" #include "io/XIO.h" -CCryptoOptions::CCryptoOptions( - const CString& modeString, - const CString& pass) : +CryptoOptions::CryptoOptions( + const String& modeString, + const String& pass) : m_pass(pass), m_mode(parseMode(modeString)) { } void -CCryptoOptions::setMode(CString modeString) +CryptoOptions::setMode(String modeString) { m_modeString = modeString; m_mode = parseMode(modeString); } ECryptoMode -CCryptoOptions::parseMode(CString modeString) +CryptoOptions::parseMode(String modeString) { if (modeString == "cfb") { return kCfb; diff --git a/src/lib/io/CryptoOptions.h b/src/lib/io/CryptoOptions.h index 5de7fadb..d80667bf 100644 --- a/src/lib/io/CryptoOptions.h +++ b/src/lib/io/CryptoOptions.h @@ -21,18 +21,18 @@ #include "io/ECryptoMode.h" //! Encapsulates basic crypto options -class CCryptoOptions { +class CryptoOptions { public: - CCryptoOptions() : m_mode(kDisabled) { } - CCryptoOptions(const CString& modeString, const CString& pass); + CryptoOptions() : m_mode(kDisabled) { } + CryptoOptions(const String& modeString, const String& pass); //! Return enum for mode string - static ECryptoMode parseMode(CString modeString); + static ECryptoMode parseMode(String modeString); //! Parse and set mode string - void setMode(CString modeString); + void setMode(String modeString); - CString m_pass; + String m_pass; ECryptoMode m_mode; - CString m_modeString; + String m_modeString; }; diff --git a/src/lib/io/CryptoStream.cpp b/src/lib/io/CryptoStream.cpp index ea9ab7c4..3b6ee327 100644 --- a/src/lib/io/CryptoStream.cpp +++ b/src/lib/io/CryptoStream.cpp @@ -27,12 +27,12 @@ using namespace CryptoPP; using namespace synergy::crypto; -CCryptoStream::CCryptoStream( +CryptoStream::CryptoStream( IEventQueue* events, synergy::IStream* stream, - const CCryptoOptions& options, + const CryptoOptions& options, bool adoptStream) : - CStreamFilter(events, stream, adoptStream), + StreamFilter(events, stream, adoptStream), m_key(NULL), m_encryption(options.m_mode, true), m_decryption(options.m_mode, false) @@ -50,13 +50,13 @@ CCryptoStream::CCryptoStream( } } -CCryptoStream::~CCryptoStream() +CryptoStream::~CryptoStream() { delete[] m_key; } UInt32 -CCryptoStream::read(void* out, UInt32 n) +CryptoStream::read(void* out, UInt32 n) { assert(m_key != NULL); LOG((CLOG_DEBUG4 "crypto: read %i (decrypt)", n)); @@ -81,7 +81,7 @@ CCryptoStream::read(void* out, UInt32 n) } void -CCryptoStream::write(const void* in, UInt32 n) +CryptoStream::write(const void* in, UInt32 n) { assert(m_key != NULL); LOG((CLOG_DEBUG4 "crypto: write %i (encrypt)", n)); @@ -95,7 +95,7 @@ CCryptoStream::write(const void* in, UInt32 n) } void -CCryptoStream::createKey(byte* out, const CString& password, UInt8 keyLength, UInt8 hashCount) +CryptoStream::createKey(byte* out, const String& password, UInt8 keyLength, UInt8 hashCount) { assert(keyLength <= SHA256::DIGESTSIZE); @@ -114,7 +114,7 @@ CCryptoStream::createKey(byte* out, const CString& password, UInt8 keyLength, UI } void -CCryptoStream::setEncryptIv(const byte* iv) +CryptoStream::setEncryptIv(const byte* iv) { assert(m_key != NULL); logBuffer("encrypt iv", iv, CRYPTO_IV_SIZE); @@ -122,7 +122,7 @@ CCryptoStream::setEncryptIv(const byte* iv) } void -CCryptoStream::setDecryptIv(const byte* iv) +CryptoStream::setDecryptIv(const byte* iv) { assert(m_key != NULL); logBuffer("decrypt iv", iv, CRYPTO_IV_SIZE); @@ -130,13 +130,13 @@ CCryptoStream::setDecryptIv(const byte* iv) } void -CCryptoStream::newIv(byte* out) +CryptoStream::newIv(byte* out) { m_autoSeedRandomPool.GenerateBlock(out, CRYPTO_IV_SIZE); } void -CCryptoStream::logBuffer(const char* name, const byte* buf, int length) +CryptoStream::logBuffer(const char* name, const byte* buf, int length) { if (CLOG->getFilter() < kDEBUG4) { return; diff --git a/src/lib/io/CryptoStream.h b/src/lib/io/CryptoStream.h index 1701fa79..42de2e20 100644 --- a/src/lib/io/CryptoStream.h +++ b/src/lib/io/CryptoStream.h @@ -22,7 +22,7 @@ #include "io/CryptoStream_cryptopp.h" #include "base/EventTypes.h" -class CCryptoOptions; +class CryptoOptions; #define CRYPTO_IV_SIZE CryptoPP::AES::BLOCKSIZE @@ -30,10 +30,10 @@ class CCryptoOptions; /*! Encrypts (on write) and decrypts (on read) to and from an underlying stream. */ -class CCryptoStream : public CStreamFilter { +class CryptoStream : public StreamFilter { public: - CCryptoStream(IEventQueue* events, synergy::IStream* stream, const CCryptoOptions& options, bool adoptStream = true); - virtual ~CCryptoStream(); + CryptoStream(IEventQueue* events, synergy::IStream* stream, const CryptoOptions& options, bool adoptStream = true); + virtual ~CryptoStream(); //! @name manipulators //@{ @@ -65,14 +65,14 @@ public: void newIv(byte* out); //! Creates a key from a password - static void createKey(byte* out, const CString& password, UInt8 keyLength, UInt8 hashCount); + static void createKey(byte* out, const String& password, UInt8 keyLength, UInt8 hashCount); private: void logBuffer(const char* name, const byte* buf, int length); byte* m_key; - CCryptoMode m_encryption; - CCryptoMode m_decryption; + CryptoMode m_encryption; + CryptoMode m_decryption; CryptoPP::AutoSeededRandomPool m_autoSeedRandomPool; }; diff --git a/src/lib/io/IStreamFilterFactory.h b/src/lib/io/IStreamFilterFactory.h index e290aaab..de9a1916 100644 --- a/src/lib/io/IStreamFilterFactory.h +++ b/src/lib/io/IStreamFilterFactory.h @@ -20,7 +20,6 @@ #include "common/IInterface.h" -using namespace synergy; namespace synergy { class IStream; } //! Stream filter factory interface @@ -34,5 +33,6 @@ public: Create and return a stream filter on \p stream. The caller must delete the returned object. */ - virtual synergy::IStream* create(IStream* stream, bool adoptStream) = 0; + virtual synergy::IStream* + create(synergy::IStream* stream, bool adoptStream) = 0; }; diff --git a/src/lib/io/StreamBuffer.cpp b/src/lib/io/StreamBuffer.cpp index bd32e6ad..113981b1 100644 --- a/src/lib/io/StreamBuffer.cpp +++ b/src/lib/io/StreamBuffer.cpp @@ -19,25 +19,25 @@ #include "io/StreamBuffer.h" // -// CStreamBuffer +// StreamBuffer // -const UInt32 CStreamBuffer::kChunkSize = 4096; +const UInt32 StreamBuffer::kChunkSize = 4096; -CStreamBuffer::CStreamBuffer() : +StreamBuffer::StreamBuffer() : m_size(0), m_headUsed(0) { // do nothing } -CStreamBuffer::~CStreamBuffer() +StreamBuffer::~StreamBuffer() { // do nothing } const void* -CStreamBuffer::peek(UInt32 n) +StreamBuffer::peek(UInt32 n) { assert(n <= m_size); @@ -63,7 +63,7 @@ CStreamBuffer::peek(UInt32 n) } void -CStreamBuffer::pop(UInt32 n) +StreamBuffer::pop(UInt32 n) { // discard all chunks if n is greater than or equal to m_size if (n >= m_size) { @@ -93,7 +93,7 @@ CStreamBuffer::pop(UInt32 n) } void -CStreamBuffer::write(const void* vdata, UInt32 n) +StreamBuffer::write(const void* vdata, UInt32 n) { assert(vdata != NULL); @@ -140,7 +140,7 @@ CStreamBuffer::write(const void* vdata, UInt32 n) } UInt32 -CStreamBuffer::getSize() const +StreamBuffer::getSize() const { return m_size; } diff --git a/src/lib/io/StreamBuffer.h b/src/lib/io/StreamBuffer.h index d8ae88b8..d35dd37c 100644 --- a/src/lib/io/StreamBuffer.h +++ b/src/lib/io/StreamBuffer.h @@ -26,10 +26,10 @@ /*! This class maintains a FIFO (first-in, last-out) buffer of bytes. */ -class CStreamBuffer { +class StreamBuffer { public: - CStreamBuffer(); - ~CStreamBuffer(); + StreamBuffer(); + ~StreamBuffer(); //! @name manipulators //@{ diff --git a/src/lib/io/StreamFilter.cpp b/src/lib/io/StreamFilter.cpp index ac99f748..eb8303ae 100644 --- a/src/lib/io/StreamFilter.cpp +++ b/src/lib/io/StreamFilter.cpp @@ -21,98 +21,98 @@ #include "base/TMethodEventJob.h" // -// CStreamFilter +// StreamFilter // -CStreamFilter::CStreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream) : +StreamFilter::StreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream) : m_stream(stream), m_adopted(adoptStream), m_events(events) { // replace handlers for m_stream m_events->removeHandlers(m_stream->getEventTarget()); - m_events->adoptHandler(CEvent::kUnknown, m_stream->getEventTarget(), - new TMethodEventJob(this, - &CStreamFilter::handleUpstreamEvent)); + m_events->adoptHandler(Event::kUnknown, m_stream->getEventTarget(), + new TMethodEventJob(this, + &StreamFilter::handleUpstreamEvent)); } -CStreamFilter::~CStreamFilter() +StreamFilter::~StreamFilter() { - m_events->removeHandler(CEvent::kUnknown, m_stream->getEventTarget()); + m_events->removeHandler(Event::kUnknown, m_stream->getEventTarget()); if (m_adopted) { delete m_stream; } } void -CStreamFilter::close() +StreamFilter::close() { getStream()->close(); } UInt32 -CStreamFilter::read(void* buffer, UInt32 n) +StreamFilter::read(void* buffer, UInt32 n) { return getStream()->read(buffer, n); } void -CStreamFilter::write(const void* buffer, UInt32 n) +StreamFilter::write(const void* buffer, UInt32 n) { getStream()->write(buffer, n); } void -CStreamFilter::flush() +StreamFilter::flush() { getStream()->flush(); } void -CStreamFilter::shutdownInput() +StreamFilter::shutdownInput() { getStream()->shutdownInput(); } void -CStreamFilter::shutdownOutput() +StreamFilter::shutdownOutput() { getStream()->shutdownOutput(); } void* -CStreamFilter::getEventTarget() const +StreamFilter::getEventTarget() const { return const_cast(reinterpret_cast(this)); } bool -CStreamFilter::isReady() const +StreamFilter::isReady() const { return getStream()->isReady(); } UInt32 -CStreamFilter::getSize() const +StreamFilter::getSize() const { return getStream()->getSize(); } synergy::IStream* -CStreamFilter::getStream() const +StreamFilter::getStream() const { return m_stream; } void -CStreamFilter::filterEvent(const CEvent& event) +StreamFilter::filterEvent(const Event& event) { - m_events->dispatchEvent(CEvent(event.getType(), + m_events->dispatchEvent(Event(event.getType(), getEventTarget(), event.getData())); } void -CStreamFilter::handleUpstreamEvent(const CEvent& event, void*) +StreamFilter::handleUpstreamEvent(const Event& event, void*) { filterEvent(event); } diff --git a/src/lib/io/StreamFilter.h b/src/lib/io/StreamFilter.h index 8f644a96..0f440825 100644 --- a/src/lib/io/StreamFilter.h +++ b/src/lib/io/StreamFilter.h @@ -26,15 +26,15 @@ This class wraps a stream. Subclasses provide indirect access to the wrapped stream, typically performing some filtering. */ -class CStreamFilter : public synergy::IStream { +class StreamFilter : public synergy::IStream { public: /*! Create a wrapper around \c stream. Iff \c adoptStream is true then this object takes ownership of the stream and will delete it in the d'tor. */ - CStreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream = true); - virtual ~CStreamFilter(); + StreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream = true); + virtual ~StreamFilter(); // IStream overrides // These all just forward to the underlying stream except getEventTarget. @@ -61,10 +61,10 @@ protected: Does the event filtering. The default simply dispatches an event identical except using this object as the event target. */ - virtual void filterEvent(const CEvent&); + virtual void filterEvent(const Event&); private: - void handleUpstreamEvent(const CEvent&, void*); + void handleUpstreamEvent(const Event&, void*); private: synergy::IStream* m_stream; diff --git a/src/lib/io/XIO.cpp b/src/lib/io/XIO.cpp index aa3a17ab..727c2ebf 100644 --- a/src/lib/io/XIO.cpp +++ b/src/lib/io/XIO.cpp @@ -22,7 +22,7 @@ // XIOClosed // -CString +String XIOClosed::getWhat() const throw() { return format("XIOClosed", "already closed"); @@ -33,7 +33,7 @@ XIOClosed::getWhat() const throw() // XIOEndOfStream // -CString +String XIOEndOfStream::getWhat() const throw() { return format("XIOEndOfStream", "reached end of stream"); @@ -44,7 +44,7 @@ XIOEndOfStream::getWhat() const throw() // XIOWouldBlock // -CString +String XIOWouldBlock::getWhat() const throw() { return format("XIOWouldBlock", "stream operation would block"); @@ -54,7 +54,7 @@ XIOWouldBlock::getWhat() const throw() // // XBadCryptoMode // -CString +String XIOBadCryptoMode::getWhat() const throw() { return "XBadCryptoMode"; diff --git a/src/lib/ipc/IpcClient.cpp b/src/lib/ipc/IpcClient.cpp index 879278fa..1a688b2d 100644 --- a/src/lib/ipc/IpcClient.cpp +++ b/src/lib/ipc/IpcClient.cpp @@ -23,11 +23,11 @@ #include "base/TMethodEventJob.h" // -// CIpcClient +// IpcClient // -CIpcClient::CIpcClient(IEventQueue* events, CSocketMultiplexer* socketMultiplexer) : - m_serverAddress(CNetworkAddress(IPC_HOST, IPC_PORT)), +IpcClient::IpcClient(IEventQueue* events, SocketMultiplexer* socketMultiplexer) : + m_serverAddress(NetworkAddress(IPC_HOST, IPC_PORT)), m_socket(events, socketMultiplexer), m_server(nullptr), m_events(events) @@ -35,8 +35,8 @@ CIpcClient::CIpcClient(IEventQueue* events, CSocketMultiplexer* socketMultiplexe init(); } -CIpcClient::CIpcClient(IEventQueue* events, CSocketMultiplexer* socketMultiplexer, int port) : - m_serverAddress(CNetworkAddress(IPC_HOST, port)), +IpcClient::IpcClient(IEventQueue* events, SocketMultiplexer* socketMultiplexer, int port) : + m_serverAddress(NetworkAddress(IPC_HOST, port)), m_socket(events, socketMultiplexer), m_server(nullptr), m_events(events) @@ -45,37 +45,37 @@ CIpcClient::CIpcClient(IEventQueue* events, CSocketMultiplexer* socketMultiplexe } void -CIpcClient::init() +IpcClient::init() { m_serverAddress.resolve(); } -CIpcClient::~CIpcClient() +IpcClient::~IpcClient() { } void -CIpcClient::connect() +IpcClient::connect() { m_events->adoptHandler( m_events->forIDataSocket().connected(), m_socket.getEventTarget(), - new TMethodEventJob( - this, &CIpcClient::handleConnected)); + new TMethodEventJob( + this, &IpcClient::handleConnected)); m_socket.connect(m_serverAddress); - m_server = new CIpcServerProxy(m_socket, m_events); + m_server = new IpcServerProxy(m_socket, m_events); m_events->adoptHandler( - m_events->forCIpcServerProxy().messageReceived(), m_server, - new TMethodEventJob( - this, &CIpcClient::handleMessageReceived)); + m_events->forIpcServerProxy().messageReceived(), m_server, + new TMethodEventJob( + this, &IpcClient::handleMessageReceived)); } void -CIpcClient::disconnect() +IpcClient::disconnect() { m_events->removeHandler(m_events->forIDataSocket().connected(), m_socket.getEventTarget()); - m_events->removeHandler(m_events->forCIpcServerProxy().messageReceived(), m_server); + m_events->removeHandler(m_events->forIpcServerProxy().messageReceived(), m_server); m_server->disconnect(); delete m_server; @@ -83,26 +83,26 @@ CIpcClient::disconnect() } void -CIpcClient::send(const CIpcMessage& message) +IpcClient::send(const IpcMessage& message) { assert(m_server != nullptr); m_server->send(message); } void -CIpcClient::handleConnected(const CEvent&, void*) +IpcClient::handleConnected(const Event&, void*) { - m_events->addEvent(CEvent( - m_events->forCIpcClient().connected(), this, m_server, CEvent::kDontFreeData)); + m_events->addEvent(Event( + m_events->forIpcClient().connected(), this, m_server, Event::kDontFreeData)); - CIpcHelloMessage message(kIpcClientNode); + IpcHelloMessage message(kIpcClientNode); send(message); } void -CIpcClient::handleMessageReceived(const CEvent& e, void*) +IpcClient::handleMessageReceived(const Event& e, void*) { - CEvent event(m_events->forCIpcClient().messageReceived(), this); + Event event(m_events->forIpcClient().messageReceived(), this); event.setDataObject(e.getDataObject()); m_events->addEvent(event); } diff --git a/src/lib/ipc/IpcClient.h b/src/lib/ipc/IpcClient.h index db7b9216..01dc1f45 100644 --- a/src/lib/ipc/IpcClient.h +++ b/src/lib/ipc/IpcClient.h @@ -22,20 +22,20 @@ #include "net/TCPSocket.h" #include "base/EventTypes.h" -class CIpcServerProxy; -class CIpcMessage; +class IpcServerProxy; +class IpcMessage; class IEventQueue; -class CSocketMultiplexer; +class SocketMultiplexer; //! IPC client for communication between daemon and GUI. /*! - * See \ref CIpcServer description. + * See \ref IpcServer description. */ -class CIpcClient { +class IpcClient { public: - CIpcClient(IEventQueue* events, CSocketMultiplexer* socketMultiplexer); - CIpcClient(IEventQueue* events, CSocketMultiplexer* socketMultiplexer, int port); - virtual ~CIpcClient(); + IpcClient(IEventQueue* events, SocketMultiplexer* socketMultiplexer); + IpcClient(IEventQueue* events, SocketMultiplexer* socketMultiplexer, int port); + virtual ~IpcClient(); //! @name manipulators //@{ @@ -47,18 +47,18 @@ public: void disconnect(); //! Sends a message to the server. - void send(const CIpcMessage& message); + void send(const IpcMessage& message); //@} private: void init(); - void handleConnected(const CEvent&, void*); - void handleMessageReceived(const CEvent&, void*); + void handleConnected(const Event&, void*); + void handleMessageReceived(const Event&, void*); private: - CNetworkAddress m_serverAddress; + NetworkAddress m_serverAddress; CTCPSocket m_socket; - CIpcServerProxy* m_server; + IpcServerProxy* m_server; IEventQueue* m_events; }; diff --git a/src/lib/ipc/IpcClientProxy.cpp b/src/lib/ipc/IpcClientProxy.cpp index 72c867ac..c239a8a0 100644 --- a/src/lib/ipc/IpcClientProxy.cpp +++ b/src/lib/ipc/IpcClientProxy.cpp @@ -27,10 +27,10 @@ #include "base/Log.h" // -// CIpcClientProxy +// IpcClientProxy // -CIpcClientProxy::CIpcClientProxy(synergy::IStream& stream, IEventQueue* events) : +IpcClientProxy::IpcClientProxy(synergy::IStream& stream, IEventQueue* events) : m_stream(stream), m_clientType(kIpcClientUnknown), m_disconnecting(false), @@ -40,26 +40,26 @@ CIpcClientProxy::CIpcClientProxy(synergy::IStream& stream, IEventQueue* events) { m_events->adoptHandler( m_events->forIStream().inputReady(), stream.getEventTarget(), - new TMethodEventJob( - this, &CIpcClientProxy::handleData)); + new TMethodEventJob( + this, &IpcClientProxy::handleData)); m_events->adoptHandler( m_events->forIStream().outputError(), stream.getEventTarget(), - new TMethodEventJob( - this, &CIpcClientProxy::handleWriteError)); + new TMethodEventJob( + this, &IpcClientProxy::handleWriteError)); m_events->adoptHandler( m_events->forIStream().inputShutdown(), stream.getEventTarget(), - new TMethodEventJob( - this, &CIpcClientProxy::handleDisconnect)); + new TMethodEventJob( + this, &IpcClientProxy::handleDisconnect)); m_events->adoptHandler( m_events->forIStream().outputShutdown(), stream.getEventTarget(), - new TMethodEventJob( - this, &CIpcClientProxy::handleWriteError)); + new TMethodEventJob( + this, &IpcClientProxy::handleWriteError)); } -CIpcClientProxy::~CIpcClientProxy() +IpcClientProxy::~IpcClientProxy() { m_events->removeHandler( m_events->forIStream().inputReady(), m_stream.getEventTarget()); @@ -82,24 +82,24 @@ CIpcClientProxy::~CIpcClientProxy() } void -CIpcClientProxy::handleDisconnect(const CEvent&, void*) +IpcClientProxy::handleDisconnect(const Event&, void*) { disconnect(); LOG((CLOG_DEBUG "ipc client disconnected")); } void -CIpcClientProxy::handleWriteError(const CEvent&, void*) +IpcClientProxy::handleWriteError(const Event&, void*) { disconnect(); LOG((CLOG_DEBUG "ipc client write error")); } void -CIpcClientProxy::handleData(const CEvent&, void*) +IpcClientProxy::handleData(const Event&, void*) { // don't allow the dtor to destroy the stream while we're using it. - CArchMutexLock lock(m_readMutex); + ArchMutexLock lock(m_readMutex); LOG((CLOG_DEBUG "start ipc handle data")); @@ -110,7 +110,7 @@ CIpcClientProxy::handleData(const CEvent&, void*) LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3])); - CIpcMessage* m = nullptr; + IpcMessage* m = nullptr; if (memcmp(code, kIpcMsgHello, 4) == 0) { m = parseHello(); } @@ -123,7 +123,7 @@ CIpcClientProxy::handleData(const CEvent&, void*) } // don't delete with this event; the data is passed to a new event. - CEvent e(m_events->forCIpcClientProxy().messageReceived(), this, NULL, CEvent::kDontFreeData); + Event e(m_events->forIpcClientProxy().messageReceived(), this, NULL, Event::kDontFreeData); e.setDataObject(m); m_events->addEvent(e); @@ -134,25 +134,25 @@ CIpcClientProxy::handleData(const CEvent&, void*) } void -CIpcClientProxy::send(const CIpcMessage& message) +IpcClientProxy::send(const IpcMessage& message) { // don't allow other threads to write until we've finished the entire // message. stream write is locked, but only for that single write. // also, don't allow the dtor to destroy the stream while we're using it. - CArchMutexLock lock(m_writeMutex); + ArchMutexLock lock(m_writeMutex); LOG((CLOG_DEBUG4 "ipc write: %d", message.type())); switch (message.type()) { case kIpcLogLine: { - const CIpcLogLineMessage& llm = static_cast(message); - CString logLine = llm.logLine(); - CProtocolUtil::writef(&m_stream, kIpcMsgLogLine, &logLine); + const IpcLogLineMessage& llm = static_cast(message); + String logLine = llm.logLine(); + ProtocolUtil::writef(&m_stream, kIpcMsgLogLine, &logLine); break; } case kIpcShutdown: - CProtocolUtil::writef(&m_stream, kIpcMsgShutdown); + ProtocolUtil::writef(&m_stream, kIpcMsgShutdown); break; default: @@ -161,34 +161,34 @@ CIpcClientProxy::send(const CIpcMessage& message) } } -CIpcHelloMessage* -CIpcClientProxy::parseHello() +IpcHelloMessage* +IpcClientProxy::parseHello() { UInt8 type; - CProtocolUtil::readf(&m_stream, kIpcMsgHello + 4, &type); + ProtocolUtil::readf(&m_stream, kIpcMsgHello + 4, &type); m_clientType = static_cast(type); // must be deleted by event handler. - return new CIpcHelloMessage(m_clientType); + return new IpcHelloMessage(m_clientType); } -CIpcCommandMessage* -CIpcClientProxy::parseCommand() +IpcCommandMessage* +IpcClientProxy::parseCommand() { - CString command; + String command; UInt8 elevate; - CProtocolUtil::readf(&m_stream, kIpcMsgCommand + 4, &command, &elevate); + ProtocolUtil::readf(&m_stream, kIpcMsgCommand + 4, &command, &elevate); // must be deleted by event handler. - return new CIpcCommandMessage(command, elevate != 0); + return new IpcCommandMessage(command, elevate != 0); } void -CIpcClientProxy::disconnect() +IpcClientProxy::disconnect() { LOG((CLOG_DEBUG "ipc disconnect, closing stream")); m_disconnecting = true; m_stream.close(); - m_events->addEvent(CEvent(m_events->forCIpcClientProxy().disconnected(), this)); + m_events->addEvent(Event(m_events->forIpcClientProxy().disconnected(), this)); } diff --git a/src/lib/ipc/IpcClientProxy.h b/src/lib/ipc/IpcClientProxy.h index 9127e530..62680e5b 100644 --- a/src/lib/ipc/IpcClientProxy.h +++ b/src/lib/ipc/IpcClientProxy.h @@ -24,32 +24,32 @@ #include "base/Event.h" namespace synergy { class IStream; } -class CIpcMessage; -class CIpcCommandMessage; -class CIpcHelloMessage; +class IpcMessage; +class IpcCommandMessage; +class IpcHelloMessage; class IEventQueue; -class CIpcClientProxy { - friend class CIpcServer; +class IpcClientProxy { + friend class IpcServer; public: - CIpcClientProxy(synergy::IStream& stream, IEventQueue* events); - virtual ~CIpcClientProxy(); + IpcClientProxy(synergy::IStream& stream, IEventQueue* events); + virtual ~IpcClientProxy(); private: - void send(const CIpcMessage& message); - void handleData(const CEvent&, void*); - void handleDisconnect(const CEvent&, void*); - void handleWriteError(const CEvent&, void*); - CIpcHelloMessage* parseHello(); - CIpcCommandMessage* parseCommand(); + void send(const IpcMessage& message); + void handleData(const Event&, void*); + void handleDisconnect(const Event&, void*); + void handleWriteError(const Event&, void*); + IpcHelloMessage* parseHello(); + IpcCommandMessage* parseCommand(); void disconnect(); private: synergy::IStream& m_stream; EIpcClientType m_clientType; bool m_disconnecting; - CArchMutex m_readMutex; - CArchMutex m_writeMutex; + ArchMutex m_readMutex; + ArchMutex m_writeMutex; IEventQueue* m_events; }; diff --git a/src/lib/ipc/IpcLogOutputter.cpp b/src/lib/ipc/IpcLogOutputter.cpp index 60c36510..14e2b541 100644 --- a/src/lib/ipc/IpcLogOutputter.cpp +++ b/src/lib/ipc/IpcLogOutputter.cpp @@ -33,7 +33,7 @@ // limit number of log lines sent in one message. #define MAX_SEND 100 -CIpcLogOutputter::CIpcLogOutputter(CIpcServer& ipcServer) : +IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer) : m_ipcServer(ipcServer), m_bufferMutex(ARCH->newMutex()), m_sending(false), @@ -42,11 +42,11 @@ m_notifyCond(ARCH->newCondVar()), m_notifyMutex(ARCH->newMutex()), m_bufferWaiting(false) { - m_bufferThread = new CThread(new TMethodJob( - this, &CIpcLogOutputter::bufferThread)); + m_bufferThread = new Thread(new TMethodJob( + this, &IpcLogOutputter::bufferThread)); } -CIpcLogOutputter::~CIpcLogOutputter() +IpcLogOutputter::~IpcLogOutputter() { m_running = false; notifyBuffer(); @@ -60,28 +60,28 @@ CIpcLogOutputter::~CIpcLogOutputter() } void -CIpcLogOutputter::open(const char* title) +IpcLogOutputter::open(const char* title) { } void -CIpcLogOutputter::close() +IpcLogOutputter::close() { } void -CIpcLogOutputter::show(bool showIfEmpty) +IpcLogOutputter::show(bool showIfEmpty) { } bool -CIpcLogOutputter::write(ELevel level, const char* text) +IpcLogOutputter::write(ELevel level, const char* text) { return write(level, text, false); } bool -CIpcLogOutputter::write(ELevel, const char* text, bool force) +IpcLogOutputter::write(ELevel, const char* text, bool force) { // TODO: discard based on thread id? hmm... // sending the buffer generates log messages, which we must throw @@ -93,7 +93,7 @@ CIpcLogOutputter::write(ELevel, const char* text, bool force) if (m_sending && !force) { // ignore events from the buffer thread (would cause recursion). - if (CThread::getCurrentThread().getID() == m_bufferThreadId) { + if (Thread::getCurrentThread().getID() == m_bufferThreadId) { return true; } } @@ -104,16 +104,16 @@ CIpcLogOutputter::write(ELevel, const char* text, bool force) } void -CIpcLogOutputter::appendBuffer(const CString& text) +IpcLogOutputter::appendBuffer(const String& text) { - CArchMutexLock lock(m_bufferMutex); + ArchMutexLock lock(m_bufferMutex); m_buffer.push(text); } void -CIpcLogOutputter::bufferThread(void*) +IpcLogOutputter::bufferThread(void*) { - CArchMutexLock lock(m_notifyMutex); + ArchMutexLock lock(m_notifyMutex); m_bufferThreadId = m_bufferThread->getID(); try { @@ -146,25 +146,25 @@ CIpcLogOutputter::bufferThread(void*) } void -CIpcLogOutputter::notifyBuffer() +IpcLogOutputter::notifyBuffer() { if (!m_bufferWaiting) { return; } - CArchMutexLock lock(m_notifyMutex); + ArchMutexLock lock(m_notifyMutex); ARCH->broadcastCondVar(m_notifyCond); } -CString -CIpcLogOutputter::getChunk(size_t count) +String +IpcLogOutputter::getChunk(size_t count) { - CArchMutexLock lock(m_bufferMutex); + ArchMutexLock lock(m_bufferMutex); if (m_buffer.size() < count) { count = m_buffer.size(); } - CString chunk; + String chunk; for (size_t i = 0; i < count; i++) { chunk.append(m_buffer.front()); chunk.append("\n"); @@ -174,9 +174,9 @@ CIpcLogOutputter::getChunk(size_t count) } void -CIpcLogOutputter::sendBuffer() +IpcLogOutputter::sendBuffer() { - CIpcLogLineMessage message(getChunk(MAX_SEND)); + IpcLogLineMessage message(getChunk(MAX_SEND)); m_sending = true; m_ipcServer.send(message, kIpcClientGui); diff --git a/src/lib/ipc/IpcLogOutputter.h b/src/lib/ipc/IpcLogOutputter.h index 196db174..a9924503 100644 --- a/src/lib/ipc/IpcLogOutputter.h +++ b/src/lib/ipc/IpcLogOutputter.h @@ -24,18 +24,18 @@ #include -class CIpcServer; -class CEvent; -class CIpcClientProxy; +class IpcServer; +class Event; +class IpcClientProxy; //! Write log to GUI over IPC /*! This outputter writes output to the GUI via IPC. */ -class CIpcLogOutputter : public ILogOutputter { +class IpcLogOutputter : public ILogOutputter { public: - CIpcLogOutputter(CIpcServer& ipcServer); - virtual ~CIpcLogOutputter(); + IpcLogOutputter(IpcServer& ipcServer); + virtual ~IpcLogOutputter(); // ILogOutputter overrides virtual void open(const char* title); @@ -51,21 +51,21 @@ public: private: void bufferThread(void*); - CString getChunk(size_t count); + String getChunk(size_t count); void sendBuffer(); - void appendBuffer(const CString& text); + void appendBuffer(const String& text); private: - typedef std::queue CBuffer; + typedef std::queue Buffer; - CIpcServer& m_ipcServer; - CBuffer m_buffer; - CArchMutex m_bufferMutex; + IpcServer& m_ipcServer; + Buffer m_buffer; + ArchMutex m_bufferMutex; bool m_sending; - CThread* m_bufferThread; + Thread* m_bufferThread; bool m_running; - CArchCond m_notifyCond; - CArchMutex m_notifyMutex; + ArchCond m_notifyCond; + ArchMutex m_notifyMutex; bool m_bufferWaiting; IArchMultithread::ThreadID m_bufferThreadId; diff --git a/src/lib/ipc/IpcMessage.cpp b/src/lib/ipc/IpcMessage.cpp index a5dadb1b..f573c7f2 100644 --- a/src/lib/ipc/IpcMessage.cpp +++ b/src/lib/ipc/IpcMessage.cpp @@ -19,51 +19,51 @@ #include "ipc/IpcMessage.h" #include "ipc/Ipc.h" -CIpcMessage::CIpcMessage(UInt8 type) : +IpcMessage::IpcMessage(UInt8 type) : m_type(type) { } -CIpcMessage::~CIpcMessage() +IpcMessage::~IpcMessage() { } -CIpcHelloMessage::CIpcHelloMessage(EIpcClientType clientType) : - CIpcMessage(kIpcHello), +IpcHelloMessage::IpcHelloMessage(EIpcClientType clientType) : + IpcMessage(kIpcHello), m_clientType(clientType) { } -CIpcHelloMessage::~CIpcHelloMessage() +IpcHelloMessage::~IpcHelloMessage() { } -CIpcShutdownMessage::CIpcShutdownMessage() : -CIpcMessage(kIpcShutdown) +IpcShutdownMessage::IpcShutdownMessage() : +IpcMessage(kIpcShutdown) { } -CIpcShutdownMessage::~CIpcShutdownMessage() +IpcShutdownMessage::~IpcShutdownMessage() { } -CIpcLogLineMessage::CIpcLogLineMessage(const CString& logLine) : -CIpcMessage(kIpcLogLine), +IpcLogLineMessage::IpcLogLineMessage(const String& logLine) : +IpcMessage(kIpcLogLine), m_logLine(logLine) { } -CIpcLogLineMessage::~CIpcLogLineMessage() +IpcLogLineMessage::~IpcLogLineMessage() { } -CIpcCommandMessage::CIpcCommandMessage(const CString& command, bool elevate) : -CIpcMessage(kIpcCommand), +IpcCommandMessage::IpcCommandMessage(const String& command, bool elevate) : +IpcMessage(kIpcCommand), m_command(command), m_elevate(elevate) { } -CIpcCommandMessage::~CIpcCommandMessage() +IpcCommandMessage::~IpcCommandMessage() { } diff --git a/src/lib/ipc/IpcMessage.h b/src/lib/ipc/IpcMessage.h index 6bfbd026..5d6c9bf7 100644 --- a/src/lib/ipc/IpcMessage.h +++ b/src/lib/ipc/IpcMessage.h @@ -23,24 +23,24 @@ #include "base/String.h" #include "base/Event.h" -class CIpcMessage : public CEventData { +class IpcMessage : public EventData { public: - virtual ~CIpcMessage(); + virtual ~IpcMessage(); //! Gets the message type ID. UInt8 type() const { return m_type; } protected: - CIpcMessage(UInt8 type); + IpcMessage(UInt8 type); private: UInt8 m_type; }; -class CIpcHelloMessage : public CIpcMessage { +class IpcHelloMessage : public IpcMessage { public: - CIpcHelloMessage(EIpcClientType clientType); - virtual ~CIpcHelloMessage(); + IpcHelloMessage(EIpcClientType clientType); + virtual ~IpcHelloMessage(); //! Gets the message type ID. EIpcClientType clientType() const { return m_clientType; } @@ -49,37 +49,37 @@ private: EIpcClientType m_clientType; }; -class CIpcShutdownMessage : public CIpcMessage { +class IpcShutdownMessage : public IpcMessage { public: - CIpcShutdownMessage(); - virtual ~CIpcShutdownMessage(); + IpcShutdownMessage(); + virtual ~IpcShutdownMessage(); }; -class CIpcLogLineMessage : public CIpcMessage { +class IpcLogLineMessage : public IpcMessage { public: - CIpcLogLineMessage(const CString& logLine); - virtual ~CIpcLogLineMessage(); + IpcLogLineMessage(const String& logLine); + virtual ~IpcLogLineMessage(); //! Gets the log line. - CString logLine() const { return m_logLine; } + String logLine() const { return m_logLine; } private: - CString m_logLine; + String m_logLine; }; -class CIpcCommandMessage : public CIpcMessage { +class IpcCommandMessage : public IpcMessage { public: - CIpcCommandMessage(const CString& command, bool elevate); - virtual ~CIpcCommandMessage(); + IpcCommandMessage(const String& command, bool elevate); + virtual ~IpcCommandMessage(); //! Gets the command. - CString command() const { return m_command; } + String command() const { return m_command; } //! Gets whether or not the process should be elevated on MS Windows. bool elevate() const { return m_elevate; } private: - CString m_command; + String m_command; bool m_elevate; }; diff --git a/src/lib/ipc/IpcServer.cpp b/src/lib/ipc/IpcServer.cpp index 1c430bdf..b79b94cd 100644 --- a/src/lib/ipc/IpcServer.cpp +++ b/src/lib/ipc/IpcServer.cpp @@ -29,41 +29,41 @@ #include "base/Log.h" // -// CIpcServer +// IpcServer // -CIpcServer::CIpcServer(IEventQueue* events, CSocketMultiplexer* socketMultiplexer) : +IpcServer::IpcServer(IEventQueue* events, SocketMultiplexer* socketMultiplexer) : m_socket(events, socketMultiplexer), - m_address(CNetworkAddress(IPC_HOST, IPC_PORT)), + m_address(NetworkAddress(IPC_HOST, IPC_PORT)), m_events(events) { init(); } -CIpcServer::CIpcServer(IEventQueue* events, CSocketMultiplexer* socketMultiplexer, int port) : +IpcServer::IpcServer(IEventQueue* events, SocketMultiplexer* socketMultiplexer, int port) : m_socket(events, socketMultiplexer), - m_address(CNetworkAddress(IPC_HOST, port)), + m_address(NetworkAddress(IPC_HOST, port)), m_events(events) { init(); } void -CIpcServer::init() +IpcServer::init() { m_clientsMutex = ARCH->newMutex(); m_address.resolve(); m_events->adoptHandler( m_events->forIListenSocket().connecting(), &m_socket, - new TMethodEventJob( - this, &CIpcServer::handleClientConnecting)); + new TMethodEventJob( + this, &IpcServer::handleClientConnecting)); } -CIpcServer::~CIpcServer() +IpcServer::~IpcServer() { ARCH->lockMutex(m_clientsMutex); - CClientList::iterator it; + ClientList::iterator it; for (it = m_clients.begin(); it != m_clients.end(); it++) { deleteClient(*it); } @@ -75,13 +75,13 @@ CIpcServer::~CIpcServer() } void -CIpcServer::listen() +IpcServer::listen() { m_socket.bind(m_address); } void -CIpcServer::handleClientConnecting(const CEvent&, void*) +IpcServer::handleClientConnecting(const Event&, void*) { synergy::IStream* stream = m_socket.accept(); if (stream == NULL) { @@ -91,30 +91,30 @@ CIpcServer::handleClientConnecting(const CEvent&, void*) LOG((CLOG_DEBUG "accepted ipc client connection")); ARCH->lockMutex(m_clientsMutex); - CIpcClientProxy* proxy = new CIpcClientProxy(*stream, m_events); + IpcClientProxy* proxy = new IpcClientProxy(*stream, m_events); m_clients.push_back(proxy); ARCH->unlockMutex(m_clientsMutex); m_events->adoptHandler( - m_events->forCIpcClientProxy().disconnected(), proxy, - new TMethodEventJob( - this, &CIpcServer::handleClientDisconnected)); + m_events->forIpcClientProxy().disconnected(), proxy, + new TMethodEventJob( + this, &IpcServer::handleClientDisconnected)); m_events->adoptHandler( - m_events->forCIpcClientProxy().messageReceived(), proxy, - new TMethodEventJob( - this, &CIpcServer::handleMessageReceived)); + m_events->forIpcClientProxy().messageReceived(), proxy, + new TMethodEventJob( + this, &IpcServer::handleMessageReceived)); - m_events->addEvent(CEvent( - m_events->forCIpcServer().clientConnected(), this, proxy, CEvent::kDontFreeData)); + m_events->addEvent(Event( + m_events->forIpcServer().clientConnected(), this, proxy, Event::kDontFreeData)); } void -CIpcServer::handleClientDisconnected(const CEvent& e, void*) +IpcServer::handleClientDisconnected(const Event& e, void*) { - CIpcClientProxy* proxy = static_cast(e.getTarget()); + IpcClientProxy* proxy = static_cast(e.getTarget()); - CArchMutexLock lock(m_clientsMutex); + ArchMutexLock lock(m_clientsMutex); m_clients.remove(proxy); deleteClient(proxy); @@ -122,34 +122,34 @@ CIpcServer::handleClientDisconnected(const CEvent& e, void*) } void -CIpcServer::handleMessageReceived(const CEvent& e, void*) +IpcServer::handleMessageReceived(const Event& e, void*) { - CEvent event(m_events->forCIpcServer().messageReceived(), this); + Event event(m_events->forIpcServer().messageReceived(), this); event.setDataObject(e.getDataObject()); m_events->addEvent(event); } void -CIpcServer::deleteClient(CIpcClientProxy* proxy) +IpcServer::deleteClient(IpcClientProxy* proxy) { - m_events->removeHandler(m_events->forCIpcClientProxy().messageReceived(), proxy); - m_events->removeHandler(m_events->forCIpcClientProxy().disconnected(), proxy); + m_events->removeHandler(m_events->forIpcClientProxy().messageReceived(), proxy); + m_events->removeHandler(m_events->forIpcClientProxy().disconnected(), proxy); delete proxy; } bool -CIpcServer::hasClients(EIpcClientType clientType) const +IpcServer::hasClients(EIpcClientType clientType) const { - CArchMutexLock lock(m_clientsMutex); + ArchMutexLock lock(m_clientsMutex); if (m_clients.empty()) { return false; } - CClientList::const_iterator it; + ClientList::const_iterator it; for (it = m_clients.begin(); it != m_clients.end(); it++) { // at least one client is alive and type matches, there are clients. - CIpcClientProxy* p = *it; + IpcClientProxy* p = *it; if (!p->m_disconnecting && p->m_clientType == clientType) { return true; } @@ -160,13 +160,13 @@ CIpcServer::hasClients(EIpcClientType clientType) const } void -CIpcServer::send(const CIpcMessage& message, EIpcClientType filterType) +IpcServer::send(const IpcMessage& message, EIpcClientType filterType) { - CArchMutexLock lock(m_clientsMutex); + ArchMutexLock lock(m_clientsMutex); - CClientList::iterator it; + ClientList::iterator it; for (it = m_clients.begin(); it != m_clients.end(); it++) { - CIpcClientProxy* proxy = *it; + IpcClientProxy* proxy = *it; if (proxy->m_clientType == filterType) { proxy->send(message); } diff --git a/src/lib/ipc/IpcServer.h b/src/lib/ipc/IpcServer.h index dababa96..f6deea7d 100644 --- a/src/lib/ipc/IpcServer.h +++ b/src/lib/ipc/IpcServer.h @@ -26,11 +26,11 @@ #include -class CEvent; -class CIpcClientProxy; -class CIpcMessage; +class Event; +class IpcClientProxy; +class IpcMessage; class IEventQueue; -class CSocketMultiplexer; +class SocketMultiplexer; //! IPC server for communication between daemon and GUI. /*! @@ -39,11 +39,11 @@ client/server process or the GUI. The IPC server runs on the daemon process. This allows the GUI to send config changes to the daemon and client/server, and allows the daemon and client/server to send log data to the GUI. */ -class CIpcServer { +class IpcServer { public: - CIpcServer(IEventQueue* events, CSocketMultiplexer* socketMultiplexer); - CIpcServer(IEventQueue* events, CSocketMultiplexer* socketMultiplexer, int port); - virtual ~CIpcServer(); + IpcServer(IEventQueue* events, SocketMultiplexer* socketMultiplexer); + IpcServer(IEventQueue* events, SocketMultiplexer* socketMultiplexer, int port); + virtual ~IpcServer(); //! @name manipulators //@{ @@ -52,7 +52,7 @@ public: void listen(); //! Send a message to all clients matching the filter type. - void send(const CIpcMessage& message, EIpcClientType filterType); + void send(const IpcMessage& message, EIpcClientType filterType); //@} //! @name accessors @@ -65,17 +65,17 @@ public: private: void init(); - void handleClientConnecting(const CEvent&, void*); - void handleClientDisconnected(const CEvent&, void*); - void handleMessageReceived(const CEvent&, void*); - void deleteClient(CIpcClientProxy* proxy); + void handleClientConnecting(const Event&, void*); + void handleClientDisconnected(const Event&, void*); + void handleMessageReceived(const Event&, void*); + void deleteClient(IpcClientProxy* proxy); private: - typedef std::list CClientList; + typedef std::list ClientList; CTCPListenSocket m_socket; - CNetworkAddress m_address; - CClientList m_clients; - CArchMutex m_clientsMutex; + NetworkAddress m_address; + ClientList m_clients; + ArchMutex m_clientsMutex; IEventQueue* m_events; }; diff --git a/src/lib/ipc/IpcServerProxy.cpp b/src/lib/ipc/IpcServerProxy.cpp index f84352cf..44a1fd48 100644 --- a/src/lib/ipc/IpcServerProxy.cpp +++ b/src/lib/ipc/IpcServerProxy.cpp @@ -26,27 +26,27 @@ #include "base/Log.h" // -// CIpcServerProxy +// IpcServerProxy // -CIpcServerProxy::CIpcServerProxy(synergy::IStream& stream, IEventQueue* events) : +IpcServerProxy::IpcServerProxy(synergy::IStream& stream, IEventQueue* events) : m_stream(stream), m_events(events) { m_events->adoptHandler(m_events->forIStream().inputReady(), stream.getEventTarget(), - new TMethodEventJob( - this, &CIpcServerProxy::handleData)); + new TMethodEventJob( + this, &IpcServerProxy::handleData)); } -CIpcServerProxy::~CIpcServerProxy() +IpcServerProxy::~IpcServerProxy() { m_events->removeHandler(m_events->forIStream().inputReady(), m_stream.getEventTarget()); } void -CIpcServerProxy::handleData(const CEvent&, void*) +IpcServerProxy::handleData(const Event&, void*) { LOG((CLOG_DEBUG "start ipc handle data")); @@ -57,12 +57,12 @@ CIpcServerProxy::handleData(const CEvent&, void*) LOG((CLOG_DEBUG "ipc read: %c%c%c%c", code[0], code[1], code[2], code[3])); - CIpcMessage* m = nullptr; + IpcMessage* m = nullptr; if (memcmp(code, kIpcMsgLogLine, 4) == 0) { m = parseLogLine(); } else if (memcmp(code, kIpcMsgShutdown, 4) == 0) { - m = new CIpcShutdownMessage(); + m = new IpcShutdownMessage(); } else { LOG((CLOG_ERR "invalid ipc message")); @@ -70,7 +70,7 @@ CIpcServerProxy::handleData(const CEvent&, void*) } // don't delete with this event; the data is passed to a new event. - CEvent e(m_events->forCIpcServerProxy().messageReceived(), this, NULL, CEvent::kDontFreeData); + Event e(m_events->forIpcServerProxy().messageReceived(), this, NULL, Event::kDontFreeData); e.setDataObject(m); m_events->addEvent(e); @@ -81,21 +81,21 @@ CIpcServerProxy::handleData(const CEvent&, void*) } void -CIpcServerProxy::send(const CIpcMessage& message) +IpcServerProxy::send(const IpcMessage& message) { LOG((CLOG_DEBUG4 "ipc write: %d", message.type())); switch (message.type()) { case kIpcHello: { - const CIpcHelloMessage& hm = static_cast(message); - CProtocolUtil::writef(&m_stream, kIpcMsgHello, hm.clientType()); + const IpcHelloMessage& hm = static_cast(message); + ProtocolUtil::writef(&m_stream, kIpcMsgHello, hm.clientType()); break; } case kIpcCommand: { - const CIpcCommandMessage& cm = static_cast(message); - CString command = cm.command(); - CProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command); + const IpcCommandMessage& cm = static_cast(message); + String command = cm.command(); + ProtocolUtil::writef(&m_stream, kIpcMsgCommand, &command); break; } @@ -105,18 +105,18 @@ CIpcServerProxy::send(const CIpcMessage& message) } } -CIpcLogLineMessage* -CIpcServerProxy::parseLogLine() +IpcLogLineMessage* +IpcServerProxy::parseLogLine() { - CString logLine; - CProtocolUtil::readf(&m_stream, kIpcMsgLogLine + 4, &logLine); + String logLine; + ProtocolUtil::readf(&m_stream, kIpcMsgLogLine + 4, &logLine); // must be deleted by event handler. - return new CIpcLogLineMessage(logLine); + return new IpcLogLineMessage(logLine); } void -CIpcServerProxy::disconnect() +IpcServerProxy::disconnect() { LOG((CLOG_DEBUG "ipc disconnect, closing stream")); m_stream.close(); diff --git a/src/lib/ipc/IpcServerProxy.h b/src/lib/ipc/IpcServerProxy.h index 74185a64..32d405bf 100644 --- a/src/lib/ipc/IpcServerProxy.h +++ b/src/lib/ipc/IpcServerProxy.h @@ -22,22 +22,22 @@ #include "base/EventTypes.h" namespace synergy { class IStream; } -class CIpcMessage; -class CIpcLogLineMessage; +class IpcMessage; +class IpcLogLineMessage; class IEventQueue; -class CIpcServerProxy { - friend class CIpcClient; +class IpcServerProxy { + friend class IpcClient; public: - CIpcServerProxy(synergy::IStream& stream, IEventQueue* events); - virtual ~CIpcServerProxy(); + IpcServerProxy(synergy::IStream& stream, IEventQueue* events); + virtual ~IpcServerProxy(); private: - void send(const CIpcMessage& message); + void send(const IpcMessage& message); - void handleData(const CEvent&, void*); - CIpcLogLineMessage* parseLogLine(); + void handleData(const Event&, void*); + IpcLogLineMessage* parseLogLine(); void disconnect(); private: diff --git a/src/lib/mt/CondVar.cpp b/src/lib/mt/CondVar.cpp index 37c4ca63..157bb2b1 100644 --- a/src/lib/mt/CondVar.cpp +++ b/src/lib/mt/CondVar.cpp @@ -21,47 +21,47 @@ #include "base/Stopwatch.h" // -// CCondVarBase +// CondVarBase // -CCondVarBase::CCondVarBase(CMutex* mutex) : +CondVarBase::CondVarBase(Mutex* mutex) : m_mutex(mutex) { assert(m_mutex != NULL); m_cond = ARCH->newCondVar(); } -CCondVarBase::~CCondVarBase() +CondVarBase::~CondVarBase() { ARCH->closeCondVar(m_cond); } void -CCondVarBase::lock() const +CondVarBase::lock() const { m_mutex->lock(); } void -CCondVarBase::unlock() const +CondVarBase::unlock() const { m_mutex->unlock(); } void -CCondVarBase::signal() +CondVarBase::signal() { ARCH->signalCondVar(m_cond); } void -CCondVarBase::broadcast() +CondVarBase::broadcast() { ARCH->broadcastCondVar(m_cond); } bool -CCondVarBase::wait(CStopwatch& timer, double timeout) const +CondVarBase::wait(Stopwatch& timer, double timeout) const { // check timeout against timer if (timeout >= 0.0) { @@ -73,13 +73,13 @@ CCondVarBase::wait(CStopwatch& timer, double timeout) const } bool -CCondVarBase::wait(double timeout) const +CondVarBase::wait(double timeout) const { return ARCH->waitCondVar(m_cond, m_mutex->m_mutex, timeout); } -CMutex* -CCondVarBase::getMutex() const +Mutex* +CondVarBase::getMutex() const { return m_mutex; } diff --git a/src/lib/mt/CondVar.h b/src/lib/mt/CondVar.h index 118f079d..5921394f 100644 --- a/src/lib/mt/CondVar.h +++ b/src/lib/mt/CondVar.h @@ -21,7 +21,7 @@ #include "mt/Mutex.h" #include "common/basic_types.h" -class CStopwatch; +class Stopwatch; //! Generic condition variable /*! @@ -30,15 +30,15 @@ but doesn't provide the actual variable storage. A condition variable is a multiprocessing primitive that can be waited on. Every condition variable has an associated mutex. */ -class CCondVarBase { +class CondVarBase { public: /*! \c mutex must not be NULL. All condition variables have an associated mutex. The mutex needn't be unique to one condition variable. */ - CCondVarBase(CMutex* mutex); - ~CCondVarBase(); + CondVarBase(Mutex* mutex); + ~CondVarBase(); //! @name manipulators //@{ @@ -104,24 +104,24 @@ public: (cancellation point) */ - bool wait(CStopwatch& timer, double timeout) const; + bool wait(Stopwatch& timer, double timeout) const; //! Get the mutex /*! Get the mutex passed to the c'tor. */ - CMutex* getMutex() const; + Mutex* getMutex() const; //@} private: // not implemented - CCondVarBase(const CCondVarBase&); - CCondVarBase& operator=(const CCondVarBase&); + CondVarBase(const CondVarBase&); + CondVarBase& operator=(const CondVarBase&); private: - CMutex* m_mutex; - CArchCond m_cond; + Mutex* m_mutex; + ArchCond m_cond; }; //! Condition variable @@ -129,13 +129,13 @@ private: A condition variable with storage for type \c T. */ template -class CCondVar : public CCondVarBase { +class CondVar : public CondVarBase { public: //! Initialize using \c value - CCondVar(CMutex* mutex, const T& value); + CondVar(Mutex* mutex, const T& value); //! Initialize using another condition variable's value - CCondVar(const CCondVar&); - ~CCondVar(); + CondVar(const CondVar&); + ~CondVar(); //! @name manipulators //@{ @@ -145,14 +145,14 @@ public: Set the variable's value. The condition variable should be locked before calling this method. */ - CCondVar& operator=(const CCondVar& cv); + CondVar& operator=(const CondVar& cv); //! Assigns \c value to this /*! Set the variable's value. The condition variable should be locked before calling this method. */ - CCondVar& operator=(const T& v); + CondVar& operator=(const T& v); //@} //! @name accessors @@ -173,10 +173,10 @@ private: template inline -CCondVar::CCondVar( - CMutex* mutex, +CondVar::CondVar( + Mutex* mutex, const T& data) : - CCondVarBase(mutex), + CondVarBase(mutex), m_data(data) { // do nothing @@ -184,9 +184,9 @@ CCondVar::CCondVar( template inline -CCondVar::CCondVar( - const CCondVar& cv) : - CCondVarBase(cv.getMutex()), +CondVar::CondVar( + const CondVar& cv) : + CondVarBase(cv.getMutex()), m_data(cv.m_data) { // do nothing @@ -194,15 +194,15 @@ CCondVar::CCondVar( template inline -CCondVar::~CCondVar() +CondVar::~CondVar() { // do nothing } template inline -CCondVar& -CCondVar::operator=(const CCondVar& cv) +CondVar& +CondVar::operator=(const CondVar& cv) { m_data = cv.m_data; return *this; @@ -210,8 +210,8 @@ CCondVar::operator=(const CCondVar& cv) template inline -CCondVar& -CCondVar::operator=(const T& data) +CondVar& +CondVar::operator=(const T& data) { m_data = data; return *this; @@ -219,7 +219,7 @@ CCondVar::operator=(const T& data) template inline -CCondVar::operator const volatile T&() const +CondVar::operator const volatile T&() const { return m_data; } diff --git a/src/lib/mt/Lock.cpp b/src/lib/mt/Lock.cpp index 669e922d..2887f67f 100644 --- a/src/lib/mt/Lock.cpp +++ b/src/lib/mt/Lock.cpp @@ -21,22 +21,22 @@ #include "mt/Mutex.h" // -// CLock +// Lock // -CLock::CLock(const CMutex* mutex) : +Lock::Lock(const Mutex* mutex) : m_mutex(mutex) { m_mutex->lock(); } -CLock::CLock(const CCondVarBase* cv) : +Lock::Lock(const CondVarBase* cv) : m_mutex(cv->getMutex()) { m_mutex->lock(); } -CLock::~CLock() +Lock::~Lock() { m_mutex->unlock(); } diff --git a/src/lib/mt/Lock.h b/src/lib/mt/Lock.h index 7a1e45af..520aa1ba 100644 --- a/src/lib/mt/Lock.h +++ b/src/lib/mt/Lock.h @@ -20,8 +20,8 @@ #include "common/common.h" -class CMutex; -class CCondVarBase; +class Mutex; +class CondVarBase; //! Mutual exclusion lock utility /*! @@ -30,20 +30,20 @@ it in the d'tor. It's easier and safer than manually locking and unlocking since unlocking must usually be done no matter how a function exits (including by unwinding due to an exception). */ -class CLock { +class Lock { public: //! Lock the mutex \c mutex - CLock(const CMutex* mutex); + Lock(const Mutex* mutex); //! Lock the condition variable \c cv - CLock(const CCondVarBase* cv); + Lock(const CondVarBase* cv); //! Unlock the mutex or condition variable - ~CLock(); + ~Lock(); private: // not implemented - CLock(const CLock&); - CLock& operator=(const CLock&); + Lock(const Lock&); + Lock& operator=(const Lock&); private: - const CMutex* m_mutex; + const Mutex* m_mutex; }; diff --git a/src/lib/mt/Mutex.cpp b/src/lib/mt/Mutex.cpp index 2e9cf534..f3f48687 100644 --- a/src/lib/mt/Mutex.cpp +++ b/src/lib/mt/Mutex.cpp @@ -21,38 +21,38 @@ #include "arch/Arch.h" // -// CMutex +// Mutex // -CMutex::CMutex() +Mutex::Mutex() { m_mutex = ARCH->newMutex(); } -CMutex::CMutex(const CMutex&) +Mutex::Mutex(const Mutex&) { m_mutex = ARCH->newMutex(); } -CMutex::~CMutex() +Mutex::~Mutex() { ARCH->closeMutex(m_mutex); } -CMutex& -CMutex::operator=(const CMutex&) +Mutex& +Mutex::operator=(const Mutex&) { return *this; } void -CMutex::lock() const +Mutex::lock() const { ARCH->lockMutex(m_mutex); } void -CMutex::unlock() const +Mutex::unlock() const { ARCH->unlockMutex(m_mutex); } diff --git a/src/lib/mt/Mutex.h b/src/lib/mt/Mutex.h index beb2b4d5..02926d35 100644 --- a/src/lib/mt/Mutex.h +++ b/src/lib/mt/Mutex.h @@ -29,16 +29,16 @@ blocked, exactly one waiting thread will acquire the lock and continue running. A thread may not lock a mutex it already owns the lock on; if it tries it will deadlock itself. */ -class CMutex { +class Mutex { public: - CMutex(); + Mutex(); //! Equivalent to default c'tor /*! Copy c'tor doesn't copy anything. It just makes it possible to copy objects that contain a mutex. */ - CMutex(const CMutex&); - ~CMutex(); + Mutex(const Mutex&); + ~Mutex(); //! @name manipulators //@{ @@ -48,7 +48,7 @@ public: This does nothing. It just makes it possible to assign objects that contain a mutex. */ - CMutex& operator=(const CMutex&); + Mutex& operator=(const Mutex&); //@} //! @name accessors @@ -74,6 +74,6 @@ public: //@} private: - friend class CCondVarBase; - CArchMutex m_mutex; + friend class CondVarBase; + ArchMutex m_mutex; }; diff --git a/src/lib/mt/Thread.cpp b/src/lib/mt/Thread.cpp index efb05f52..6888153f 100644 --- a/src/lib/mt/Thread.cpp +++ b/src/lib/mt/Thread.cpp @@ -25,12 +25,12 @@ #include "base/IJob.h" // -// CThread +// Thread // -CThread::CThread(IJob* job) +Thread::Thread(IJob* job) { - m_thread = ARCH->newThread(&CThread::threadFunc, job); + m_thread = ARCH->newThread(&Thread::threadFunc, job); if (m_thread == NULL) { // couldn't create thread delete job; @@ -38,26 +38,26 @@ CThread::CThread(IJob* job) } } -CThread::CThread(const CThread& thread) +Thread::Thread(const Thread& thread) { m_thread = ARCH->copyThread(thread.m_thread); } -CThread::CThread(CArchThread adoptedThread) +Thread::Thread(ArchThread adoptedThread) { m_thread = adoptedThread; } -CThread::~CThread() +Thread::~Thread() { ARCH->closeThread(m_thread); } -CThread& -CThread::operator=(const CThread& thread) +Thread& +Thread::operator=(const Thread& thread) { // copy given thread and release ours - CArchThread copy = ARCH->copyThread(thread.m_thread); + ArchThread copy = ARCH->copyThread(thread.m_thread); ARCH->closeThread(m_thread); // cut over @@ -67,49 +67,49 @@ CThread::operator=(const CThread& thread) } void -CThread::exit(void* result) +Thread::exit(void* result) { throw XThreadExit(result); } void -CThread::cancel() +Thread::cancel() { ARCH->cancelThread(m_thread); } void -CThread::setPriority(int n) +Thread::setPriority(int n) { ARCH->setPriorityOfThread(m_thread, n); } void -CThread::unblockPollSocket() +Thread::unblockPollSocket() { ARCH->unblockPollSocket(m_thread); } -CThread -CThread::getCurrentThread() +Thread +Thread::getCurrentThread() { - return CThread(ARCH->newCurrentThread()); + return Thread(ARCH->newCurrentThread()); } void -CThread::testCancel() +Thread::testCancel() { ARCH->testCancelThread(); } bool -CThread::wait(double timeout) const +Thread::wait(double timeout) const { return ARCH->wait(m_thread, timeout); } void* -CThread::getResult() const +Thread::getResult() const { if (wait()) return ARCH->getResultOfThread(m_thread); @@ -118,30 +118,30 @@ CThread::getResult() const } IArchMultithread::ThreadID -CThread::getID() const +Thread::getID() const { return ARCH->getIDOfThread(m_thread); } bool -CThread::operator==(const CThread& thread) const +Thread::operator==(const Thread& thread) const { return ARCH->isSameThread(m_thread, thread.m_thread); } bool -CThread::operator!=(const CThread& thread) const +Thread::operator!=(const Thread& thread) const { return !ARCH->isSameThread(m_thread, thread.m_thread); } void* -CThread::threadFunc(void* vjob) +Thread::threadFunc(void* vjob) { // get this thread's id for logging IArchMultithread::ThreadID id; { - CArchThread thread = ARCH->newCurrentThread(); + ArchThread thread = ARCH->newCurrentThread(); id = ARCH->getIDOfThread(thread); ARCH->closeThread(thread); } diff --git a/src/lib/mt/Thread.h b/src/lib/mt/Thread.h index 8a74c671..7c70ceb5 100644 --- a/src/lib/mt/Thread.h +++ b/src/lib/mt/Thread.h @@ -24,10 +24,10 @@ class IJob; //! Thread handle /*! -Creating a CThread creates a new context of execution (i.e. thread) that -runs simulatenously with the calling thread. A CThread is only a handle -to a thread; deleting a CThread does not cancel or destroy the thread it -refers to and multiple CThread objects can refer to the same thread. +Creating a Thread creates a new context of execution (i.e. thread) that +runs simulatenously with the calling thread. A Thread is only a handle +to a thread; deleting a Thread does not cancel or destroy the thread it +refers to and multiple Thread objects can refer to the same thread. Threads can terminate themselves but cannot be forced to terminate by other threads. However, other threads can signal a thread to terminate @@ -40,21 +40,21 @@ a request to cancel the thread. Cancellation points are noted in the documentation. */ // note -- do not derive from this class -class CThread { +class Thread { public: //! Run \c adoptedJob in a new thread /*! Create and start a new thread executing the \c adoptedJob. The new thread takes ownership of \c adoptedJob and will delete it. */ - CThread(IJob* adoptedJob); + Thread(IJob* adoptedJob); //! Duplicate a thread handle /*! Make a new thread object that refers to an existing thread. This does \b not start a new thread. */ - CThread(const CThread&); + Thread(const Thread&); //! Release a thread handle /*! @@ -62,7 +62,7 @@ public: will keep running until the job completes or calls exit() or allows itself to be cancelled. */ - ~CThread(); + ~Thread(); //! @name manipulators //@{ @@ -73,7 +73,7 @@ public: makes this thread object refer to another thread. It does \b not start a new thread. */ - CThread& operator=(const CThread&); + Thread& operator=(const Thread&); //! Terminate the calling thread /*! @@ -84,7 +84,7 @@ public: have \c catch(...) blocks then you should add the following before each to avoid catching the exit: \code - catch(CThreadExit&) { throw; } + catch(ThreadExit&) { throw; } \endcode or add the \c RETHROW_XTHREAD macro to the \c catch(...) block. */ @@ -107,7 +107,7 @@ public: may have, especially mutexes. They can \c catch(XThreadCancel) to do that then rethrow the exception or they can let it happen automatically by doing clean up in the d'tors of automatic - objects (like CLock). Clients are strongly encouraged to do the latter. + objects (like Lock). Clients are strongly encouraged to do the latter. During cancellation, further cancel() calls are ignored (i.e. a thread cannot be interrupted by a cancel during cancellation). @@ -139,9 +139,9 @@ public: //! Get current thread's handle /*! - Return a CThread object representing the calling thread. + Return a Thread object representing the calling thread. */ - static CThread getCurrentThread(); + static Thread getCurrentThread(); //! Test for cancellation /*! @@ -180,7 +180,7 @@ public: //! Get the thread id /*! Returns an integer id for this thread. This id must not be used to - check if two CThread objects refer to the same thread. Use + check if two Thread objects refer to the same thread. Use operator==() for that. */ IArchMultithread::ThreadID @@ -188,23 +188,23 @@ public: //! Compare thread handles /*! - Returns true if two CThread objects refer to the same thread. + Returns true if two Thread objects refer to the same thread. */ - bool operator==(const CThread&) const; + bool operator==(const Thread&) const; //! Compare thread handles /*! - Returns true if two CThread objects do not refer to the same thread. + Returns true if two Thread objects do not refer to the same thread. */ - bool operator!=(const CThread&) const; + bool operator!=(const Thread&) const; //@} private: - CThread(CArchThread); + Thread(ArchThread); static void* threadFunc(void*); private: - CArchThread m_thread; + ArchThread m_thread; }; diff --git a/src/lib/mt/XMT.cpp b/src/lib/mt/XMT.cpp index 91d18de2..426d1a06 100644 --- a/src/lib/mt/XMT.cpp +++ b/src/lib/mt/XMT.cpp @@ -22,7 +22,7 @@ // XMTThreadUnavailable // -CString +String XMTThreadUnavailable::getWhat() const throw() { return format("XMTThreadUnavailable", "cannot create thread"); diff --git a/src/lib/mt/XThread.h b/src/lib/mt/XThread.h index 64d8719e..236958f3 100644 --- a/src/lib/mt/XThread.h +++ b/src/lib/mt/XThread.h @@ -22,7 +22,7 @@ //! Thread exception to exit /*! -Thrown by CThread::exit() to exit a thread. Clients of CThread +Thrown by Thread::exit() to exit a thread. Clients of Thread must not throw this type but must rethrow it if caught (by XThreadExit, XThread, or ...). */ diff --git a/src/lib/net/IDataSocket.h b/src/lib/net/IDataSocket.h index 7ecafead..e59afebd 100644 --- a/src/lib/net/IDataSocket.h +++ b/src/lib/net/IDataSocket.h @@ -30,10 +30,10 @@ represent a full-duplex data stream. */ class IDataSocket : public ISocket, public synergy::IStream { public: - class CConnectionFailedInfo { + class ConnectionFailedInfo { public: - CConnectionFailedInfo(const char* what) : m_what(what) { } - CString m_what; + ConnectionFailedInfo(const char* what) : m_what(what) { } + String m_what; }; IDataSocket(IEventQueue* events) { } @@ -48,7 +48,7 @@ public: event when it fails. The stream acts as if shutdown for input and output until the stream connects. */ - virtual void connect(const CNetworkAddress&) = 0; + virtual void connect(const NetworkAddress&) = 0; //@} @@ -57,7 +57,7 @@ public: // in VC++6. it claims the methods are unused locals and warns // that it's removing them. it's presumably tickled by inheriting // methods with identical signatures from both superclasses. - virtual void bind(const CNetworkAddress&) = 0; + virtual void bind(const NetworkAddress&) = 0; virtual void close(); virtual void* getEventTarget() const; diff --git a/src/lib/net/IListenSocket.h b/src/lib/net/IListenSocket.h index 838dc6ee..76011e21 100644 --- a/src/lib/net/IListenSocket.h +++ b/src/lib/net/IListenSocket.h @@ -44,7 +44,7 @@ public: //@} // ISocket overrides - virtual void bind(const CNetworkAddress&) = 0; + virtual void bind(const NetworkAddress&) = 0; virtual void close() = 0; virtual void* getEventTarget() const = 0; }; diff --git a/src/lib/net/ISocket.h b/src/lib/net/ISocket.h index d4220d21..4cc7ff1b 100644 --- a/src/lib/net/ISocket.h +++ b/src/lib/net/ISocket.h @@ -22,7 +22,7 @@ #include "base/Event.h" #include "base/EventTypes.h" -class CNetworkAddress; +class NetworkAddress; //! Generic socket interface /*! @@ -38,7 +38,7 @@ public: /*! Binds the socket to a particular address. */ - virtual void bind(const CNetworkAddress&) = 0; + virtual void bind(const NetworkAddress&) = 0; //! Close socket /*! diff --git a/src/lib/net/ISocketMultiplexerJob.h b/src/lib/net/ISocketMultiplexerJob.h index 61057dd2..c03fdce8 100644 --- a/src/lib/net/ISocketMultiplexerJob.h +++ b/src/lib/net/ISocketMultiplexerJob.h @@ -56,7 +56,7 @@ public: /*! Return the socket to multiplex */ - virtual CArchSocket getSocket() const = 0; + virtual ArchSocket getSocket() const = 0; //! Check for interest in readability /*! diff --git a/src/lib/net/NetworkAddress.cpp b/src/lib/net/NetworkAddress.cpp index c7f93381..a2001719 100644 --- a/src/lib/net/NetworkAddress.cpp +++ b/src/lib/net/NetworkAddress.cpp @@ -25,21 +25,21 @@ #include // -// CNetworkAddress +// NetworkAddress // // name re-resolution adapted from a patch by Brent Priddy. -CNetworkAddress::CNetworkAddress() : +NetworkAddress::NetworkAddress() : m_address(NULL), m_hostname(), m_port(0) { - // note -- make no calls to CNetwork socket interface here; - // we're often called prior to CNetwork::init(). + // note -- make no calls to Network socket interface here; + // we're often called prior to Network::init(). } -CNetworkAddress::CNetworkAddress(int port) : +NetworkAddress::NetworkAddress(int port) : m_address(NULL), m_hostname(), m_port(port) @@ -49,7 +49,7 @@ CNetworkAddress::CNetworkAddress(int port) : ARCH->setAddrPort(m_address, m_port); } -CNetworkAddress::CNetworkAddress(const CNetworkAddress& addr) : +NetworkAddress::NetworkAddress(const NetworkAddress& addr) : m_address(addr.m_address != NULL ? ARCH->copyAddr(addr.m_address) : NULL), m_hostname(addr.m_hostname), m_port(addr.m_port) @@ -57,19 +57,19 @@ CNetworkAddress::CNetworkAddress(const CNetworkAddress& addr) : // do nothing } -CNetworkAddress::CNetworkAddress(const CString& hostname, int port) : +NetworkAddress::NetworkAddress(const String& hostname, int port) : m_address(NULL), m_hostname(hostname), m_port(port) { // check for port suffix - CString::size_type i = m_hostname.rfind(':'); - if (i != CString::npos && i + 1 < m_hostname.size()) { + String::size_type i = m_hostname.rfind(':'); + if (i != String::npos && i + 1 < m_hostname.size()) { // found a colon. see if it looks like an IPv6 address. bool colonNotation = false; bool dotNotation = false; bool doubleColon = false; - for (CString::size_type j = 0; j < i; ++j) { + for (String::size_type j = 0; j < i; ++j) { if (m_hostname[j] == ':') { colonNotation = true; dotNotation = false; @@ -109,17 +109,17 @@ CNetworkAddress::CNetworkAddress(const CString& hostname, int port) : checkPort(); } -CNetworkAddress::~CNetworkAddress() +NetworkAddress::~NetworkAddress() { if (m_address != NULL) { ARCH->closeAddr(m_address); } } -CNetworkAddress& -CNetworkAddress::operator=(const CNetworkAddress& addr) +NetworkAddress& +NetworkAddress::operator=(const NetworkAddress& addr) { - CArchNetAddress newAddr = NULL; + ArchNetAddress newAddr = NULL; if (addr.m_address != NULL) { newAddr = ARCH->copyAddr(addr.m_address); } @@ -133,7 +133,7 @@ CNetworkAddress::operator=(const CNetworkAddress& addr) } void -CNetworkAddress::resolve() +NetworkAddress::resolve() { // discard previous address if (m_address != NULL) { @@ -169,43 +169,43 @@ CNetworkAddress::resolve() } bool -CNetworkAddress::operator==(const CNetworkAddress& addr) const +NetworkAddress::operator==(const NetworkAddress& addr) const { return ARCH->isEqualAddr(m_address, addr.m_address); } bool -CNetworkAddress::operator!=(const CNetworkAddress& addr) const +NetworkAddress::operator!=(const NetworkAddress& addr) const { return !operator==(addr); } bool -CNetworkAddress::isValid() const +NetworkAddress::isValid() const { return (m_address != NULL); } -const CArchNetAddress& -CNetworkAddress::getAddress() const +const ArchNetAddress& +NetworkAddress::getAddress() const { return m_address; } int -CNetworkAddress::getPort() const +NetworkAddress::getPort() const { return m_port; } -CString -CNetworkAddress::getHostname() const +String +NetworkAddress::getHostname() const { return m_hostname; } void -CNetworkAddress::checkPort() +NetworkAddress::checkPort() { // check port number if (m_port <= 0 || m_port > 65535) { diff --git a/src/lib/net/NetworkAddress.h b/src/lib/net/NetworkAddress.h index 92e27e7d..fce73fcd 100644 --- a/src/lib/net/NetworkAddress.h +++ b/src/lib/net/NetworkAddress.h @@ -26,18 +26,18 @@ /*! This class represents a network address. */ -class CNetworkAddress { +class NetworkAddress { public: /*! Constructs the invalid address */ - CNetworkAddress(); + NetworkAddress(); /*! Construct the wildcard address with the given port. \c port must not be zero. */ - CNetworkAddress(int port); + NetworkAddress(int port); /*! Construct the network address for the given \c hostname and \c port. @@ -49,13 +49,13 @@ public: is thrown with an error of \c XSocketAddress::kBadPort. The hostname is not resolved by the c'tor; use \c resolve to do that. */ - CNetworkAddress(const CString& hostname, int port); + NetworkAddress(const String& hostname, int port); - CNetworkAddress(const CNetworkAddress&); + NetworkAddress(const NetworkAddress&); - ~CNetworkAddress(); + ~NetworkAddress(); - CNetworkAddress& operator=(const CNetworkAddress&); + NetworkAddress& operator=(const NetworkAddress&); //! @name manipulators //@{ @@ -77,13 +77,13 @@ public: /*! Returns true if this address is equal to \p address. */ - bool operator==(const CNetworkAddress& address) const; + bool operator==(const NetworkAddress& address) const; //! Check address inequality /*! Returns true if this address is not equal to \p address. */ - bool operator!=(const CNetworkAddress& address) const; + bool operator!=(const NetworkAddress& address) const; //! Check address validity /*! @@ -96,7 +96,7 @@ public: Returns the address in the platform's native network address structure. */ - const CArchNetAddress& getAddress() const; + const ArchNetAddress& getAddress() const; //! Get port /*! @@ -109,7 +109,7 @@ public: /*! Returns the hostname passed to the c'tor sans any port suffix. */ - CString getHostname() const; + String getHostname() const; //@} @@ -117,7 +117,7 @@ private: void checkPort(); private: - CArchNetAddress m_address; - CString m_hostname; + ArchNetAddress m_address; + String m_hostname; int m_port; }; diff --git a/src/lib/net/SocketMultiplexer.cpp b/src/lib/net/SocketMultiplexer.cpp index 9a7874fe..cc0e9bb0 100644 --- a/src/lib/net/SocketMultiplexer.cpp +++ b/src/lib/net/SocketMultiplexer.cpp @@ -30,16 +30,16 @@ #include "common/stdvector.h" // -// CSocketMultiplexer +// SocketMultiplexer // -CSocketMultiplexer::CSocketMultiplexer() : - m_mutex(new CMutex), +SocketMultiplexer::SocketMultiplexer() : + m_mutex(new Mutex), m_thread(NULL), m_update(false), - m_jobsReady(new CCondVar(m_mutex, false)), - m_jobListLock(new CCondVar(m_mutex, false)), - m_jobListLockLocked(new CCondVar(m_mutex, false)), + m_jobsReady(new CondVar(m_mutex, false)), + m_jobListLock(new CondVar(m_mutex, false)), + m_jobListLockLocked(new CondVar(m_mutex, false)), m_jobListLocker(NULL), m_jobListLockLocker(NULL) { @@ -49,11 +49,11 @@ CSocketMultiplexer::CSocketMultiplexer() : m_cursorMark = reinterpret_cast(this); // start thread - m_thread = new CThread(new TMethodJob( - this, &CSocketMultiplexer::serviceThread)); + m_thread = new Thread(new TMethodJob( + this, &SocketMultiplexer::serviceThread)); } -CSocketMultiplexer::~CSocketMultiplexer() +SocketMultiplexer::~SocketMultiplexer() { m_thread->cancel(); m_thread->unblockPollSocket(); @@ -67,14 +67,14 @@ CSocketMultiplexer::~CSocketMultiplexer() delete m_mutex; // clean up jobs - for (CSocketJobMap::iterator i = m_socketJobMap.begin(); + for (SocketJobMap::iterator i = m_socketJobMap.begin(); i != m_socketJobMap.end(); ++i) { delete *(i->second); } } void -CSocketMultiplexer::addSocket(ISocket* socket, ISocketMultiplexerJob* job) +SocketMultiplexer::addSocket(ISocket* socket, ISocketMultiplexerJob* job) { assert(socket != NULL); assert(job != NULL); @@ -89,17 +89,17 @@ CSocketMultiplexer::addSocket(ISocket* socket, ISocketMultiplexerJob* job) lockJobList(); // insert/replace job - CSocketJobMap::iterator i = m_socketJobMap.find(socket); + SocketJobMap::iterator i = m_socketJobMap.find(socket); if (i == m_socketJobMap.end()) { // we *must* put the job at the end so the order of jobs in // the list continue to match the order of jobs in pfds in // serviceThread(). - CJobCursor j = m_socketJobs.insert(m_socketJobs.end(), job); + JobCursor j = m_socketJobs.insert(m_socketJobs.end(), job); m_update = true; m_socketJobMap.insert(std::make_pair(socket, j)); } else { - CJobCursor j = i->second; + JobCursor j = i->second; if (*j != job) { delete *j; *j = job; @@ -112,7 +112,7 @@ CSocketMultiplexer::addSocket(ISocket* socket, ISocketMultiplexerJob* job) } void -CSocketMultiplexer::removeSocket(ISocket* socket) +SocketMultiplexer::removeSocket(ISocket* socket) { assert(socket != NULL); @@ -128,7 +128,7 @@ CSocketMultiplexer::removeSocket(ISocket* socket) // remove job. rather than removing it from the map we put NULL // in the list instead so the order of jobs in the list continues // to match the order of jobs in pfds in serviceThread(). - CSocketJobMap::iterator i = m_socketJobMap.find(socket); + SocketJobMap::iterator i = m_socketJobMap.find(socket); if (i != m_socketJobMap.end()) { if (*(i->second) != NULL) { delete *(i->second); @@ -142,18 +142,18 @@ CSocketMultiplexer::removeSocket(ISocket* socket) } void -CSocketMultiplexer::serviceThread(void*) +SocketMultiplexer::serviceThread(void*) { - std::vector pfds; - IArchNetwork::CPollEntry pfd; + std::vector pfds; + IArchNetwork::PollEntry pfd; // service the connections for (;;) { - CThread::testCancel(); + Thread::testCancel(); // wait until there are jobs to handle { - CLock lock(m_mutex); + Lock lock(m_mutex); while (!(bool)*m_jobsReady) { m_jobsReady->wait(); } @@ -169,8 +169,8 @@ CSocketMultiplexer::serviceThread(void*) pfds.clear(); pfds.reserve(m_socketJobMap.size()); - CJobCursor cursor = newCursor(); - CJobCursor jobCursor = nextCursor(cursor); + JobCursor cursor = newCursor(); + JobCursor jobCursor = nextCursor(cursor); while (jobCursor != m_socketJobs.end()) { ISocketMultiplexerJob* job = *jobCursor; if (job != NULL) { @@ -208,8 +208,8 @@ CSocketMultiplexer::serviceThread(void*) // iterate over socket jobs, invoking each and saving the // new job. UInt32 i = 0; - CJobCursor cursor = newCursor(); - CJobCursor jobCursor = nextCursor(cursor); + JobCursor cursor = newCursor(); + JobCursor jobCursor = nextCursor(cursor); while (i < pfds.size() && jobCursor != m_socketJobs.end()) { if (*jobCursor != NULL) { // get poll state @@ -225,7 +225,7 @@ CSocketMultiplexer::serviceThread(void*) // save job, if different if (newJob != job) { - CLock lock(m_mutex); + Lock lock(m_mutex); delete job; *jobCursor = newJob; m_update = true; @@ -240,7 +240,7 @@ CSocketMultiplexer::serviceThread(void*) } // delete any removed socket jobs - for (CSocketJobMap::iterator i = m_socketJobMap.begin(); + for (SocketJobMap::iterator i = m_socketJobMap.begin(); i != m_socketJobMap.end();) { if (*(i->second) == NULL) { m_socketJobMap.erase(i++); @@ -256,19 +256,19 @@ CSocketMultiplexer::serviceThread(void*) } } -CSocketMultiplexer::CJobCursor -CSocketMultiplexer::newCursor() +SocketMultiplexer::JobCursor +SocketMultiplexer::newCursor() { - CLock lock(m_mutex); + Lock lock(m_mutex); return m_socketJobs.insert(m_socketJobs.begin(), m_cursorMark); } -CSocketMultiplexer::CJobCursor -CSocketMultiplexer::nextCursor(CJobCursor cursor) +SocketMultiplexer::JobCursor +SocketMultiplexer::nextCursor(JobCursor cursor) { - CLock lock(m_mutex); - CJobCursor j = m_socketJobs.end(); - CJobCursor i = cursor; + Lock lock(m_mutex); + JobCursor j = m_socketJobs.end(); + JobCursor i = cursor; while (++i != m_socketJobs.end()) { if (*i != m_cursorMark) { // found a real job (as opposed to a cursor) @@ -283,16 +283,16 @@ CSocketMultiplexer::nextCursor(CJobCursor cursor) } void -CSocketMultiplexer::deleteCursor(CJobCursor cursor) +SocketMultiplexer::deleteCursor(JobCursor cursor) { - CLock lock(m_mutex); + Lock lock(m_mutex); m_socketJobs.erase(cursor); } void -CSocketMultiplexer::lockJobListLock() +SocketMultiplexer::lockJobListLock() { - CLock lock(m_mutex); + Lock lock(m_mutex); // wait for the lock on the lock while (*m_jobListLockLocked) { @@ -301,16 +301,16 @@ CSocketMultiplexer::lockJobListLock() // take ownership of the lock on the lock *m_jobListLockLocked = true; - m_jobListLockLocker = new CThread(CThread::getCurrentThread()); + m_jobListLockLocker = new Thread(Thread::getCurrentThread()); } void -CSocketMultiplexer::lockJobList() +SocketMultiplexer::lockJobList() { - CLock lock(m_mutex); + Lock lock(m_mutex); // make sure we're the one that called lockJobListLock() - assert(*m_jobListLockLocker == CThread::getCurrentThread()); + assert(*m_jobListLockLocker == Thread::getCurrentThread()); // wait for the job list lock while (*m_jobListLock) { @@ -328,12 +328,12 @@ CSocketMultiplexer::lockJobList() } void -CSocketMultiplexer::unlockJobList() +SocketMultiplexer::unlockJobList() { - CLock lock(m_mutex); + Lock lock(m_mutex); // make sure we're the one that called lockJobList() - assert(*m_jobListLocker == CThread::getCurrentThread()); + assert(*m_jobListLocker == Thread::getCurrentThread()); // release the lock delete m_jobListLocker; diff --git a/src/lib/net/SocketMultiplexer.h b/src/lib/net/SocketMultiplexer.h index 36a3f03c..b610f4e4 100644 --- a/src/lib/net/SocketMultiplexer.h +++ b/src/lib/net/SocketMultiplexer.h @@ -23,9 +23,9 @@ #include "common/stdmap.h" template -class CCondVar; -class CMutex; -class CThread; +class CondVar; +class Mutex; +class Thread; class ISocket; class ISocketMultiplexerJob; @@ -33,10 +33,10 @@ class ISocketMultiplexerJob; /*! A socket multiplexer services multiple sockets simultaneously. */ -class CSocketMultiplexer { +class SocketMultiplexer { public: - CSocketMultiplexer(); - ~CSocketMultiplexer(); + SocketMultiplexer(); + ~SocketMultiplexer(); //! @name manipulators //@{ @@ -50,7 +50,7 @@ public: //@{ // maybe belongs on ISocketMultiplexer - static CSocketMultiplexer* + static SocketMultiplexer* getInstance(); //@} @@ -58,9 +58,9 @@ public: private: // list of jobs. we use a list so we can safely iterate over it // while other threads modify it. - typedef std::list CSocketJobs; - typedef CSocketJobs::iterator CJobCursor; - typedef std::map CSocketJobMap; + typedef std::list SocketJobs; + typedef SocketJobs::iterator JobCursor; + typedef std::map SocketJobMap; // service sockets. the service thread will only access m_sockets // and m_update while m_pollable and m_polling are true. all other @@ -77,9 +77,9 @@ private: // nextCursor() finds the next non-dummy item, moves our dummy // item just past it, and returns an iterator for the non-dummy // item. all cursor calls lock the mutex for their duration. - CJobCursor newCursor(); - CJobCursor nextCursor(CJobCursor); - void deleteCursor(CJobCursor); + JobCursor newCursor(); + JobCursor nextCursor(JobCursor); + void deleteCursor(JobCursor); // lock out locking the job list. this blocks if another thread // has already locked out locking. once it returns, only the @@ -95,16 +95,16 @@ private: void unlockJobList(); private: - CMutex* m_mutex; - CThread* m_thread; + Mutex* m_mutex; + Thread* m_thread; bool m_update; - CCondVar* m_jobsReady; - CCondVar* m_jobListLock; - CCondVar* m_jobListLockLocked; - CThread* m_jobListLocker; - CThread* m_jobListLockLocker; + CondVar* m_jobsReady; + CondVar* m_jobListLock; + CondVar* m_jobListLockLocked; + Thread* m_jobListLocker; + Thread* m_jobListLockLocker; - CSocketJobs m_socketJobs; - CSocketJobMap m_socketJobMap; + SocketJobs m_socketJobs; + SocketJobMap m_socketJobMap; ISocketMultiplexerJob* m_cursorMark; }; diff --git a/src/lib/net/TCPListenSocket.cpp b/src/lib/net/TCPListenSocket.cpp index c8f7a69c..81142c49 100644 --- a/src/lib/net/TCPListenSocket.cpp +++ b/src/lib/net/TCPListenSocket.cpp @@ -34,11 +34,11 @@ // CTCPListenSocket // -CTCPListenSocket::CTCPListenSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexer) : +CTCPListenSocket::CTCPListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer) : m_events(events), m_socketMultiplexer(socketMultiplexer) { - m_mutex = new CMutex; + m_mutex = new Mutex; try { m_socket = ARCH->newSocket(IArchNetwork::kINET, IArchNetwork::kSTREAM); } @@ -62,10 +62,10 @@ CTCPListenSocket::~CTCPListenSocket() } void -CTCPListenSocket::bind(const CNetworkAddress& addr) +CTCPListenSocket::bind(const NetworkAddress& addr) { try { - CLock lock(m_mutex); + Lock lock(m_mutex); ARCH->setReuseAddrOnSocket(m_socket, true); ARCH->bindSocket(m_socket, addr.getAddress()); ARCH->listenOnSocket(m_socket); @@ -85,7 +85,7 @@ CTCPListenSocket::bind(const CNetworkAddress& addr) void CTCPListenSocket::close() { - CLock lock(m_mutex); + Lock lock(m_mutex); if (m_socket == NULL) { throw XIOClosed(); } @@ -142,7 +142,7 @@ CTCPListenSocket::serviceListening(ISocketMultiplexerJob* job, return NULL; } if (read) { - m_events->addEvent(CEvent(m_events->forIListenSocket().connecting(), this, NULL)); + m_events->addEvent(Event(m_events->forIListenSocket().connecting(), this, NULL)); // stop polling on this socket until the client accepts return NULL; } diff --git a/src/lib/net/TCPListenSocket.h b/src/lib/net/TCPListenSocket.h index ad03f0a9..d1e32b96 100644 --- a/src/lib/net/TCPListenSocket.h +++ b/src/lib/net/TCPListenSocket.h @@ -21,10 +21,10 @@ #include "net/IListenSocket.h" #include "arch/IArchNetwork.h" -class CMutex; +class Mutex; class ISocketMultiplexerJob; class IEventQueue; -class CSocketMultiplexer; +class SocketMultiplexer; //! TCP listen socket /*! @@ -32,11 +32,11 @@ A listen socket using TCP. */ class CTCPListenSocket : public IListenSocket { public: - CTCPListenSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexer); + CTCPListenSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer); ~CTCPListenSocket(); // ISocket overrides - virtual void bind(const CNetworkAddress&); + virtual void bind(const NetworkAddress&); virtual void close(); virtual void* getEventTarget() const; @@ -49,8 +49,8 @@ private: bool, bool, bool); private: - CArchSocket m_socket; - CMutex* m_mutex; + ArchSocket m_socket; + Mutex* m_mutex; IEventQueue* m_events; - CSocketMultiplexer* m_socketMultiplexer; + SocketMultiplexer* m_socketMultiplexer; }; diff --git a/src/lib/net/TCPSocket.cpp b/src/lib/net/TCPSocket.cpp index 3f90b57c..41f28eae 100644 --- a/src/lib/net/TCPSocket.cpp +++ b/src/lib/net/TCPSocket.cpp @@ -37,7 +37,7 @@ // CTCPSocket // -CTCPSocket::CTCPSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexer) : +CTCPSocket::CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer) : IDataSocket(events), m_mutex(), m_flushed(&m_mutex, true), @@ -54,7 +54,7 @@ CTCPSocket::CTCPSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexe init(); } -CTCPSocket::CTCPSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexer, CArchSocket socket) : +CTCPSocket::CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, ArchSocket socket) : IDataSocket(events), m_mutex(), m_socket(socket), @@ -81,7 +81,7 @@ CTCPSocket::~CTCPSocket() } void -CTCPSocket::bind(const CNetworkAddress& addr) +CTCPSocket::bind(const NetworkAddress& addr) { try { ARCH->bindSocket(m_socket, addr.getAddress()); @@ -100,7 +100,7 @@ CTCPSocket::close() // remove ourself from the multiplexer setJob(NULL); - CLock lock(&m_mutex); + Lock lock(&m_mutex); // clear buffers and enter disconnected state if (m_connected) { @@ -110,7 +110,7 @@ CTCPSocket::close() // close the socket if (m_socket != NULL) { - CArchSocket socket = m_socket; + ArchSocket socket = m_socket; m_socket = NULL; try { ARCH->closeSocket(socket); @@ -132,7 +132,7 @@ UInt32 CTCPSocket::read(void* buffer, UInt32 n) { // copy data directly from our input buffer - CLock lock(&m_mutex); + Lock lock(&m_mutex); UInt32 size = m_inputBuffer.getSize(); if (n > size) { n = size; @@ -156,7 +156,7 @@ CTCPSocket::write(const void* buffer, UInt32 n) { bool wasEmpty; { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // must not have shutdown output if (!m_writable) { @@ -186,7 +186,7 @@ CTCPSocket::write(const void* buffer, UInt32 n) void CTCPSocket::flush() { - CLock lock(&m_mutex); + Lock lock(&m_mutex); while (m_flushed == false) { m_flushed.wait(); } @@ -197,7 +197,7 @@ CTCPSocket::shutdownInput() { bool useNewJob = false; { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // shutdown socket for reading try { @@ -224,7 +224,7 @@ CTCPSocket::shutdownOutput() { bool useNewJob = false; { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // shutdown socket for writing try { @@ -249,22 +249,22 @@ CTCPSocket::shutdownOutput() bool CTCPSocket::isReady() const { - CLock lock(&m_mutex); + Lock lock(&m_mutex); return (m_inputBuffer.getSize() > 0); } UInt32 CTCPSocket::getSize() const { - CLock lock(&m_mutex); + Lock lock(&m_mutex); return m_inputBuffer.getSize(); } void -CTCPSocket::connect(const CNetworkAddress& addr) +CTCPSocket::connect(const NetworkAddress& addr) { { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // fail on attempts to reconnect if (m_socket == NULL || m_connected) { @@ -358,15 +358,15 @@ CTCPSocket::newJob() void CTCPSocket::sendConnectionFailedEvent(const char* msg) { - CConnectionFailedInfo* info = new CConnectionFailedInfo(msg); - m_events->addEvent(CEvent(m_events->forIDataSocket().connectionFailed(), - getEventTarget(), info, CEvent::kDontFreeData)); + ConnectionFailedInfo* info = new ConnectionFailedInfo(msg); + m_events->addEvent(Event(m_events->forIDataSocket().connectionFailed(), + getEventTarget(), info, Event::kDontFreeData)); } void -CTCPSocket::sendEvent(CEvent::Type type) +CTCPSocket::sendEvent(Event::Type type) { - m_events->addEvent(CEvent(type, getEventTarget(), NULL)); + m_events->addEvent(Event(type, getEventTarget(), NULL)); } void @@ -408,7 +408,7 @@ ISocketMultiplexerJob* CTCPSocket::serviceConnecting(ISocketMultiplexerJob* job, bool, bool write, bool error) { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // should only check for errors if error is true but checking a new // socket (and a socket that's connecting should be new) for errors @@ -452,7 +452,7 @@ ISocketMultiplexerJob* CTCPSocket::serviceConnected(ISocketMultiplexerJob* job, bool read, bool write, bool error) { - CLock lock(&m_mutex); + Lock lock(&m_mutex); if (error) { sendEvent(m_events->forISocket().disconnected()); diff --git a/src/lib/net/TCPSocket.h b/src/lib/net/TCPSocket.h index 3169ba59..5e08eda1 100644 --- a/src/lib/net/TCPSocket.h +++ b/src/lib/net/TCPSocket.h @@ -24,11 +24,11 @@ #include "mt/Mutex.h" #include "arch/IArchNetwork.h" -class CMutex; -class CThread; +class Mutex; +class Thread; class ISocketMultiplexerJob; class IEventQueue; -class CSocketMultiplexer; +class SocketMultiplexer; //! TCP data socket /*! @@ -36,12 +36,12 @@ A data socket using TCP. */ class CTCPSocket : public IDataSocket { public: - CTCPSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexer); - CTCPSocket(IEventQueue* events, CSocketMultiplexer* socketMultiplexer, CArchSocket socket); + CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer); + CTCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer, ArchSocket socket); ~CTCPSocket(); // ISocket overrides - virtual void bind(const CNetworkAddress&); + virtual void bind(const NetworkAddress&); virtual void close(); virtual void* getEventTarget() const; @@ -55,7 +55,7 @@ public: virtual UInt32 getSize() const; // IDataSocket overrides - virtual void connect(const CNetworkAddress&); + virtual void connect(const NetworkAddress&); private: void init(); @@ -63,7 +63,7 @@ private: void setJob(ISocketMultiplexerJob*); ISocketMultiplexerJob* newJob(); void sendConnectionFailedEvent(const char*); - void sendEvent(CEvent::Type); + void sendEvent(Event::Type); void onConnected(); void onInputShutdown(); @@ -78,14 +78,14 @@ private: bool, bool, bool); private: - CMutex m_mutex; - CArchSocket m_socket; - CStreamBuffer m_inputBuffer; - CStreamBuffer m_outputBuffer; - CCondVar m_flushed; + Mutex m_mutex; + ArchSocket m_socket; + StreamBuffer m_inputBuffer; + StreamBuffer m_outputBuffer; + CondVar m_flushed; bool m_connected; bool m_readable; bool m_writable; IEventQueue* m_events; - CSocketMultiplexer* m_socketMultiplexer; + SocketMultiplexer* m_socketMultiplexer; }; diff --git a/src/lib/net/TCPSocketFactory.cpp b/src/lib/net/TCPSocketFactory.cpp index 8365f3c3..e1441155 100644 --- a/src/lib/net/TCPSocketFactory.cpp +++ b/src/lib/net/TCPSocketFactory.cpp @@ -25,7 +25,7 @@ // CTCPSocketFactory // -CTCPSocketFactory::CTCPSocketFactory(IEventQueue* events, CSocketMultiplexer* socketMultiplexer) : +CTCPSocketFactory::CTCPSocketFactory(IEventQueue* events, SocketMultiplexer* socketMultiplexer) : m_events(events), m_socketMultiplexer(socketMultiplexer) { diff --git a/src/lib/net/TCPSocketFactory.h b/src/lib/net/TCPSocketFactory.h index a3ad9729..f0d23aa8 100644 --- a/src/lib/net/TCPSocketFactory.h +++ b/src/lib/net/TCPSocketFactory.h @@ -21,12 +21,12 @@ #include "net/ISocketFactory.h" class IEventQueue; -class CSocketMultiplexer; +class SocketMultiplexer; //! Socket factory for TCP sockets class CTCPSocketFactory : public ISocketFactory { public: - CTCPSocketFactory(IEventQueue* events, CSocketMultiplexer* socketMultiplexer); + CTCPSocketFactory(IEventQueue* events, SocketMultiplexer* socketMultiplexer); virtual ~CTCPSocketFactory(); // ISocketFactory overrides @@ -35,5 +35,5 @@ public: private: IEventQueue* m_events; - CSocketMultiplexer* m_socketMultiplexer; + SocketMultiplexer* m_socketMultiplexer; }; diff --git a/src/lib/net/TSocketMultiplexerMethodJob.h b/src/lib/net/TSocketMultiplexerMethodJob.h index 1f109256..98dd3932 100644 --- a/src/lib/net/TSocketMultiplexerMethodJob.h +++ b/src/lib/net/TSocketMultiplexerMethodJob.h @@ -33,20 +33,20 @@ public: //! run() invokes \c object->method(arg) TSocketMultiplexerMethodJob(T* object, Method method, - CArchSocket socket, bool readable, bool writeable); + ArchSocket socket, bool readable, bool writeable); virtual ~TSocketMultiplexerMethodJob(); // IJob overrides virtual ISocketMultiplexerJob* run(bool readable, bool writable, bool error); - virtual CArchSocket getSocket() const; + virtual ArchSocket getSocket() const; virtual bool isReadable() const; virtual bool isWritable() const; private: T* m_object; Method m_method; - CArchSocket m_socket; + ArchSocket m_socket; bool m_readable; bool m_writable; void* m_arg; @@ -55,7 +55,7 @@ private: template inline TSocketMultiplexerMethodJob::TSocketMultiplexerMethodJob(T* object, - Method method, CArchSocket socket, + Method method, ArchSocket socket, bool readable, bool writable) : m_object(object), m_method(method), @@ -86,7 +86,7 @@ TSocketMultiplexerMethodJob::run(bool read, bool write, bool error) template inline -CArchSocket +ArchSocket TSocketMultiplexerMethodJob::getSocket() const { return m_socket; diff --git a/src/lib/net/XSocket.cpp b/src/lib/net/XSocket.cpp index 6b913c71..5dd202d3 100644 --- a/src/lib/net/XSocket.cpp +++ b/src/lib/net/XSocket.cpp @@ -24,7 +24,7 @@ // XSocketAddress::XSocketAddress(EError error, - const CString& hostname, int port) _NOEXCEPT : + const String& hostname, int port) _NOEXCEPT : m_error(error), m_hostname(hostname), m_port(port) @@ -38,7 +38,7 @@ XSocketAddress::getError() const throw() return m_error; } -CString +String XSocketAddress::getHostname() const throw() { return m_hostname; @@ -50,7 +50,7 @@ XSocketAddress::getPort() const throw() return m_port; } -CString +String XSocketAddress::getWhat() const throw() { static const char* s_errorID[] = { @@ -77,7 +77,7 @@ XSocketAddress::getWhat() const throw() // XSocketIOClose // -CString +String XSocketIOClose::getWhat() const throw() { return format("XSocketIOClose", "close: %{1}", what()); @@ -88,7 +88,7 @@ XSocketIOClose::getWhat() const throw() // XSocketBind // -CString +String XSocketBind::getWhat() const throw() { return format("XSocketBind", "cannot bind address: %{1}", what()); @@ -99,7 +99,7 @@ XSocketBind::getWhat() const throw() // XSocketConnect // -CString +String XSocketConnect::getWhat() const throw() { return format("XSocketConnect", "cannot connect socket: %{1}", what()); @@ -110,7 +110,7 @@ XSocketConnect::getWhat() const throw() // XSocketCreate // -CString +String XSocketCreate::getWhat() const throw() { return format("XSocketCreate", "cannot create socket: %{1}", what()); diff --git a/src/lib/net/XSocket.h b/src/lib/net/XSocket.h index 7194ada3..8ce99830 100644 --- a/src/lib/net/XSocket.h +++ b/src/lib/net/XSocket.h @@ -41,7 +41,7 @@ public: kBadPort //!< The port is invalid }; - XSocketAddress(EError, const CString& hostname, int port) _NOEXCEPT; + XSocketAddress(EError, const String& hostname, int port) _NOEXCEPT; virtual ~XSocketAddress() _NOEXCEPT { } //! @name accessors @@ -50,7 +50,7 @@ public: //! Get the error code EError getError() const throw(); //! Get the hostname - CString getHostname() const throw(); + String getHostname() const throw(); //! Get the port int getPort() const throw(); @@ -58,11 +58,11 @@ public: protected: // XBase overrides - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: EError m_error; - CString m_hostname; + String m_hostname; int m_port; }; diff --git a/src/lib/platform/MSWindowsClipboard.cpp b/src/lib/platform/MSWindowsClipboard.cpp index 8587e71c..ad6705b2 100644 --- a/src/lib/platform/MSWindowsClipboard.cpp +++ b/src/lib/platform/MSWindowsClipboard.cpp @@ -94,7 +94,7 @@ CMSWindowsClipboard::empty() } void -CMSWindowsClipboard::add(EFormat format, const CString& data) +CMSWindowsClipboard::add(EFormat format, const String& data) { LOG((CLOG_DEBUG "add %d bytes to clipboard format: %d", data.size(), format)); @@ -161,7 +161,7 @@ CMSWindowsClipboard::has(EFormat format) const return false; } -CString +String CMSWindowsClipboard::get(EFormat format) const { // find the converter for the first clipboard format we can handle @@ -182,7 +182,7 @@ CMSWindowsClipboard::get(EFormat format) const // if no converter then we don't recognize any formats if (converter == NULL) { - return CString(); + return String(); } // get a handle to the clipboard data @@ -191,7 +191,7 @@ CMSWindowsClipboard::get(EFormat format) const // nb: can't cause this using integ tests; this is only caused when // the selected converter returns an invalid format -- which you // cannot cause using public functions. - return CString(); + return String(); } // convert diff --git a/src/lib/platform/MSWindowsClipboard.h b/src/lib/platform/MSWindowsClipboard.h index 0df974f5..45654643 100644 --- a/src/lib/platform/MSWindowsClipboard.h +++ b/src/lib/platform/MSWindowsClipboard.h @@ -55,12 +55,12 @@ public: // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const CString& data); + virtual void add(EFormat, const String& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual CString get(EFormat) const; + virtual String get(EFormat) const; void setFacade(IMSWindowsClipboardFacade& facade); @@ -68,8 +68,8 @@ private: void clearConverters(); UINT convertFormatToWin32(EFormat) const; - HANDLE convertTextToWin32(const CString& data) const; - CString convertTextFromWin32(HANDLE) const; + HANDLE convertTextToWin32(const String& data) const; + String convertTextFromWin32(HANDLE) const; static UINT getOwnershipFormat(); @@ -105,9 +105,9 @@ public: // the input data must be in the IClipboard format returned by // getFormat(). the return data will be in the win32 clipboard // format returned by getWin32Format(), allocated by GlobalAlloc(). - virtual HANDLE fromIClipboard(const CString&) const = 0; + virtual HANDLE fromIClipboard(const String&) const = 0; // convert from the win32 clipboard format to the IClipboard format // (i.e., the reverse of fromIClipboard()). - virtual CString toIClipboard(HANDLE data) const = 0; + virtual String toIClipboard(HANDLE data) const = 0; }; diff --git a/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp b/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp index dfe00716..7ad1bd57 100644 --- a/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardAnyTextConverter.cpp @@ -39,10 +39,10 @@ CMSWindowsClipboardAnyTextConverter::getFormat() const } HANDLE -CMSWindowsClipboardAnyTextConverter::fromIClipboard(const CString& data) const +CMSWindowsClipboardAnyTextConverter::fromIClipboard(const String& data) const { // convert linefeeds and then convert to desired encoding - CString text = doFromIClipboard(convertLinefeedToWin32(data)); + String text = doFromIClipboard(convertLinefeedToWin32(data)); UInt32 size = (UInt32)text.size(); // copy to memory handle @@ -63,18 +63,18 @@ CMSWindowsClipboardAnyTextConverter::fromIClipboard(const CString& data) const return gData; } -CString +String CMSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const { // get datator const char* src = (const char*)GlobalLock(data); UInt32 srcSize = (UInt32)GlobalSize(data); if (src == NULL || srcSize <= 1) { - return CString(); + return String(); } // convert text - CString text = doToIClipboard(CString(src, srcSize)); + String text = doToIClipboard(String(src, srcSize)); // release handle GlobalUnlock(data); @@ -83,9 +83,9 @@ CMSWindowsClipboardAnyTextConverter::toIClipboard(HANDLE data) const return convertLinefeedToUnix(text); } -CString +String CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32( - const CString& src) const + const String& src) const { // note -- we assume src is a valid UTF-8 string @@ -102,7 +102,7 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32( } // allocate new string - CString dst; + String dst; dst.reserve(src.size() + numNewlines); // copy string, converting newlines @@ -117,9 +117,9 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToWin32( return dst; } -CString +String CMSWindowsClipboardAnyTextConverter::convertLinefeedToUnix( - const CString& src) const + const String& src) const { // count newlines in string UInt32 numNewlines = 0; @@ -134,7 +134,7 @@ CMSWindowsClipboardAnyTextConverter::convertLinefeedToUnix( } // allocate new string - CString dst; + String dst; dst.reserve(src.size()); // copy string, converting newlines diff --git a/src/lib/platform/MSWindowsClipboardAnyTextConverter.h b/src/lib/platform/MSWindowsClipboardAnyTextConverter.h index f2d2e21f..05f4ca28 100644 --- a/src/lib/platform/MSWindowsClipboardAnyTextConverter.h +++ b/src/lib/platform/MSWindowsClipboardAnyTextConverter.h @@ -31,8 +31,8 @@ public: virtual IClipboard::EFormat getFormat() const; virtual UINT getWin32Format() const = 0; - virtual HANDLE fromIClipboard(const CString&) const; - virtual CString toIClipboard(HANDLE) const; + virtual HANDLE fromIClipboard(const String&) const; + virtual String toIClipboard(HANDLE) const; protected: //! Convert from IClipboard format @@ -40,18 +40,18 @@ protected: Do UTF-8 conversion only. Memory handle allocation and linefeed conversion is done by this class. doFromIClipboard() must include the nul terminator in the returned string (not - including the CString's nul terminator). + including the String's nul terminator). */ - virtual CString doFromIClipboard(const CString&) const = 0; + virtual String doFromIClipboard(const String&) const = 0; //! Convert to IClipboard format /*! Do UTF-8 conversion only. Memory handle allocation and linefeed conversion is done by this class. */ - virtual CString doToIClipboard(const CString&) const = 0; + virtual String doToIClipboard(const String&) const = 0; private: - CString convertLinefeedToWin32(const CString&) const; - CString convertLinefeedToUnix(const CString&) const; + String convertLinefeedToWin32(const String&) const; + String convertLinefeedToUnix(const String&) const; }; diff --git a/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp b/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp index 1c9bd730..c0b1d0c8 100644 --- a/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardBitmapConverter.cpp @@ -47,7 +47,7 @@ CMSWindowsClipboardBitmapConverter::getWin32Format() const } HANDLE -CMSWindowsClipboardBitmapConverter::fromIClipboard(const CString& data) const +CMSWindowsClipboardBitmapConverter::fromIClipboard(const String& data) const { // copy to memory handle HGLOBAL gData = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, data.size()); @@ -67,13 +67,13 @@ CMSWindowsClipboardBitmapConverter::fromIClipboard(const CString& data) const return gData; } -CString +String CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const { // get datator const char* src = (const char*)GlobalLock(data); if (src == NULL) { - return CString(); + return String(); } UInt32 srcSize = (UInt32)GlobalSize(data); @@ -85,7 +85,7 @@ CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const bitmap->bmiHeader.biBitCount == 32) && bitmap->bmiHeader.biCompression == BI_RGB) { // already in canonical form - CString image(src, srcSize); + String image(src, srcSize); GlobalUnlock(data); return image; } @@ -138,7 +138,7 @@ CMSWindowsClipboardBitmapConverter::toIClipboard(HANDLE data) const GdiFlush(); // extract data - CString image((const char*)&info, info.biSize); + String image((const char*)&info, info.biSize); image.append((const char*)raw, 4 * w * h); // clean up GDI diff --git a/src/lib/platform/MSWindowsClipboardBitmapConverter.h b/src/lib/platform/MSWindowsClipboardBitmapConverter.h index 4493c7f2..9b269af5 100644 --- a/src/lib/platform/MSWindowsClipboardBitmapConverter.h +++ b/src/lib/platform/MSWindowsClipboardBitmapConverter.h @@ -31,6 +31,6 @@ public: virtual IClipboard::EFormat getFormat() const; virtual UINT getWin32Format() const; - virtual HANDLE fromIClipboard(const CString&) const; - virtual CString toIClipboard(HANDLE) const; + virtual HANDLE fromIClipboard(const String&) const; + virtual String toIClipboard(HANDLE) const; }; diff --git a/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp b/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp index 84d83034..af08e4b1 100644 --- a/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardHTMLConverter.cpp @@ -46,15 +46,15 @@ CMSWindowsClipboardHTMLConverter::getWin32Format() const return m_format; } -CString -CMSWindowsClipboardHTMLConverter::doFromIClipboard(const CString& data) const +String +CMSWindowsClipboardHTMLConverter::doFromIClipboard(const String& data) const { // prepare to CF_HTML format prefix and suffix - CString prefix("Version:0.9\r\nStartHTML:0000000105\r\n" + String prefix("Version:0.9\r\nStartHTML:0000000105\r\n" "EndHTML:ZZZZZZZZZZ\r\n" "StartFragment:XXXXXXXXXX\r\nEndFragment:YYYYYYYYYY\r\n" ""); - CString suffix("\r\n"); + String suffix("\r\n"); // Get byte offsets for header UInt32 StartFragment = (UInt32)prefix.size(); @@ -75,45 +75,45 @@ CMSWindowsClipboardHTMLConverter::doFromIClipboard(const CString& data) const return prefix; } -CString -CMSWindowsClipboardHTMLConverter::doToIClipboard(const CString& data) const +String +CMSWindowsClipboardHTMLConverter::doToIClipboard(const String& data) const { // get fragment start/end args - CString startArg = findArg(data, "StartFragment"); - CString endArg = findArg(data, "EndFragment"); + String startArg = findArg(data, "StartFragment"); + String endArg = findArg(data, "EndFragment"); if (startArg.empty() || endArg.empty()) { - return CString(); + return String(); } // convert args to integers SInt32 start = (SInt32)atoi(startArg.c_str()); SInt32 end = (SInt32)atoi(endArg.c_str()); if (start <= 0 || end <= 0 || start >= end) { - return CString(); + return String(); } // extract the fragment return data.substr(start, end - start); } -CString +String CMSWindowsClipboardHTMLConverter::findArg( - const CString& data, const CString& name) const + const String& data, const String& name) const { - CString::size_type i = data.find(name); - if (i == CString::npos) { - return CString(); + String::size_type i = data.find(name); + if (i == String::npos) { + return String(); } i = data.find_first_of(":\r\n", i); - if (i == CString::npos || data[i] != ':') { - return CString(); + if (i == String::npos || data[i] != ':') { + return String(); } i = data.find_first_of("0123456789\r\n", i + 1); - if (i == CString::npos || data[i] == '\r' || data[i] == '\n') { - return CString(); + if (i == String::npos || data[i] == '\r' || data[i] == '\n') { + return String(); } - CString::size_type j = data.find_first_not_of("0123456789", i); - if (j == CString::npos) { + String::size_type j = data.find_first_not_of("0123456789", i); + if (j == String::npos) { j = data.size(); } return data.substr(i, j - i); diff --git a/src/lib/platform/MSWindowsClipboardHTMLConverter.h b/src/lib/platform/MSWindowsClipboardHTMLConverter.h index aca33245..32a5a125 100644 --- a/src/lib/platform/MSWindowsClipboardHTMLConverter.h +++ b/src/lib/platform/MSWindowsClipboardHTMLConverter.h @@ -34,11 +34,11 @@ public: protected: // CMSWindowsClipboardAnyTextConverter overrides - virtual CString doFromIClipboard(const CString&) const; - virtual CString doToIClipboard(const CString&) const; + virtual String doFromIClipboard(const String&) const; + virtual String doToIClipboard(const String&) const; private: - CString findArg(const CString& data, const CString& name) const; + String findArg(const String& data, const String& name) const; private: UINT m_format; diff --git a/src/lib/platform/MSWindowsClipboardTextConverter.cpp b/src/lib/platform/MSWindowsClipboardTextConverter.cpp index ee980b5a..9a4e3b24 100644 --- a/src/lib/platform/MSWindowsClipboardTextConverter.cpp +++ b/src/lib/platform/MSWindowsClipboardTextConverter.cpp @@ -40,20 +40,20 @@ CMSWindowsClipboardTextConverter::getWin32Format() const return CF_TEXT; } -CString -CMSWindowsClipboardTextConverter::doFromIClipboard(const CString& data) const +String +CMSWindowsClipboardTextConverter::doFromIClipboard(const String& data) const { // convert and add nul terminator - return CUnicode::UTF8ToText(data) += '\0'; + return Unicode::UTF8ToText(data) += '\0'; } -CString -CMSWindowsClipboardTextConverter::doToIClipboard(const CString& data) const +String +CMSWindowsClipboardTextConverter::doToIClipboard(const String& data) const { // convert and truncate at first nul terminator - CString dst = CUnicode::textToUTF8(data); - CString::size_type n = dst.find('\0'); - if (n != CString::npos) { + String dst = Unicode::textToUTF8(data); + String::size_type n = dst.find('\0'); + if (n != String::npos) { dst.erase(n); } return dst; diff --git a/src/lib/platform/MSWindowsClipboardTextConverter.h b/src/lib/platform/MSWindowsClipboardTextConverter.h index ffcf0fad..f3cf9865 100644 --- a/src/lib/platform/MSWindowsClipboardTextConverter.h +++ b/src/lib/platform/MSWindowsClipboardTextConverter.h @@ -32,6 +32,6 @@ public: protected: // CMSWindowsClipboardAnyTextConverter overrides - virtual CString doFromIClipboard(const CString&) const; - virtual CString doToIClipboard(const CString&) const; + virtual String doFromIClipboard(const String&) const; + virtual String doToIClipboard(const String&) const; }; diff --git a/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp b/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp index b188ea3f..6f488f1e 100644 --- a/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp +++ b/src/lib/platform/MSWindowsClipboardUTF16Converter.cpp @@ -40,20 +40,20 @@ CMSWindowsClipboardUTF16Converter::getWin32Format() const return CF_UNICODETEXT; } -CString -CMSWindowsClipboardUTF16Converter::doFromIClipboard(const CString& data) const +String +CMSWindowsClipboardUTF16Converter::doFromIClipboard(const String& data) const { // convert and add nul terminator - return CUnicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0); + return Unicode::UTF8ToUTF16(data).append(sizeof(wchar_t), 0); } -CString -CMSWindowsClipboardUTF16Converter::doToIClipboard(const CString& data) const +String +CMSWindowsClipboardUTF16Converter::doToIClipboard(const String& data) const { // convert and strip nul terminator - CString dst = CUnicode::UTF16ToUTF8(data); - CString::size_type n = dst.find('\0'); - if (n != CString::npos) { + String dst = Unicode::UTF16ToUTF8(data); + String::size_type n = dst.find('\0'); + if (n != String::npos) { dst.erase(n); } return dst; diff --git a/src/lib/platform/MSWindowsClipboardUTF16Converter.h b/src/lib/platform/MSWindowsClipboardUTF16Converter.h index e02eab62..bc0e97b7 100644 --- a/src/lib/platform/MSWindowsClipboardUTF16Converter.h +++ b/src/lib/platform/MSWindowsClipboardUTF16Converter.h @@ -32,6 +32,6 @@ public: protected: // CMSWindowsClipboardAnyTextConverter overrides - virtual CString doFromIClipboard(const CString&) const; - virtual CString doToIClipboard(const CString&) const; + virtual String doFromIClipboard(const String&) const; + virtual String doToIClipboard(const String&) const; }; diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index b007a122..22fe8606 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -144,7 +144,7 @@ CMSWindowsDesks::enable() // we wouldn't need this if windows notified us of a desktop // change but as far as i can tell it doesn't. m_timer = m_events->newTimer(0.2, NULL); - m_events->adoptHandler(CEvent::kTimer, m_timer, + m_events->adoptHandler(Event::kTimer, m_timer, new TMethodEventJob( this, &CMSWindowsDesks::handleCheckDesk)); @@ -156,7 +156,7 @@ CMSWindowsDesks::disable() { // remove timer if (m_timer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_timer); + m_events->removeHandler(Event::kTimer, m_timer); m_events->deleteTimer(m_timer); m_timer = NULL; } @@ -186,7 +186,7 @@ CMSWindowsDesks::resetOptions() } void -CMSWindowsDesks::setOptions(const COptionsList& options) +CMSWindowsDesks::setOptions(const OptionsList& options) { for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { if (options[i] == kOptionWin32KeepForeground) { @@ -543,7 +543,7 @@ CMSWindowsDesks::deskMouseRelativeMove(SInt32 dx, SInt32 dy) const } void -CMSWindowsDesks::deskEnter(CDesk* desk) +CMSWindowsDesks::deskEnter(Desk* desk) { if (!m_isPrimary) { ReleaseCapture(); @@ -571,7 +571,7 @@ CMSWindowsDesks::deskEnter(CDesk* desk) } void -CMSWindowsDesks::deskLeave(CDesk* desk, HKL keyLayout) +CMSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout) { ShowCursor(FALSE); if (m_isPrimary) { @@ -657,7 +657,7 @@ CMSWindowsDesks::deskThread(void* vdesk) MSG msg; // use given desktop for this thread - CDesk* desk = reinterpret_cast(vdesk); + Desk* desk = reinterpret_cast(vdesk); desk->m_threadID = GetCurrentThreadId(); desk->m_window = NULL; desk->m_foregroundWindow = NULL; @@ -678,7 +678,7 @@ CMSWindowsDesks::deskThread(void* vdesk) // tell main thread that we're ready { - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_deskReady = true; m_deskReady.broadcast(); } @@ -789,7 +789,7 @@ CMSWindowsDesks::deskThread(void* vdesk) } // notify that message was processed - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_deskReady = true; m_deskReady.broadcast(); } @@ -804,14 +804,14 @@ CMSWindowsDesks::deskThread(void* vdesk) } } -CMSWindowsDesks::CDesk* -CMSWindowsDesks::addDesk(const CString& name, HDESK hdesk) +CMSWindowsDesks::Desk* +CMSWindowsDesks::addDesk(const String& name, HDESK hdesk) { - CDesk* desk = new CDesk; + Desk* desk = new Desk; desk->m_name = name; desk->m_desk = hdesk; desk->m_targetID = GetCurrentThreadId(); - desk->m_thread = new CThread(new TMethodJob( + desk->m_thread = new Thread(new TMethodJob( this, &CMSWindowsDesks::deskThread, desk)); waitForDesk(); m_desks.insert(std::make_pair(name, desk)); @@ -821,9 +821,9 @@ CMSWindowsDesks::addDesk(const CString& name, HDESK hdesk) void CMSWindowsDesks::removeDesks() { - for (CDesks::iterator index = m_desks.begin(); + for (Desks::iterator index = m_desks.begin(); index != m_desks.end(); ++index) { - CDesk* desk = index->second; + Desk* desk = index->second; PostThreadMessage(desk->m_threadID, WM_QUIT, 0, 0); desk->m_thread->wait(); delete desk->m_thread; @@ -838,10 +838,10 @@ void CMSWindowsDesks::checkDesk() { // get current desktop. if we already know about it then return. - CDesk* desk; + Desk* desk; HDESK hdesk = openInputDesktop(); - CString name = getDesktopName(hdesk); - CDesks::const_iterator index = m_desks.find(name); + String name = getDesktopName(hdesk); + Desks::const_iterator index = m_desks.find(name); if (index == m_desks.end()) { desk = addDesk(name, hdesk); // hold on to hdesk until thread exits so the desk can't @@ -856,7 +856,7 @@ CMSWindowsDesks::checkDesk() // first switch, then shut down. if (m_stopOnDeskSwitch && m_activeDesk != NULL && name != m_activeDeskName) { LOG((CLOG_DEBUG "shutting down because of desk switch to \"%s\"", name.c_str())); - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); return; } @@ -911,7 +911,7 @@ CMSWindowsDesks::checkDesk() } bool -CMSWindowsDesks::isDeskAccessible(const CDesk* desk) const +CMSWindowsDesks::isDeskAccessible(const Desk* desk) const { return (desk != NULL && desk->m_desk != NULL); } @@ -921,7 +921,7 @@ CMSWindowsDesks::waitForDesk() const { CMSWindowsDesks* self = const_cast(this); - CLock lock(&m_mutex); + Lock lock(&m_mutex); while (!(bool)m_deskReady) { m_deskReady.wait(); } @@ -929,7 +929,7 @@ CMSWindowsDesks::waitForDesk() const } void -CMSWindowsDesks::handleCheckDesk(const CEvent&, void*) +CMSWindowsDesks::handleCheckDesk(const Event&, void*) { checkDesk(); @@ -958,18 +958,18 @@ CMSWindowsDesks::closeDesktop(HDESK desk) } } -CString +String CMSWindowsDesks::getDesktopName(HDESK desk) { if (desk == NULL) { - return CString(); + return String(); } else { DWORD size; GetUserObjectInformation(desk, UOI_NAME, NULL, 0, &size); TCHAR* name = (TCHAR*)alloca(size + sizeof(TCHAR)); GetUserObjectInformation(desk, UOI_NAME, name, size, &size); - CString result(name); + String result(name); return result; } } diff --git a/src/lib/platform/MSWindowsDesks.h b/src/lib/platform/MSWindowsDesks.h index d514487d..aa5e5ca7 100644 --- a/src/lib/platform/MSWindowsDesks.h +++ b/src/lib/platform/MSWindowsDesks.h @@ -30,9 +30,9 @@ #define WIN32_LEAN_AND_MEAN #include -class CEvent; -class CEventQueueTimer; -class CThread; +class Event; +class EventQueueTimer; +class Thread; class IJob; class IScreenSaver; class IEventQueue; @@ -111,7 +111,7 @@ public: Set options to given values. Ignores unknown options and doesn't modify options that aren't given in \c options. */ - void setOptions(const COptionsList& options); + void setOptions(const OptionsList& options); //! Update the key state /*! @@ -192,10 +192,10 @@ public: //@} private: - class CDesk { + class Desk { public: - CString m_name; - CThread* m_thread; + String m_name; + Thread* m_thread; DWORD m_threadID; DWORD m_targetID; HDESK m_desk; @@ -203,7 +203,7 @@ private: HWND m_foregroundWindow; bool m_lowLevel; }; - typedef std::map CDesks; + typedef std::map Desks; // initialization and shutdown operations void queryHookLibrary(HINSTANCE hookLibrary); @@ -217,16 +217,16 @@ private: // message handlers void deskMouseMove(SInt32 x, SInt32 y) const; void deskMouseRelativeMove(SInt32 dx, SInt32 dy) const; - void deskEnter(CDesk* desk); - void deskLeave(CDesk* desk, HKL keyLayout); + void deskEnter(Desk* desk); + void deskLeave(Desk* desk, HKL keyLayout); void deskThread(void* vdesk); // desk switch checking and handling - CDesk* addDesk(const CString& name, HDESK hdesk); + Desk* addDesk(const String& name, HDESK hdesk); void removeDesks(); void checkDesk(); - bool isDeskAccessible(const CDesk* desk) const; - void handleCheckDesk(const CEvent& event, void*); + bool isDeskAccessible(const Desk* desk) const; + void handleCheckDesk(const Event& event, void*); // communication with desk threads void waitForDesk() const; @@ -238,7 +238,7 @@ private: // desk API wrappers HDESK openInputDesktop(); void closeDesktop(HDESK); - CString getDesktopName(HDESK); + String getDesktopName(HDESK); // our desk window procs static LRESULT CALLBACK primaryDeskProc(HWND, UINT, WPARAM, LPARAM); @@ -267,7 +267,7 @@ private: bool m_multimon; // the timer used to check for desktop switching - CEventQueueTimer* m_timer; + EventQueueTimer* m_timer; // screen saver stuff DWORD m_threadID; @@ -275,13 +275,13 @@ private: bool m_screensaverNotify; // the current desk and it's name - CDesk* m_activeDesk; - CString m_activeDeskName; + Desk* m_activeDesk; + String m_activeDeskName; // one desk per desktop and a cond var to communicate with it - CMutex m_mutex; - CCondVar m_deskReady; - CDesks m_desks; + Mutex m_mutex; + CondVar m_deskReady; + Desks m_desks; // hook library stuff InstallFunc m_install; diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.cpp b/src/lib/platform/MSWindowsEventQueueBuffer.cpp index 92241ec4..76dc1e75 100644 --- a/src/lib/platform/MSWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/MSWindowsEventQueueBuffer.cpp @@ -23,10 +23,10 @@ #include "base/IEventQueue.h" // -// CEventQueueTimer +// EventQueueTimer // -class CEventQueueTimer { }; +class EventQueueTimer { }; // @@ -43,7 +43,7 @@ CMSWindowsEventQueueBuffer::CMSWindowsEventQueueBuffer(IEventQueue* events) : m_userEvent = RegisterWindowMessage("SYNERGY_USER_EVENT"); // get message type for daemon quit - m_daemonQuit = CArchMiscWindows::getDaemonQuitMessage(); + m_daemonQuit = ArchMiscWindows::getDaemonQuitMessage(); // make sure this thread has a message queue MSG dummy; @@ -83,7 +83,7 @@ CMSWindowsEventQueueBuffer::waitForEvent(double timeout) } IEventQueueBuffer::Type -CMSWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) +CMSWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID) { // peek at messages first. waiting for QS_ALLINPUT will return // if a message has been sent to our window but GetMessage will @@ -100,11 +100,11 @@ CMSWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) return kNone; } else if (result == 0) { - event = CEvent(CEvent::kQuit); + event = Event(Event::kQuit); return kSystem; } else if (m_daemonQuit != 0 && m_event.message == m_daemonQuit) { - event = CEvent(CEvent::kQuit); + event = Event(Event::kQuit); return kSystem; } else if (m_event.message == m_userEvent) { @@ -112,7 +112,7 @@ CMSWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) return kUser; } else { - event = CEvent(CEvent::kSystem, + event = Event(Event::kSystem, m_events->getSystemTarget(), &m_event); return kSystem; } @@ -131,14 +131,14 @@ CMSWindowsEventQueueBuffer::isEmpty() const return (HIWORD(GetQueueStatus(QS_ALLINPUT)) == 0); } -CEventQueueTimer* +EventQueueTimer* CMSWindowsEventQueueBuffer::newTimer(double, bool) const { - return new CEventQueueTimer; + return new EventQueueTimer; } void -CMSWindowsEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const +CMSWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const { delete timer; } diff --git a/src/lib/platform/MSWindowsEventQueueBuffer.h b/src/lib/platform/MSWindowsEventQueueBuffer.h index 4c916320..6cd03fb2 100644 --- a/src/lib/platform/MSWindowsEventQueueBuffer.h +++ b/src/lib/platform/MSWindowsEventQueueBuffer.h @@ -34,12 +34,12 @@ public: // IEventQueueBuffer overrides virtual void init() { } virtual void waitForEvent(double timeout); - virtual Type getEvent(CEvent& event, UInt32& dataID); + virtual Type getEvent(Event& event, UInt32& dataID); virtual bool addEvent(UInt32 dataID); virtual bool isEmpty() const; - virtual CEventQueueTimer* + virtual EventQueueTimer* newTimer(double duration, bool oneShot) const; - virtual void deleteTimer(CEventQueueTimer*) const; + virtual void deleteTimer(EventQueueTimer*) const; private: DWORD m_thread; diff --git a/src/lib/platform/MSWindowsKeyState.cpp b/src/lib/platform/MSWindowsKeyState.cpp index 3bdb74eb..05bd6c45 100644 --- a/src/lib/platform/MSWindowsKeyState.cpp +++ b/src/lib/platform/MSWindowsKeyState.cpp @@ -555,13 +555,13 @@ const KeyID CMSWindowsKeyState::s_virtualKey[] = /* 0x1ff */ { kKeyNone } // reserved }; -struct CWin32Modifiers { +struct Win32Modifiers { public: UINT m_vk; KeyModifierMask m_mask; }; -static const CWin32Modifiers s_modifiers[] = +static const Win32Modifiers s_modifiers[] = { { VK_SHIFT, KeyModifierShift }, { VK_LSHIFT, KeyModifierShift }, @@ -578,7 +578,7 @@ static const CWin32Modifiers s_modifiers[] = CMSWindowsKeyState::CMSWindowsKeyState( CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events) : - CKeyState(events), + KeyState(events), m_eventTarget(eventTarget), m_desks(desks), m_keyLayout(GetKeyboardLayout(0)), @@ -593,8 +593,8 @@ CMSWindowsKeyState::CMSWindowsKeyState( } CMSWindowsKeyState::CMSWindowsKeyState( - CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, CKeyMap& keyMap) : - CKeyState(events, keyMap), + CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap) : + KeyState(events, keyMap), m_eventTarget(eventTarget), m_desks(desks), m_keyLayout(GetKeyboardLayout(0)), @@ -625,7 +625,7 @@ void CMSWindowsKeyState::disable() { if (m_fixTimer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_fixTimer); + m_events->removeHandler(Event::kTimer, m_fixTimer); m_events->deleteTimer(m_fixTimer); m_fixTimer = NULL; } @@ -672,7 +672,7 @@ CMSWindowsKeyState::useSavedModifiers(bool enable) if (enable != m_useSavedModifiers) { m_useSavedModifiers = enable; if (!m_useSavedModifiers) { - // transfer any modifier state changes to CKeyState's state + // transfer any modifier state changes to KeyState's state KeyModifierMask mask = m_originalSavedModifiers ^ m_savedModifiers; getActiveModifiersRValue() = (getActiveModifiers() & ~mask) | (m_savedModifiers & mask); @@ -759,7 +759,7 @@ CMSWindowsKeyState::mapKeyToVirtualKey(KeyID key) const void CMSWindowsKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState) { - CKeyState::onKey(button, down, newState); + KeyState::onKey(button, down, newState); } void @@ -771,20 +771,20 @@ CMSWindowsKeyState::sendKeyEvent(void* target, if (press || isAutoRepeat) { // send key if (press && !isAutoRepeat) { - CKeyState::sendKeyEvent(target, true, false, + KeyState::sendKeyEvent(target, true, false, key, mask, 1, button); if (count > 0) { --count; } } if (count >= 1) { - CKeyState::sendKeyEvent(target, true, true, + KeyState::sendKeyEvent(target, true, true, key, mask, count, button); } } else { // do key up - CKeyState::sendKeyEvent(target, false, false, key, mask, 1, button); + KeyState::sendKeyEvent(target, false, false, key, mask, 1, button); } } @@ -792,14 +792,14 @@ void CMSWindowsKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button) { - CKeyState::fakeKeyDown(id, mask, button); + KeyState::fakeKeyDown(id, mask, button); } bool CMSWindowsKeyState::fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) { - return CKeyState::fakeKeyRepeat(id, mask, count, button); + return KeyState::fakeKeyRepeat(id, mask, count, button); } bool @@ -817,7 +817,7 @@ CMSWindowsKeyState::fakeCtrlAltDel() CloseHandle( hEvtSendSas ); } else { - CThread cad(new CFunctionJob(&CMSWindowsKeyState::ctrlAltDelThread)); + Thread cad(new FunctionJob(&CMSWindowsKeyState::ctrlAltDelThread)); cad.wait(); } @@ -918,7 +918,7 @@ CMSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const } void -CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap) +CMSWindowsKeyState::getKeyMap(synergy::KeyMap& keyMap) { // update keyboard groups if (getGroups(m_groups)) { @@ -934,7 +934,7 @@ CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap) memset(m_virtualKeyToButton, 0, sizeof(m_virtualKeyToButton)); m_keyToVKMap.clear(); - CKeyMap::KeyItem item; + synergy::KeyMap::KeyItem item; SInt32 numGroups = (SInt32)m_groups.size(); for (SInt32 g = 0; g < numGroups; ++g) { item.m_group = g; @@ -1118,7 +1118,7 @@ CMSWindowsKeyState::getKeyMap(CKeyMap& keyMap) item.m_client = m_buttonToVK[i]; // get flags for modifier keys - CKeyMap::initModifierKey(item); + synergy::KeyMap::initModifierKey(item); if (item.m_id == 0) { // translate virtual key to a character with and without @@ -1292,7 +1292,7 @@ CMSWindowsKeyState::getActiveModifiersRValue() return m_savedModifiers; } else { - return CKeyState::getActiveModifiersRValue(); + return KeyState::getActiveModifiersRValue(); } } @@ -1354,7 +1354,7 @@ CMSWindowsKeyState::mapButtonToVirtualKey(KeyButton button) const } KeyID -CMSWindowsKeyState::getIDForKey(CKeyMap::KeyItem& item, +CMSWindowsKeyState::getIDForKey(synergy::KeyMap::KeyItem& item, KeyButton button, UINT virtualKey, PBYTE keyState, HKL hkl) const { @@ -1366,7 +1366,7 @@ CMSWindowsKeyState::getIDForKey(CKeyMap::KeyItem& item, switch (n) { case -1: - return CKeyMap::getDeadKey(id); + return synergy::KeyMap::getDeadKey(id); default: case 0: @@ -1385,7 +1385,7 @@ CMSWindowsKeyState::getIDForKey(CKeyMap::KeyItem& item, } void -CMSWindowsKeyState::addKeyEntry(CKeyMap& keyMap, CKeyMap::KeyItem& item) +CMSWindowsKeyState::addKeyEntry(synergy::KeyMap& keyMap, synergy::KeyMap::KeyItem& item) { keyMap.addKeyEntry(item); if (item.m_group == 0) { diff --git a/src/lib/platform/MSWindowsKeyState.h b/src/lib/platform/MSWindowsKeyState.h index abba89e9..8e128d93 100644 --- a/src/lib/platform/MSWindowsKeyState.h +++ b/src/lib/platform/MSWindowsKeyState.h @@ -25,8 +25,8 @@ #define WIN32_LEAN_AND_MEAN #include -class CEvent; -class CEventQueueTimer; +class Event; +class EventQueueTimer; class CMSWindowsDesks; class IEventQueue; @@ -34,10 +34,10 @@ class IEventQueue; /*! This class maps KeyIDs to keystrokes. */ -class CMSWindowsKeyState : public CKeyState { +class CMSWindowsKeyState : public KeyState { public: CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events); - CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, CKeyMap& keyMap); + CMSWindowsKeyState(CMSWindowsDesks* desks, void* eventTarget, IEventQueue* events, synergy::KeyMap& keyMap); virtual ~CMSWindowsKeyState(); //! @name manipulators @@ -145,7 +145,7 @@ public: virtual SInt32 pollActiveGroup() const; virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const; - // CKeyState overrides + // KeyState overrides virtual void onKey(KeyButton button, bool down, KeyModifierMask newState); virtual void sendKeyEvent(void* target, @@ -160,8 +160,8 @@ public: void setSavedModifiers(KeyModifierMask value) { m_savedModifiers = value; } protected: - // CKeyState overrides - virtual void getKeyMap(CKeyMap& keyMap); + // KeyState overrides + virtual void getKeyMap(synergy::KeyMap& keyMap); virtual void fakeKey(const Keystroke& keystroke); virtual KeyModifierMask& getActiveModifiersRValue(); @@ -175,11 +175,11 @@ private: bool getGroups(GroupList&) const; void setWindowGroup(SInt32 group); - KeyID getIDForKey(CKeyMap::KeyItem& item, + KeyID getIDForKey(synergy::KeyMap::KeyItem& item, KeyButton button, UINT virtualKey, PBYTE keyState, HKL hkl) const; - void addKeyEntry(CKeyMap& keyMap, CKeyMap::KeyItem& item); + void addKeyEntry(synergy::KeyMap& keyMap, synergy::KeyMap::KeyItem& item); void init(); @@ -202,7 +202,7 @@ private: IEventQueue* m_events; // the timer used to check for fixing key state - CEventQueueTimer* m_fixTimer; + EventQueueTimer* m_fixTimer; // the groups (keyboard layouts) GroupList m_groups; diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 54ae63fb..efaaba70 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -95,7 +95,7 @@ CMSWindowsScreen::CMSWindowsScreen( bool noHooks, bool stopOnDeskSwitch, IEventQueue* events) : - CPlatformScreen(events), + PlatformScreen(events), m_isPrimary(isPrimary), m_noHooks(noHooks), m_isOnScreen(m_isPrimary), @@ -154,7 +154,7 @@ CMSWindowsScreen::CMSWindowsScreen( // SHGetFolderPath is deprecated in vista, but use it for xp support. char desktopPath[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, 0, desktopPath))) { - m_desktopPath = CString(desktopPath); + m_desktopPath = String(desktopPath); LOG((CLOG_DEBUG "using desktop for drop target: %s", m_desktopPath.c_str())); } else { @@ -177,7 +177,7 @@ CMSWindowsScreen::CMSWindowsScreen( } // install event handlers - m_events->adoptHandler(CEvent::kSystem, m_events->getSystemTarget(), + m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(), new TMethodEventJob(this, &CMSWindowsScreen::handleSystemEvent)); @@ -191,7 +191,7 @@ CMSWindowsScreen::~CMSWindowsScreen() disable(); m_events->adoptBuffer(NULL); - m_events->removeHandler(CEvent::kSystem, m_events->getSystemTarget()); + m_events->removeHandler(Event::kSystem, m_events->getSystemTarget()); delete m_keyState; delete m_desks; delete m_screensaver; @@ -228,7 +228,7 @@ CMSWindowsScreen::enable() // we need to poll some things to fix them m_fixTimer = m_events->newTimer(1.0, NULL); - m_events->adoptHandler(CEvent::kTimer, m_fixTimer, + m_events->adoptHandler(Event::kTimer, m_fixTimer, new TMethodEventJob(this, &CMSWindowsScreen::handleFixes)); @@ -249,7 +249,7 @@ CMSWindowsScreen::enable() // prevent the system from entering power saving modes. if // it did we'd be forced to disconnect from the server and // the server would not be able to wake us up. - CArchMiscWindows::addBusyState(CArchMiscWindows::kSYSTEM); + ArchMiscWindows::addBusyState(ArchMiscWindows::kSYSTEM); } } @@ -268,8 +268,8 @@ CMSWindowsScreen::disable() } else { // allow the system to enter power saving mode - CArchMiscWindows::removeBusyState(CArchMiscWindows::kSYSTEM | - CArchMiscWindows::kDISPLAY); + ArchMiscWindows::removeBusyState(ArchMiscWindows::kSYSTEM | + ArchMiscWindows::kDISPLAY); } // tell key state @@ -281,7 +281,7 @@ CMSWindowsScreen::disable() // uninstall fix timer if (m_fixTimer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_fixTimer); + m_events->removeHandler(Event::kTimer, m_fixTimer); m_events->deleteTimer(m_fixTimer); m_fixTimer = NULL; } @@ -309,7 +309,7 @@ CMSWindowsScreen::enter() else { // Entering a secondary screen. Ensure that no screensaver is active // and that the screen is not in powersave mode. - CArchMiscWindows::wakeupDisplay(); + ArchMiscWindows::wakeupDisplay(); if(m_screensaver != NULL && m_screensaverActive) { @@ -370,7 +370,7 @@ CMSWindowsScreen::leave() forceShowCursor(); if (isDraggingStarted() && !m_isPrimary) { - m_sendDragThread = new CThread( + m_sendDragThread = new Thread( new TMethodJob( this, &CMSWindowsScreen::sendDragThread)); @@ -382,12 +382,12 @@ CMSWindowsScreen::leave() void CMSWindowsScreen::sendDragThread(void*) { - CString& draggingFilename = getDraggingFilename(); + String& draggingFilename = getDraggingFilename(); size_t size = draggingFilename.size(); if (draggingFilename.empty() == false) { - CClientApp& app = CClientApp::instance(); - CClient* client = app.getClientPtr(); + ClientApp& app = ClientApp::instance(); + Client* client = app.getClientPtr(); UInt32 fileCount = 1; LOG((CLOG_DEBUG "send dragging info to server: %s", draggingFilename.c_str())); client->sendDragInfo(fileCount, draggingFilename, size); @@ -404,7 +404,7 @@ CMSWindowsScreen::setClipboard(ClipboardID, const IClipboard* src) CMSWindowsClipboard dst(m_window); if (src != NULL) { // save clipboard data - return CClipboard::copy(&dst, src); + return Clipboard::copy(&dst, src); } else { // assert clipboard ownership @@ -488,7 +488,7 @@ CMSWindowsScreen::resetOptions() } void -CMSWindowsScreen::setOptions(const COptionsList& options) +CMSWindowsScreen::setOptions(const OptionsList& options) { m_desks->setOptions(options); } @@ -515,7 +515,7 @@ bool CMSWindowsScreen::getClipboard(ClipboardID, IClipboard* dst) const { CMSWindowsClipboard src(m_window); - CClipboard::copy(dst, &src); + Clipboard::copy(dst, &src); return true; } @@ -625,7 +625,7 @@ CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) bool err; if (key == kKeyNone) { // check if already registered - err = (m_hotKeyToIDMap.count(CHotKeyItem(vk, modifiers)) > 0); + err = (m_hotKeyToIDMap.count(HotKeyItem(vk, modifiers)) > 0); } else { // register with OS @@ -633,17 +633,17 @@ CMSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) } if (!err) { - m_hotKeys.insert(std::make_pair(id, CHotKeyItem(vk, modifiers))); - m_hotKeyToIDMap[CHotKeyItem(vk, modifiers)] = id; + m_hotKeys.insert(std::make_pair(id, HotKeyItem(vk, modifiers))); + m_hotKeyToIDMap[HotKeyItem(vk, modifiers)] = id; } else { m_oldHotKeyIDs.push_back(id); m_hotKeys.erase(id); - LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", CKeyMap::formatKey(key, mask).c_str(), key, mask)); + LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask)); return 0; } - LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", CKeyMap::formatKey(key, mask).c_str(), key, mask, id)); + LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask, id)); return id; } @@ -783,7 +783,7 @@ void CMSWindowsScreen::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button) { - CPlatformScreen::fakeKeyDown(id, mask, button); + PlatformScreen::fakeKeyDown(id, mask, button); updateForceShowCursor(); } @@ -791,7 +791,7 @@ bool CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) { - bool result = CPlatformScreen::fakeKeyRepeat(id, mask, count, button); + bool result = PlatformScreen::fakeKeyRepeat(id, mask, count, button); updateForceShowCursor(); return result; } @@ -799,7 +799,7 @@ CMSWindowsScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask, bool CMSWindowsScreen::fakeKeyUp(KeyButton button) { - bool result = CPlatformScreen::fakeKeyUp(button); + bool result = PlatformScreen::fakeKeyUp(button); updateForceShowCursor(); return result; } @@ -807,7 +807,7 @@ CMSWindowsScreen::fakeKeyUp(KeyButton button) void CMSWindowsScreen::fakeAllKeysUp() { - CPlatformScreen::fakeAllKeysUp(); + PlatformScreen::fakeAllKeysUp(); updateForceShowCursor(); } @@ -915,15 +915,15 @@ CMSWindowsScreen::destroyWindow(HWND hwnd) const } void -CMSWindowsScreen::sendEvent(CEvent::Type type, void* data) +CMSWindowsScreen::sendEvent(Event::Type type, void* data) { - m_events->addEvent(CEvent(type, getEventTarget(), data)); + m_events->addEvent(Event(type, getEventTarget(), data)); } void -CMSWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id) +CMSWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id) { - CClipboardInfo* info = (CClipboardInfo*)malloc(sizeof(CClipboardInfo)); + ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo)); if(info == NULL) { LOG((CLOG_ERR "malloc failed on %s:%s", __FILE__, __LINE__ )); return; @@ -934,12 +934,12 @@ CMSWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id) } void -CMSWindowsScreen::handleSystemEvent(const CEvent& event, void*) +CMSWindowsScreen::handleSystemEvent(const Event& event, void*) { MSG* msg = reinterpret_cast(event.getData()); assert(msg != NULL); - if (CArchMiscWindows::processDialog(msg)) { + if (ArchMiscWindows::processDialog(msg)) { return; } if (onPreDispatch(msg->hwnd, msg->message, msg->wParam, msg->lParam)) { @@ -1080,15 +1080,15 @@ CMSWindowsScreen::onEvent(HWND, UINT msg, case PBT_APMRESUMEAUTOMATIC: case PBT_APMRESUMECRITICAL: case PBT_APMRESUMESUSPEND: - m_events->addEvent(CEvent(m_events->forIScreen().resume(), + m_events->addEvent(Event(m_events->forIScreen().resume(), getEventTarget(), NULL, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); break; case PBT_APMSUSPEND: - m_events->addEvent(CEvent(m_events->forIScreen().suspend(), + m_events->addEvent(Event(m_events->forIScreen().suspend(), getEventTarget(), NULL, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); break; } *result = TRUE; @@ -1266,13 +1266,13 @@ CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam) // find the hot key id HotKeyToIDMap::const_iterator i = - m_hotKeyToIDMap.find(CHotKeyItem(virtKey, modifiers)); + m_hotKeyToIDMap.find(HotKeyItem(virtKey, modifiers)); if (i == m_hotKeyToIDMap.end()) { return false; } // find what kind of event - CEvent::Type type; + Event::Type type; if ((lParam & 0x80000000u) == 0u) { if ((lParam & 0x40000000u) != 0u) { // ignore key repeats but it counts as a hot key @@ -1285,8 +1285,8 @@ CMSWindowsScreen::onHotKey(WPARAM wParam, LPARAM lParam) } // generate event - m_events->addEvent(CEvent(type, getEventTarget(), - CHotKeyInfo::alloc(i->second))); + m_events->addEvent(Event(type, getEventTarget(), + HotKeyInfo::alloc(i->second))); return true; } @@ -1322,14 +1322,14 @@ CMSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam) LOG((CLOG_DEBUG1 "event: button press button=%d", button)); if (button != kButtonNone) { sendEvent(m_events->forIPrimaryScreen().buttonDown(), - CButtonInfo::alloc(button, mask)); + ButtonInfo::alloc(button, mask)); } } else { LOG((CLOG_DEBUG1 "event: button release button=%d", button)); if (button != kButtonNone) { sendEvent(m_events->forIPrimaryScreen().buttonUp(), - CButtonInfo::alloc(button, mask)); + ButtonInfo::alloc(button, mask)); } } } @@ -1371,7 +1371,7 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my) // motion on primary screen sendEvent( m_events->forIPrimaryScreen().motionOnPrimary(), - CMotionInfo::alloc(m_xCursor, m_yCursor)); + MotionInfo::alloc(m_xCursor, m_yCursor)); if (m_buttons[kButtonLeft] == true && m_draggingStarted == false) { m_draggingStarted = true; @@ -1401,7 +1401,7 @@ CMSWindowsScreen::onMouseMove(SInt32 mx, SInt32 my) } else { // send motion - sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), CMotionInfo::alloc(x, y)); + sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y)); } } @@ -1414,7 +1414,7 @@ CMSWindowsScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta) // ignore message if posted prior to last mark change if (!ignore()) { LOG((CLOG_DEBUG1 "event: button wheel delta=%+d,%+d", xDelta, yDelta)); - sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(xDelta, yDelta)); + sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(xDelta, yDelta)); } return true; } @@ -1443,7 +1443,7 @@ CMSWindowsScreen::onScreensaver(bool activated) sendEvent(m_events->forIPrimaryScreen().screensaverActivated()); // enable display power down - CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY); + ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY); } } else { @@ -1452,7 +1452,7 @@ CMSWindowsScreen::onScreensaver(bool activated) sendEvent(m_events->forIPrimaryScreen().screensaverDeactivated()); // disable display power down - CArchMiscWindows::addBusyState(CArchMiscWindows::kDISPLAY); + ArchMiscWindows::addBusyState(ArchMiscWindows::kDISPLAY); } } @@ -1602,7 +1602,7 @@ CMSWindowsScreen::updateScreenShape() } void -CMSWindowsScreen::handleFixes(const CEvent&, void*) +CMSWindowsScreen::handleFixes(const Event&, void*) { // fix clipboard chain fixClipboardViewer(); @@ -1740,11 +1740,11 @@ CMSWindowsScreen::updateKeysCB(void*) // update layouts if necessary if (m_keyState->didGroupsChange()) { - CPlatformScreen::updateKeyMap(); + PlatformScreen::updateKeyMap(); } // now update the keyboard state - CPlatformScreen::updateKeyState(); + PlatformScreen::updateKeyState(); // now see which keys we thought were down but now think are up. // send key releases for these keys to the active client. @@ -1840,10 +1840,10 @@ CMSWindowsScreen::fakeLocalKey(KeyButton button, bool press) const } // -// CMSWindowsScreen::CHotKeyItem +// CMSWindowsScreen::HotKeyItem // -CMSWindowsScreen::CHotKeyItem::CHotKeyItem(UINT keycode, UINT mask) : +CMSWindowsScreen::HotKeyItem::HotKeyItem(UINT keycode, UINT mask) : m_keycode(keycode), m_mask(mask) { @@ -1851,26 +1851,26 @@ CMSWindowsScreen::CHotKeyItem::CHotKeyItem(UINT keycode, UINT mask) : } UINT -CMSWindowsScreen::CHotKeyItem::getVirtualKey() const +CMSWindowsScreen::HotKeyItem::getVirtualKey() const { return m_keycode; } bool -CMSWindowsScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const +CMSWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const { return (m_keycode < x.m_keycode || (m_keycode == x.m_keycode && m_mask < x.m_mask)); } void -CMSWindowsScreen::fakeDraggingFiles(CDragFileList fileList) +CMSWindowsScreen::fakeDraggingFiles(DragFileList fileList) { // possible design flaw: this function stops a "not implemented" // exception from being thrown. } -CString& +String& CMSWindowsScreen::getDraggingFilename() { if (m_draggingStarted) { @@ -1897,7 +1897,7 @@ CMSWindowsScreen::getDraggingFilename() fakeKeyUp(1); fakeMouseButton(kButtonLeft, false); - CString filename; + String filename; DOUBLE timeout = ARCH->time() + .5f; while (ARCH->time() < timeout) { ARCH->sleep(.05f); @@ -1910,7 +1910,7 @@ CMSWindowsScreen::getDraggingFilename() ShowWindow(m_dropWindow, SW_HIDE); if (!filename.empty()) { - if (CDragInformation::isFileValid(filename)) { + if (DragInformation::isFileValid(filename)) { m_draggingFilename = filename; } else { @@ -1926,7 +1926,7 @@ CMSWindowsScreen::getDraggingFilename() return m_draggingFilename; } -const CString& +const String& CMSWindowsScreen::getDropTarget() const { return m_desktopPath; diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h index ab9db641..58f04360 100644 --- a/src/lib/platform/MSWindowsScreen.h +++ b/src/lib/platform/MSWindowsScreen.h @@ -29,15 +29,15 @@ #define WIN32_LEAN_AND_MEAN #include -class CEventQueueTimer; +class EventQueueTimer; class CMSWindowsDesks; class CMSWindowsKeyState; class CMSWindowsScreenSaver; -class CThread; +class Thread; class CMSWindowsDropTarget; //! Implementation of IPlatformScreen for Microsoft Windows -class CMSWindowsScreen : public CPlatformScreen { +class CMSWindowsScreen : public PlatformScreen { public: CMSWindowsScreen( bool isPrimary, @@ -113,17 +113,17 @@ public: virtual void closeScreensaver(); virtual void screensaver(bool activate); virtual void resetOptions(); - virtual void setOptions(const COptionsList& options); + virtual void setOptions(const OptionsList& options); virtual void setSequenceNumber(UInt32); virtual bool isPrimary() const; - virtual void fakeDraggingFiles(CDragFileList fileList); - virtual CString& getDraggingFilename(); - virtual const CString& + virtual void fakeDraggingFiles(DragFileList fileList); + virtual String& getDraggingFilename(); + virtual const String& getDropTarget() const; protected: // IPlatformScreen overrides - virtual void handleSystemEvent(const CEvent&, void*); + virtual void handleSystemEvent(const Event&, void*); virtual void updateButtons(); virtual IKeyState* getKeyState() const; @@ -143,9 +143,9 @@ private: // convenience function to send events public: // HACK - void sendEvent(CEvent::Type type, void* = NULL); + void sendEvent(Event::Type type, void* = NULL); private: // HACK - void sendClipboardEvent(CEvent::Type type, ClipboardID id); + void sendClipboardEvent(Event::Type type, ClipboardID id); // handle message before it gets dispatched. returns true iff // the message should not be dispatched. @@ -183,7 +183,7 @@ private: // HACK void updateScreenShape(); // fix timer callback - void handleFixes(const CEvent&, void*); + void handleFixes(const Event&, void*); // fix the clipboard viewer chain void fixClipboardViewer(); @@ -224,21 +224,21 @@ private: // HACK void sendDragThread(void*); private: - struct CHotKeyItem { + struct HotKeyItem { public: - CHotKeyItem(UINT vk, UINT modifiers); + HotKeyItem(UINT vk, UINT modifiers); UINT getVirtualKey() const; - bool operator<(const CHotKeyItem&) const; + bool operator<(const HotKeyItem&) const; private: UINT m_keycode; UINT m_mask; }; - typedef std::map HotKeyMap; + typedef std::map HotKeyMap; typedef std::vector HotKeyIDList; - typedef std::map HotKeyToIDMap; + typedef std::map HotKeyToIDMap; typedef std::vector PrimaryKeyDownList; static HINSTANCE s_windowInstance; @@ -277,7 +277,7 @@ private: DWORD m_threadID; // timer for periodically checking stuff that requires polling - CEventQueueTimer* m_fixTimer; + EventQueueTimer* m_fixTimer; // the keyboard layout to use when off primary screen HKL m_keyLayout; @@ -331,14 +331,14 @@ private: IEventQueue* m_events; - CString m_desktopPath; + String m_desktopPath; CMSWindowsDropTarget* m_dropTarget; HWND m_dropWindow; const int m_dropWindowSize; - CThread* m_sendDragThread; + Thread* m_sendDragThread; PrimaryKeyDownList m_primaryKeyDownList; }; diff --git a/src/lib/platform/MSWindowsScreenSaver.cpp b/src/lib/platform/MSWindowsScreenSaver.cpp index 233eb826..95fb0eb6 100644 --- a/src/lib/platform/MSWindowsScreenSaver.cpp +++ b/src/lib/platform/MSWindowsScreenSaver.cpp @@ -112,7 +112,7 @@ CMSWindowsScreenSaver::enable() } // restore display power down - CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY); + ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY); } void @@ -128,7 +128,7 @@ CMSWindowsScreenSaver::disable() } // disable display power down - CArchMiscWindows::addBusyState(CArchMiscWindows::kDISPLAY); + ArchMiscWindows::addBusyState(ArchMiscWindows::kDISPLAY); } void @@ -147,7 +147,7 @@ CMSWindowsScreenSaver::activate() } // restore power save when screen saver activates - CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY); + ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY); } } @@ -187,7 +187,7 @@ CMSWindowsScreenSaver::deactivate() m_wasEnabled, 0, SPIF_SENDWININICHANGE); // disable display power down - CArchMiscWindows::removeBusyState(CArchMiscWindows::kDISPLAY); + ArchMiscWindows::removeBusyState(ArchMiscWindows::kDISPLAY); } bool @@ -220,7 +220,7 @@ CMSWindowsScreenSaver::watchDesktop() // watch desktop in another thread LOG((CLOG_DEBUG "watching screen saver desktop")); m_active = true; - m_watch = new CThread(new TMethodJob(this, + m_watch = new Thread(new TMethodJob(this, &CMSWindowsScreenSaver::watchDesktopThread)); } @@ -235,7 +235,7 @@ CMSWindowsScreenSaver::watchProcess(HANDLE process) LOG((CLOG_DEBUG "watching screen saver process")); m_process = process; m_active = true; - m_watch = new CThread(new TMethodJob(this, + m_watch = new Thread(new TMethodJob(this, &CMSWindowsScreenSaver::watchProcessThread)); } } @@ -284,7 +284,7 @@ void CMSWindowsScreenSaver::watchProcessThread(void*) { for (;;) { - CThread::testCancel(); + Thread::testCancel(); if (WaitForSingleObject(m_process, 50) == WAIT_OBJECT_0) { // process terminated LOG((CLOG_DEBUG "screen saver died")); @@ -301,19 +301,19 @@ void CMSWindowsScreenSaver::setSecure(bool secure, bool saveSecureAsInt) { HKEY hkey = - CArchMiscWindows::addKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure); + ArchMiscWindows::addKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure); if (hkey == NULL) { return; } if (saveSecureAsInt) { - CArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? 1 : 0); + ArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? 1 : 0); } else { - CArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? "1" : "0"); + ArchMiscWindows::setValue(hkey, g_isSecureNT, secure ? "1" : "0"); } - CArchMiscWindows::closeKey(hkey); + ArchMiscWindows::closeKey(hkey); } bool @@ -321,7 +321,7 @@ CMSWindowsScreenSaver::isSecure(bool* wasSecureFlagAnInt) const { // get the password protection setting key HKEY hkey = - CArchMiscWindows::openKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure); + ArchMiscWindows::openKey(HKEY_CURRENT_USER, g_pathScreenSaverIsSecure); if (hkey == NULL) { return false; } @@ -329,28 +329,28 @@ CMSWindowsScreenSaver::isSecure(bool* wasSecureFlagAnInt) const // get the value. the value may be an int or a string, depending // on the version of windows. bool result; - switch (CArchMiscWindows::typeOfValue(hkey, g_isSecureNT)) { + switch (ArchMiscWindows::typeOfValue(hkey, g_isSecureNT)) { default: result = false; break; - case CArchMiscWindows::kUINT: { + case ArchMiscWindows::kUINT: { DWORD value = - CArchMiscWindows::readValueInt(hkey, g_isSecureNT); + ArchMiscWindows::readValueInt(hkey, g_isSecureNT); *wasSecureFlagAnInt = true; result = (value != 0); break; } - case CArchMiscWindows::kSTRING: { + case ArchMiscWindows::kSTRING: { std::string value = - CArchMiscWindows::readValueString(hkey, g_isSecureNT); + ArchMiscWindows::readValueString(hkey, g_isSecureNT); *wasSecureFlagAnInt = false; result = (value != "0"); break; } } - CArchMiscWindows::closeKey(hkey); + ArchMiscWindows::closeKey(hkey); return result; } diff --git a/src/lib/platform/MSWindowsScreenSaver.h b/src/lib/platform/MSWindowsScreenSaver.h index 3ca60f4b..3f2234a7 100644 --- a/src/lib/platform/MSWindowsScreenSaver.h +++ b/src/lib/platform/MSWindowsScreenSaver.h @@ -24,7 +24,7 @@ #define WIN32_LEAN_AND_MEAN #include -class CThread; +class Thread; //! Microsoft windows screen saver implementation class CMSWindowsScreenSaver : public IScreenSaver { @@ -54,7 +54,7 @@ public: virtual bool isActive() const; private: - class CFindScreenSaverInfo { + class FindScreenSaverInfo { public: HDESK m_desktop; HWND m_window; @@ -77,7 +77,7 @@ private: bool m_wasSecureAnInt; HANDLE m_process; - CThread* m_watch; + Thread* m_watch; DWORD m_threadID; UINT m_msg; WPARAM m_wParam; diff --git a/src/lib/platform/MSWindowsUtil.cpp b/src/lib/platform/MSWindowsUtil.cpp index 74c1dbb6..b325fb62 100644 --- a/src/lib/platform/MSWindowsUtil.cpp +++ b/src/lib/platform/MSWindowsUtil.cpp @@ -26,7 +26,7 @@ // CMSWindowsUtil // -CString +String CMSWindowsUtil::getString(HINSTANCE instance, DWORD id) { char buffer[1024]; @@ -51,12 +51,12 @@ CMSWindowsUtil::getString(HINSTANCE instance, DWORD id) } while (n == size); msg[n] = '\0'; - CString result(msg); + String result(msg); delete[] msg; return result; } -CString +String CMSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id) { char* buffer; @@ -69,12 +69,12 @@ CMSWindowsUtil::getErrorString(HINSTANCE hinstance, DWORD error, DWORD id) (LPTSTR)&buffer, 0, NULL) == 0) { - CString errorString = synergy::string::sprintf("%d", error); + String errorString = synergy::string::sprintf("%d", error); return synergy::string::format(getString(hinstance, id).c_str(), errorString.c_str()); } else { - CString result(buffer); + String result(buffer); LocalFree(buffer); return result; } diff --git a/src/lib/platform/MSWindowsUtil.h b/src/lib/platform/MSWindowsUtil.h index 573d7c60..9a7db5c0 100644 --- a/src/lib/platform/MSWindowsUtil.h +++ b/src/lib/platform/MSWindowsUtil.h @@ -29,12 +29,12 @@ public: /*! Gets a string for \p id from the string table of \p instance. */ - static CString getString(HINSTANCE instance, DWORD id); + static String getString(HINSTANCE instance, DWORD id); //! Get error string /*! Gets a system error message for \p error. If the error cannot be found return the string for \p id, replacing ${1} with \p error. */ - static CString getErrorString(HINSTANCE, DWORD error, DWORD id); + static String getErrorString(HINSTANCE, DWORD error, DWORD id); }; diff --git a/src/lib/platform/MSWindowsWatchdog.cpp b/src/lib/platform/MSWindowsWatchdog.cpp index 8bf98b3c..156d997c 100644 --- a/src/lib/platform/MSWindowsWatchdog.cpp +++ b/src/lib/platform/MSWindowsWatchdog.cpp @@ -47,8 +47,8 @@ const char g_activeDesktop[] = {"activeDesktop:"}; CMSWindowsWatchdog::CMSWindowsWatchdog( bool autoDetectCommand, - CIpcServer& ipcServer, - CIpcLogOutputter& ipcLogOutputter) : + IpcServer& ipcServer, + IpcLogOutputter& ipcLogOutputter) : m_thread(NULL), m_autoDetectCommand(autoDetectCommand), m_monitoring(true), @@ -82,10 +82,10 @@ CMSWindowsWatchdog::~CMSWindowsWatchdog() void CMSWindowsWatchdog::startAsync() { - m_thread = new CThread(new TMethodJob( + m_thread = new Thread(new TMethodJob( this, &CMSWindowsWatchdog::mainLoop, nullptr)); - m_outputThread = new CThread(new TMethodJob( + m_outputThread = new Thread(new TMethodJob( this, &CMSWindowsWatchdog::outputLoop, nullptr)); } @@ -381,7 +381,7 @@ CMSWindowsWatchdog::getCommand() const } // seems like a fairly convoluted way to get the process name - const char* launchName = CApp::instance().argsBase().m_pname; + const char* launchName = App::instance().argsBase().m_pname; std::string args = ARCH->commandLine(); // build up a full command line @@ -440,7 +440,7 @@ CMSWindowsWatchdog::shutdownProcess(HANDLE handle, DWORD pid, int timeout) return; } - CIpcShutdownMessage shutdown; + IpcShutdownMessage shutdown; m_ipcServer.send(shutdown, kIpcClientNode); // wait for process to exit gracefully. diff --git a/src/lib/platform/MSWindowsWatchdog.h b/src/lib/platform/MSWindowsWatchdog.h index 4d2b1166..ef548c83 100644 --- a/src/lib/platform/MSWindowsWatchdog.h +++ b/src/lib/platform/MSWindowsWatchdog.h @@ -27,17 +27,17 @@ #include #include -class CThread; -class CIpcLogOutputter; -class CIpcServer; -class CFileLogOutputter; +class Thread; +class IpcLogOutputter; +class IpcServer; +class FileLogOutputter; class CMSWindowsWatchdog { public: CMSWindowsWatchdog( bool autoDetectCommand, - CIpcServer& ipcServer, - CIpcLogOutputter& ipcLogOutputter); + IpcServer& ipcServer, + IpcLogOutputter& ipcLogOutputter); virtual ~CMSWindowsWatchdog(); void startAsync(); @@ -61,16 +61,16 @@ private: void testOutput(CString buffer); private: - CThread* m_thread; + Thread* m_thread; bool m_autoDetectCommand; std::string m_command; bool m_monitoring; bool m_commandChanged; HANDLE m_stdOutWrite; HANDLE m_stdOutRead; - CThread* m_outputThread; - CIpcServer& m_ipcServer; - CIpcLogOutputter& m_ipcLogOutputter; + Thread* m_outputThread; + IpcServer& m_ipcServer; + IpcLogOutputter& m_ipcLogOutputter; bool m_elevateProcess; CMSWindowsSession m_session; PROCESS_INFORMATION m_processInfo; @@ -89,8 +89,8 @@ An error occured in the process watchdog. */ class XMSWindowsWatchdogError : public XSynergy { public: - XMSWindowsWatchdogError(const CString& msg) : XSynergy(msg) { } + XMSWindowsWatchdogError(const String& msg) : XSynergy(msg) { } // XBase overrides - virtual CString getWhat() const throw() { return what(); } + virtual String getWhat() const throw() { return what(); } }; diff --git a/src/lib/platform/OSXClipboard.cpp b/src/lib/platform/OSXClipboard.cpp index 025f5754..a1a5b337 100644 --- a/src/lib/platform/OSXClipboard.cpp +++ b/src/lib/platform/OSXClipboard.cpp @@ -27,17 +27,17 @@ #include "arch/XArch.h" // -// COSXClipboard +// OSXClipboard // -COSXClipboard::COSXClipboard() : +OSXClipboard::OSXClipboard() : m_time(0), m_pboard(NULL) { - m_converters.push_back(new COSXClipboardHTMLConverter); - m_converters.push_back(new COSXClipboardBMPConverter); - m_converters.push_back(new COSXClipboardUTF16Converter); - m_converters.push_back(new COSXClipboardTextConverter); + m_converters.push_back(new OSXClipboardHTMLConverter); + m_converters.push_back(new OSXClipboardBMPConverter); + m_converters.push_back(new OSXClipboardUTF16Converter); + m_converters.push_back(new OSXClipboardTextConverter); @@ -56,13 +56,13 @@ COSXClipboard::COSXClipboard() : } } -COSXClipboard::~COSXClipboard() +OSXClipboard::~OSXClipboard() { clearConverters(); } bool -COSXClipboard::empty() +OSXClipboard::empty() { LOG((CLOG_DEBUG "emptying clipboard")); if (m_pboard == NULL) @@ -78,7 +78,7 @@ COSXClipboard::empty() } bool -COSXClipboard::synchronize() +OSXClipboard::synchronize() { if (m_pboard == NULL) return false; @@ -93,7 +93,7 @@ COSXClipboard::synchronize() } void -COSXClipboard::add(EFormat format, const CString & data) +OSXClipboard::add(EFormat format, const String & data) { bool emptied = false; if (m_pboard == NULL) @@ -117,7 +117,7 @@ COSXClipboard::add(EFormat format, const CString & data) // skip converters for other formats if (converter->getFormat() == format) { - CString osXData = converter->fromIClipboard(data); + String osXData = converter->fromIClipboard(data); CFStringRef flavorType = converter->getOSXFormat(); CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, (UInt8 *)osXData.data(), osXData.size()); @@ -143,7 +143,7 @@ COSXClipboard::add(EFormat format, const CString & data) } bool -COSXClipboard::open(Time time) const +OSXClipboard::open(Time time) const { if (m_pboard == NULL) return false; @@ -154,20 +154,20 @@ COSXClipboard::open(Time time) const } void -COSXClipboard::close() const +OSXClipboard::close() const { LOG((CLOG_DEBUG "closing clipboard")); /* not needed */ } IClipboard::Time -COSXClipboard::getTime() const +OSXClipboard::getTime() const { return m_time; } bool -COSXClipboard::has(EFormat format) const +OSXClipboard::has(EFormat format) const { if (m_pboard == NULL) return false; @@ -193,12 +193,12 @@ COSXClipboard::has(EFormat format) const return false; } -CString -COSXClipboard::get(EFormat format) const +String +OSXClipboard::get(EFormat format) const { CFStringRef type; PasteboardItemID item; - CString result; + String result; if (m_pboard == NULL) return result; @@ -237,13 +237,13 @@ COSXClipboard::get(EFormat format) const throw err; } - result = CString((char *) CFDataGetBytePtr(buffer), CFDataGetLength(buffer)); + result = String((char *) CFDataGetBytePtr(buffer), CFDataGetLength(buffer)); } catch (OSStatus err) { - LOG((CLOG_DEBUG "exception thrown in COSXClipboard::get MacError (%d)", err)); + LOG((CLOG_DEBUG "exception thrown in OSXClipboard::get MacError (%d)", err)); } catch (...) { - LOG((CLOG_DEBUG "unknown exception in COSXClipboard::get")); + LOG((CLOG_DEBUG "unknown exception in OSXClipboard::get")); RETHROW_XTHREAD } @@ -254,7 +254,7 @@ COSXClipboard::get(EFormat format) const } void -COSXClipboard::clearConverters() +OSXClipboard::clearConverters() { if (m_pboard == NULL) return; diff --git a/src/lib/platform/OSXClipboard.h b/src/lib/platform/OSXClipboard.h index e76c13fb..ab428d10 100644 --- a/src/lib/platform/OSXClipboard.h +++ b/src/lib/platform/OSXClipboard.h @@ -26,22 +26,22 @@ class IOSXClipboardConverter; //! OS X clipboard implementation -class COSXClipboard : public IClipboard { +class OSXClipboard : public IClipboard { public: - COSXClipboard(); - virtual ~COSXClipboard(); + OSXClipboard(); + virtual ~OSXClipboard(); //! Test if clipboard is owned by synergy static bool isOwnedBySynergy(); // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const CString& data); + virtual void add(EFormat, const String& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual CString get(EFormat) const; + virtual String get(EFormat) const; bool synchronize(); private: @@ -82,14 +82,14 @@ public: getFormat(). The return data will be in the scrap format returned by getOSXFormat(). */ - virtual CString fromIClipboard(const CString&) const = 0; + virtual String fromIClipboard(const String&) const = 0; //! Convert to IClipboard format /*! Convert from the carbon scrap format to the IClipboard format (i.e., the reverse of fromIClipboard()). */ - virtual CString toIClipboard(const CString&) const = 0; + virtual String toIClipboard(const String&) const = 0; //@} }; diff --git a/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp b/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp index a41982ea..1d17b9f2 100644 --- a/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp +++ b/src/lib/platform/OSXClipboardAnyBitmapConverter.cpp @@ -19,30 +19,30 @@ #include "platform/OSXClipboardAnyBitmapConverter.h" #include -COSXClipboardAnyBitmapConverter::COSXClipboardAnyBitmapConverter() +OSXClipboardAnyBitmapConverter::OSXClipboardAnyBitmapConverter() { // do nothing } -COSXClipboardAnyBitmapConverter::~COSXClipboardAnyBitmapConverter() +OSXClipboardAnyBitmapConverter::~OSXClipboardAnyBitmapConverter() { // do nothing } IClipboard::EFormat -COSXClipboardAnyBitmapConverter::getFormat() const +OSXClipboardAnyBitmapConverter::getFormat() const { return IClipboard::kBitmap; } -CString -COSXClipboardAnyBitmapConverter::fromIClipboard(const CString& data) const +String +OSXClipboardAnyBitmapConverter::fromIClipboard(const String& data) const { return doFromIClipboard(data); } -CString -COSXClipboardAnyBitmapConverter::toIClipboard(const CString& data) const +String +OSXClipboardAnyBitmapConverter::toIClipboard(const String& data) const { return doToIClipboard(data); } diff --git a/src/lib/platform/OSXClipboardAnyBitmapConverter.h b/src/lib/platform/OSXClipboardAnyBitmapConverter.h index eb4a51bc..0ad3c4d0 100644 --- a/src/lib/platform/OSXClipboardAnyBitmapConverter.h +++ b/src/lib/platform/OSXClipboardAnyBitmapConverter.h @@ -21,28 +21,28 @@ #include "platform/OSXClipboard.h" //! Convert to/from some text encoding -class COSXClipboardAnyBitmapConverter : public IOSXClipboardConverter { +class OSXClipboardAnyBitmapConverter : public IOSXClipboardConverter { public: - COSXClipboardAnyBitmapConverter(); - virtual ~COSXClipboardAnyBitmapConverter(); + OSXClipboardAnyBitmapConverter(); + virtual ~OSXClipboardAnyBitmapConverter(); // IOSXClipboardConverter overrides virtual IClipboard::EFormat getFormat() const; virtual CFStringRef getOSXFormat() const = 0; - virtual CString fromIClipboard(const CString &) const; - virtual CString toIClipboard(const CString &) const; + virtual String fromIClipboard(const String &) const; + virtual String toIClipboard(const String &) const; protected: //! Convert from IClipboard format /*! Do UTF-8 conversion and linefeed conversion. */ - virtual CString doFromIClipboard(const CString&) const = 0; + virtual String doFromIClipboard(const String&) const = 0; //! Convert to IClipboard format /*! Do UTF-8 conversion and Linefeed conversion. */ - virtual CString doToIClipboard(const CString&) const = 0; + virtual String doToIClipboard(const String&) const = 0; }; diff --git a/src/lib/platform/OSXClipboardAnyTextConverter.cpp b/src/lib/platform/OSXClipboardAnyTextConverter.cpp index 8dac60ce..5d29cb3f 100644 --- a/src/lib/platform/OSXClipboardAnyTextConverter.cpp +++ b/src/lib/platform/OSXClipboardAnyTextConverter.cpp @@ -21,34 +21,34 @@ #include // -// COSXClipboardAnyTextConverter +// OSXClipboardAnyTextConverter // -COSXClipboardAnyTextConverter::COSXClipboardAnyTextConverter() +OSXClipboardAnyTextConverter::OSXClipboardAnyTextConverter() { // do nothing } -COSXClipboardAnyTextConverter::~COSXClipboardAnyTextConverter() +OSXClipboardAnyTextConverter::~OSXClipboardAnyTextConverter() { // do nothing } IClipboard::EFormat -COSXClipboardAnyTextConverter::getFormat() const +OSXClipboardAnyTextConverter::getFormat() const { return IClipboard::kText; } -CString -COSXClipboardAnyTextConverter::fromIClipboard(const CString& data) const +String +OSXClipboardAnyTextConverter::fromIClipboard(const String& data) const { // convert linefeeds and then convert to desired encoding return doFromIClipboard(convertLinefeedToMacOS(data)); } -CString -COSXClipboardAnyTextConverter::toIClipboard(const CString& data) const +String +OSXClipboardAnyTextConverter::toIClipboard(const String& data) const { // convert text then newlines return convertLinefeedToUnix(doToIClipboard(data)); @@ -68,21 +68,21 @@ isCR(char ch) return (ch == '\r'); } -CString -COSXClipboardAnyTextConverter::convertLinefeedToMacOS(const CString& src) +String +OSXClipboardAnyTextConverter::convertLinefeedToMacOS(const String& src) { // note -- we assume src is a valid UTF-8 string - CString copy = src; + String copy = src; std::replace_if(copy.begin(), copy.end(), isLF, '\r'); return copy; } -CString -COSXClipboardAnyTextConverter::convertLinefeedToUnix(const CString& src) +String +OSXClipboardAnyTextConverter::convertLinefeedToUnix(const String& src) { - CString copy = src; + String copy = src; std::replace_if(copy.begin(), copy.end(), isCR, '\n'); diff --git a/src/lib/platform/OSXClipboardAnyTextConverter.h b/src/lib/platform/OSXClipboardAnyTextConverter.h index d6231196..f26e34c8 100644 --- a/src/lib/platform/OSXClipboardAnyTextConverter.h +++ b/src/lib/platform/OSXClipboardAnyTextConverter.h @@ -21,33 +21,33 @@ #include "platform/OSXClipboard.h" //! Convert to/from some text encoding -class COSXClipboardAnyTextConverter : public IOSXClipboardConverter { +class OSXClipboardAnyTextConverter : public IOSXClipboardConverter { public: - COSXClipboardAnyTextConverter(); - virtual ~COSXClipboardAnyTextConverter(); + OSXClipboardAnyTextConverter(); + virtual ~OSXClipboardAnyTextConverter(); // IOSXClipboardConverter overrides virtual IClipboard::EFormat getFormat() const; virtual CFStringRef getOSXFormat() const = 0; - virtual CString fromIClipboard(const CString &) const; - virtual CString toIClipboard(const CString &) const; + virtual String fromIClipboard(const String &) const; + virtual String toIClipboard(const String &) const; protected: //! Convert from IClipboard format /*! Do UTF-8 conversion and linefeed conversion. */ - virtual CString doFromIClipboard(const CString&) const = 0; + virtual String doFromIClipboard(const String&) const = 0; //! Convert to IClipboard format /*! Do UTF-8 conversion and Linefeed conversion. */ - virtual CString doToIClipboard(const CString&) const = 0; + virtual String doToIClipboard(const String&) const = 0; private: - static CString convertLinefeedToMacOS(const CString&); - static CString convertLinefeedToUnix(const CString&); + static String convertLinefeedToMacOS(const String&); + static String convertLinefeedToUnix(const String&); }; diff --git a/src/lib/platform/OSXClipboardBMPConverter.cpp b/src/lib/platform/OSXClipboardBMPConverter.cpp index 4190e6a0..fd2b3db9 100644 --- a/src/lib/platform/OSXClipboardBMPConverter.cpp +++ b/src/lib/platform/OSXClipboardBMPConverter.cpp @@ -68,33 +68,33 @@ toLE(UInt8*& dst, UInt32 src) dst += 4; } -COSXClipboardBMPConverter::COSXClipboardBMPConverter() +OSXClipboardBMPConverter::OSXClipboardBMPConverter() { // do nothing } -COSXClipboardBMPConverter::~COSXClipboardBMPConverter() +OSXClipboardBMPConverter::~OSXClipboardBMPConverter() { // do nothing } IClipboard::EFormat -COSXClipboardBMPConverter::getFormat() const +OSXClipboardBMPConverter::getFormat() const { return IClipboard::kBitmap; } CFStringRef -COSXClipboardBMPConverter::getOSXFormat() const +OSXClipboardBMPConverter::getOSXFormat() const { // TODO: does this only work with Windows? return CFSTR("com.microsoft.bmp"); } -CString -COSXClipboardBMPConverter::fromIClipboard(const CString& bmp) const +String +OSXClipboardBMPConverter::fromIClipboard(const String& bmp) const { - LOG((CLOG_DEBUG1 "ENTER COSXClipboardBMPConverter::doFromIClipboard()")); + LOG((CLOG_DEBUG1 "ENTER OSXClipboardBMPConverter::doFromIClipboard()")); // create BMP image UInt8 header[14]; UInt8* dst = header; @@ -104,21 +104,21 @@ COSXClipboardBMPConverter::fromIClipboard(const CString& bmp) const toLE(dst, static_cast(0)); toLE(dst, static_cast(0)); toLE(dst, static_cast(14 + 40)); - return CString(reinterpret_cast(header), 14) + bmp; + return String(reinterpret_cast(header), 14) + bmp; } -CString -COSXClipboardBMPConverter::toIClipboard(const CString& bmp) const +String +OSXClipboardBMPConverter::toIClipboard(const String& bmp) const { // make sure data is big enough for a BMP file if (bmp.size() <= 14 + 40) { - return CString(); + return String(); } // check BMP file header const UInt8* rawBMPHeader = reinterpret_cast(bmp.data()); if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') { - return CString(); + return String(); } // get offset to image data diff --git a/src/lib/platform/OSXClipboardBMPConverter.h b/src/lib/platform/OSXClipboardBMPConverter.h index af505b79..f19c1de6 100644 --- a/src/lib/platform/OSXClipboardBMPConverter.h +++ b/src/lib/platform/OSXClipboardBMPConverter.h @@ -21,10 +21,10 @@ #include "platform/OSXClipboard.h" //! Convert to/from some text encoding -class COSXClipboardBMPConverter : public IOSXClipboardConverter { +class OSXClipboardBMPConverter : public IOSXClipboardConverter { public: - COSXClipboardBMPConverter(); - virtual ~COSXClipboardBMPConverter(); + OSXClipboardBMPConverter(); + virtual ~OSXClipboardBMPConverter(); // IMSWindowsClipboardConverter overrides virtual IClipboard::EFormat @@ -33,12 +33,12 @@ public: virtual CFStringRef getOSXFormat() const; - // COSXClipboardAnyBMPConverter overrides - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + // OSXClipboardAnyBMPConverter overrides + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; // generic encoding converter - static CString convertString(const CString& data, + static String convertString(const String& data, CFStringEncoding fromEncoding, CFStringEncoding toEncoding); }; diff --git a/src/lib/platform/OSXClipboardHTMLConverter.cpp b/src/lib/platform/OSXClipboardHTMLConverter.cpp index b2e60e00..dd06d26e 100644 --- a/src/lib/platform/OSXClipboardHTMLConverter.cpp +++ b/src/lib/platform/OSXClipboardHTMLConverter.cpp @@ -20,31 +20,31 @@ #include "base/Unicode.h" -COSXClipboardHTMLConverter::COSXClipboardHTMLConverter() +OSXClipboardHTMLConverter::OSXClipboardHTMLConverter() { // do nothing } -COSXClipboardHTMLConverter::~COSXClipboardHTMLConverter() +OSXClipboardHTMLConverter::~OSXClipboardHTMLConverter() { // do nothing } IClipboard::EFormat -COSXClipboardHTMLConverter::getFormat() const +OSXClipboardHTMLConverter::getFormat() const { return IClipboard::kHTML; } CFStringRef -COSXClipboardHTMLConverter::getOSXFormat() const +OSXClipboardHTMLConverter::getOSXFormat() const { return CFSTR("public.html"); } -CString -COSXClipboardHTMLConverter::convertString( - const CString& data, +String +OSXClipboardHTMLConverter::convertString( + const String& data, CFStringEncoding fromEncoding, CFStringEncoding toEncoding) { @@ -53,7 +53,7 @@ COSXClipboardHTMLConverter::convertString( data.c_str(), fromEncoding); if (stringRef == NULL) { - return CString(); + return String(); } CFIndex buffSize; @@ -66,13 +66,13 @@ COSXClipboardHTMLConverter::convertString( if (buffer == NULL) { CFRelease(stringRef); - return CString(); + return String(); } CFStringGetBytes(stringRef, entireString, toEncoding, 0, false, (UInt8*)buffer, buffSize, NULL); - CString result(buffer, buffSize); + String result(buffer, buffSize); delete[] buffer; CFRelease(stringRef); @@ -80,15 +80,15 @@ COSXClipboardHTMLConverter::convertString( return result; } -CString -COSXClipboardHTMLConverter::doFromIClipboard(const CString& data) const +String +OSXClipboardHTMLConverter::doFromIClipboard(const String& data) const { return convertString(data, kCFStringEncodingUTF8, CFStringGetSystemEncoding()); } -CString -COSXClipboardHTMLConverter::doToIClipboard(const CString& data) const +String +OSXClipboardHTMLConverter::doToIClipboard(const String& data) const { return convertString(data, CFStringGetSystemEncoding(), kCFStringEncodingUTF8); diff --git a/src/lib/platform/OSXClipboardHTMLConverter.h b/src/lib/platform/OSXClipboardHTMLConverter.h index a038ee6c..379b5644 100644 --- a/src/lib/platform/OSXClipboardHTMLConverter.h +++ b/src/lib/platform/OSXClipboardHTMLConverter.h @@ -21,10 +21,10 @@ #include "OSXClipboardAnyTextConverter.h" //! Convert to/from HTML encoding -class COSXClipboardHTMLConverter : public COSXClipboardAnyTextConverter { +class OSXClipboardHTMLConverter : public OSXClipboardAnyTextConverter { public: - COSXClipboardHTMLConverter(); - virtual ~COSXClipboardHTMLConverter(); + OSXClipboardHTMLConverter(); + virtual ~OSXClipboardHTMLConverter(); // IMSWindowsClipboardConverter overrides virtual IClipboard::EFormat @@ -33,12 +33,12 @@ public: virtual CFStringRef getOSXFormat() const; protected: - // COSXClipboardAnyTextConverter overrides - virtual CString doFromIClipboard(const CString&) const; - virtual CString doToIClipboard(const CString&) const; + // OSXClipboardAnyTextConverter overrides + virtual String doFromIClipboard(const String&) const; + virtual String doToIClipboard(const String&) const; // generic encoding converter - static CString convertString(const CString& data, + static String convertString(const String& data, CFStringEncoding fromEncoding, CFStringEncoding toEncoding); }; diff --git a/src/lib/platform/OSXClipboardTextConverter.cpp b/src/lib/platform/OSXClipboardTextConverter.cpp index b8be020d..194f3de3 100644 --- a/src/lib/platform/OSXClipboardTextConverter.cpp +++ b/src/lib/platform/OSXClipboardTextConverter.cpp @@ -21,28 +21,28 @@ #include "base/Unicode.h" // -// COSXClipboardTextConverter +// OSXClipboardTextConverter // -COSXClipboardTextConverter::COSXClipboardTextConverter() +OSXClipboardTextConverter::OSXClipboardTextConverter() { // do nothing } -COSXClipboardTextConverter::~COSXClipboardTextConverter() +OSXClipboardTextConverter::~OSXClipboardTextConverter() { // do nothing } CFStringRef -COSXClipboardTextConverter::getOSXFormat() const +OSXClipboardTextConverter::getOSXFormat() const { return CFSTR("public.plain-text"); } -CString -COSXClipboardTextConverter::convertString( - const CString& data, +String +OSXClipboardTextConverter::convertString( + const String& data, CFStringEncoding fromEncoding, CFStringEncoding toEncoding) { @@ -51,7 +51,7 @@ COSXClipboardTextConverter::convertString( data.c_str(), fromEncoding); if (stringRef == NULL) { - return CString(); + return String(); } CFIndex buffSize; @@ -64,13 +64,13 @@ COSXClipboardTextConverter::convertString( if (buffer == NULL) { CFRelease(stringRef); - return CString(); + return String(); } CFStringGetBytes(stringRef, entireString, toEncoding, 0, false, (UInt8*)buffer, buffSize, NULL); - CString result(buffer, buffSize); + String result(buffer, buffSize); delete[] buffer; CFRelease(stringRef); @@ -78,15 +78,15 @@ COSXClipboardTextConverter::convertString( return result; } -CString -COSXClipboardTextConverter::doFromIClipboard(const CString& data) const +String +OSXClipboardTextConverter::doFromIClipboard(const String& data) const { return convertString(data, kCFStringEncodingUTF8, CFStringGetSystemEncoding()); } -CString -COSXClipboardTextConverter::doToIClipboard(const CString& data) const +String +OSXClipboardTextConverter::doToIClipboard(const String& data) const { return convertString(data, CFStringGetSystemEncoding(), kCFStringEncodingUTF8); diff --git a/src/lib/platform/OSXClipboardTextConverter.h b/src/lib/platform/OSXClipboardTextConverter.h index ecb19276..42c34b95 100644 --- a/src/lib/platform/OSXClipboardTextConverter.h +++ b/src/lib/platform/OSXClipboardTextConverter.h @@ -21,22 +21,22 @@ #include "platform/OSXClipboardAnyTextConverter.h" //! Convert to/from locale text encoding -class COSXClipboardTextConverter : public COSXClipboardAnyTextConverter { +class OSXClipboardTextConverter : public OSXClipboardAnyTextConverter { public: - COSXClipboardTextConverter(); - virtual ~COSXClipboardTextConverter(); + OSXClipboardTextConverter(); + virtual ~OSXClipboardTextConverter(); // IOSXClipboardAnyTextConverter overrides virtual CFStringRef getOSXFormat() const; protected: - // COSXClipboardAnyTextConverter overrides - virtual CString doFromIClipboard(const CString&) const; - virtual CString doToIClipboard(const CString&) const; + // OSXClipboardAnyTextConverter overrides + virtual String doFromIClipboard(const String&) const; + virtual String doToIClipboard(const String&) const; // generic encoding converter - static CString convertString(const CString& data, + static String convertString(const String& data, CFStringEncoding fromEncoding, CFStringEncoding toEncoding); }; diff --git a/src/lib/platform/OSXClipboardUTF16Converter.cpp b/src/lib/platform/OSXClipboardUTF16Converter.cpp index fe28ec6e..72ec8a1b 100644 --- a/src/lib/platform/OSXClipboardUTF16Converter.cpp +++ b/src/lib/platform/OSXClipboardUTF16Converter.cpp @@ -21,35 +21,35 @@ #include "base/Unicode.h" // -// COSXClipboardUTF16Converter +// OSXClipboardUTF16Converter // -COSXClipboardUTF16Converter::COSXClipboardUTF16Converter() +OSXClipboardUTF16Converter::OSXClipboardUTF16Converter() { // do nothing } -COSXClipboardUTF16Converter::~COSXClipboardUTF16Converter() +OSXClipboardUTF16Converter::~OSXClipboardUTF16Converter() { // do nothing } CFStringRef -COSXClipboardUTF16Converter::getOSXFormat() const +OSXClipboardUTF16Converter::getOSXFormat() const { return CFSTR("public.utf16-plain-text"); } -CString -COSXClipboardUTF16Converter::doFromIClipboard(const CString& data) const +String +OSXClipboardUTF16Converter::doFromIClipboard(const String& data) const { // convert and add nul terminator - return CUnicode::UTF8ToUTF16(data); + return Unicode::UTF8ToUTF16(data); } -CString -COSXClipboardUTF16Converter::doToIClipboard(const CString& data) const +String +OSXClipboardUTF16Converter::doToIClipboard(const String& data) const { // convert and strip nul terminator - return CUnicode::UTF16ToUTF8(data); + return Unicode::UTF16ToUTF8(data); } diff --git a/src/lib/platform/OSXClipboardUTF16Converter.h b/src/lib/platform/OSXClipboardUTF16Converter.h index 2ab4c64d..f8d42b74 100644 --- a/src/lib/platform/OSXClipboardUTF16Converter.h +++ b/src/lib/platform/OSXClipboardUTF16Converter.h @@ -21,17 +21,17 @@ #include "platform/OSXClipboardAnyTextConverter.h" //! Convert to/from UTF-16 encoding -class COSXClipboardUTF16Converter : public COSXClipboardAnyTextConverter { +class OSXClipboardUTF16Converter : public OSXClipboardAnyTextConverter { public: - COSXClipboardUTF16Converter(); - virtual ~COSXClipboardUTF16Converter(); + OSXClipboardUTF16Converter(); + virtual ~OSXClipboardUTF16Converter(); // IOSXClipboardAnyTextConverter overrides virtual CFStringRef getOSXFormat() const; protected: - // COSXClipboardAnyTextConverter overrides - virtual CString doFromIClipboard(const CString&) const; - virtual CString doToIClipboard(const CString&) const; + // OSXClipboardAnyTextConverter overrides + virtual String doFromIClipboard(const String&) const; + virtual String doToIClipboard(const String&) const; }; diff --git a/src/lib/platform/OSXDragSimulator.m b/src/lib/platform/OSXDragSimulator.m index d6588d41..0226b4c9 100644 --- a/src/lib/platform/OSXDragSimulator.m +++ b/src/lib/platform/OSXDragSimulator.m @@ -23,7 +23,7 @@ #if defined(MAC_OS_X_VERSION_10_7) NSWindow* g_dragWindow = NULL; -COSXDragView* g_dragView = NULL; +OSXDragView* g_dragView = NULL; NSString* g_ext = NULL; void @@ -42,7 +42,7 @@ runCocoaApp() [window setAlphaValue:0.1]; [window makeKeyAndOrderFront:nil]; - COSXDragView* dragView = [[COSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)]; + OSXDragView* dragView = [[OSXDragView alloc] initWithFrame:NSMakeRect(0, 0, 3, 3)]; g_dragWindow = window; g_dragView = dragView; diff --git a/src/lib/platform/OSXDragView.h b/src/lib/platform/OSXDragView.h index 00d63e88..bcbc1ef3 100644 --- a/src/lib/platform/OSXDragView.h +++ b/src/lib/platform/OSXDragView.h @@ -19,7 +19,7 @@ #ifdef MAC_OS_X_VERSION_10_7 -@interface COSXDragView : NSView +@interface OSXDragView : NSView { NSMutableString* m_dropTarget; NSString* m_dragFileExt; diff --git a/src/lib/platform/OSXDragView.m b/src/lib/platform/OSXDragView.m index e85c43b5..7eb145f7 100644 --- a/src/lib/platform/OSXDragView.m +++ b/src/lib/platform/OSXDragView.m @@ -19,7 +19,7 @@ #ifdef MAC_OS_X_VERSION_10_7 -@implementation COSXDragView +@implementation OSXDragView @dynamic draggingFormation; @dynamic animatesToDestination; diff --git a/src/lib/platform/OSXEventQueueBuffer.cpp b/src/lib/platform/OSXEventQueueBuffer.cpp index 13f7ccc3..06df99d9 100644 --- a/src/lib/platform/OSXEventQueueBuffer.cpp +++ b/src/lib/platform/OSXEventQueueBuffer.cpp @@ -22,16 +22,16 @@ #include "base/IEventQueue.h" // -// CEventQueueTimer +// EventQueueTimer // -class CEventQueueTimer { }; +class EventQueueTimer { }; // -// COSXEventQueueBuffer +// OSXEventQueueBuffer // -COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) : +OSXEventQueueBuffer::OSXEventQueueBuffer(IEventQueue* events) : m_event(NULL), m_eventQueue(events), m_carbonEventQueue(NULL) @@ -39,7 +39,7 @@ COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) : // do nothing } -COSXEventQueueBuffer::~COSXEventQueueBuffer() +OSXEventQueueBuffer::~OSXEventQueueBuffer() { // release the last event if (m_event != NULL) { @@ -48,20 +48,20 @@ COSXEventQueueBuffer::~COSXEventQueueBuffer() } void -COSXEventQueueBuffer::init() +OSXEventQueueBuffer::init() { m_carbonEventQueue = GetCurrentEventQueue(); } void -COSXEventQueueBuffer::waitForEvent(double timeout) +OSXEventQueueBuffer::waitForEvent(double timeout) { EventRef event; ReceiveNextEvent(0, NULL, timeout, false, &event); } IEventQueueBuffer::Type -COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) +OSXEventQueueBuffer::getEvent(Event& event, UInt32& dataID) { // release the previous event if (m_event != NULL) { @@ -74,7 +74,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) // handle the event if (error == eventLoopQuitErr) { - event = CEvent(CEvent::kQuit); + event = Event(Event::kQuit); return kSystem; } else if (error != noErr) { @@ -88,7 +88,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) return kUser; default: - event = CEvent(CEvent::kSystem, + event = Event(Event::kSystem, m_eventQueue->getSystemTarget(), &m_event); return kSystem; } @@ -96,7 +96,7 @@ COSXEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) } bool -COSXEventQueueBuffer::addEvent(UInt32 dataID) +OSXEventQueueBuffer::addEvent(UInt32 dataID) { EventRef event; OSStatus error = CreateEvent( @@ -123,21 +123,21 @@ COSXEventQueueBuffer::addEvent(UInt32 dataID) } bool -COSXEventQueueBuffer::isEmpty() const +OSXEventQueueBuffer::isEmpty() const { EventRef event; OSStatus status = ReceiveNextEvent(0, NULL, 0.0, false, &event); return (status == eventLoopTimedOutErr); } -CEventQueueTimer* -COSXEventQueueBuffer::newTimer(double, bool) const +EventQueueTimer* +OSXEventQueueBuffer::newTimer(double, bool) const { - return new CEventQueueTimer; + return new EventQueueTimer; } void -COSXEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const +OSXEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const { delete timer; } diff --git a/src/lib/platform/OSXEventQueueBuffer.h b/src/lib/platform/OSXEventQueueBuffer.h index fc5d3bbd..46eaf475 100644 --- a/src/lib/platform/OSXEventQueueBuffer.h +++ b/src/lib/platform/OSXEventQueueBuffer.h @@ -25,20 +25,20 @@ class IEventQueue; //! Event queue buffer for OS X -class COSXEventQueueBuffer : public IEventQueueBuffer { +class OSXEventQueueBuffer : public IEventQueueBuffer { public: - COSXEventQueueBuffer(IEventQueue* eventQueue); - virtual ~COSXEventQueueBuffer(); + OSXEventQueueBuffer(IEventQueue* eventQueue); + virtual ~OSXEventQueueBuffer(); // IEventQueueBuffer overrides virtual void init(); virtual void waitForEvent(double timeout); - virtual Type getEvent(CEvent& event, UInt32& dataID); + virtual Type getEvent(Event& event, UInt32& dataID); virtual bool addEvent(UInt32 dataID); virtual bool isEmpty() const; - virtual CEventQueueTimer* + virtual EventQueueTimer* newTimer(double duration, bool oneShot) const; - virtual void deleteTimer(CEventQueueTimer*) const; + virtual void deleteTimer(EventQueueTimer*) const; private: EventRef m_event; diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index 7a8e42cd..30a65cf6 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -48,12 +48,12 @@ static const UInt32 s_numLockVK = 71; static const UInt32 s_osxNumLock = 1 << 16; -struct CKeyEntry { +struct KeyEntry { public: KeyID m_keyID; UInt32 m_virtualKey; }; -static const CKeyEntry s_controlKeys[] = { +static const KeyEntry s_controlKeys[] = { #if defined(MAC_OS_X_VERSION_10_5) // cursor keys. if we don't do this we'll may still get these from // the keyboard resource but they may not correspond to the arrow @@ -177,27 +177,27 @@ static const CKeyEntry s_controlKeys[] = { // -// COSXKeyState +// OSXKeyState // -COSXKeyState::COSXKeyState(IEventQueue* events) : - CKeyState(events) +OSXKeyState::OSXKeyState(IEventQueue* events) : + KeyState(events) { init(); } -COSXKeyState::COSXKeyState(IEventQueue* events, CKeyMap& keyMap) : - CKeyState(events, keyMap) +OSXKeyState::OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap) : + KeyState(events, keyMap) { init(); } -COSXKeyState::~COSXKeyState() +OSXKeyState::~OSXKeyState() { } void -COSXKeyState::init() +OSXKeyState::init() { m_deadKeyState = 0; m_shiftPressed = false; @@ -216,7 +216,7 @@ COSXKeyState::init() } KeyModifierMask -COSXKeyState::mapModifiersFromOSX(UInt32 mask) const +OSXKeyState::mapModifiersFromOSX(UInt32 mask) const { KeyModifierMask outMask = 0; if ((mask & kCGEventFlagMaskShift) != 0) { @@ -243,7 +243,7 @@ COSXKeyState::mapModifiersFromOSX(UInt32 mask) const } KeyModifierMask -COSXKeyState::mapModifiersToCarbon(UInt32 mask) const +OSXKeyState::mapModifiersToCarbon(UInt32 mask) const { KeyModifierMask outMask = 0; if ((mask & kCGEventFlagMaskShift) != 0) { @@ -269,7 +269,7 @@ COSXKeyState::mapModifiersToCarbon(UInt32 mask) const } KeyButton -COSXKeyState::mapKeyFromEvent(CKeyIDs& ids, +OSXKeyState::mapKeyFromEvent(KeyIDs& ids, KeyModifierMask* maskOut, CGEventRef event) const { ids.clear(); @@ -295,7 +295,7 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids, } // check for special keys - CVirtualKeyMap::const_iterator i = m_virtualKeyMap.find(vkCode); + VirtualKeyMap::const_iterator i = m_virtualKeyMap.find(vkCode); if (i != m_virtualKeyMap.end()) { m_deadKeyState = 0; ids.push_back(i->second); @@ -371,7 +371,7 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids, if (count != 0 || m_deadKeyState == 0) { m_deadKeyState = 0; for (UniCharCount i = 0; i < count; ++i) { - ids.push_back(CKeyResource::unicharToKeyID(chars[i])); + ids.push_back(KeyResource::unicharToKeyID(chars[i])); } adjustAltGrModifier(ids, maskOut, isCommand); return mapVirtualKeyToKeyButton(vkCode); @@ -384,14 +384,14 @@ COSXKeyState::mapKeyFromEvent(CKeyIDs& ids, } bool -COSXKeyState::fakeCtrlAltDel() +OSXKeyState::fakeCtrlAltDel() { // pass keys through unchanged return false; } KeyModifierMask -COSXKeyState::pollActiveModifiers() const +OSXKeyState::pollActiveModifiers() const { // falsely assumed that the mask returned by GetCurrentKeyModifiers() // was the same as a CGEventFlags (which is what mapModifiersFromOSX @@ -423,7 +423,7 @@ COSXKeyState::pollActiveModifiers() const } SInt32 -COSXKeyState::pollActiveGroup() const +OSXKeyState::pollActiveGroup() const { bool layoutValid = true; #if defined(MAC_OS_X_VERSION_10_5) @@ -444,9 +444,9 @@ COSXKeyState::pollActiveGroup() const } void -COSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const +OSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const { - KeyMap km; + ::KeyMap km; GetKeys(km); const UInt8* m = reinterpret_cast(km); for (UInt32 i = 0; i < 16; ++i) { @@ -459,7 +459,7 @@ COSXKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const } void -COSXKeyState::getKeyMap(CKeyMap& keyMap) +OSXKeyState::getKeyMap(synergy::KeyMap& keyMap) { // update keyboard groups if (getGroups(m_groups)) { @@ -505,7 +505,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap) } void -COSXKeyState::fakeKey(const Keystroke& keystroke) +OSXKeyState::fakeKey(const Keystroke& keystroke) { switch (keystroke.m_type) { case Keystroke::kButton: { @@ -601,13 +601,13 @@ COSXKeyState::fakeKey(const Keystroke& keystroke) } void -COSXKeyState::getKeyMapForSpecialKeys(CKeyMap& keyMap, SInt32 group) const +OSXKeyState::getKeyMapForSpecialKeys(synergy::KeyMap& keyMap, SInt32 group) const { // special keys are insensitive to modifers and none are dead keys - CKeyMap::KeyItem item; + synergy::KeyMap::KeyItem item; for (size_t i = 0; i < sizeof(s_controlKeys) / sizeof(s_controlKeys[0]); ++i) { - const CKeyEntry& entry = s_controlKeys[i]; + const KeyEntry& entry = s_controlKeys[i]; item.m_id = entry.m_keyID; item.m_group = group; item.m_button = mapVirtualKeyToKeyButton(entry.m_virtualKey); @@ -615,7 +615,7 @@ COSXKeyState::getKeyMapForSpecialKeys(CKeyMap& keyMap, SInt32 group) const item.m_sensitive = 0; item.m_dead = false; item.m_client = 0; - CKeyMap::initModifierKey(item); + synergy::KeyMap::initModifierKey(item); keyMap.addKeyEntry(item); if (item.m_lock) { @@ -626,14 +626,14 @@ COSXKeyState::getKeyMapForSpecialKeys(CKeyMap& keyMap, SInt32 group) const // note: we don't special case the number pad keys. querying the // mac keyboard returns the non-keypad version of those keys but - // a CKeyState always provides a mapping from keypad keys to + // a KeyState always provides a mapping from keypad keys to // non-keypad keys so we'll be able to generate the characters // anyway. } bool -COSXKeyState::getKeyMap(CKeyMap& keyMap, - SInt32 group, const CKeyResource& r) const +OSXKeyState::getKeyMap(synergy::KeyMap& keyMap, + SInt32 group, const KeyResource& r) const { if (!r.isValid()) { return false; @@ -646,7 +646,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap, std::vector > buttonKeys(r.getNumTables()); // iterate over each button - CKeyMap::KeyItem item; + synergy::KeyMap::KeyItem item; for (UInt32 i = 0; i < r.getNumButtons(); ++i) { item.m_button = mapVirtualKeyToKeyButton(i); @@ -656,7 +656,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap, // convert the entry in each table for this button to a KeyID for (UInt32 j = 0; j < r.getNumTables(); ++j) { buttonKeys[j].first = r.getKey(j, i); - buttonKeys[j].second = CKeyMap::isDeadKey(buttonKeys[j].first); + buttonKeys[j].second = synergy::KeyMap::isDeadKey(buttonKeys[j].first); } // iterate over each character table @@ -679,7 +679,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap, item.m_group = group; item.m_dead = buttonKeys[j].second; item.m_client = buttonKeys[j].second ? 1 : 0; - CKeyMap::initModifierKey(item); + synergy::KeyMap::initModifierKey(item); if (item.m_lock) { // all locking keys are half duplex on OS X keyMap.addHalfDuplexButton(i); @@ -750,7 +750,7 @@ COSXKeyState::getKeyMap(CKeyMap& keyMap, } bool -COSXKeyState::mapSynergyHotKeyToMac(KeyID key, KeyModifierMask mask, +OSXKeyState::mapSynergyHotKeyToMac(KeyID key, KeyModifierMask mask, UInt32 &macVirtualKey, UInt32 &macModifierMask) const { // look up button for key @@ -785,7 +785,7 @@ COSXKeyState::mapSynergyHotKeyToMac(KeyID key, KeyModifierMask mask, } void -COSXKeyState::handleModifierKeys(void* target, +OSXKeyState::handleModifierKeys(void* target, KeyModifierMask oldMask, KeyModifierMask newMask) { // compute changed modifiers @@ -819,7 +819,7 @@ COSXKeyState::handleModifierKeys(void* target, } void -COSXKeyState::handleModifierKey(void* target, +OSXKeyState::handleModifierKey(void* target, UInt32 virtualKey, KeyID id, bool down, KeyModifierMask newMask) { @@ -829,7 +829,7 @@ COSXKeyState::handleModifierKey(void* target, } bool -COSXKeyState::getGroups(GroupList& groups) const +OSXKeyState::getGroups(GroupList& groups) const { CFIndex n; bool gotLayouts = false; @@ -871,7 +871,7 @@ COSXKeyState::getGroups(GroupList& groups) const } void -COSXKeyState::setGroup(SInt32 group) +OSXKeyState::setGroup(SInt32 group) { #if defined(MAC_OS_X_VERSION_10_5) TISSetInputMethodKeyboardLayoutOverride(m_groups[group]); @@ -881,7 +881,7 @@ COSXKeyState::setGroup(SInt32 group) } void -COSXKeyState::checkKeyboardLayout() +OSXKeyState::checkKeyboardLayout() { // XXX -- should call this when notified that groups have changed. // if no notification for that then we should poll. @@ -893,11 +893,11 @@ COSXKeyState::checkKeyboardLayout() } void -COSXKeyState::adjustAltGrModifier(const CKeyIDs& ids, +OSXKeyState::adjustAltGrModifier(const KeyIDs& ids, KeyModifierMask* mask, bool isCommand) const { if (!isCommand) { - for (CKeyIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) { + for (KeyIDs::const_iterator i = ids.begin(); i != ids.end(); ++i) { KeyID id = *i; if (id != kKeyNone && ((id < 0xe000u || id > 0xefffu) || @@ -910,25 +910,25 @@ COSXKeyState::adjustAltGrModifier(const CKeyIDs& ids, } KeyButton -COSXKeyState::mapVirtualKeyToKeyButton(UInt32 keyCode) +OSXKeyState::mapVirtualKeyToKeyButton(UInt32 keyCode) { // 'A' maps to 0 so shift every id return static_cast(keyCode + KeyButtonOffset); } UInt32 -COSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton) +OSXKeyState::mapKeyButtonToVirtualKey(KeyButton keyButton) { return static_cast(keyButton - KeyButtonOffset); } // -// COSXKeyState::CKeyResource +// OSXKeyState::KeyResource // KeyID -COSXKeyState::CKeyResource::getKeyID(UInt8 c) +OSXKeyState::KeyResource::getKeyID(UInt8 c) { if (c == 0) { return kKeyNone; @@ -1070,7 +1070,7 @@ COSXKeyState::CKeyResource::getKeyID(UInt8 c) } KeyID -COSXKeyState::CKeyResource::unicharToKeyID(UniChar c) +OSXKeyState::KeyResource::unicharToKeyID(UniChar c) { switch (c) { case 3: @@ -1101,10 +1101,10 @@ COSXKeyState::CKeyResource::unicharToKeyID(UniChar c) // -// COSXKeyState::CUCHRKeyResource +// OSXKeyState::CUCHRKeyResource // -COSXKeyState::CUCHRKeyResource::CUCHRKeyResource(const void* resource, +OSXKeyState::CUCHRKeyResource::CUCHRKeyResource(const void* resource, UInt32 keyboardType) : m_m(NULL), m_cti(NULL), @@ -1174,32 +1174,32 @@ COSXKeyState::CUCHRKeyResource::CUCHRKeyResource(const void* resource, } bool -COSXKeyState::CUCHRKeyResource::isValid() const +OSXKeyState::CUCHRKeyResource::isValid() const { return (m_m != NULL); } UInt32 -COSXKeyState::CUCHRKeyResource::getNumModifierCombinations() const +OSXKeyState::CUCHRKeyResource::getNumModifierCombinations() const { // only 32 (not 256) because the righthanded modifier bits are ignored return 32; } UInt32 -COSXKeyState::CUCHRKeyResource::getNumTables() const +OSXKeyState::CUCHRKeyResource::getNumTables() const { return m_cti->keyToCharTableCount; } UInt32 -COSXKeyState::CUCHRKeyResource::getNumButtons() const +OSXKeyState::CUCHRKeyResource::getNumButtons() const { return m_cti->keyToCharTableSize; } UInt32 -COSXKeyState::CUCHRKeyResource::getTableForModifier(UInt32 mask) const +OSXKeyState::CUCHRKeyResource::getTableForModifier(UInt32 mask) const { if (mask >= m_m->modifiersCount) { return m_m->defaultTableNum; @@ -1210,7 +1210,7 @@ COSXKeyState::CUCHRKeyResource::getTableForModifier(UInt32 mask) const } KeyID -COSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const +OSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const { assert(table < getNumTables()); assert(button < getNumButtons()); @@ -1246,7 +1246,7 @@ COSXKeyState::CUCHRKeyResource::getKey(UInt32 table, UInt32 button) const } bool -COSXKeyState::CUCHRKeyResource::getDeadKey( +OSXKeyState::CUCHRKeyResource::getDeadKey( KeySequence& keys, UInt16 index) const { if (m_sri == NULL || index >= m_sri->keyStateRecordCount) { @@ -1282,14 +1282,14 @@ COSXKeyState::CUCHRKeyResource::getDeadKey( // convert keys to their dead counterparts for (KeySequence::iterator i = keys.begin(); i != keys.end(); ++i) { - *i = CKeyMap::getDeadKey(*i); + *i = synergy::KeyMap::getDeadKey(*i); } return true; } bool -COSXKeyState::CUCHRKeyResource::getKeyRecord( +OSXKeyState::CUCHRKeyResource::getKeyRecord( KeySequence& keys, UInt16 index, UInt16& state) const { const UInt8* base = reinterpret_cast(m_resource); @@ -1353,7 +1353,7 @@ COSXKeyState::CUCHRKeyResource::getKeyRecord( } bool -COSXKeyState::CUCHRKeyResource::addSequence( +OSXKeyState::CUCHRKeyResource::addSequence( KeySequence& keys, UCKeyCharSeq c) const { if ((c & kUCKeyOutputTestForIndexMask) == kUCKeyOutputSequenceIndexMask) { diff --git a/src/lib/platform/OSXKeyState.h b/src/lib/platform/OSXKeyState.h index fad80701..fd3d99b0 100644 --- a/src/lib/platform/OSXKeyState.h +++ b/src/lib/platform/OSXKeyState.h @@ -35,13 +35,13 @@ /*! A key state for OS X. */ -class COSXKeyState : public CKeyState { +class OSXKeyState : public KeyState { public: - typedef std::vector CKeyIDs; + typedef std::vector KeyIDs; - COSXKeyState(IEventQueue* events); - COSXKeyState(IEventQueue* events, CKeyMap& keyMap); - virtual ~COSXKeyState(); + OSXKeyState(IEventQueue* events); + OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap); + virtual ~OSXKeyState(); //! @name modifiers //@{ @@ -79,7 +79,7 @@ public: that was pressed or released, or 0 if the button doesn't map to a known KeyID. */ - KeyButton mapKeyFromEvent(CKeyIDs& ids, + KeyButton mapKeyFromEvent(KeyIDs& ids, KeyModifierMask* maskOut, CGEventRef event) const; //! Map key and mask to native values @@ -101,21 +101,21 @@ public: virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const; protected: - // CKeyState overrides - virtual void getKeyMap(CKeyMap& keyMap); + // KeyState overrides + virtual void getKeyMap(synergy::KeyMap& keyMap); virtual void fakeKey(const Keystroke& keystroke); private: - class CKeyResource; + class KeyResource; typedef std::vector GroupList; - // Add hard coded special keys to a CKeyMap. + // Add hard coded special keys to a synergy::KeyMap. void getKeyMapForSpecialKeys( - CKeyMap& keyMap, SInt32 group) const; + synergy::KeyMap& keyMap, SInt32 group) const; // Convert keyboard resource to a key map - bool getKeyMap(CKeyMap& keyMap, - SInt32 group, const CKeyResource& r) const; + bool getKeyMap(synergy::KeyMap& keyMap, + SInt32 group, const KeyResource& r) const; // Get the available keyboard groups bool getGroups(GroupList&) const; @@ -138,7 +138,7 @@ private: // option is acting as AltGr (i.e. it generates a glyph and there are // no command modifiers active) then we don't send the super modifier // to clients because they'd try to match it as a command modifier. - void adjustAltGrModifier(const CKeyIDs& ids, + void adjustAltGrModifier(const KeyIDs& ids, KeyModifierMask* mask, bool isCommand) const; // Maps an OS X virtual key id to a KeyButton. This simply remaps @@ -152,7 +152,7 @@ private: void init(); private: - class CKeyResource : public IInterface { + class KeyResource : public IInterface { public: virtual bool isValid() const = 0; virtual UInt32 getNumModifierCombinations() const = 0; @@ -169,11 +169,11 @@ private: }; - class CUCHRKeyResource : public CKeyResource { + class CUCHRKeyResource : public KeyResource { public: CUCHRKeyResource(const void*, UInt32 keyboardType); - // CKeyResource overrides + // KeyResource overrides virtual bool isValid() const; virtual UInt32 getNumModifierCombinations() const; virtual UInt32 getNumTables() const; @@ -208,9 +208,9 @@ private: }; typedef std::map GroupMap; - typedef std::map CVirtualKeyMap; + typedef std::map VirtualKeyMap; - CVirtualKeyMap m_virtualKeyMap; + VirtualKeyMap m_virtualKeyMap; mutable UInt32 m_deadKeyState; GroupList m_groups; GroupMap m_groupMap; diff --git a/src/lib/platform/OSXScreen.cpp b/src/lib/platform/OSXScreen.cpp index fd2ceea9..348baf71 100644 --- a/src/lib/platform/OSXScreen.cpp +++ b/src/lib/platform/OSXScreen.cpp @@ -73,14 +73,14 @@ void logCursorVisibility(); void avoidHesitatingCursor(); // -// COSXScreen +// OSXScreen // -bool COSXScreen::s_testedForGHOM = false; -bool COSXScreen::s_hasGHOM = false; +bool OSXScreen::s_testedForGHOM = false; +bool OSXScreen::s_hasGHOM = false; -COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor) : - CPlatformScreen(events), +OSXScreen::OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor) : + PlatformScreen(events), m_isPrimary(isPrimary), m_isOnScreen(m_isPrimary), m_cursorPosValid(false), @@ -97,9 +97,9 @@ COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCur m_hiddenWindow(NULL), m_userInputWindow(NULL), m_switchEventHandlerRef(0), - m_pmMutex(new CMutex), + m_pmMutex(new Mutex), m_pmWatchThread(NULL), - m_pmThreadReady(new CCondVar(m_pmMutex, false)), + m_pmThreadReady(new CondVar(m_pmMutex, false)), m_pmRootPort(0), m_activeModifierHotKey(0), m_activeModifierHotKeyMask(0), @@ -116,8 +116,8 @@ COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCur try { m_displayID = CGMainDisplayID(); updateScreenShape(m_displayID, 0); - m_screensaver = new COSXScreenSaver(m_events, getEventTarget()); - m_keyState = new COSXKeyState(m_events); + m_screensaver = new OSXScreenSaver(m_events, getEventTarget()); + m_keyState = new OSXKeyState(m_events); // only needed when running as a server. if (m_isPrimary) { @@ -161,23 +161,23 @@ COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCur constructMouseButtonEventMap(); // watch for requests to sleep - m_events->adoptHandler(m_events->forCOSXScreen().confirmSleep(), + m_events->adoptHandler(m_events->forOSXScreen().confirmSleep(), getEventTarget(), - new TMethodEventJob(this, - &COSXScreen::handleConfirmSleep)); + new TMethodEventJob(this, + &OSXScreen::handleConfirmSleep)); // create thread for monitoring system power state. *m_pmThreadReady = false; #if defined(MAC_OS_X_VERSION_10_7) - m_carbonLoopMutex = new CMutex(); - m_carbonLoopReady = new CCondVar(m_carbonLoopMutex, false); + m_carbonLoopMutex = new Mutex(); + m_carbonLoopReady = new CondVar(m_carbonLoopMutex, false); #endif LOG((CLOG_DEBUG "starting watchSystemPowerThread")); - m_pmWatchThread = new CThread(new TMethodJob - (this, &COSXScreen::watchSystemPowerThread)); + m_pmWatchThread = new Thread(new TMethodJob + (this, &OSXScreen::watchSystemPowerThread)); } catch (...) { - m_events->removeHandler(m_events->forCOSXScreen().confirmSleep(), + m_events->removeHandler(m_events->forOSXScreen().confirmSleep(), getEventTarget()); if (m_switchEventHandlerRef != 0) { RemoveEventHandler(m_switchEventHandlerRef); @@ -207,24 +207,24 @@ COSXScreen::COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCur } // install event handlers - m_events->adoptHandler(CEvent::kSystem, m_events->getSystemTarget(), - new TMethodEventJob(this, - &COSXScreen::handleSystemEvent)); + m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(), + new TMethodEventJob(this, + &OSXScreen::handleSystemEvent)); // install the platform event queue - m_events->adoptBuffer(new COSXEventQueueBuffer(m_events)); + m_events->adoptBuffer(new OSXEventQueueBuffer(m_events)); } -COSXScreen::~COSXScreen() +OSXScreen::~OSXScreen() { disable(); m_events->adoptBuffer(NULL); - m_events->removeHandler(CEvent::kSystem, m_events->getSystemTarget()); + m_events->removeHandler(Event::kSystem, m_events->getSystemTarget()); if (m_pmWatchThread) { // make sure the thread has setup the runloop. { - CLock lock(m_pmMutex); + Lock lock(m_pmMutex); while (!(bool)*m_pmThreadReady) { m_pmThreadReady->wait(); } @@ -240,7 +240,7 @@ COSXScreen::~COSXScreen() delete m_pmThreadReady; delete m_pmMutex; - m_events->removeHandler(m_events->forCOSXScreen().confirmSleep(), + m_events->removeHandler(m_events->forOSXScreen().confirmSleep(), getEventTarget()); RemoveEventHandler(m_switchEventHandlerRef); @@ -272,20 +272,20 @@ COSXScreen::~COSXScreen() } void* -COSXScreen::getEventTarget() const +OSXScreen::getEventTarget() const { - return const_cast(this); + return const_cast(this); } bool -COSXScreen::getClipboard(ClipboardID, IClipboard* dst) const +OSXScreen::getClipboard(ClipboardID, IClipboard* dst) const { - CClipboard::copy(dst, &m_pasteboard); + Clipboard::copy(dst, &m_pasteboard); return true; } void -COSXScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const +OSXScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const { x = m_x; y = m_y; @@ -294,7 +294,7 @@ COSXScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const } void -COSXScreen::getCursorPos(SInt32& x, SInt32& y) const +OSXScreen::getCursorPos(SInt32& x, SInt32& y) const { CGEventRef event = CGEventCreate(NULL); CGPoint mouse = CGEventGetLocation(event); @@ -307,13 +307,13 @@ COSXScreen::getCursorPos(SInt32& x, SInt32& y) const } void -COSXScreen::reconfigure(UInt32) +OSXScreen::reconfigure(UInt32) { // do nothing } void -COSXScreen::warpCursor(SInt32 x, SInt32 y) +OSXScreen::warpCursor(SInt32 x, SInt32 y) { // move cursor without generating events CGPoint pos; @@ -328,25 +328,25 @@ COSXScreen::warpCursor(SInt32 x, SInt32 y) } void -COSXScreen::fakeInputBegin() +OSXScreen::fakeInputBegin() { // FIXME -- not implemented } void -COSXScreen::fakeInputEnd() +OSXScreen::fakeInputEnd() { // FIXME -- not implemented } SInt32 -COSXScreen::getJumpZoneSize() const +OSXScreen::getJumpZoneSize() const { return 1; } bool -COSXScreen::isAnyMouseButtonDown(UInt32& buttonID) const +OSXScreen::isAnyMouseButtonDown(UInt32& buttonID) const { if (m_buttonState.test(0)) { buttonID = kButtonLeft; @@ -357,14 +357,14 @@ COSXScreen::isAnyMouseButtonDown(UInt32& buttonID) const } void -COSXScreen::getCursorCenter(SInt32& x, SInt32& y) const +OSXScreen::getCursorCenter(SInt32& x, SInt32& y) const { x = m_xCenter; y = m_yCenter; } UInt32 -COSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) +OSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) { // get mac virtual key and modifier mask matching synergy key and mask UInt32 macKey, macMask; @@ -402,24 +402,24 @@ COSXScreen::registerHotKey(KeyID key, KeyModifierMask mask) GetApplicationEventTarget(), 0, &ref); okay = (status == noErr); - m_hotKeyToIDMap[CHotKeyItem(macKey, macMask)] = id; + m_hotKeyToIDMap[HotKeyItem(macKey, macMask)] = id; } if (!okay) { m_oldHotKeyIDs.push_back(id); - m_hotKeyToIDMap.erase(CHotKeyItem(macKey, macMask)); - LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", CKeyMap::formatKey(key, mask).c_str(), key, mask)); + m_hotKeyToIDMap.erase(HotKeyItem(macKey, macMask)); + LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask)); return 0; } - m_hotKeys.insert(std::make_pair(id, CHotKeyItem(ref, macKey, macMask))); + m_hotKeys.insert(std::make_pair(id, HotKeyItem(ref, macKey, macMask))); - LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", CKeyMap::formatKey(key, mask).c_str(), key, mask, id)); + LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask, id)); return id; } void -COSXScreen::unregisterHotKey(UInt32 id) +OSXScreen::unregisterHotKey(UInt32 id) { // look up hotkey HotKeyMap::iterator i = m_hotKeys.find(id); @@ -462,7 +462,7 @@ COSXScreen::unregisterHotKey(UInt32 id) } void -COSXScreen::constructMouseButtonEventMap() +OSXScreen::constructMouseButtonEventMap() { const CGEventType source[NumButtonIDs][3] = { {kCGEventLeftMouseUp, kCGEventLeftMouseDragged, kCGEventLeftMouseDown}, @@ -483,7 +483,7 @@ COSXScreen::constructMouseButtonEventMap() } void -COSXScreen::postMouseEvent(CGPoint& pos) const +OSXScreen::postMouseEvent(CGPoint& pos) const { // check if cursor position is valid on the client display configuration // stkamp@users.sourceforge.net @@ -530,7 +530,7 @@ COSXScreen::postMouseEvent(CGPoint& pos) const } void -COSXScreen::fakeMouseButton(ButtonID id, bool press) +OSXScreen::fakeMouseButton(ButtonID id, bool press) { NXEventHandle handle = NXOpenEventStatus(); double clickTime = NXClickTime(handle); @@ -606,7 +606,7 @@ COSXScreen::fakeMouseButton(ButtonID id, bool press) // ... otherwise, perform a single press or release as normal. - MouseButtonState state = press ? kMouseButtonDown : kMouseButtonUp; + EMouseButtonState state = press ? kMouseButtonDown : kMouseButtonUp; LOG((CLOG_DEBUG1 "faking mouse button id: %d press: %s", id, press ? "pressed" : "released")); @@ -626,8 +626,8 @@ COSXScreen::fakeMouseButton(ButtonID id, bool press) } if (!press && (id == kButtonLeft)) { if (m_fakeDraggingStarted) { - m_getDropTargetThread = new CThread(new TMethodJob( - this, &COSXScreen::getDropTargetThread)); + m_getDropTargetThread = new Thread(new TMethodJob( + this, &OSXScreen::getDropTargetThread)); } m_draggingStarted = false; @@ -635,7 +635,7 @@ COSXScreen::fakeMouseButton(ButtonID id, bool press) } void -COSXScreen::getDropTargetThread(void*) +OSXScreen::getDropTargetThread(void*) { #if defined(MAC_OS_X_VERSION_10_7) char* cstr = NULL; @@ -669,7 +669,7 @@ COSXScreen::getDropTargetThread(void*) } void -COSXScreen::fakeMouseMove(SInt32 x, SInt32 y) +OSXScreen::fakeMouseMove(SInt32 x, SInt32 y) { if (m_fakeDraggingStarted) { m_buttonState.set(0, kMouseButtonDown); @@ -693,7 +693,7 @@ COSXScreen::fakeMouseMove(SInt32 x, SInt32 y) } void -COSXScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const +OSXScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const { // OS X does not appear to have a fake relative mouse move function. // simulate it by getting the current mouse position and adding to @@ -718,7 +718,7 @@ COSXScreen::fakeMouseRelativeMove(SInt32 dx, SInt32 dy) const } void -COSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const +OSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const { if (xDelta != 0 || yDelta != 0) { #if defined(MAC_OS_X_VERSION_10_5) @@ -741,7 +741,7 @@ COSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const } void -COSXScreen::showCursor() +OSXScreen::showCursor() { LOG((CLOG_DEBUG "showing cursor")); @@ -768,7 +768,7 @@ COSXScreen::showCursor() } void -COSXScreen::hideCursor() +OSXScreen::hideCursor() { LOG((CLOG_DEBUG "hiding cursor")); @@ -795,13 +795,13 @@ COSXScreen::hideCursor() } void -COSXScreen::enable() +OSXScreen::enable() { // watch the clipboard m_clipboardTimer = m_events->newTimer(1.0, NULL); - m_events->adoptHandler(CEvent::kTimer, m_clipboardTimer, - new TMethodEventJob(this, - &COSXScreen::handleClipboardCheck)); + m_events->adoptHandler(Event::kTimer, m_clipboardTimer, + new TMethodEventJob(this, + &OSXScreen::handleClipboardCheck)); if (m_isPrimary) { // FIXME -- start watching jump zones @@ -844,7 +844,7 @@ COSXScreen::enable() } void -COSXScreen::disable() +OSXScreen::disable() { if (m_autoShowHideCursor) { showCursor(); @@ -869,7 +869,7 @@ COSXScreen::disable() // uninstall clipboard timer if (m_clipboardTimer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_clipboardTimer); + m_events->removeHandler(Event::kTimer, m_clipboardTimer); m_events->deleteTimer(m_clipboardTimer); m_clipboardTimer = NULL; } @@ -878,7 +878,7 @@ COSXScreen::disable() } void -COSXScreen::enter() +OSXScreen::enter() { showCursor(); @@ -909,24 +909,24 @@ COSXScreen::enter() } bool -COSXScreen::leave() +OSXScreen::leave() { hideCursor(); if (isDraggingStarted()) { - CString& fileList = getDraggingFilename(); + String& fileList = getDraggingFilename(); if (!m_isPrimary) { if (fileList.empty() == false) { - CClientApp& app = CClientApp::instance(); - CClient* client = app.getClientPtr(); + ClientApp& app = ClientApp::instance(); + Client* client = app.getClientPtr(); - CDragInformation di; + DragInformation di; di.setFilename(fileList); - CDragFileList dragFileList; + DragFileList dragFileList; dragFileList.push_back(di); - CString info; - UInt32 fileCount = CDragInformation::setupDragInfo( + String info; + UInt32 fileCount = DragInformation::setupDragInfo( dragFileList, info); client->sendDragInfo(fileCount, info, info.size()); LOG((CLOG_DEBUG "send dragging file to server")); @@ -951,17 +951,17 @@ COSXScreen::leave() } bool -COSXScreen::setClipboard(ClipboardID, const IClipboard* src) +OSXScreen::setClipboard(ClipboardID, const IClipboard* src) { if(src != NULL) { LOG((CLOG_DEBUG "setting clipboard")); - CClipboard::copy(&m_pasteboard, src); + Clipboard::copy(&m_pasteboard, src); } return true; } void -COSXScreen::checkClipboards() +OSXScreen::checkClipboards() { LOG((CLOG_DEBUG2 "checking clipboard")); if (m_pasteboard.synchronize()) { @@ -972,7 +972,7 @@ COSXScreen::checkClipboards() } void -COSXScreen::openScreensaver(bool notify) +OSXScreen::openScreensaver(bool notify) { m_screensaverNotify = notify; if (!m_screensaverNotify) { @@ -981,7 +981,7 @@ COSXScreen::openScreensaver(bool notify) } void -COSXScreen::closeScreensaver() +OSXScreen::closeScreensaver() { if (!m_screensaverNotify) { m_screensaver->enable(); @@ -989,7 +989,7 @@ COSXScreen::closeScreensaver() } void -COSXScreen::screensaver(bool activate) +OSXScreen::screensaver(bool activate) { if (activate) { m_screensaver->activate(); @@ -1000,46 +1000,46 @@ COSXScreen::screensaver(bool activate) } void -COSXScreen::resetOptions() +OSXScreen::resetOptions() { // no options } void -COSXScreen::setOptions(const COptionsList&) +OSXScreen::setOptions(const OptionsList&) { // no options } void -COSXScreen::setSequenceNumber(UInt32 seqNum) +OSXScreen::setSequenceNumber(UInt32 seqNum) { m_sequenceNumber = seqNum; } bool -COSXScreen::isPrimary() const +OSXScreen::isPrimary() const { return m_isPrimary; } void -COSXScreen::sendEvent(CEvent::Type type, void* data) const +OSXScreen::sendEvent(Event::Type type, void* data) const { - m_events->addEvent(CEvent(type, getEventTarget(), data)); + m_events->addEvent(Event(type, getEventTarget(), data)); } void -COSXScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id) const +OSXScreen::sendClipboardEvent(Event::Type type, ClipboardID id) const { - CClipboardInfo* info = (CClipboardInfo*)malloc(sizeof(CClipboardInfo)); + ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo)); info->m_id = id; info->m_sequenceNumber = m_sequenceNumber; sendEvent(type, info); } void -COSXScreen::handleSystemEvent(const CEvent& event, void*) +OSXScreen::handleSystemEvent(const Event& event, void*) { EventRef* carbonEvent = reinterpret_cast(event.getData()); assert(carbonEvent != NULL); @@ -1126,7 +1126,7 @@ COSXScreen::handleSystemEvent(const CEvent& event, void*) } bool -COSXScreen::onMouseMove(SInt32 mx, SInt32 my) +OSXScreen::onMouseMove(SInt32 mx, SInt32 my) { LOG((CLOG_DEBUG2 "mouse move %+d,%+d", mx, my)); @@ -1144,7 +1144,7 @@ COSXScreen::onMouseMove(SInt32 mx, SInt32 my) if (m_isOnScreen) { // motion on primary screen sendEvent(m_events->forIPrimaryScreen().motionOnPrimary(), - CMotionInfo::alloc(m_xCursor, m_yCursor)); + MotionInfo::alloc(m_xCursor, m_yCursor)); if (m_buttonState.test(0)) { m_draggingStarted = true; } @@ -1168,7 +1168,7 @@ COSXScreen::onMouseMove(SInt32 mx, SInt32 my) } else { // send motion - sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), CMotionInfo::alloc(x, y)); + sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y)); } } @@ -1176,7 +1176,7 @@ COSXScreen::onMouseMove(SInt32 mx, SInt32 my) } bool -COSXScreen::onMouseButton(bool pressed, UInt16 macButton) +OSXScreen::onMouseButton(bool pressed, UInt16 macButton) { // Buttons 2 and 3 are inverted on the mac ButtonID button = mapMacButtonToSynergy(macButton); @@ -1185,14 +1185,14 @@ COSXScreen::onMouseButton(bool pressed, UInt16 macButton) LOG((CLOG_DEBUG1 "event: button press button=%d", button)); if (button != kButtonNone) { KeyModifierMask mask = m_keyState->getActiveModifiers(); - sendEvent(m_events->forIPrimaryScreen().buttonDown(), CButtonInfo::alloc(button, mask)); + sendEvent(m_events->forIPrimaryScreen().buttonDown(), ButtonInfo::alloc(button, mask)); } } else { LOG((CLOG_DEBUG1 "event: button release button=%d", button)); if (button != kButtonNone) { KeyModifierMask mask = m_keyState->getActiveModifiers(); - sendEvent(m_events->forIPrimaryScreen().buttonUp(), CButtonInfo::alloc(button, mask)); + sendEvent(m_events->forIPrimaryScreen().buttonUp(), ButtonInfo::alloc(button, mask)); } } @@ -1213,7 +1213,7 @@ COSXScreen::onMouseButton(bool pressed, UInt16 macButton) } if (macButton == kButtonLeft) { - MouseButtonState state = pressed ? kMouseButtonDown : kMouseButtonUp; + EMouseButtonState state = pressed ? kMouseButtonDown : kMouseButtonUp; m_buttonState.set(kButtonLeft - 1, state); if (pressed) { m_draggingFilename.clear(); @@ -1221,8 +1221,8 @@ COSXScreen::onMouseButton(bool pressed, UInt16 macButton) } else { if (m_fakeDraggingStarted) { - m_getDropTargetThread = new CThread(new TMethodJob( - this, &COSXScreen::getDropTargetThread)); + m_getDropTargetThread = new Thread(new TMethodJob( + this, &OSXScreen::getDropTargetThread)); } m_draggingStarted = false; @@ -1233,24 +1233,24 @@ COSXScreen::onMouseButton(bool pressed, UInt16 macButton) } bool -COSXScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta) const +OSXScreen::onMouseWheel(SInt32 xDelta, SInt32 yDelta) const { LOG((CLOG_DEBUG1 "event: button wheel delta=%+d,%+d", xDelta, yDelta)); - sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(xDelta, yDelta)); + sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(xDelta, yDelta)); return true; } void -COSXScreen::handleClipboardCheck(const CEvent&, void*) +OSXScreen::handleClipboardCheck(const Event&, void*) { checkClipboards(); } #if !defined(MAC_OS_X_VERSION_10_5) pascal void -COSXScreen::displayManagerCallback(void* inUserData, SInt16 inMessage, void*) +OSXScreen::displayManagerCallback(void* inUserData, SInt16 inMessage, void*) { - COSXScreen* screen = (COSXScreen*)inUserData; + OSXScreen* screen = (OSXScreen*)inUserData; if (inMessage == kDMNotifyEvent) { screen->onDisplayChange(); @@ -1258,7 +1258,7 @@ COSXScreen::displayManagerCallback(void* inUserData, SInt16 inMessage, void*) } bool -COSXScreen::onDisplayChange() +OSXScreen::onDisplayChange() { // screen resolution may have changed. save old shape. SInt32 xOld = m_x, yOld = m_y, wOld = m_w, hOld = m_h; @@ -1283,9 +1283,9 @@ COSXScreen::onDisplayChange() } #else void -COSXScreen::displayReconfigurationCallback(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags, void* inUserData) +OSXScreen::displayReconfigurationCallback(CGDirectDisplayID displayID, CGDisplayChangeSummaryFlags flags, void* inUserData) { - COSXScreen* screen = (COSXScreen*)inUserData; + OSXScreen* screen = (OSXScreen*)inUserData; // Closing or opening the lid when an external monitor is // connected causes an kCGDisplayBeginConfigurationFlag event @@ -1306,7 +1306,7 @@ COSXScreen::displayReconfigurationCallback(CGDirectDisplayID displayID, CGDispla #endif bool -COSXScreen::onKey(CGEventRef event) +OSXScreen::onKey(CGEventRef event) { CGEventType eventKind = CGEventGetType(event); @@ -1328,9 +1328,9 @@ COSXScreen::onKey(CGEventRef event) if (m_modifierHotKeys.count(newMask) > 0) { m_activeModifierHotKey = m_modifierHotKeys[newMask]; m_activeModifierHotKeyMask = newMask; - m_events->addEvent(CEvent(m_events->forIPrimaryScreen().hotKeyDown(), + m_events->addEvent(Event(m_events->forIPrimaryScreen().hotKeyDown(), getEventTarget(), - CHotKeyInfo::alloc(m_activeModifierHotKey))); + HotKeyInfo::alloc(m_activeModifierHotKey))); } } @@ -1339,9 +1339,9 @@ COSXScreen::onKey(CGEventRef event) else if (m_activeModifierHotKey != 0) { KeyModifierMask mask = (newMask & m_activeModifierHotKeyMask); if (mask != m_activeModifierHotKeyMask) { - m_events->addEvent(CEvent(m_events->forIPrimaryScreen().hotKeyUp(), + m_events->addEvent(Event(m_events->forIPrimaryScreen().hotKeyUp(), getEventTarget(), - CHotKeyInfo::alloc(m_activeModifierHotKey))); + HotKeyInfo::alloc(m_activeModifierHotKey))); m_activeModifierHotKey = 0; m_activeModifierHotKeyMask = 0; } @@ -1356,14 +1356,14 @@ COSXScreen::onKey(CGEventRef event) // so we check for a key/modifier match in our hot key map. if (!m_isOnScreen) { HotKeyToIDMap::const_iterator i = - m_hotKeyToIDMap.find(CHotKeyItem(virtualKey, + m_hotKeyToIDMap.find(HotKeyItem(virtualKey, m_keyState->mapModifiersToCarbon(macMask) & 0xff00u)); if (i != m_hotKeyToIDMap.end()) { UInt32 id = i->second; // determine event type - CEvent::Type type; + Event::Type type; //UInt32 eventKind = GetEventKind(event); if (eventKind == kCGEventKeyDown) { type = m_events->forIPrimaryScreen().hotKeyDown(); @@ -1375,8 +1375,8 @@ COSXScreen::onKey(CGEventRef event) return false; } - m_events->addEvent(CEvent(type, getEventTarget(), - CHotKeyInfo::alloc(id))); + m_events->addEvent(Event(type, getEventTarget(), + HotKeyInfo::alloc(id))); return true; } @@ -1389,7 +1389,7 @@ COSXScreen::onKey(CGEventRef event) // map event to keys KeyModifierMask mask; - COSXKeyState::CKeyIDs keys; + OSXKeyState::KeyIDs keys; KeyButton button = m_keyState->mapKeyFromEvent(keys, &mask, event); if (button == 0) { return false; @@ -1417,7 +1417,7 @@ COSXScreen::onKey(CGEventRef event) } // send key events - for (COSXKeyState::CKeyIDs::const_iterator i = keys.begin(); + for (OSXKeyState::KeyIDs::const_iterator i = keys.begin(); i != keys.end(); ++i) { m_keyState->sendKeyEvent(getEventTarget(), down, isRepeat, *i, sendMask, 1, button); @@ -1427,7 +1427,7 @@ COSXScreen::onKey(CGEventRef event) } bool -COSXScreen::onHotKey(EventRef event) const +OSXScreen::onHotKey(EventRef event) const { // get the hotkey id EventHotKeyID hkid; @@ -1436,7 +1436,7 @@ COSXScreen::onHotKey(EventRef event) const UInt32 id = hkid.id; // determine event type - CEvent::Type type; + Event::Type type; UInt32 eventKind = GetEventKind(event); if (eventKind == kEventHotKeyPressed) { type = m_events->forIPrimaryScreen().hotKeyDown(); @@ -1448,14 +1448,14 @@ COSXScreen::onHotKey(EventRef event) const return false; } - m_events->addEvent(CEvent(type, getEventTarget(), - CHotKeyInfo::alloc(id))); + m_events->addEvent(Event(type, getEventTarget(), + HotKeyInfo::alloc(id))); return true; } ButtonID -COSXScreen::mapMacButtonToSynergy(UInt16 macButton) const +OSXScreen::mapMacButtonToSynergy(UInt16 macButton) const { switch (macButton) { case 1: @@ -1472,7 +1472,7 @@ COSXScreen::mapMacButtonToSynergy(UInt16 macButton) const } SInt32 -COSXScreen::mapScrollWheelToSynergy(SInt32 x) const +OSXScreen::mapScrollWheelToSynergy(SInt32 x) const { // return accelerated scrolling but not exponentially scaled as it is // on the mac. @@ -1481,7 +1481,7 @@ COSXScreen::mapScrollWheelToSynergy(SInt32 x) const } SInt32 -COSXScreen::mapScrollWheelFromSynergy(SInt32 x) const +OSXScreen::mapScrollWheelFromSynergy(SInt32 x) const { // use server's acceleration with a little boost since other platforms // take one wheel step as a larger step than the mac does. @@ -1489,7 +1489,7 @@ COSXScreen::mapScrollWheelFromSynergy(SInt32 x) const } double -COSXScreen::getScrollSpeed() const +OSXScreen::getScrollSpeed() const { double scaling = 0.0; @@ -1515,19 +1515,19 @@ COSXScreen::getScrollSpeed() const } double -COSXScreen::getScrollSpeedFactor() const +OSXScreen::getScrollSpeedFactor() const { return pow(10.0, getScrollSpeed()); } void -COSXScreen::enableDragTimer(bool enable) +OSXScreen::enableDragTimer(bool enable) { if (enable && m_dragTimer == NULL) { m_dragTimer = m_events->newTimer(0.01, NULL); - m_events->adoptHandler(CEvent::kTimer, m_dragTimer, - new TMethodEventJob(this, - &COSXScreen::handleDrag)); + m_events->adoptHandler(Event::kTimer, m_dragTimer, + new TMethodEventJob(this, + &OSXScreen::handleDrag)); CGEventRef event = CGEventCreate(NULL); CGPoint mouse = CGEventGetLocation(event); m_dragLastPoint.h = (short)mouse.x; @@ -1535,14 +1535,14 @@ COSXScreen::enableDragTimer(bool enable) CFRelease(event); } else if (!enable && m_dragTimer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_dragTimer); + m_events->removeHandler(Event::kTimer, m_dragTimer); m_events->deleteTimer(m_dragTimer); m_dragTimer = NULL; } } void -COSXScreen::handleDrag(const CEvent&, void*) +OSXScreen::handleDrag(const Event&, void*) { CGEventRef event = CGEventCreate(NULL); CGPoint p = CGEventGetLocation(event); @@ -1556,7 +1556,7 @@ COSXScreen::handleDrag(const CEvent&, void*) } void -COSXScreen::updateButtons() +OSXScreen::updateButtons() { UInt32 buttons = GetCurrentButtonState(); @@ -1564,19 +1564,19 @@ COSXScreen::updateButtons() } IKeyState* -COSXScreen::getKeyState() const +OSXScreen::getKeyState() const { return m_keyState; } void -COSXScreen::updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags flags) +OSXScreen::updateScreenShape(const CGDirectDisplayID, const CGDisplayChangeSummaryFlags flags) { updateScreenShape(); } void -COSXScreen::updateScreenShape() +OSXScreen::updateScreenShape() { // get info for each display CGDisplayCount displayCount = 0; @@ -1633,28 +1633,28 @@ COSXScreen::updateScreenShape() // // FAST USER SWITCH NOTIFICATION SUPPORT // -// COSXScreen::userSwitchCallback(void*) +// OSXScreen::userSwitchCallback(void*) // // gets called if a fast user switch occurs // pascal OSStatus -COSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, +OSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, EventRef theEvent, void* inUserData) { - COSXScreen* screen = (COSXScreen*)inUserData; + OSXScreen* screen = (OSXScreen*)inUserData; UInt32 kind = GetEventKind(theEvent); IEventQueue* events = screen->getEvents(); if (kind == kEventSystemUserSessionDeactivated) { LOG((CLOG_DEBUG "user session deactivated")); - events->addEvent(CEvent(events->forIScreen().suspend(), + events->addEvent(Event(events->forIScreen().suspend(), screen->getEventTarget())); } else if (kind == kEventSystemUserSessionActivated) { LOG((CLOG_DEBUG "user session activated")); - events->addEvent(CEvent(events->forIScreen().resume(), + events->addEvent(Event(events->forIScreen().resume(), screen->getEventTarget())); } return (CallNextEventHandler(nextHandler, theEvent)); @@ -1665,13 +1665,13 @@ COSXScreen::userSwitchCallback(EventHandlerCallRef nextHandler, // // SLEEP/WAKEUP NOTIFICATION SUPPORT // -// COSXScreen::watchSystemPowerThread(void*) +// OSXScreen::watchSystemPowerThread(void*) // // main of thread monitoring system power (sleep/wakup) using a CFRunLoop // void -COSXScreen::watchSystemPowerThread(void*) +OSXScreen::watchSystemPowerThread(void*) { io_object_t notifier; IONotificationPortRef notificationPortRef; @@ -1693,7 +1693,7 @@ COSXScreen::watchSystemPowerThread(void*) // thread is ready { - CLock lock(m_pmMutex); + Lock lock(m_pmMutex); *m_pmThreadReady = true; m_pmThreadReady->signal(); } @@ -1713,7 +1713,7 @@ COSXScreen::watchSystemPowerThread(void*) #if defined(MAC_OS_X_VERSION_10_7) { - CLock lockCarbon(m_carbonLoopMutex); + Lock lockCarbon(m_carbonLoopMutex); if (*m_carbonLoopReady == false) { // we signalling carbon loop ready before starting @@ -1739,36 +1739,36 @@ COSXScreen::watchSystemPowerThread(void*) CFRelease(runloopSourceRef); } - CLock lock(m_pmMutex); + Lock lock(m_pmMutex); IODeregisterForSystemPower(¬ifier); m_pmRootPort = 0; LOG((CLOG_DEBUG "stopped watchSystemPowerThread")); } void -COSXScreen::powerChangeCallback(void* refcon, io_service_t service, +OSXScreen::powerChangeCallback(void* refcon, io_service_t service, natural_t messageType, void* messageArg) { - ((COSXScreen*)refcon)->handlePowerChangeRequest(messageType, messageArg); + ((OSXScreen*)refcon)->handlePowerChangeRequest(messageType, messageArg); } void -COSXScreen::handlePowerChangeRequest(natural_t messageType, void* messageArg) +OSXScreen::handlePowerChangeRequest(natural_t messageType, void* messageArg) { // we've received a power change notification switch (messageType) { case kIOMessageSystemWillSleep: - // COSXScreen has to handle this in the main thread so we have to + // OSXScreen has to handle this in the main thread so we have to // queue a confirm sleep event here. we actually don't allow the // system to sleep until the event is handled. - m_events->addEvent(CEvent(m_events->forCOSXScreen().confirmSleep(), + m_events->addEvent(Event(m_events->forOSXScreen().confirmSleep(), getEventTarget(), messageArg, - CEvent::kDontFreeData)); + Event::kDontFreeData)); return; case kIOMessageSystemHasPoweredOn: LOG((CLOG_DEBUG "system wakeup")); - m_events->addEvent(CEvent(m_events->forIScreen().resume(), + m_events->addEvent(Event(m_events->forIScreen().resume(), getEventTarget())); break; @@ -1776,23 +1776,23 @@ COSXScreen::handlePowerChangeRequest(natural_t messageType, void* messageArg) break; } - CLock lock(m_pmMutex); + Lock lock(m_pmMutex); if (m_pmRootPort != 0) { IOAllowPowerChange(m_pmRootPort, (long)messageArg); } } void -COSXScreen::handleConfirmSleep(const CEvent& event, void*) +OSXScreen::handleConfirmSleep(const Event& event, void*) { long messageArg = (long)event.getData(); if (messageArg != 0) { - CLock lock(m_pmMutex); + Lock lock(m_pmMutex); if (m_pmRootPort != 0) { // deliver suspend event immediately. - m_events->addEvent(CEvent(m_events->forIScreen().suspend(), + m_events->addEvent(Event(m_events->forIScreen().suspend(), getEventTarget(), NULL, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); LOG((CLOG_DEBUG "system will sleep")); IOAllowPowerChange(m_pmRootPort, messageArg); @@ -1853,7 +1853,7 @@ static CGSSetGlobalHotKeyOperatingMode_t s_CGSSetGlobalHotKeyOperatingMode; } bool -COSXScreen::isGlobalHotKeyOperatingModeAvailable() +OSXScreen::isGlobalHotKeyOperatingModeAvailable() { if (!s_testedForGHOM) { s_testedForGHOM = true; @@ -1868,7 +1868,7 @@ COSXScreen::isGlobalHotKeyOperatingModeAvailable() } void -COSXScreen::setGlobalHotKeysEnabled(bool enabled) +OSXScreen::setGlobalHotKeysEnabled(bool enabled) { if (isGlobalHotKeyOperatingModeAvailable()) { CGSConnection conn = s__CGSDefaultConnection(); @@ -1886,7 +1886,7 @@ COSXScreen::setGlobalHotKeysEnabled(bool enabled) } bool -COSXScreen::getGlobalHotKeysEnabled() +OSXScreen::getGlobalHotKeysEnabled() { CGSGlobalHotKeyOperatingMode mode; if (isGlobalHotKeyOperatingModeAvailable()) { @@ -1902,10 +1902,10 @@ COSXScreen::getGlobalHotKeysEnabled() #endif // -// COSXScreen::CHotKeyItem +// OSXScreen::HotKeyItem // -COSXScreen::CHotKeyItem::CHotKeyItem(UInt32 keycode, UInt32 mask) : +OSXScreen::HotKeyItem::HotKeyItem(UInt32 keycode, UInt32 mask) : m_ref(NULL), m_keycode(keycode), m_mask(mask) @@ -1913,7 +1913,7 @@ COSXScreen::CHotKeyItem::CHotKeyItem(UInt32 keycode, UInt32 mask) : // do nothing } -COSXScreen::CHotKeyItem::CHotKeyItem(EventHotKeyRef ref, +OSXScreen::HotKeyItem::HotKeyItem(EventHotKeyRef ref, UInt32 keycode, UInt32 mask) : m_ref(ref), m_keycode(keycode), @@ -1923,13 +1923,13 @@ COSXScreen::CHotKeyItem::CHotKeyItem(EventHotKeyRef ref, } EventHotKeyRef -COSXScreen::CHotKeyItem::getRef() const +OSXScreen::HotKeyItem::getRef() const { return m_ref; } bool -COSXScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const +OSXScreen::HotKeyItem::operator<(const HotKeyItem& x) const { return (m_keycode < x.m_keycode || (m_keycode == x.m_keycode && m_mask < x.m_mask)); @@ -1939,7 +1939,7 @@ COSXScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const // will show the cursor if a local event comes in while synergy has the cursor // off the screen. CGEventRef -COSXScreen::handleCGInputEventSecondary( +OSXScreen::handleCGInputEventSecondary( CGEventTapProxy proxy, CGEventType type, CGEventRef event, @@ -1949,7 +1949,7 @@ COSXScreen::handleCGInputEventSecondary( // should be tested better before reintroducing. return event; - COSXScreen* screen = (COSXScreen*)refcon; + OSXScreen* screen = (OSXScreen*)refcon; if (screen->m_cursorHidden && type == kCGEventMouseMoved) { CGPoint pos = CGEventGetLocation(event); @@ -1965,12 +1965,12 @@ COSXScreen::handleCGInputEventSecondary( // Quartz event tap support CGEventRef -COSXScreen::handleCGInputEvent(CGEventTapProxy proxy, +OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void* refcon) { - COSXScreen* screen = (COSXScreen*)refcon; + OSXScreen* screen = (OSXScreen*)refcon; CGPoint pos; switch(type) { @@ -2036,38 +2036,38 @@ COSXScreen::handleCGInputEvent(CGEventTapProxy proxy, } void -COSXScreen::CMouseButtonState::set(UInt32 button, MouseButtonState state) +OSXScreen::MouseButtonState::set(UInt32 button, EMouseButtonState state) { bool newState = (state == kMouseButtonDown); m_buttons.set(button, newState); } bool -COSXScreen::CMouseButtonState::any() +OSXScreen::MouseButtonState::any() { return m_buttons.any(); } void -COSXScreen::CMouseButtonState::reset() +OSXScreen::MouseButtonState::reset() { m_buttons.reset(); } void -COSXScreen::CMouseButtonState::overwrite(UInt32 buttons) +OSXScreen::MouseButtonState::overwrite(UInt32 buttons) { m_buttons = std::bitset(buttons); } bool -COSXScreen::CMouseButtonState::test(UInt32 button) const +OSXScreen::MouseButtonState::test(UInt32 button) const { return m_buttons.test(button); } SInt8 -COSXScreen::CMouseButtonState::getFirstButtonDown() const +OSXScreen::MouseButtonState::getFirstButtonDown() const { if (m_buttons.any()) { for (unsigned short button = 0; button < m_buttons.size(); button++) { @@ -2080,7 +2080,7 @@ COSXScreen::CMouseButtonState::getFirstButtonDown() const } char* -COSXScreen::CFStringRefToUTF8String(CFStringRef aString) +OSXScreen::CFStringRefToUTF8String(CFStringRef aString) { if (aString == NULL) { return NULL; @@ -2098,12 +2098,12 @@ COSXScreen::CFStringRefToUTF8String(CFStringRef aString) } void -COSXScreen::fakeDraggingFiles(CDragFileList fileList) +OSXScreen::fakeDraggingFiles(DragFileList fileList) { m_fakeDraggingStarted = true; - CString fileExt; + String fileExt; if (fileList.size() == 1) { - fileExt = CDragInformation::getDragFileExtension( + fileExt = DragInformation::getDragFileExtension( fileList.at(0).getFilename()); } @@ -2114,8 +2114,8 @@ COSXScreen::fakeDraggingFiles(CDragFileList fileList) #endif } -CString& -COSXScreen::getDraggingFilename() +String& +OSXScreen::getDraggingFilename() { if (m_draggingStarted) { CFStringRef dragInfo = getDraggedFileURL(); @@ -2127,7 +2127,7 @@ COSXScreen::getDraggingFilename() else { LOG((CLOG_DEBUG "drag info: %s", info)); CFRelease(dragInfo); - CString fileList(info); + String fileList(info); m_draggingFilename = fileList; } @@ -2140,7 +2140,7 @@ COSXScreen::getDraggingFilename() } void -COSXScreen::waitForCarbonLoop() const +OSXScreen::waitForCarbonLoop() const { #if defined(MAC_OS_X_VERSION_10_7) if (*m_carbonLoopReady) { @@ -2148,7 +2148,7 @@ COSXScreen::waitForCarbonLoop() const return; } - CLock lock(m_carbonLoopMutex); + Lock lock(m_carbonLoopMutex); LOG((CLOG_DEBUG "waiting for carbon loop")); diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index 5038611f..2d55426a 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -41,20 +41,20 @@ extern "C" { template -class CCondVar; -class CEventQueueTimer; -class CMutex; -class CThread; -class COSXKeyState; -class COSXScreenSaver; +class CondVar; +class EventQueueTimer; +class Mutex; +class Thread; +class OSXKeyState; +class OSXScreenSaver; class IEventQueue; -class CMutex; +class Mutex; //! Implementation of IPlatformScreen for OS X -class COSXScreen : public CPlatformScreen { +class OSXScreen : public PlatformScreen { public: - COSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor=true); - virtual ~COSXScreen(); + OSXScreen(IEventQueue* events, bool isPrimary, bool autoShowHideCursor=true); + virtual ~OSXScreen(); IEventQueue* getEvents() const { return m_events; } @@ -93,18 +93,18 @@ public: virtual void closeScreensaver(); virtual void screensaver(bool activate); virtual void resetOptions(); - virtual void setOptions(const COptionsList& options); + virtual void setOptions(const OptionsList& options); virtual void setSequenceNumber(UInt32); virtual bool isPrimary() const; - virtual void fakeDraggingFiles(CDragFileList fileList); - virtual CString& getDraggingFilename(); + virtual void fakeDraggingFiles(DragFileList fileList); + virtual String& getDraggingFilename(); - const CString& getDropTarget() const { return m_dropTarget; } + const String& getDropTarget() const { return m_dropTarget; } void waitForCarbonLoop() const; protected: // IPlatformScreen overrides - virtual void handleSystemEvent(const CEvent&, void*); + virtual void handleSystemEvent(const Event&, void*); virtual void updateButtons(); virtual IKeyState* getKeyState() const; @@ -114,8 +114,8 @@ private: void postMouseEvent(CGPoint&) const; // convenience function to send events - void sendEvent(CEvent::Type type, void* = NULL) const; - void sendClipboardEvent(CEvent::Type type, ClipboardID id) const; + void sendEvent(Event::Type type, void* = NULL) const; + void sendClipboardEvent(Event::Type type, ClipboardID id) const; // message handlers bool onMouseMove(SInt32 mx, SInt32 my); @@ -157,10 +157,10 @@ private: void enableDragTimer(bool enable); // drag timer handler - void handleDrag(const CEvent&, void*); + void handleDrag(const Event&, void*); // clipboard check timer handler - void handleClipboardCheck(const CEvent&, void*); + void handleClipboardCheck(const Event&, void*); #if defined(MAC_OS_X_VERSION_10_5) // Resolution switch callback @@ -183,7 +183,7 @@ private: void handlePowerChangeRequest(natural_t messageType, void* messageArgument); - void handleConfirmSleep(const CEvent& event, void*); + void handleConfirmSleep(const Event& event, void*); // global hotkey operating mode static bool isGlobalHotKeyOperatingModeAvailable(); @@ -206,14 +206,14 @@ private: void getDropTargetThread(void*); private: - struct CHotKeyItem { + struct HotKeyItem { public: - CHotKeyItem(UInt32, UInt32); - CHotKeyItem(EventHotKeyRef, UInt32, UInt32); + HotKeyItem(UInt32, UInt32); + HotKeyItem(EventHotKeyRef, UInt32, UInt32); EventHotKeyRef getRef() const; - bool operator<(const CHotKeyItem&) const; + bool operator<(const HotKeyItem&) const; private: EventHotKeyRef m_ref; @@ -221,7 +221,7 @@ private: UInt32 m_mask; }; - enum MouseButtonState { + enum EMouseButtonState { kMouseButtonUp = 0, kMouseButtonDragged, kMouseButtonDown, @@ -229,9 +229,9 @@ private: }; - class CMouseButtonState { + class MouseButtonState { public: - void set(UInt32 button, MouseButtonState state); + void set(UInt32 button, EMouseButtonState state); bool any(); void reset(); void overwrite(UInt32 buttons); @@ -242,10 +242,10 @@ private: std::bitset m_buttons; }; - typedef std::map HotKeyMap; + typedef std::map HotKeyMap; typedef std::vector HotKeyIDList; typedef std::map ModifierHotKeyMap; - typedef std::map HotKeyToIDMap; + typedef std::map HotKeyToIDMap; // true if screen is being used as a primary screen, false otherwise bool m_isPrimary; @@ -271,29 +271,29 @@ private: fakeMouseButton button method is marked 'const'. This is Evil, and this should be moved to a place where it need not be mutable as soon as possible. */ - mutable CMouseButtonState m_buttonState; + mutable MouseButtonState m_buttonState; typedef std::map MouseButtonEventMapType; std::vector MouseButtonEventMap; bool m_cursorHidden; SInt32 m_dragNumButtonsDown; Point m_dragLastPoint; - CEventQueueTimer* m_dragTimer; + EventQueueTimer* m_dragTimer; // keyboard stuff - COSXKeyState* m_keyState; + OSXKeyState* m_keyState; // clipboards - COSXClipboard m_pasteboard; + OSXClipboard m_pasteboard; UInt32 m_sequenceNumber; // screen saver stuff - COSXScreenSaver* m_screensaver; + OSXScreenSaver* m_screensaver; bool m_screensaverNotify; // clipboard stuff bool m_ownClipboard; - CEventQueueTimer* m_clipboardTimer; + EventQueueTimer* m_clipboardTimer; // window object that gets user input events when the server // has focus. @@ -312,9 +312,9 @@ private: EventHandlerRef m_switchEventHandlerRef; // sleep / wakeup - CMutex* m_pmMutex; - CThread* m_pmWatchThread; - CCondVar* m_pmThreadReady; + Mutex* m_pmMutex; + Thread* m_pmWatchThread; + CondVar* m_pmThreadReady; CFRunLoopRef m_pmRunloop; io_connect_t m_pmRootPort; @@ -345,11 +345,11 @@ private: IEventQueue* m_events; - CThread* m_getDropTargetThread; - CString m_dropTarget; + Thread* m_getDropTargetThread; + String m_dropTarget; #if defined(MAC_OS_X_VERSION_10_7) - CMutex* m_carbonLoopMutex; - CCondVar* m_carbonLoopReady; + Mutex* m_carbonLoopMutex; + CondVar* m_carbonLoopReady; #endif }; diff --git a/src/lib/platform/OSXScreenSaver.cpp b/src/lib/platform/OSXScreenSaver.cpp index c393077f..25e4be2f 100644 --- a/src/lib/platform/OSXScreenSaver.cpp +++ b/src/lib/platform/OSXScreenSaver.cpp @@ -31,10 +31,10 @@ void getProcessSerialNumber(const char* name, ProcessSerialNumber& psn); bool testProcessName(const char* name, const ProcessSerialNumber& psn); // -// COSXScreenSaver +// OSXScreenSaver // -COSXScreenSaver::COSXScreenSaver(IEventQueue* events, void* eventTarget) : +OSXScreenSaver::OSXScreenSaver(IEventQueue* events, void* eventTarget) : m_eventTarget(eventTarget), m_enabled(true), m_events(events) @@ -64,7 +64,7 @@ COSXScreenSaver::COSXScreenSaver(IEventQueue* events, void* eventTarget) : } } -COSXScreenSaver::~COSXScreenSaver() +OSXScreenSaver::~OSXScreenSaver() { RemoveEventHandler(m_launchTerminationEventHandlerRef); // screenSaverUtilReleaseController(m_screenSaverController); @@ -72,60 +72,60 @@ COSXScreenSaver::~COSXScreenSaver() } void -COSXScreenSaver::enable() +OSXScreenSaver::enable() { m_enabled = true; screenSaverUtilEnable(m_screenSaverController); } void -COSXScreenSaver::disable() +OSXScreenSaver::disable() { m_enabled = false; screenSaverUtilDisable(m_screenSaverController); } void -COSXScreenSaver::activate() +OSXScreenSaver::activate() { screenSaverUtilActivate(m_screenSaverController); } void -COSXScreenSaver::deactivate() +OSXScreenSaver::deactivate() { screenSaverUtilDeactivate(m_screenSaverController, m_enabled); } bool -COSXScreenSaver::isActive() const +OSXScreenSaver::isActive() const { return (screenSaverUtilIsActive(m_screenSaverController) != 0); } void -COSXScreenSaver::processLaunched(ProcessSerialNumber psn) +OSXScreenSaver::processLaunched(ProcessSerialNumber psn) { if (testProcessName("ScreenSaverEngine", psn)) { m_screenSaverPSN = psn; LOG((CLOG_DEBUG1 "ScreenSaverEngine launched. Enabled=%d", m_enabled)); if (m_enabled) { m_events->addEvent( - CEvent(m_events->forIPrimaryScreen().screensaverActivated(), + Event(m_events->forIPrimaryScreen().screensaverActivated(), m_eventTarget)); } } } void -COSXScreenSaver::processTerminated(ProcessSerialNumber psn) +OSXScreenSaver::processTerminated(ProcessSerialNumber psn) { if (m_screenSaverPSN.highLongOfPSN == psn.highLongOfPSN && m_screenSaverPSN.lowLongOfPSN == psn.lowLongOfPSN) { LOG((CLOG_DEBUG1 "ScreenSaverEngine terminated. Enabled=%d", m_enabled)); if (m_enabled) { m_events->addEvent( - CEvent(m_events->forIPrimaryScreen().screensaverDeactivated(), + Event(m_events->forIPrimaryScreen().screensaverDeactivated(), m_eventTarget)); } @@ -135,7 +135,7 @@ COSXScreenSaver::processTerminated(ProcessSerialNumber psn) } pascal OSStatus -COSXScreenSaver::launchTerminationCallback( +OSXScreenSaver::launchTerminationCallback( EventHandlerCallRef nextHandler, EventRef theEvent, void* userData) { @@ -151,7 +151,7 @@ COSXScreenSaver::launchTerminationCallback( if ((result == noErr) && (actualSize > 0) && (actualType == typeProcessSerialNumber)) { - COSXScreenSaver* screenSaver = (COSXScreenSaver*)userData; + OSXScreenSaver* screenSaver = (OSXScreenSaver*)userData; UInt32 eventKind = GetEventKind(theEvent); if (eventKind == kEventAppLaunched) { screenSaver->processLaunched(psn); diff --git a/src/lib/platform/OSXScreenSaver.h b/src/lib/platform/OSXScreenSaver.h index 9ad7d10e..04658cf9 100644 --- a/src/lib/platform/OSXScreenSaver.h +++ b/src/lib/platform/OSXScreenSaver.h @@ -25,10 +25,10 @@ class IEventQueue; //! OSX screen saver implementation -class COSXScreenSaver : public IScreenSaver { +class OSXScreenSaver : public IScreenSaver { public: - COSXScreenSaver(IEventQueue* events, void* eventTarget); - virtual ~COSXScreenSaver(); + OSXScreenSaver(IEventQueue* events, void* eventTarget); + virtual ~OSXScreenSaver(); // IScreenSaver overrides virtual void enable(); diff --git a/src/lib/platform/XWindowsClipboard.cpp b/src/lib/platform/XWindowsClipboard.cpp index 95aa4aa5..a589f2ae 100644 --- a/src/lib/platform/XWindowsClipboard.cpp +++ b/src/lib/platform/XWindowsClipboard.cpp @@ -145,7 +145,7 @@ CXWindowsClipboard::addRequest(Window owner, Window requestor, if (!success) { // send failure LOG((CLOG_DEBUG1 "failed")); - insertReply(new CReply(requestor, target, time)); + insertReply(new Reply(requestor, target, time)); } // send notifications that are pending @@ -164,7 +164,7 @@ CXWindowsClipboard::addSimpleRequest(Window requestor, } // handle targets - CString data; + String data; Atom type = None; int format = 0; if (target == m_atomTargets) { @@ -193,14 +193,14 @@ CXWindowsClipboard::addSimpleRequest(Window requestor, if (type != None) { // success LOG((CLOG_DEBUG1 "success")); - insertReply(new CReply(requestor, target, time, + insertReply(new Reply(requestor, target, time, property, data, type, format)); return true; } else { // failure LOG((CLOG_DEBUG1 "failed")); - insertReply(new CReply(requestor, target, time)); + insertReply(new Reply(requestor, target, time)); return false; } } @@ -209,7 +209,7 @@ bool CXWindowsClipboard::processRequest(Window requestor, ::Time /*time*/, Atom property) { - CReplyMap::iterator index = m_replies.find(requestor); + ReplyMap::iterator index = m_replies.find(requestor); if (index == m_replies.end()) { // unknown requestor window return false; @@ -218,10 +218,10 @@ CXWindowsClipboard::processRequest(Window requestor, // find the property in the known requests. it should be the // first property but we'll check 'em all if we have to. - CReplyList& replies = index->second; - for (CReplyList::iterator index2 = replies.begin(); + ReplyList& replies = index->second; + for (ReplyList::iterator index2 = replies.begin(); index2 != replies.end(); ++index2) { - CReply* reply = *index2; + Reply* reply = *index2; if (reply->m_replied && reply->m_property == property) { // if reply is complete then remove it and start the // next one. @@ -236,7 +236,7 @@ CXWindowsClipboard::processRequest(Window requestor, bool CXWindowsClipboard::destroyRequest(Window requestor) { - CReplyMap::iterator index = m_replies.find(requestor); + ReplyMap::iterator index = m_replies.find(requestor); if (index == m_replies.end()) { // unknown requestor window return false; @@ -298,7 +298,7 @@ CXWindowsClipboard::empty() } void -CXWindowsClipboard::add(EFormat format, const CString& data) +CXWindowsClipboard::add(EFormat format, const String& data) { assert(m_open); assert(m_owner); @@ -378,7 +378,7 @@ CXWindowsClipboard::has(EFormat format) const return m_added[format]; } -CString +String CXWindowsClipboard::get(EFormat format) const { assert(m_open); @@ -504,7 +504,7 @@ CXWindowsClipboard::icccmFillCache() // instead of the correct type ATOM; allow either. const Atom atomTargets = m_atomTargets; Atom target; - CString data; + String data; if (!icccmGetSelection(atomTargets, &target, &data) || (target != m_atomAtom && target != m_atomTargets)) { LOG((CLOG_DEBUG1 "selection doesn't support TARGETS")); @@ -548,7 +548,7 @@ CXWindowsClipboard::icccmFillCache() // get the data Atom actualTarget; - CString targetData; + String targetData; if (!icccmGetSelection(target, &actualTarget, &targetData)) { LOG((CLOG_DEBUG1 " no data for target %s", CXWindowsUtil::atomToString(m_display, target).c_str())); continue; @@ -564,7 +564,7 @@ CXWindowsClipboard::icccmFillCache() bool CXWindowsClipboard::icccmGetSelection(Atom target, - Atom* actualTarget, CString* data) const + Atom* actualTarget, String* data) const { assert(actualTarget != NULL); assert(data != NULL); @@ -588,7 +588,7 @@ IClipboard::Time CXWindowsClipboard::icccmGetTime() const { Atom actualTarget; - CString data; + String data; if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) && actualTarget == m_atomInteger) { Time time = *reinterpret_cast(data.data()); @@ -659,7 +659,7 @@ CXWindowsClipboard::motifOwnsClipboard() const // get the Motif clipboard header property from the root window Atom target; SInt32 format; - CString data; + String data; Window root = RootWindow(m_display, DefaultScreen(m_display)); if (!CXWindowsUtil::getWindowProperty(m_display, root, m_atomMotifClipHeader, @@ -668,9 +668,9 @@ CXWindowsClipboard::motifOwnsClipboard() const } // check the owner window against the current clipboard owner - const CMotifClipHeader* header = - reinterpret_cast(data.data()); - if (data.size() >= sizeof(CMotifClipHeader) && + const MotifClipHeader* header = + reinterpret_cast(data.data()); + if (data.size() >= sizeof(MotifClipHeader) && header->m_id == kMotifClipHeader) { if (static_cast(header->m_selectionOwner) == owner) { return true; @@ -688,7 +688,7 @@ CXWindowsClipboard::motifFillCache() // get the Motif clipboard header property from the root window Atom target; SInt32 format; - CString data; + String data; Window root = RootWindow(m_display, DefaultScreen(m_display)); if (!CXWindowsUtil::getWindowProperty(m_display, root, m_atomMotifClipHeader, @@ -697,9 +697,9 @@ CXWindowsClipboard::motifFillCache() } // check that the header is okay - const CMotifClipHeader* header = - reinterpret_cast(data.data()); - if (data.size() < sizeof(CMotifClipHeader) || + const MotifClipHeader* header = + reinterpret_cast(data.data()); + if (data.size() < sizeof(MotifClipHeader) || header->m_id != kMotifClipHeader || header->m_numItems < 1) { return; @@ -717,9 +717,9 @@ CXWindowsClipboard::motifFillCache() } // check that the item is okay - const CMotifClipItem* item = - reinterpret_cast(data.data()); - if (data.size() < sizeof(CMotifClipItem) || + const MotifClipItem* item = + reinterpret_cast(data.data()); + if (data.size() < sizeof(MotifClipItem) || item->m_id != kMotifClipItem || item->m_numFormats - item->m_numDeletedFormats < 1) { return; @@ -731,13 +731,13 @@ CXWindowsClipboard::motifFillCache() reinterpret_cast(data.data())); // get the available formats - typedef std::map CMotifFormatMap; - CMotifFormatMap motifFormats; + typedef std::map MotifFormatMap; + MotifFormatMap motifFormats; for (SInt32 i = 0; i < numFormats; ++i) { // get Motif format property from the root window sprintf(name, "_MOTIF_CLIP_ITEM_%d", formats[i]); Atom atomFormat = XInternAtom(m_display, name, False); - CString data; + String data; if (!CXWindowsUtil::getWindowProperty(m_display, root, atomFormat, &data, &target, &format, False)) { @@ -745,9 +745,9 @@ CXWindowsClipboard::motifFillCache() } // check that the format is okay - const CMotifClipFormat* motifFormat = - reinterpret_cast(data.data()); - if (data.size() < sizeof(CMotifClipFormat) || + const MotifClipFormat* motifFormat = + reinterpret_cast(data.data()); + if (data.size() < sizeof(MotifClipFormat) || motifFormat->m_id != kMotifClipFormat || motifFormat->m_length < 0 || motifFormat->m_type == None || @@ -772,21 +772,21 @@ CXWindowsClipboard::motifFillCache() } // see if atom is in target list - CMotifFormatMap::const_iterator index2 = + MotifFormatMap::const_iterator index2 = motifFormats.find(converter->getAtom()); if (index2 == motifFormats.end()) { continue; } // get format - const CMotifClipFormat* motifFormat = - reinterpret_cast( + const MotifClipFormat* motifFormat = + reinterpret_cast( index2->second.data()); const Atom target = motifFormat->m_type; // get the data (finally) Atom actualTarget; - CString targetData; + String targetData; if (!motifGetSelection(motifFormat, &actualTarget, &targetData)) { LOG((CLOG_DEBUG1 " no data for target %s", CXWindowsUtil::atomToString(m_display, target).c_str())); continue; @@ -801,8 +801,8 @@ CXWindowsClipboard::motifFillCache() } bool -CXWindowsClipboard::motifGetSelection(const CMotifClipFormat* format, - Atom* actualTarget, CString* data) const +CXWindowsClipboard::motifGetSelection(const MotifClipFormat* format, + Atom* actualTarget, String* data) const { // if the current clipboard owner and the owner indicated by the // motif clip header are the same then transfer via a property on @@ -838,7 +838,7 @@ CXWindowsClipboard::insertMultipleReply(Window requestor, // get the requested targets Atom target; SInt32 format; - CString data; + String data; if (!CXWindowsUtil::getWindowProperty(m_display, requestor, property, &data, &target, &format, False)) { // can't get the requested targets @@ -875,14 +875,14 @@ CXWindowsClipboard::insertMultipleReply(Window requestor, } // add reply for MULTIPLE request - insertReply(new CReply(requestor, m_atomMultiple, - time, property, CString(), None, 32)); + insertReply(new Reply(requestor, m_atomMultiple, + time, property, String(), None, 32)); return true; } void -CXWindowsClipboard::insertReply(CReply* reply) +CXWindowsClipboard::insertReply(Reply* reply) { assert(reply != NULL); @@ -909,7 +909,7 @@ CXWindowsClipboard::insertReply(CReply* reply) // note errors while we adjust event masks bool error = false; { - CXWindowsUtil::CErrorLock lock(m_display, &error); + CXWindowsUtil::ErrorLock lock(m_display, &error); // get and save the current event mask XWindowAttributes attr; @@ -934,7 +934,7 @@ CXWindowsClipboard::pushReplies() { // send the first reply for each window if that reply hasn't // been sent yet. - for (CReplyMap::iterator index = m_replies.begin(); + for (ReplyMap::iterator index = m_replies.begin(); index != m_replies.end(); ) { assert(!index->second.empty()); CReplyList::iterator listit = index->second.begin(); @@ -953,10 +953,10 @@ CXWindowsClipboard::pushReplies() } void -CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex, - CReplyList& replies, CReplyList::iterator index) +CXWindowsClipboard::pushReplies(ReplyMap::iterator& mapIndex, + ReplyList& replies, ReplyList::iterator index) { - CReply* reply = *index; + Reply* reply = *index; while (sendReply(reply)) { // reply is complete. discard it and send the next reply, // if any. @@ -971,7 +971,7 @@ CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex, // if there are no more replies in the list then remove the list // and stop watching the requestor for events. if (replies.empty()) { - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); Window requestor = mapIndex->first; XSelectInput(m_display, requestor, m_eventMasks[requestor]); m_replies.erase(mapIndex++); @@ -983,7 +983,7 @@ CXWindowsClipboard::pushReplies(CReplyMap::iterator& mapIndex, } bool -CXWindowsClipboard::sendReply(CReply* reply) +CXWindowsClipboard::sendReply(Reply* reply) { assert(reply != NULL); @@ -1048,7 +1048,7 @@ CXWindowsClipboard::sendReply(CReply* reply) LOG((CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property)); reply->m_done = true; if (reply->m_property != None) { - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); XDeleteProperty(m_display, reply->m_requestor, reply->m_property); } @@ -1083,13 +1083,13 @@ CXWindowsClipboard::sendReply(CReply* reply) // knowing the properties may help design a workaround, if // it becomes necessary. if (CLOG->getFilter() >= kDEBUG2) { - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); int n; Atom* props = XListProperties(m_display, reply->m_requestor, &n); LOG((CLOG_DEBUG2 "properties of 0x%08x:", reply->m_requestor)); for (int i = 0; i < n; ++i) { Atom target; - CString data; + String data; char* name = XGetAtomName(m_display, props[i]); if (!CXWindowsUtil::getWindowProperty(m_display, reply->m_requestor, @@ -1100,9 +1100,9 @@ CXWindowsClipboard::sendReply(CReply* reply) // if there are any non-ascii characters in string // then print the binary data. static const char* hex = "0123456789abcdef"; - for (CString::size_type j = 0; j < data.size(); ++j) { + for (String::size_type j = 0; j < data.size(); ++j) { if (data[j] < 32 || data[j] > 126) { - CString tmp; + String tmp; tmp.reserve(data.size() * 3); for (j = 0; j < data.size(); ++j) { unsigned char v = (unsigned char)data[j]; @@ -1141,7 +1141,7 @@ CXWindowsClipboard::sendReply(CReply* reply) void CXWindowsClipboard::clearReplies() { - for (CReplyMap::iterator index = m_replies.begin(); + for (ReplyMap::iterator index = m_replies.begin(); index != m_replies.end(); ++index) { clearReplies(index->second); } @@ -1150,9 +1150,9 @@ CXWindowsClipboard::clearReplies() } void -CXWindowsClipboard::clearReplies(CReplyList& replies) +CXWindowsClipboard::clearReplies(ReplyList& replies) { - for (CReplyList::iterator index = replies.begin(); + for (ReplyList::iterator index = replies.begin(); index != replies.end(); ++index) { delete *index; } @@ -1171,7 +1171,7 @@ CXWindowsClipboard::sendNotify(Window requestor, event.xselection.target = target; event.xselection.property = property; event.xselection.time = time; - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); XSendEvent(m_display, requestor, False, 0, &event); } @@ -1210,7 +1210,7 @@ CXWindowsClipboard::wasOwnedAtTime(::Time time) const } Atom -CXWindowsClipboard::getTargetsData(CString& data, int* format) const +CXWindowsClipboard::getTargetsData(String& data, int* format) const { assert(format != NULL); @@ -1235,7 +1235,7 @@ CXWindowsClipboard::getTargetsData(CString& data, int* format) const } Atom -CXWindowsClipboard::getTimestampData(CString& data, int* format) const +CXWindowsClipboard::getTimestampData(String& data, int* format) const { assert(format != NULL); @@ -1273,7 +1273,7 @@ CXWindowsClipboard::CICCCMGetClipboard::~CICCCMGetClipboard() bool CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display, - Atom selection, Atom target, Atom* actualTarget, CString* data) + Atom selection, Atom target, Atom* actualTarget, String* data) { assert(actualTarget != NULL); assert(data != NULL); @@ -1314,7 +1314,7 @@ CXWindowsClipboard::CICCCMGetClipboard::readClipboard(Display* display, // by badly behaved selection owners. XEvent xevent; std::vector events; - CStopwatch timeout(true); + Stopwatch timeout(true); static const double s_timeout = 0.25; // FIXME -- is this too short? bool noWait = false; while (!m_done && !m_failed) { @@ -1418,7 +1418,7 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent( // get the data from the property Atom target; - const CString::size_type oldSize = m_data->size(); + const String::size_type oldSize = m_data->size(); if (!CXWindowsUtil::getWindowProperty(display, m_requestor, m_property, m_data, &target, NULL, True)) { // unable to read property @@ -1484,10 +1484,10 @@ CXWindowsClipboard::CICCCMGetClipboard::processEvent( // -// CXWindowsClipboard::CReply +// CXWindowsClipboard::Reply // -CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) : +CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time) : m_requestor(requestor), m_target(target), m_time(time), @@ -1502,8 +1502,8 @@ CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time) : // do nothing } -CXWindowsClipboard::CReply::CReply(Window requestor, Atom target, ::Time time, - Atom property, const CString& data, Atom type, int format) : +CXWindowsClipboard::Reply::Reply(Window requestor, Atom target, ::Time time, + Atom property, const String& data, Atom type, int format) : m_requestor(requestor), m_target(target), m_time(time), diff --git a/src/lib/platform/XWindowsClipboard.h b/src/lib/platform/XWindowsClipboard.h index 293a91f3..8739d727 100644 --- a/src/lib/platform/XWindowsClipboard.h +++ b/src/lib/platform/XWindowsClipboard.h @@ -88,12 +88,12 @@ public: // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const CString& data); + virtual void add(EFormat, const String& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual CString get(EFormat) const; + virtual String get(EFormat) const; private: // remove all converters from our list @@ -146,7 +146,7 @@ private: // cannot be performed (in which case *actualTarget == None). bool readClipboard(Display* display, Atom selection, Atom target, - Atom* actualTarget, CString* data); + Atom* actualTarget, String* data); private: bool processEvent(Display* display, XEvent* event); @@ -167,7 +167,7 @@ private: bool m_reading; // the converted selection data - CString* m_data; + String* m_data; // the actual type of the data. if this is None then the // selection owner cannot convert to the requested type. @@ -182,7 +182,7 @@ private: enum { kMotifClipFormat = 1, kMotifClipItem, kMotifClipHeader }; // _MOTIF_CLIP_HEADER structure - class CMotifClipHeader { + class MotifClipHeader { public: SInt32 m_id; // kMotifClipHeader SInt32 m_pad1[3]; @@ -195,7 +195,7 @@ private: }; // Motif clip item structure - class CMotifClipItem { + class MotifClipItem { public: SInt32 m_id; // kMotifClipItem SInt32 m_pad1[5]; @@ -206,7 +206,7 @@ private: }; // Motif clip format structure - class CMotifClipFormat { + class MotifClipFormat { public: SInt32 m_id; // kMotifClipFormat SInt32 m_pad1[6]; @@ -219,11 +219,11 @@ private: }; // stores data needed to respond to a selection request - class CReply { + class Reply { public: - CReply(Window, Atom target, ::Time); - CReply(Window, Atom target, ::Time, Atom property, - const CString& data, Atom type, int format); + Reply(Window, Atom target, ::Time); + Reply(Window, Atom target, ::Time, Atom property, + const String& data, Atom type, int format); public: // information about the request @@ -239,21 +239,21 @@ private: bool m_done; // the data to send and its type and format - CString m_data; + String m_data; Atom m_type; int m_format; // index of next byte in m_data to send UInt32 m_ptr; }; - typedef std::list CReplyList; - typedef std::map CReplyMap; - typedef std::map CReplyEventMask; + typedef std::list ReplyList; + typedef std::map ReplyMap; + typedef std::map ReplyEventMask; // ICCCM interoperability methods void icccmFillCache(); bool icccmGetSelection(Atom target, - Atom* actualTarget, CString* data) const; + Atom* actualTarget, String* data) const; Time icccmGetTime() const; // motif interoperability methods @@ -261,26 +261,26 @@ private: void motifUnlockClipboard() const; bool motifOwnsClipboard() const; void motifFillCache(); - bool motifGetSelection(const CMotifClipFormat*, - Atom* actualTarget, CString* data) const; + bool motifGetSelection(const MotifClipFormat*, + Atom* actualTarget, String* data) const; Time motifGetTime() const; // reply methods bool insertMultipleReply(Window, ::Time, Atom); - void insertReply(CReply*); + void insertReply(Reply*); void pushReplies(); - void pushReplies(CReplyMap::iterator&, - CReplyList&, CReplyList::iterator); - bool sendReply(CReply*); + void pushReplies(ReplyMap::iterator&, + ReplyList&, ReplyList::iterator); + bool sendReply(Reply*); void clearReplies(); - void clearReplies(CReplyList&); + void clearReplies(ReplyList&); void sendNotify(Window requestor, Atom selection, Atom target, Atom property, Time time); bool wasOwnedAtTime(::Time) const; // data conversion methods - Atom getTargetsData(CString&, int* format) const; - Atom getTimestampData(CString&, int* format) const; + Atom getTargetsData(String&, int* format) const; + Atom getTimestampData(String&, int* format) const; private: typedef std::vector ConverterList; @@ -303,11 +303,11 @@ private: bool m_cached; Time m_cacheTime; bool m_added[kNumFormats]; - CString m_data[kNumFormats]; + String m_data[kNumFormats]; // conversion request replies - CReplyMap m_replies; - CReplyEventMask m_eventMasks; + ReplyMap m_replies; + ReplyEventMask m_eventMasks; // clipboard format converters ConverterList m_converters; @@ -365,14 +365,14 @@ public: getFormat(). The return data will be in the X selection format returned by getAtom(). */ - virtual CString fromIClipboard(const CString&) const = 0; + virtual String fromIClipboard(const String&) const = 0; //! Convert to IClipboard format /*! Convert from the X selection format to the IClipboard format (i.e., the reverse of fromIClipboard()). */ - virtual CString toIClipboard(const CString&) const = 0; + virtual String toIClipboard(const String&) const = 0; //@} }; diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp index 800e51dc..61cfa772 100644 --- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp +++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.cpp @@ -122,8 +122,8 @@ CXWindowsClipboardAnyBitmapConverter::getDataSize() const return 8; } -CString -CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const +String +CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const String& bmp) const { // fill BMP info header with native-endian data CBMPInfoHeader infoHeader; @@ -145,7 +145,7 @@ CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const infoHeader.biWidth == 0 || infoHeader.biHeight == 0 || infoHeader.biPlanes != 0 || infoHeader.biCompression != 0 || (infoHeader.biBitCount != 24 && infoHeader.biBitCount != 32)) { - return CString(); + return String(); } // convert to image format @@ -160,14 +160,14 @@ CXWindowsClipboardAnyBitmapConverter::fromIClipboard(const CString& bmp) const } } -CString -CXWindowsClipboardAnyBitmapConverter::toIClipboard(const CString& image) const +String +CXWindowsClipboardAnyBitmapConverter::toIClipboard(const String& image) const { // convert to raw BMP data UInt32 w, h, depth; - CString rawBMP = doToIClipboard(image, w, h, depth); + String rawBMP = doToIClipboard(image, w, h, depth); if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) { - return CString(); + return String(); } // fill BMP info header with little-endian data @@ -186,6 +186,6 @@ CXWindowsClipboardAnyBitmapConverter::toIClipboard(const CString& image) const toLE(dst, static_cast(0)); // construct image - return CString(reinterpret_cast(infoHeader), + return String(reinterpret_cast(infoHeader), sizeof(infoHeader)) + rawBMP; } diff --git a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h index 8e238f02..e4dafeda 100644 --- a/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h +++ b/src/lib/platform/XWindowsClipboardAnyBitmapConverter.h @@ -32,22 +32,22 @@ public: getFormat() const; virtual Atom getAtom() const = 0; virtual int getDataSize() const; - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; protected: //! Convert from IClipboard format /*! Convert raw BGR pixel data to another image format. */ - virtual CString doBGRFromIClipboard(const UInt8* bgrData, + virtual String doBGRFromIClipboard(const UInt8* bgrData, UInt32 w, UInt32 h) const = 0; //! Convert from IClipboard format /*! Convert raw BGRA pixel data to another image format. */ - virtual CString doBGRAFromIClipboard(const UInt8* bgrData, + virtual String doBGRAFromIClipboard(const UInt8* bgrData, UInt32 w, UInt32 h) const = 0; //! Convert to IClipboard format @@ -55,6 +55,6 @@ protected: Convert an image into raw BGR or BGRA image data and store the width, height, and image depth (24 or 32). */ - virtual CString doToIClipboard(const CString&, + virtual String doToIClipboard(const String&, UInt32& w, UInt32& h, UInt32& depth) const = 0; }; diff --git a/src/lib/platform/XWindowsClipboardBMPConverter.cpp b/src/lib/platform/XWindowsClipboardBMPConverter.cpp index 25f56fa7..0db91783 100644 --- a/src/lib/platform/XWindowsClipboardBMPConverter.cpp +++ b/src/lib/platform/XWindowsClipboardBMPConverter.cpp @@ -101,8 +101,8 @@ CXWindowsClipboardBMPConverter::getDataSize() const return 8; } -CString -CXWindowsClipboardBMPConverter::fromIClipboard(const CString& bmp) const +String +CXWindowsClipboardBMPConverter::fromIClipboard(const String& bmp) const { // create BMP image UInt8 header[14]; @@ -113,21 +113,21 @@ CXWindowsClipboardBMPConverter::fromIClipboard(const CString& bmp) const toLE(dst, static_cast(0)); toLE(dst, static_cast(0)); toLE(dst, static_cast(14 + 40)); - return CString(reinterpret_cast(header), 14) + bmp; + return String(reinterpret_cast(header), 14) + bmp; } -CString -CXWindowsClipboardBMPConverter::toIClipboard(const CString& bmp) const +String +CXWindowsClipboardBMPConverter::toIClipboard(const String& bmp) const { // make sure data is big enough for a BMP file if (bmp.size() <= 14 + 40) { - return CString(); + return String(); } // check BMP file header const UInt8* rawBMPHeader = reinterpret_cast(bmp.data()); if (rawBMPHeader[0] != 'B' || rawBMPHeader[1] != 'M') { - return CString(); + return String(); } // get offset to image data diff --git a/src/lib/platform/XWindowsClipboardBMPConverter.h b/src/lib/platform/XWindowsClipboardBMPConverter.h index b7726d07..7231688b 100644 --- a/src/lib/platform/XWindowsClipboardBMPConverter.h +++ b/src/lib/platform/XWindowsClipboardBMPConverter.h @@ -32,8 +32,8 @@ public: getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; private: Atom m_atom; diff --git a/src/lib/platform/XWindowsClipboardHTMLConverter.cpp b/src/lib/platform/XWindowsClipboardHTMLConverter.cpp index e07fec73..f9e1e8f0 100644 --- a/src/lib/platform/XWindowsClipboardHTMLConverter.cpp +++ b/src/lib/platform/XWindowsClipboardHTMLConverter.cpp @@ -54,14 +54,14 @@ CXWindowsClipboardHTMLConverter::getDataSize() const return 8; } -CString -CXWindowsClipboardHTMLConverter::fromIClipboard(const CString& data) const +String +CXWindowsClipboardHTMLConverter::fromIClipboard(const String& data) const { - return CUnicode::UTF8ToUTF16(data); + return Unicode::UTF8ToUTF16(data); } -CString -CXWindowsClipboardHTMLConverter::toIClipboard(const CString& data) const +String +CXWindowsClipboardHTMLConverter::toIClipboard(const String& data) const { - return CUnicode::UTF16ToUTF8(data); + return Unicode::UTF16ToUTF8(data); } diff --git a/src/lib/platform/XWindowsClipboardHTMLConverter.h b/src/lib/platform/XWindowsClipboardHTMLConverter.h index fe8344c2..56c091e4 100644 --- a/src/lib/platform/XWindowsClipboardHTMLConverter.h +++ b/src/lib/platform/XWindowsClipboardHTMLConverter.h @@ -34,8 +34,8 @@ public: getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; private: Atom m_atom; diff --git a/src/lib/platform/XWindowsClipboardTextConverter.cpp b/src/lib/platform/XWindowsClipboardTextConverter.cpp index 35363e44..f6067392 100644 --- a/src/lib/platform/XWindowsClipboardTextConverter.cpp +++ b/src/lib/platform/XWindowsClipboardTextConverter.cpp @@ -54,24 +54,24 @@ CXWindowsClipboardTextConverter::getDataSize() const return 8; } -CString -CXWindowsClipboardTextConverter::fromIClipboard(const CString& data) const +String +CXWindowsClipboardTextConverter::fromIClipboard(const String& data) const { - return CUnicode::UTF8ToText(data); + return Unicode::UTF8ToText(data); } -CString -CXWindowsClipboardTextConverter::toIClipboard(const CString& data) const +String +CXWindowsClipboardTextConverter::toIClipboard(const String& data) const { // convert to UTF-8 bool errors; - CString utf8 = CUnicode::textToUTF8(data, &errors); + String utf8 = Unicode::textToUTF8(data, &errors); // if there were decoding errors then, to support old applications // that don't understand UTF-8 but can report the exact binary // UTF-8 representation, see if the data appears to be UTF-8. if // so then use it as is. - if (errors && CUnicode::isUTF8(data)) { + if (errors && Unicode::isUTF8(data)) { return data; } diff --git a/src/lib/platform/XWindowsClipboardTextConverter.h b/src/lib/platform/XWindowsClipboardTextConverter.h index a0ed52c4..0e1d73f9 100644 --- a/src/lib/platform/XWindowsClipboardTextConverter.h +++ b/src/lib/platform/XWindowsClipboardTextConverter.h @@ -34,8 +34,8 @@ public: getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; private: Atom m_atom; diff --git a/src/lib/platform/XWindowsClipboardUCS2Converter.cpp b/src/lib/platform/XWindowsClipboardUCS2Converter.cpp index ffd8be82..a3bb66a0 100644 --- a/src/lib/platform/XWindowsClipboardUCS2Converter.cpp +++ b/src/lib/platform/XWindowsClipboardUCS2Converter.cpp @@ -54,14 +54,14 @@ CXWindowsClipboardUCS2Converter::getDataSize() const return 16; } -CString -CXWindowsClipboardUCS2Converter::fromIClipboard(const CString& data) const +String +CXWindowsClipboardUCS2Converter::fromIClipboard(const String& data) const { - return CUnicode::UTF8ToUCS2(data); + return Unicode::UTF8ToUCS2(data); } -CString -CXWindowsClipboardUCS2Converter::toIClipboard(const CString& data) const +String +CXWindowsClipboardUCS2Converter::toIClipboard(const String& data) const { - return CUnicode::UCS2ToUTF8(data); + return Unicode::UCS2ToUTF8(data); } diff --git a/src/lib/platform/XWindowsClipboardUCS2Converter.h b/src/lib/platform/XWindowsClipboardUCS2Converter.h index daefccea..d68072e3 100644 --- a/src/lib/platform/XWindowsClipboardUCS2Converter.h +++ b/src/lib/platform/XWindowsClipboardUCS2Converter.h @@ -34,8 +34,8 @@ public: getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; private: Atom m_atom; diff --git a/src/lib/platform/XWindowsClipboardUTF8Converter.cpp b/src/lib/platform/XWindowsClipboardUTF8Converter.cpp index 050aaea3..fde643b1 100644 --- a/src/lib/platform/XWindowsClipboardUTF8Converter.cpp +++ b/src/lib/platform/XWindowsClipboardUTF8Converter.cpp @@ -52,14 +52,14 @@ CXWindowsClipboardUTF8Converter::getDataSize() const return 8; } -CString -CXWindowsClipboardUTF8Converter::fromIClipboard(const CString& data) const +String +CXWindowsClipboardUTF8Converter::fromIClipboard(const String& data) const { return data; } -CString -CXWindowsClipboardUTF8Converter::toIClipboard(const CString& data) const +String +CXWindowsClipboardUTF8Converter::toIClipboard(const String& data) const { return data; } diff --git a/src/lib/platform/XWindowsClipboardUTF8Converter.h b/src/lib/platform/XWindowsClipboardUTF8Converter.h index 0ad6c2dd..4d114d43 100644 --- a/src/lib/platform/XWindowsClipboardUTF8Converter.h +++ b/src/lib/platform/XWindowsClipboardUTF8Converter.h @@ -34,8 +34,8 @@ public: getFormat() const; virtual Atom getAtom() const; virtual int getDataSize() const; - virtual CString fromIClipboard(const CString&) const; - virtual CString toIClipboard(const CString&) const; + virtual String fromIClipboard(const String&) const; + virtual String toIClipboard(const String&) const; private: Atom m_atom; diff --git a/src/lib/platform/XWindowsEventQueueBuffer.cpp b/src/lib/platform/XWindowsEventQueueBuffer.cpp index 74c0c30f..2438d3de 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.cpp +++ b/src/lib/platform/XWindowsEventQueueBuffer.cpp @@ -42,10 +42,10 @@ #endif // -// CEventQueueTimer +// EventQueueTimer // -class CEventQueueTimer { }; +class EventQueueTimer { }; // @@ -84,7 +84,7 @@ CXWindowsEventQueueBuffer::~CXWindowsEventQueueBuffer() void CXWindowsEventQueueBuffer::waitForEvent(double dtimeout) { - CThread::testCancel(); + Thread::testCancel(); // clear out the pipe in preparation for waiting. @@ -98,7 +98,7 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout) } { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // we're now waiting for events m_waiting = true; @@ -107,7 +107,7 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout) } // calling flush may have queued up a new event. if (!CXWindowsEventQueueBuffer::isEmpty()) { - CThread::testCancel(); + Thread::testCancel(); return; } @@ -190,17 +190,17 @@ CXWindowsEventQueueBuffer::waitForEvent(double dtimeout) { // we're no longer waiting for events - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_waiting = false; } - CThread::testCancel(); + Thread::testCancel(); } IEventQueueBuffer::Type -CXWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) +CXWindowsEventQueueBuffer::getEvent(Event& event, UInt32& dataID) { - CLock lock(&m_mutex); + Lock lock(&m_mutex); // push out pending events flush(); @@ -215,7 +215,7 @@ CXWindowsEventQueueBuffer::getEvent(CEvent& event, UInt32& dataID) return kUser; } else { - event = CEvent(CEvent::kSystem, + event = Event(Event::kSystem, m_events->getSystemTarget(), &m_event); return kSystem; } @@ -233,7 +233,7 @@ CXWindowsEventQueueBuffer::addEvent(UInt32 dataID) xevent.xclient.data.l[0] = static_cast(dataID); // save the message - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_postedEvents.push_back(xevent); // if we're currently waiting for an event then send saved events to @@ -261,18 +261,18 @@ CXWindowsEventQueueBuffer::addEvent(UInt32 dataID) bool CXWindowsEventQueueBuffer::isEmpty() const { - CLock lock(&m_mutex); + Lock lock(&m_mutex); return (XPending(m_display) == 0 ); } -CEventQueueTimer* +EventQueueTimer* CXWindowsEventQueueBuffer::newTimer(double, bool) const { - return new CEventQueueTimer; + return new EventQueueTimer; } void -CXWindowsEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const +CXWindowsEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const { delete timer; } diff --git a/src/lib/platform/XWindowsEventQueueBuffer.h b/src/lib/platform/XWindowsEventQueueBuffer.h index f18a0769..224e9881 100644 --- a/src/lib/platform/XWindowsEventQueueBuffer.h +++ b/src/lib/platform/XWindowsEventQueueBuffer.h @@ -39,25 +39,25 @@ public: // IEventQueueBuffer overrides virtual void init() { } virtual void waitForEvent(double timeout); - virtual Type getEvent(CEvent& event, UInt32& dataID); + virtual Type getEvent(Event& event, UInt32& dataID); virtual bool addEvent(UInt32 dataID); virtual bool isEmpty() const; - virtual CEventQueueTimer* + virtual EventQueueTimer* newTimer(double duration, bool oneShot) const; - virtual void deleteTimer(CEventQueueTimer*) const; + virtual void deleteTimer(EventQueueTimer*) const; private: void flush(); private: - typedef std::vector CEventList; + typedef std::vector EventList; - CMutex m_mutex; + Mutex m_mutex; Display* m_display; Window m_window; Atom m_userEvent; XEvent m_event; - CEventList m_postedEvents; + EventList m_postedEvents; bool m_waiting; int m_pipefd[2]; IEventQueue* m_events; diff --git a/src/lib/platform/XWindowsKeyState.cpp b/src/lib/platform/XWindowsKeyState.cpp index 17075fe7..840d1338 100644 --- a/src/lib/platform/XWindowsKeyState.cpp +++ b/src/lib/platform/XWindowsKeyState.cpp @@ -43,7 +43,7 @@ static const size_t ModifiersFromXDefaultSize = 32; CXWindowsKeyState::CXWindowsKeyState( Display* display, bool useXKB, IEventQueue* events) : - CKeyState(events), + KeyState(events), m_display(display), m_modifierFromX(ModifiersFromXDefaultSize) { @@ -52,8 +52,8 @@ CXWindowsKeyState::CXWindowsKeyState( CXWindowsKeyState::CXWindowsKeyState( Display* display, bool useXKB, - IEventQueue* events, CKeyMap& keyMap) : - CKeyState(events, keyMap), + IEventQueue* events, synergy::KeyMap& keyMap) : + KeyState(events, keyMap), m_display(display), m_modifierFromX(ModifiersFromXDefaultSize) { @@ -152,7 +152,7 @@ CXWindowsKeyState::mapModifiersToX(KeyModifierMask mask, } void -CXWindowsKeyState::mapKeyToKeycodes(KeyID key, CKeycodeList& keycodes) const +CXWindowsKeyState::mapKeyToKeycodes(KeyID key, KeycodeList& keycodes) const { keycodes.clear(); std::pair(i + minKeycode); @@ -495,7 +495,7 @@ CXWindowsKeyState::updateKeysymMap(CKeyMap& keyMap) item.m_lock = false; if (modifierButtons.count(keycode) > 0) { // get flags for modifier keys - CKeyMap::initModifierKey(item); + synergy::KeyMap::initModifierKey(item); // add mapping from X (unless we already have) if (item.m_generates != 0) { @@ -543,7 +543,7 @@ CXWindowsKeyState::updateKeysymMap(CKeyMap& keyMap) #if HAVE_XKB_EXTENSION void -CXWindowsKeyState::updateKeysymMapXKB(CKeyMap& keyMap) +CXWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap) { static const XkbKTMapEntryRec defMapEntry = { True, // active @@ -589,7 +589,7 @@ CXWindowsKeyState::updateKeysymMapXKB(CKeyMap& keyMap) // check every button. on this pass we save all modifiers as native // X modifier masks. - CKeyMap::KeyItem item; + synergy::KeyMap::KeyItem item; for (int i = m_xkb->min_key_code; i <= m_xkb->max_key_code; ++i) { KeyCode keycode = static_cast(i); item.m_button = static_cast(keycode); @@ -783,7 +783,7 @@ CXWindowsKeyState::updateKeysymMapXKB(CKeyMap& keyMap) void CXWindowsKeyState::remapKeyModifiers(KeyID id, SInt32 group, - CKeyMap::KeyItem& item, void* vself) + synergy::KeyMap::KeyItem& item, void* vself) { CXWindowsKeyState* self = reinterpret_cast(vself); item.m_required = diff --git a/src/lib/platform/XWindowsKeyState.h b/src/lib/platform/XWindowsKeyState.h index 6ac5c118..12aea567 100644 --- a/src/lib/platform/XWindowsKeyState.h +++ b/src/lib/platform/XWindowsKeyState.h @@ -42,9 +42,9 @@ class IEventQueue; /*! A key state for X Windows. */ -class CXWindowsKeyState : public CKeyState { +class CXWindowsKeyState : public KeyState { public: - typedef std::vector CKeycodeList; + typedef std::vector KeycodeList; enum { kGroupPoll = -1, kGroupPollAndSet = -2 @@ -52,7 +52,7 @@ public: CXWindowsKeyState(Display*, bool useXKB, IEventQueue* events); CXWindowsKeyState(Display*, bool useXKB, - IEventQueue* events, CKeyMap& keyMap); + IEventQueue* events, synergy::KeyMap& keyMap); ~CXWindowsKeyState(); //! @name modifiers @@ -99,7 +99,7 @@ public: that key. */ void mapKeyToKeycodes(KeyID key, - CKeycodeList& keycodes) const; + KeycodeList& keycodes) const; //@} @@ -111,20 +111,20 @@ public: virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const; protected: - // CKeyState overrides - virtual void getKeyMap(CKeyMap& keyMap); + // KeyState overrides + virtual void getKeyMap(synergy::KeyMap& keyMap); virtual void fakeKey(const Keystroke& keystroke); private: void init(Display* display, bool useXKB); - void updateKeysymMap(CKeyMap&); - void updateKeysymMapXKB(CKeyMap&); + void updateKeysymMap(synergy::KeyMap&); + void updateKeysymMapXKB(synergy::KeyMap&); bool hasModifiersXKB() const; int getEffectiveGroup(KeyCode, int group) const; UInt32 getGroupFromState(unsigned int state) const; static void remapKeyModifiers(KeyID, SInt32, - CKeyMap::KeyItem&, void*); + synergy::KeyMap::KeyItem&, void*); private: struct XKBModifierInfo { diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 15f1385c..f520334b 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -121,7 +121,7 @@ CXWindowsScreen::CXWindowsScreen( m_xi2detected(false), m_xrandr(false), m_events(events), - CPlatformScreen(events) + PlatformScreen(events) { assert(s_screen == NULL); @@ -187,7 +187,7 @@ CXWindowsScreen::CXWindowsScreen( } // install event handlers - m_events->adoptHandler(CEvent::kSystem, m_events->getSystemTarget(), + m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(), new TMethodEventJob(this, &CXWindowsScreen::handleSystemEvent)); @@ -202,7 +202,7 @@ CXWindowsScreen::~CXWindowsScreen() assert(m_display != NULL); m_events->adoptBuffer(NULL); - m_events->removeHandler(CEvent::kSystem, m_events->getSystemTarget()); + m_events->removeHandler(Event::kSystem, m_events->getSystemTarget()); for (ClipboardID id = 0; id < kClipboardEnd; ++id) { delete m_clipboard[id]; } @@ -279,7 +279,7 @@ CXWindowsScreen::enter() // set the input focus to what it had been when we took it if (m_lastFocus != None) { // the window may not exist anymore so ignore errors - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); XSetInputFocus(m_display, m_lastFocus, m_lastFocusRevert, CurrentTime); } @@ -396,7 +396,7 @@ CXWindowsScreen::setClipboard(ClipboardID id, const IClipboard* clipboard) if (clipboard != NULL) { // save clipboard data - return CClipboard::copy(m_clipboard[id], clipboard, timestamp); + return Clipboard::copy(m_clipboard[id], clipboard, timestamp); } else { // assert clipboard ownership @@ -451,7 +451,7 @@ CXWindowsScreen::resetOptions() } void -CXWindowsScreen::setOptions(const COptionsList& options) +CXWindowsScreen::setOptions(const OptionsList& options) { for (UInt32 i = 0, n = options.size(); i < n; i += 2) { if (options[i] == kOptionXTestXineramaUnaware) { @@ -498,7 +498,7 @@ CXWindowsScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const m_display, m_clipboard[id]->getWindow()); // copy the clipboard - return CClipboard::copy(clipboard, m_clipboard[id], timestamp); + return Clipboard::copy(clipboard, m_clipboard[id], timestamp); } void @@ -576,7 +576,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) LOG((CLOG_DEBUG "could not map hotkey id=%04x mask=%04x", key, mask)); return 0; } - CXWindowsKeyState::CKeycodeList keycodes; + CXWindowsKeyState::KeycodeList keycodes; m_keyState->mapKeyToKeycodes(key, keycodes); if (key != kKeyNone && keycodes.empty()) { // can't map key @@ -600,7 +600,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) // requested modifiers. bool err = false; { - CXWindowsUtil::CErrorLock lock(m_display, &err); + CXWindowsUtil::ErrorLock lock(m_display, &err); if (key == kKeyNone) { static const KeyModifierMask s_hotKeyModifiers[] = { KeyModifierShift, @@ -677,7 +677,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) False, GrabModeAsync, GrabModeAsync); if (!err) { hotKeys.push_back(std::make_pair(code, modifiers2)); - m_hotKeyToIDMap[CHotKeyItem(code, modifiers2)] = id; + m_hotKeyToIDMap[HotKeyItem(code, modifiers2)] = id; } } } @@ -704,7 +704,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) } - for (CXWindowsKeyState::CKeycodeList::iterator j = keycodes.begin(); + for (CXWindowsKeyState::KeycodeList::iterator j = keycodes.begin(); j != keycodes.end() && !err; ++j) { for (size_t i = 0; i < (1u << numToggleModifiers); ++i) { // add toggle modifiers for index i @@ -724,7 +724,7 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) False, GrabModeAsync, GrabModeAsync); if (!err) { hotKeys.push_back(std::make_pair(*j, tmpModifiers)); - m_hotKeyToIDMap[CHotKeyItem(*j, tmpModifiers)] = id; + m_hotKeyToIDMap[HotKeyItem(*j, tmpModifiers)] = id; } } } @@ -736,16 +736,16 @@ CXWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) for (HotKeyList::iterator j = hotKeys.begin(); j != hotKeys.end(); ++j) { XUngrabKey(m_display, j->first, j->second, m_root); - m_hotKeyToIDMap.erase(CHotKeyItem(j->first, j->second)); + m_hotKeyToIDMap.erase(HotKeyItem(j->first, j->second)); } m_oldHotKeyIDs.push_back(id); m_hotKeys.erase(id); - LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", CKeyMap::formatKey(key, mask).c_str(), key, mask)); + LOG((CLOG_WARN "failed to register hotkey %s (id=%04x mask=%04x)", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask)); return 0; } - LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", CKeyMap::formatKey(key, mask).c_str(), key, mask, id)); + LOG((CLOG_DEBUG "registered hotkey %s (id=%04x mask=%04x) as id=%d", synergy::KeyMap::formatKey(key, mask).c_str(), key, mask, id)); return id; } @@ -761,12 +761,12 @@ CXWindowsScreen::unregisterHotKey(UInt32 id) // unregister with OS bool err = false; { - CXWindowsUtil::CErrorLock lock(m_display, &err); + CXWindowsUtil::ErrorLock lock(m_display, &err); HotKeyList& hotKeys = i->second; for (HotKeyList::iterator j = hotKeys.begin(); j != hotKeys.end(); ++j) { XUngrabKey(m_display, j->first, j->second, m_root); - m_hotKeyToIDMap.erase(CHotKeyItem(j->first, j->second)); + m_hotKeyToIDMap.erase(HotKeyItem(j->first, j->second)); } } if (err) { @@ -1145,15 +1145,15 @@ CXWindowsScreen::openIM() } void -CXWindowsScreen::sendEvent(CEvent::Type type, void* data) +CXWindowsScreen::sendEvent(Event::Type type, void* data) { - m_events->addEvent(CEvent(type, getEventTarget(), data)); + m_events->addEvent(Event(type, getEventTarget(), data)); } void -CXWindowsScreen::sendClipboardEvent(CEvent::Type type, ClipboardID id) +CXWindowsScreen::sendClipboardEvent(Event::Type type, ClipboardID id) { - CClipboardInfo* info = (CClipboardInfo*)malloc(sizeof(CClipboardInfo)); + ClipboardInfo* info = (ClipboardInfo*)malloc(sizeof(ClipboardInfo)); info->m_id = id; info->m_sequenceNumber = m_sequenceNumber; sendEvent(type, info); @@ -1168,7 +1168,7 @@ CXWindowsScreen::getKeyState() const Bool CXWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg) { - CKeyEventFilter* filter = reinterpret_cast(arg); + KeyEventFilter* filter = reinterpret_cast(arg); return (xevent->type == filter->m_event && xevent->xkey.window == filter->m_window && xevent->xkey.time == filter->m_time && @@ -1176,7 +1176,7 @@ CXWindowsScreen::findKeyEvent(Display*, XEvent* xevent, XPointer arg) } void -CXWindowsScreen::handleSystemEvent(const CEvent& event, void*) +CXWindowsScreen::handleSystemEvent(const Event& event, void*) { XEvent* xevent = reinterpret_cast(event.getData()); assert(xevent != NULL); @@ -1189,7 +1189,7 @@ CXWindowsScreen::handleSystemEvent(const CEvent& event, void*) // KeyPress event that has the same key and time as // this release event, if any. first prepare the // filter info. - CKeyEventFilter filter; + KeyEventFilter filter; filter.m_event = KeyPress; filter.m_window = xevent->xkey.window; filter.m_time = xevent->xkey.time; @@ -1531,13 +1531,13 @@ CXWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat) { // find the hot key id HotKeyToIDMap::const_iterator i = - m_hotKeyToIDMap.find(CHotKeyItem(xkey.keycode, xkey.state)); + m_hotKeyToIDMap.find(HotKeyItem(xkey.keycode, xkey.state)); if (i == m_hotKeyToIDMap.end()) { return false; } // find what kind of event - CEvent::Type type; + Event::Type type; if (xkey.type == KeyPress) { type = m_events->forIPrimaryScreen().hotKeyDown(); } @@ -1550,8 +1550,8 @@ CXWindowsScreen::onHotKey(XKeyEvent& xkey, bool isRepeat) // generate event (ignore key repeats) if (!isRepeat) { - m_events->addEvent(CEvent(type, getEventTarget(), - CHotKeyInfo::alloc(i->second))); + m_events->addEvent(Event(type, getEventTarget(), + HotKeyInfo::alloc(i->second))); } return true; } @@ -1563,7 +1563,7 @@ CXWindowsScreen::onMousePress(const XButtonEvent& xbutton) ButtonID button = mapButtonFromX(&xbutton); KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state); if (button != kButtonNone) { - sendEvent(m_events->forIPrimaryScreen().buttonDown(), CButtonInfo::alloc(button, mask)); + sendEvent(m_events->forIPrimaryScreen().buttonDown(), ButtonInfo::alloc(button, mask)); } } @@ -1574,15 +1574,15 @@ CXWindowsScreen::onMouseRelease(const XButtonEvent& xbutton) ButtonID button = mapButtonFromX(&xbutton); KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state); if (button != kButtonNone) { - sendEvent(m_events->forIPrimaryScreen().buttonUp(), CButtonInfo::alloc(button, mask)); + sendEvent(m_events->forIPrimaryScreen().buttonUp(), ButtonInfo::alloc(button, mask)); } else if (xbutton.button == 4) { // wheel forward (away from user) - sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(0, 120)); + sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(0, 120)); } else if (xbutton.button == 5) { // wheel backward (toward user) - sendEvent(m_events->forIPrimaryScreen().wheel(), CWheelInfo::alloc(0, -120)); + sendEvent(m_events->forIPrimaryScreen().wheel(), WheelInfo::alloc(0, -120)); } // XXX -- support x-axis scrolling } @@ -1621,7 +1621,7 @@ CXWindowsScreen::onMouseMove(const XMotionEvent& xmotion) else if (m_isOnScreen) { // motion on primary screen sendEvent(m_events->forIPrimaryScreen().motionOnPrimary(), - CMotionInfo::alloc(m_xCursor, m_yCursor)); + MotionInfo::alloc(m_xCursor, m_yCursor)); } else { // motion on secondary screen. warp mouse back to @@ -1651,7 +1651,7 @@ CXWindowsScreen::onMouseMove(const XMotionEvent& xmotion) // warping to the primary screen's enter position, // effectively overriding it. if (x != 0 || y != 0) { - sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), CMotionInfo::alloc(x, y)); + sendEvent(m_events->forIPrimaryScreen().motionOnSecondary(), MotionInfo::alloc(x, y)); } } } @@ -1769,7 +1769,7 @@ CXWindowsScreen::selectEvents(Window w) const // ignore errors while we adjust event masks. windows could be // destroyed at any time after the XQueryTree() in doSelectEvents() // so we must ignore BadWindow errors. - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); // adjust event masks doSelectEvents(w); @@ -1990,7 +1990,7 @@ CXWindowsScreen::grabMouseAndKeyboard() // and wait before retrying. give up after s_timeout seconds. static const double s_timeout = 1.0; int result; - CStopwatch timer; + Stopwatch timer; do { // keyboard first do { @@ -2059,10 +2059,10 @@ CXWindowsScreen::refreshKeyboard(XEvent* event) // -// CXWindowsScreen::CHotKeyItem +// CXWindowsScreen::HotKeyItem // -CXWindowsScreen::CHotKeyItem::CHotKeyItem(int keycode, unsigned int mask) : +CXWindowsScreen::HotKeyItem::HotKeyItem(int keycode, unsigned int mask) : m_keycode(keycode), m_mask(mask) { @@ -2070,7 +2070,7 @@ CXWindowsScreen::CHotKeyItem::CHotKeyItem(int keycode, unsigned int mask) : } bool -CXWindowsScreen::CHotKeyItem::operator<(const CHotKeyItem& x) const +CXWindowsScreen::HotKeyItem::operator<(const HotKeyItem& x) const { return (m_keycode < x.m_keycode || (m_keycode == x.m_keycode && m_mask < x.m_mask)); diff --git a/src/lib/platform/XWindowsScreen.h b/src/lib/platform/XWindowsScreen.h index 294e6136..a270aeb3 100644 --- a/src/lib/platform/XWindowsScreen.h +++ b/src/lib/platform/XWindowsScreen.h @@ -34,7 +34,7 @@ class CXWindowsKeyState; class CXWindowsScreenSaver; //! Implementation of IPlatformScreen for X11 -class CXWindowsScreen : public CPlatformScreen { +class CXWindowsScreen : public PlatformScreen { public: CXWindowsScreen(const char* displayName, bool isPrimary, bool disableXInitThreads, int mouseScrollDelta, @@ -81,20 +81,20 @@ public: virtual void closeScreensaver(); virtual void screensaver(bool activate); virtual void resetOptions(); - virtual void setOptions(const COptionsList& options); + virtual void setOptions(const OptionsList& options); virtual void setSequenceNumber(UInt32); virtual bool isPrimary() const; protected: // IPlatformScreen overrides - virtual void handleSystemEvent(const CEvent&, void*); + virtual void handleSystemEvent(const Event&, void*); virtual void updateButtons(); virtual IKeyState* getKeyState() const; private: // event sending - void sendEvent(CEvent::Type, void* = NULL); - void sendClipboardEvent(CEvent::Type, ClipboardID); + void sendEvent(Event::Type, void* = NULL); + void sendClipboardEvent(Event::Type, ClipboardID); // create the transparent cursor Cursor createBlankCursor() const; @@ -115,7 +115,7 @@ private: static int ioErrorHandler(Display*); private: - class CKeyEventFilter { + class KeyEventFilter { public: int m_event; Window m_window; @@ -154,21 +154,21 @@ private: static Bool findKeyEvent(Display*, XEvent* xevent, XPointer arg); private: - struct CHotKeyItem { + struct HotKeyItem { public: - CHotKeyItem(int, unsigned int); + HotKeyItem(int, unsigned int); - bool operator<(const CHotKeyItem&) const; + bool operator<(const HotKeyItem&) const; private: int m_keycode; unsigned int m_mask; }; - typedef std::set CFilteredKeycodes; + typedef std::set FilteredKeycodes; typedef std::vector > HotKeyList; typedef std::map HotKeyMap; typedef std::vector HotKeyIDList; - typedef std::map HotKeyToIDMap; + typedef std::map HotKeyToIDMap; // true if screen is being used as a primary screen, false otherwise bool m_isPrimary; @@ -205,7 +205,7 @@ private: XIM m_im; XIC m_ic; KeyCode m_lastKeycode; - CFilteredKeycodes m_filtered; + FilteredKeycodes m_filtered; // clipboards CXWindowsClipboard* m_clipboard[kClipboardEnd]; @@ -244,7 +244,7 @@ private: int m_xrandrEventBase; IEventQueue* m_events; - CKeyMap m_keyMap; + synergy::KeyMap m_keyMap; // pointer to (singleton) screen. this is only needed by // ioErrorHandler(). diff --git a/src/lib/platform/XWindowsScreenSaver.cpp b/src/lib/platform/XWindowsScreenSaver.cpp index 140bee46..6d2cc73a 100644 --- a/src/lib/platform/XWindowsScreenSaver.cpp +++ b/src/lib/platform/XWindowsScreenSaver.cpp @@ -97,7 +97,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver( // watch top-level windows for changes bool error = false; { - CXWindowsUtil::CErrorLock lock(m_display, &error); + CXWindowsUtil::ErrorLock lock(m_display, &error); Window root = DefaultRootWindow(m_display); XWindowAttributes attr; XGetWindowAttributes(m_display, root, &attr); @@ -122,7 +122,7 @@ CXWindowsScreenSaver::CXWindowsScreenSaver( } // install disable timer event handler - m_events->adoptHandler(CEvent::kTimer, this, + m_events->adoptHandler(Event::kTimer, this, new TMethodEventJob(this, &CXWindowsScreenSaver::handleDisableTimer)); } @@ -133,14 +133,14 @@ CXWindowsScreenSaver::~CXWindowsScreenSaver() if (m_disableTimer != NULL) { m_events->deleteTimer(m_disableTimer); } - m_events->removeHandler(CEvent::kTimer, this); + m_events->removeHandler(Event::kTimer, this); if (m_display != NULL) { enableDPMS(m_dpmsEnabled); XSetScreenSaver(m_display, m_timeout, m_interval, m_preferBlanking, m_allowExposures); clearWatchForXScreenSaver(); - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); XSelectInput(m_display, DefaultRootWindow(m_display), m_rootEventMask); } } @@ -356,7 +356,7 @@ CXWindowsScreenSaver::setXScreenSaver(Window window) bool error = false; XWindowAttributes attr; { - CXWindowsUtil::CErrorLock lock(m_display, &error); + CXWindowsUtil::ErrorLock lock(m_display, &error); XGetWindowAttributes(m_display, m_xscreensaver, &attr); } setXScreenSaverActive(!error && attr.map_state != IsUnmapped); @@ -399,12 +399,12 @@ CXWindowsScreenSaver::setXScreenSaverActive(bool activated) updateDisableTimer(); if (activated) { - m_events->addEvent(CEvent( + m_events->addEvent(Event( m_events->forIPrimaryScreen().screensaverActivated(), m_eventTarget)); } else { - m_events->addEvent(CEvent( + m_events->addEvent(Event( m_events->forIPrimaryScreen().screensaverDeactivated(), m_eventTarget)); } @@ -429,7 +429,7 @@ CXWindowsScreenSaver::sendXScreenSaverCommand(Atom cmd, long arg1, long arg2) LOG((CLOG_DEBUG "send xscreensaver command: %d %d %d", (long)cmd, arg1, arg2)); bool error = false; { - CXWindowsUtil::CErrorLock lock(m_display, &error); + CXWindowsUtil::ErrorLock lock(m_display, &error); XSendEvent(m_display, m_xscreensaver, False, 0, &event); } if (error) { @@ -466,8 +466,8 @@ void CXWindowsScreenSaver::clearWatchForXScreenSaver() { // stop watching all windows - CXWindowsUtil::CErrorLock lock(m_display); - for (CWatchList::iterator index = m_watchWindows.begin(); + CXWindowsUtil::ErrorLock lock(m_display); + for (WatchList::iterator index = m_watchWindows.begin(); index != m_watchWindows.end(); ++index) { XSelectInput(m_display, index->first, index->second); } @@ -481,7 +481,7 @@ CXWindowsScreenSaver::addWatchXScreenSaver(Window window) bool error = false; XWindowAttributes attr; { - CXWindowsUtil::CErrorLock lock(m_display, &error); + CXWindowsUtil::ErrorLock lock(m_display, &error); XGetWindowAttributes(m_display, window, &attr); } @@ -490,7 +490,7 @@ CXWindowsScreenSaver::addWatchXScreenSaver(Window window) if (!error && attr.override_redirect == True) { error = false; { - CXWindowsUtil::CErrorLock lock(m_display, &error); + CXWindowsUtil::ErrorLock lock(m_display, &error); XSelectInput(m_display, window, attr.your_event_mask | PropertyChangeMask); } @@ -515,7 +515,7 @@ CXWindowsScreenSaver::updateDisableTimer() } void -CXWindowsScreenSaver::handleDisableTimer(const CEvent&, void*) +CXWindowsScreenSaver::handleDisableTimer(const Event&, void*) { // send fake mouse motion directly to xscreensaver if (m_xscreensaver != None) { @@ -534,7 +534,7 @@ CXWindowsScreenSaver::handleDisableTimer(const CEvent&, void*) event.xmotion.is_hint = NotifyNormal; event.xmotion.same_screen = True; - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); XSendEvent(m_display, m_xscreensaver, False, 0, &event); m_disablePos = 20 - m_disablePos; @@ -547,7 +547,7 @@ CXWindowsScreenSaver::activateDPMS(bool activate) #if HAVE_X11_EXTENSIONS_DPMS_H if (m_dpms) { // DPMSForceLevel will generate a BadMatch if DPMS is disabled - CXWindowsUtil::CErrorLock lock(m_display); + CXWindowsUtil::ErrorLock lock(m_display); DPMSForceLevel(m_display, activate ? DPMSModeStandby : DPMSModeOn); } #endif diff --git a/src/lib/platform/XWindowsScreenSaver.h b/src/lib/platform/XWindowsScreenSaver.h index 3040f6ce..d025d653 100644 --- a/src/lib/platform/XWindowsScreenSaver.h +++ b/src/lib/platform/XWindowsScreenSaver.h @@ -28,8 +28,8 @@ # include #endif -class CEvent; -class CEventQueueTimer; +class Event; +class EventQueueTimer; //! X11 screen saver implementation class CXWindowsScreenSaver : public IScreenSaver { @@ -95,7 +95,7 @@ private: void updateDisableTimer(); // called periodically to prevent the screen saver from starting - void handleDisableTimer(const CEvent&, void*); + void handleDisableTimer(const Event&, void*); // force DPMS to activate or deactivate void activateDPMS(bool activate); @@ -110,7 +110,7 @@ private: bool isDPMSActivated() const; private: - typedef std::map CWatchList; + typedef std::map WatchList; // the X display Display* m_display; @@ -131,7 +131,7 @@ private: long m_rootEventMask; // potential xscreensaver windows being watched - CWatchList m_watchWindows; + WatchList m_watchWindows; // atoms used to communicate with xscreensaver's window Atom m_atomScreenSaver; @@ -158,7 +158,7 @@ private: bool m_suppressDisable; // the disable timer (NULL if not installed) - CEventQueueTimer* m_disableTimer; + EventQueueTimer* m_disableTimer; // fake mouse motion position for suppressing the screen saver. // xscreensaver since 2.21 requires the mouse to move more than 10 diff --git a/src/lib/platform/XWindowsUtil.cpp b/src/lib/platform/XWindowsUtil.cpp index 5b471bac..bde02807 100644 --- a/src/lib/platform/XWindowsUtil.cpp +++ b/src/lib/platform/XWindowsUtil.cpp @@ -1290,11 +1290,11 @@ static const KeySym s_map1008FF[] = // CXWindowsUtil // -CXWindowsUtil::CKeySymMap CXWindowsUtil::s_keySymToUCS4; +CXWindowsUtil::KeySymMap CXWindowsUtil::s_keySymToUCS4; bool CXWindowsUtil::getWindowProperty(Display* display, Window window, - Atom property, CString* data, Atom* type, + Atom property, String* data, Atom* type, SInt32* format, bool deleteProperty) { assert(display != NULL); @@ -1303,7 +1303,7 @@ CXWindowsUtil::getWindowProperty(Display* display, Window window, int actualDatumSize; // ignore errors. XGetWindowProperty() will report failure. - CXWindowsUtil::CErrorLock lock(display); + CXWindowsUtil::ErrorLock lock(display); // read the property bool okay = true; @@ -1395,7 +1395,7 @@ CXWindowsUtil::setWindowProperty(Display* display, Window window, // save errors bool error = false; - CXWindowsUtil::CErrorLock lock(display, &error); + CXWindowsUtil::ErrorLock lock(display, &error); // how much data to send in first chunk? UInt32 chunkSize = size; @@ -1445,7 +1445,7 @@ CXWindowsUtil::getCurrentTime(Display* display, Window window) &dummy, 0); // look for property notify events with the following - CPropertyNotifyPredicateInfo filter; + PropertyNotifyPredicateInfo filter; filter.m_window = window; filter.m_property = atom; @@ -1546,7 +1546,7 @@ CXWindowsUtil::mapKeySymToKeyID(KeySym k) default: { // lookup character in table - CKeySymMap::const_iterator index = s_keySymToUCS4.find(k); + KeySymMap::const_iterator index = s_keySymToUCS4.find(k); if (index != s_keySymToUCS4.end()) { return static_cast(index->second); } @@ -1606,7 +1606,7 @@ CXWindowsUtil::getModifierBitForKeySym(KeySym keysym) } } -CString +String CXWindowsUtil::atomToString(Display* display, Atom atom) { if (atom == 0) { @@ -1614,26 +1614,26 @@ CXWindowsUtil::atomToString(Display* display, Atom atom) } bool error = false; - CXWindowsUtil::CErrorLock lock(display, &error); + CXWindowsUtil::ErrorLock lock(display, &error); char* name = XGetAtomName(display, atom); if (error) { return synergy::string::sprintf(" (%d)", (int)atom); } else { - CString msg = synergy::string::sprintf("%s (%d)", name, (int)atom); + String msg = synergy::string::sprintf("%s (%d)", name, (int)atom); XFree(name); return msg; } } -CString +String CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num) { char** names = new char*[num]; bool error = false; - CXWindowsUtil::CErrorLock lock(display, &error); + CXWindowsUtil::ErrorLock lock(display, &error); XGetAtomNames(display, const_cast(atom), (int)num, names); - CString msg; + String msg; if (error) { for (UInt32 i = 0; i < num; ++i) { msg += synergy::string::sprintf(" (%d), ", (int)atom[i]); @@ -1653,7 +1653,7 @@ CXWindowsUtil::atomsToString(Display* display, const Atom* atom, UInt32 num) } void -CXWindowsUtil::convertAtomProperty(CString& data) +CXWindowsUtil::convertAtomProperty(String& data) { // as best i can tell, 64-bit systems don't pack Atoms into properties // as 32-bit numbers but rather as the 64-bit numbers they are. that @@ -1668,13 +1668,13 @@ CXWindowsUtil::convertAtomProperty(CString& data) } void -CXWindowsUtil::appendAtomData(CString& data, Atom atom) +CXWindowsUtil::appendAtomData(String& data, Atom atom) { data.append(reinterpret_cast(&atom), sizeof(Atom)); } void -CXWindowsUtil::replaceAtomData(CString& data, UInt32 index, Atom atom) +CXWindowsUtil::replaceAtomData(String& data, UInt32 index, Atom atom) { data.replace(index * sizeof(Atom), sizeof(Atom), reinterpret_cast(&atom), @@ -1682,7 +1682,7 @@ CXWindowsUtil::replaceAtomData(CString& data, UInt32 index, Atom atom) } void -CXWindowsUtil::appendTimeData(CString& data, Time time) +CXWindowsUtil::appendTimeData(String& data, Time time) { data.append(reinterpret_cast(&time), sizeof(Time)); } @@ -1690,8 +1690,8 @@ CXWindowsUtil::appendTimeData(CString& data, Time time) Bool CXWindowsUtil::propertyNotifyPredicate(Display*, XEvent* xevent, XPointer arg) { - CPropertyNotifyPredicateInfo* filter = - reinterpret_cast(arg); + PropertyNotifyPredicateInfo* filter = + reinterpret_cast(arg); return (xevent->type == PropertyNotify && xevent->xproperty.window == filter->m_window && xevent->xproperty.atom == filter->m_property && @@ -1710,31 +1710,31 @@ CXWindowsUtil::initKeyMaps() // -// CXWindowsUtil::CErrorLock +// CXWindowsUtil::ErrorLock // -CXWindowsUtil::CErrorLock* CXWindowsUtil::CErrorLock::s_top = NULL; +CXWindowsUtil::ErrorLock* CXWindowsUtil::ErrorLock::s_top = NULL; -CXWindowsUtil::CErrorLock::CErrorLock(Display* display) : +CXWindowsUtil::ErrorLock::ErrorLock(Display* display) : m_display(display) { - install(&CXWindowsUtil::CErrorLock::ignoreHandler, NULL); + install(&CXWindowsUtil::ErrorLock::ignoreHandler, NULL); } -CXWindowsUtil::CErrorLock::CErrorLock(Display* display, bool* flag) : +CXWindowsUtil::ErrorLock::ErrorLock(Display* display, bool* flag) : m_display(display) { - install(&CXWindowsUtil::CErrorLock::saveHandler, flag); + install(&CXWindowsUtil::ErrorLock::saveHandler, flag); } -CXWindowsUtil::CErrorLock::CErrorLock(Display* display, +CXWindowsUtil::ErrorLock::ErrorLock(Display* display, ErrorHandler handler, void* data) : m_display(display) { install(handler, data); } -CXWindowsUtil::CErrorLock::~CErrorLock() +CXWindowsUtil::ErrorLock::~ErrorLock() { // make sure everything finishes before uninstalling handler if (m_display != NULL) { @@ -1747,7 +1747,7 @@ CXWindowsUtil::CErrorLock::~CErrorLock() } void -CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data) +CXWindowsUtil::ErrorLock::install(ErrorHandler handler, void* data) { // make sure everything finishes before installing handler if (m_display != NULL) { @@ -1758,13 +1758,13 @@ CXWindowsUtil::CErrorLock::install(ErrorHandler handler, void* data) m_handler = handler; m_userData = data; m_oldXHandler = XSetErrorHandler( - &CXWindowsUtil::CErrorLock::internalHandler); + &CXWindowsUtil::ErrorLock::internalHandler); m_next = s_top; s_top = this; } int -CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event) +CXWindowsUtil::ErrorLock::internalHandler(Display* display, XErrorEvent* event) { if (s_top != NULL && s_top->m_handler != NULL) { s_top->m_handler(display, event, s_top->m_userData); @@ -1773,13 +1773,13 @@ CXWindowsUtil::CErrorLock::internalHandler(Display* display, XErrorEvent* event) } void -CXWindowsUtil::CErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*) +CXWindowsUtil::ErrorLock::ignoreHandler(Display*, XErrorEvent* e, void*) { LOG((CLOG_DEBUG1 "ignoring X error: %d", e->error_code)); } void -CXWindowsUtil::CErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag) +CXWindowsUtil::ErrorLock::saveHandler(Display*, XErrorEvent* e, void* flag) { LOG((CLOG_DEBUG1 "flagging X error: %d", e->error_code)); *reinterpret_cast(flag) = true; diff --git a/src/lib/platform/XWindowsUtil.h b/src/lib/platform/XWindowsUtil.h index 17149266..5ee4a3f9 100644 --- a/src/lib/platform/XWindowsUtil.h +++ b/src/lib/platform/XWindowsUtil.h @@ -44,7 +44,7 @@ public: */ static bool getWindowProperty(Display*, Window window, Atom property, - CString* data, Atom* type, + String* data, Atom* type, SInt32* format, bool deleteProperty); //! Set property @@ -81,14 +81,14 @@ public: /*! Converts \p atom to its string representation. */ - static CString atomToString(Display*, Atom atom); + static String atomToString(Display*, Atom atom); //! Convert several Atoms to a string /*! Converts each atom in \p atoms to its string representation and concatenates the results. */ - static CString atomsToString(Display* display, + static String atomsToString(Display* display, const Atom* atom, UInt32 num); //! Prepare a property of atoms for use @@ -96,21 +96,21 @@ public: 64-bit systems may need to modify a property's data if it's a list of Atoms before using it. */ - static void convertAtomProperty(CString& data); + static void convertAtomProperty(String& data); //! Append an Atom to property data /*! Converts \p atom to a 32-bit on-the-wire format and appends it to \p data. */ - static void appendAtomData(CString& data, Atom atom); + static void appendAtomData(String& data, Atom atom); //! Replace an Atom in property data /*! Converts \p atom to a 32-bit on-the-wire format and replaces the atom at index \p index in \p data. */ - static void replaceAtomData(CString& data, + static void replaceAtomData(String& data, UInt32 index, Atom atom); //! Append an Time to property data @@ -118,7 +118,7 @@ public: Converts \p time to a 32-bit on-the-wire format and appends it to \p data. */ - static void appendTimeData(CString& data, Time time); + static void appendTimeData(String& data, Time time); //! X11 error handler /*! @@ -126,10 +126,10 @@ public: previous error handler in the d'tor. A lock should only be installed while the display is locked by the thread. - CErrorLock() ignores errors - CErrorLock(bool* flag) sets *flag to true if any error occurs + ErrorLock() ignores errors + ErrorLock(bool* flag) sets *flag to true if any error occurs */ - class CErrorLock { + class ErrorLock { public: //! Error handler type typedef void (*ErrorHandler)(Display*, XErrorEvent*, void* userData); @@ -137,19 +137,19 @@ public: /*! Ignore X11 errors. */ - CErrorLock(Display*); + ErrorLock(Display*); /*! Set \c *errorFlag if any error occurs. */ - CErrorLock(Display*, bool* errorFlag); + ErrorLock(Display*, bool* errorFlag); /*! Call \c handler on each error. */ - CErrorLock(Display*, ErrorHandler handler, void* userData); + ErrorLock(Display*, ErrorHandler handler, void* userData); - ~CErrorLock(); + ~ErrorLock(); private: void install(ErrorHandler, void*); @@ -164,12 +164,12 @@ public: ErrorHandler m_handler; void* m_userData; XErrorHandler m_oldXHandler; - CErrorLock* m_next; - static CErrorLock* s_top; + ErrorLock* m_next; + static ErrorLock* s_top; }; private: - class CPropertyNotifyPredicateInfo { + class PropertyNotifyPredicateInfo { public: Window m_window; Atom m_property; @@ -181,7 +181,7 @@ private: static void initKeyMaps(); private: - typedef std::map CKeySymMap; + typedef std::map KeySymMap; - static CKeySymMap s_keySymToUCS4; + static KeySymMap s_keySymToUCS4; }; diff --git a/src/lib/server/BaseClientProxy.cpp b/src/lib/server/BaseClientProxy.cpp index e76e74b0..58f28e00 100644 --- a/src/lib/server/BaseClientProxy.cpp +++ b/src/lib/server/BaseClientProxy.cpp @@ -19,10 +19,10 @@ #include "server/BaseClientProxy.h" // -// CBaseClientProxy +// BaseClientProxy // -CBaseClientProxy::CBaseClientProxy(const CString& name) : +BaseClientProxy::BaseClientProxy(const String& name) : m_name(name), m_x(0), m_y(0) @@ -30,27 +30,27 @@ CBaseClientProxy::CBaseClientProxy(const CString& name) : // do nothing } -CBaseClientProxy::~CBaseClientProxy() +BaseClientProxy::~BaseClientProxy() { // do nothing } void -CBaseClientProxy::setJumpCursorPos(SInt32 x, SInt32 y) +BaseClientProxy::setJumpCursorPos(SInt32 x, SInt32 y) { m_x = x; m_y = y; } void -CBaseClientProxy::getJumpCursorPos(SInt32& x, SInt32& y) const +BaseClientProxy::getJumpCursorPos(SInt32& x, SInt32& y) const { x = m_x; y = m_y; } -CString -CBaseClientProxy::getName() const +String +BaseClientProxy::getName() const { return m_name; } diff --git a/src/lib/server/BaseClientProxy.h b/src/lib/server/BaseClientProxy.h index ad744cc5..136d254b 100644 --- a/src/lib/server/BaseClientProxy.h +++ b/src/lib/server/BaseClientProxy.h @@ -22,13 +22,13 @@ #include "base/String.h" //! Generic proxy for client or primary -class CBaseClientProxy : public IClient { +class BaseClientProxy : public IClient { public: /*! \c name is the name of the client. */ - CBaseClientProxy(const CString& name); - ~CBaseClientProxy(); + BaseClientProxy(const String& name); + ~BaseClientProxy(); //! @name manipulators //@{ @@ -77,13 +77,13 @@ public: virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta) = 0; virtual void screensaver(bool activate) = 0; virtual void resetOptions() = 0; - virtual void setOptions(const COptionsList& options) = 0; + virtual void setOptions(const OptionsList& options) = 0; virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size) = 0; virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize) = 0; - virtual CString getName() const; + virtual String getName() const; private: - CString m_name; + String m_name; SInt32 m_x, m_y; }; diff --git a/src/lib/server/ClientListener.cpp b/src/lib/server/ClientListener.cpp index 48f6ef3d..18b9ea40 100644 --- a/src/lib/server/ClientListener.cpp +++ b/src/lib/server/ClientListener.cpp @@ -33,13 +33,13 @@ #include "base/TMethodEventJob.h" // -// CClientListener +// ClientListener // -CClientListener::CClientListener(const CNetworkAddress& address, +ClientListener::ClientListener(const NetworkAddress& address, ISocketFactory* socketFactory, IStreamFilterFactory* streamFilterFactory, - const CCryptoOptions& crypto, + const CryptoOptions& crypto, IEventQueue* events) : m_socketFactory(socketFactory), m_streamFilterFactory(streamFilterFactory), @@ -73,29 +73,29 @@ CClientListener::CClientListener(const CNetworkAddress& address, // setup event handler m_events->adoptHandler(m_events->forIListenSocket().connecting(), m_listen, - new TMethodEventJob(this, - &CClientListener::handleClientConnecting)); + new TMethodEventJob(this, + &ClientListener::handleClientConnecting)); } -CClientListener::~CClientListener() +ClientListener::~ClientListener() { LOG((CLOG_DEBUG1 "stop listening for clients")); // discard already connected clients - for (CNewClients::iterator index = m_newClients.begin(); + for (NewClients::iterator index = m_newClients.begin(); index != m_newClients.end(); ++index) { - CClientProxyUnknown* client = *index; + ClientProxyUnknown* client = *index; m_events->removeHandler( - m_events->forCClientProxyUnknown().success(), client); + m_events->forClientProxyUnknown().success(), client); m_events->removeHandler( - m_events->forCClientProxyUnknown().failure(), client); + m_events->forClientProxyUnknown().failure(), client); m_events->removeHandler( - m_events->forCClientProxy().disconnected(), client); + m_events->forClientProxy().disconnected(), client); delete client; } // discard waiting clients - CClientProxy* client = getNextClient(); + ClientProxy* client = getNextClient(); while (client != NULL) { delete client; client = getNextClient(); @@ -108,26 +108,26 @@ CClientListener::~CClientListener() } void -CClientListener::setServer(CServer* server) +ClientListener::setServer(Server* server) { assert(server != NULL); m_server = server; } -CClientProxy* -CClientListener::getNextClient() +ClientProxy* +ClientListener::getNextClient() { - CClientProxy* client = NULL; + ClientProxy* client = NULL; if (!m_waitingClients.empty()) { client = m_waitingClients.front(); m_waitingClients.pop_front(); - m_events->removeHandler(m_events->forCClientProxy().disconnected(), client); + m_events->removeHandler(m_events->forClientProxy().disconnected(), client); } return client; } void -CClientListener::handleClientConnecting(const CEvent&, void*) +ClientListener::handleClientConnecting(const Event&, void*) { // accept client connection synergy::IStream* stream = m_listen->accept(); @@ -140,10 +140,10 @@ CClientListener::handleClientConnecting(const CEvent&, void*) if (m_streamFilterFactory != NULL) { stream = m_streamFilterFactory->create(stream, true); } - stream = new CPacketStreamFilter(m_events, stream, true); + stream = new PacketStreamFilter(m_events, stream, true); if (m_crypto.m_mode != kDisabled) { - CCryptoStream* cryptoStream = new CCryptoStream( + CryptoStream* cryptoStream = new CryptoStream( m_events, stream, m_crypto, true); stream = cryptoStream; } @@ -151,59 +151,59 @@ CClientListener::handleClientConnecting(const CEvent&, void*) assert(m_server != NULL); // create proxy for unknown client - CClientProxyUnknown* client = new CClientProxyUnknown(stream, 30.0, m_server, m_events); + ClientProxyUnknown* client = new ClientProxyUnknown(stream, 30.0, m_server, m_events); m_newClients.insert(client); // watch for events from unknown client - m_events->adoptHandler(m_events->forCClientProxyUnknown().success(), client, - new TMethodEventJob(this, - &CClientListener::handleUnknownClient, client)); - m_events->adoptHandler(m_events->forCClientProxyUnknown().failure(), client, - new TMethodEventJob(this, - &CClientListener::handleUnknownClient, client)); + m_events->adoptHandler(m_events->forClientProxyUnknown().success(), client, + new TMethodEventJob(this, + &ClientListener::handleUnknownClient, client)); + m_events->adoptHandler(m_events->forClientProxyUnknown().failure(), client, + new TMethodEventJob(this, + &ClientListener::handleUnknownClient, client)); } void -CClientListener::handleUnknownClient(const CEvent&, void* vclient) +ClientListener::handleUnknownClient(const Event&, void* vclient) { - CClientProxyUnknown* unknownClient = - reinterpret_cast(vclient); + ClientProxyUnknown* unknownClient = + reinterpret_cast(vclient); // we should have the client in our new client list assert(m_newClients.count(unknownClient) == 1); // get the real client proxy and install it - CClientProxy* client = unknownClient->orphanClientProxy(); + ClientProxy* client = unknownClient->orphanClientProxy(); if (client != NULL) { // handshake was successful m_waitingClients.push_back(client); - m_events->addEvent(CEvent(m_events->forCClientListener().connected(), this)); + m_events->addEvent(Event(m_events->forClientListener().connected(), this)); // watch for client to disconnect while it's in our queue - m_events->adoptHandler(m_events->forCClientProxy().disconnected(), client, - new TMethodEventJob(this, - &CClientListener::handleClientDisconnected, + m_events->adoptHandler(m_events->forClientProxy().disconnected(), client, + new TMethodEventJob(this, + &ClientListener::handleClientDisconnected, client)); } // now finished with unknown client - m_events->removeHandler(m_events->forCClientProxyUnknown().success(), client); - m_events->removeHandler(m_events->forCClientProxyUnknown().failure(), client); + m_events->removeHandler(m_events->forClientProxyUnknown().success(), client); + m_events->removeHandler(m_events->forClientProxyUnknown().failure(), client); m_newClients.erase(unknownClient); delete unknownClient; } void -CClientListener::handleClientDisconnected(const CEvent&, void* vclient) +ClientListener::handleClientDisconnected(const Event&, void* vclient) { - CClientProxy* client = reinterpret_cast(vclient); + ClientProxy* client = reinterpret_cast(vclient); // find client in waiting clients queue - for (CWaitingClients::iterator i = m_waitingClients.begin(), + for (WaitingClients::iterator i = m_waitingClients.begin(), n = m_waitingClients.end(); i != n; ++i) { if (*i == client) { m_waitingClients.erase(i); - m_events->removeHandler(m_events->forCClientProxy().disconnected(), + m_events->removeHandler(m_events->forClientProxy().disconnected(), client); delete client; break; diff --git a/src/lib/server/ClientListener.h b/src/lib/server/ClientListener.h index 41cb4419..951a2889 100644 --- a/src/lib/server/ClientListener.h +++ b/src/lib/server/ClientListener.h @@ -25,29 +25,29 @@ #include "common/stddeque.h" #include "common/stdset.h" -class CClientProxy; -class CClientProxyUnknown; -class CNetworkAddress; +class ClientProxy; +class ClientProxyUnknown; +class NetworkAddress; class IListenSocket; class ISocketFactory; class IStreamFilterFactory; -class CServer; +class Server; class IEventQueue; -class CClientListener { +class ClientListener { public: // The factories are adopted. - CClientListener(const CNetworkAddress&, + ClientListener(const NetworkAddress&, ISocketFactory*, IStreamFilterFactory*, - const CCryptoOptions& crypto, + const CryptoOptions& crypto, IEventQueue* events); - ~CClientListener(); + ~ClientListener(); //! @name manipulators //@{ - void setServer(CServer* server); + void setServer(Server* server); //@} @@ -60,29 +60,29 @@ public: list. The client is responsible for deleting the returned client. Returns NULL if no clients are available. */ - CClientProxy* getNextClient(); + ClientProxy* getNextClient(); //! Get server which owns this listener - CServer* getServer() { return m_server; } + Server* getServer() { return m_server; } //@} private: // client connection event handlers - void handleClientConnecting(const CEvent&, void*); - void handleUnknownClient(const CEvent&, void*); - void handleClientDisconnected(const CEvent&, void*); + void handleClientConnecting(const Event&, void*); + void handleUnknownClient(const Event&, void*); + void handleClientDisconnected(const Event&, void*); private: - typedef std::set CNewClients; - typedef std::deque CWaitingClients; + typedef std::set NewClients; + typedef std::deque WaitingClients; IListenSocket* m_listen; ISocketFactory* m_socketFactory; IStreamFilterFactory* m_streamFilterFactory; - CNewClients m_newClients; - CWaitingClients m_waitingClients; - CServer* m_server; - CCryptoOptions m_crypto; + NewClients m_newClients; + WaitingClients m_waitingClients; + Server* m_server; + CryptoOptions m_crypto; IEventQueue* m_events; }; diff --git a/src/lib/server/ClientProxy.cpp b/src/lib/server/ClientProxy.cpp index fb48cf61..58bf5784 100644 --- a/src/lib/server/ClientProxy.cpp +++ b/src/lib/server/ClientProxy.cpp @@ -24,38 +24,38 @@ #include "base/EventQueue.h" // -// CClientProxy +// ClientProxy // -CClientProxy::CClientProxy(const CString& name, synergy::IStream* stream) : - CBaseClientProxy(name), +ClientProxy::ClientProxy(const String& name, synergy::IStream* stream) : + BaseClientProxy(name), m_stream(stream) { } -CClientProxy::~CClientProxy() +ClientProxy::~ClientProxy() { delete m_stream; } void -CClientProxy::close(const char* msg) +ClientProxy::close(const char* msg) { LOG((CLOG_DEBUG1 "send close \"%s\" to \"%s\"", msg, getName().c_str())); - CProtocolUtil::writef(getStream(), msg); + ProtocolUtil::writef(getStream(), msg); // force the close to be sent before we return getStream()->flush(); } synergy::IStream* -CClientProxy::getStream() const +ClientProxy::getStream() const { return m_stream; } void* -CClientProxy::getEventTarget() const +ClientProxy::getEventTarget() const { - return static_cast(const_cast(this)); + return static_cast(const_cast(this)); } diff --git a/src/lib/server/ClientProxy.h b/src/lib/server/ClientProxy.h index 4fd181c7..83b9b369 100644 --- a/src/lib/server/ClientProxy.h +++ b/src/lib/server/ClientProxy.h @@ -26,13 +26,13 @@ namespace synergy { class IStream; } //! Generic proxy for client -class CClientProxy : public CBaseClientProxy { +class ClientProxy : public BaseClientProxy { public: /*! \c name is the name of the client. */ - CClientProxy(const CString& name, synergy::IStream* adoptedStream); - ~CClientProxy(); + ClientProxy(const String& name, synergy::IStream* adoptedStream); + ~ClientProxy(); //! @name manipulators //@{ @@ -82,7 +82,7 @@ public: virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta) = 0; virtual void screensaver(bool activate) = 0; virtual void resetOptions() = 0; - virtual void setOptions(const COptionsList& options) = 0; + virtual void setOptions(const OptionsList& options) = 0; virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size) = 0; virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize) = 0; diff --git a/src/lib/server/ClientProxy1_0.cpp b/src/lib/server/ClientProxy1_0.cpp index 8a25460a..767a7891 100644 --- a/src/lib/server/ClientProxy1_0.cpp +++ b/src/lib/server/ClientProxy1_0.cpp @@ -28,57 +28,57 @@ #include // -// CClientProxy1_0 +// ClientProxy1_0 // -CClientProxy1_0::CClientProxy1_0(const CString& name, synergy::IStream* stream, IEventQueue* events) : - CClientProxy(name, stream), +ClientProxy1_0::ClientProxy1_0(const String& name, synergy::IStream* stream, IEventQueue* events) : + ClientProxy(name, stream), m_heartbeatTimer(NULL), - m_parser(&CClientProxy1_0::parseHandshakeMessage), + m_parser(&ClientProxy1_0::parseHandshakeMessage), m_events(events) { // install event handlers m_events->adoptHandler(m_events->forIStream().inputReady(), stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxy1_0::handleData, NULL)); + new TMethodEventJob(this, + &ClientProxy1_0::handleData, NULL)); m_events->adoptHandler(m_events->forIStream().outputError(), stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxy1_0::handleWriteError, NULL)); + new TMethodEventJob(this, + &ClientProxy1_0::handleWriteError, NULL)); m_events->adoptHandler(m_events->forIStream().inputShutdown(), stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxy1_0::handleDisconnect, NULL)); + new TMethodEventJob(this, + &ClientProxy1_0::handleDisconnect, NULL)); m_events->adoptHandler(m_events->forIStream().outputShutdown(), stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxy1_0::handleWriteError, NULL)); - m_events->adoptHandler(CEvent::kTimer, this, - new TMethodEventJob(this, - &CClientProxy1_0::handleFlatline, NULL)); + new TMethodEventJob(this, + &ClientProxy1_0::handleWriteError, NULL)); + m_events->adoptHandler(Event::kTimer, this, + new TMethodEventJob(this, + &ClientProxy1_0::handleFlatline, NULL)); setHeartbeatRate(kHeartRate, kHeartRate * kHeartBeatsUntilDeath); LOG((CLOG_DEBUG1 "querying client \"%s\" info", getName().c_str())); - CProtocolUtil::writef(getStream(), kMsgQInfo); + ProtocolUtil::writef(getStream(), kMsgQInfo); } -CClientProxy1_0::~CClientProxy1_0() +ClientProxy1_0::~ClientProxy1_0() { removeHandlers(); } void -CClientProxy1_0::disconnect() +ClientProxy1_0::disconnect() { removeHandlers(); getStream()->close(); - m_events->addEvent(CEvent(m_events->forCClientProxy().disconnected(), getEventTarget())); + m_events->addEvent(Event(m_events->forClientProxy().disconnected(), getEventTarget())); } void -CClientProxy1_0::removeHandlers() +ClientProxy1_0::removeHandlers() { // uninstall event handlers m_events->removeHandler(m_events->forIStream().inputReady(), @@ -89,14 +89,14 @@ CClientProxy1_0::removeHandlers() getStream()->getEventTarget()); m_events->removeHandler(m_events->forIStream().outputShutdown(), getStream()->getEventTarget()); - m_events->removeHandler(CEvent::kTimer, this); + m_events->removeHandler(Event::kTimer, this); // remove timer removeHeartbeatTimer(); } void -CClientProxy1_0::addHeartbeatTimer() +ClientProxy1_0::addHeartbeatTimer() { if (m_heartbeatAlarm > 0.0) { m_heartbeatTimer = m_events->newOneShotTimer(m_heartbeatAlarm, this); @@ -104,7 +104,7 @@ CClientProxy1_0::addHeartbeatTimer() } void -CClientProxy1_0::removeHeartbeatTimer() +ClientProxy1_0::removeHeartbeatTimer() { if (m_heartbeatTimer != NULL) { m_events->deleteTimer(m_heartbeatTimer); @@ -113,7 +113,7 @@ CClientProxy1_0::removeHeartbeatTimer() } void -CClientProxy1_0::resetHeartbeatTimer() +ClientProxy1_0::resetHeartbeatTimer() { // reset the alarm removeHeartbeatTimer(); @@ -121,19 +121,19 @@ CClientProxy1_0::resetHeartbeatTimer() } void -CClientProxy1_0::resetHeartbeatRate() +ClientProxy1_0::resetHeartbeatRate() { setHeartbeatRate(kHeartRate, kHeartRate * kHeartBeatsUntilDeath); } void -CClientProxy1_0::setHeartbeatRate(double, double alarm) +ClientProxy1_0::setHeartbeatRate(double, double alarm) { m_heartbeatAlarm = alarm; } void -CClientProxy1_0::handleData(const CEvent&, void*) +ClientProxy1_0::handleData(const Event&, void*) { // handle messages until there are no more. first read message code. UInt8 code[4]; @@ -163,7 +163,7 @@ CClientProxy1_0::handleData(const CEvent&, void*) } bool -CClientProxy1_0::parseHandshakeMessage(const UInt8* code) +ClientProxy1_0::parseHandshakeMessage(const UInt8* code) { if (memcmp(code, kMsgCNoop, 4) == 0) { // discard no-ops @@ -172,9 +172,9 @@ CClientProxy1_0::parseHandshakeMessage(const UInt8* code) } else if (memcmp(code, kMsgDInfo, 4) == 0) { // future messages get parsed by parseMessage - m_parser = &CClientProxy1_0::parseMessage; + m_parser = &ClientProxy1_0::parseMessage; if (recvInfo()) { - m_events->addEvent(CEvent(m_events->forCClientProxy().ready(), getEventTarget())); + m_events->addEvent(Event(m_events->forClientProxy().ready(), getEventTarget())); addHeartbeatTimer(); return true; } @@ -183,12 +183,12 @@ CClientProxy1_0::parseHandshakeMessage(const UInt8* code) } bool -CClientProxy1_0::parseMessage(const UInt8* code) +ClientProxy1_0::parseMessage(const UInt8* code) { if (memcmp(code, kMsgDInfo, 4) == 0) { if (recvInfo()) { m_events->addEvent( - CEvent(m_events->forIScreen().shapeChanged(), getEventTarget())); + Event(m_events->forIScreen().shapeChanged(), getEventTarget())); return true; } return false; @@ -208,21 +208,21 @@ CClientProxy1_0::parseMessage(const UInt8* code) } void -CClientProxy1_0::handleDisconnect(const CEvent&, void*) +ClientProxy1_0::handleDisconnect(const Event&, void*) { LOG((CLOG_NOTE "client \"%s\" has disconnected", getName().c_str())); disconnect(); } void -CClientProxy1_0::handleWriteError(const CEvent&, void*) +ClientProxy1_0::handleWriteError(const Event&, void*) { LOG((CLOG_WARN "error writing to client \"%s\"", getName().c_str())); disconnect(); } void -CClientProxy1_0::handleFlatline(const CEvent&, void*) +ClientProxy1_0::handleFlatline(const Event&, void*) { // didn't get a heartbeat fast enough. assume client is dead. LOG((CLOG_NOTE "client \"%s\" is dead", getName().c_str())); @@ -230,14 +230,14 @@ CClientProxy1_0::handleFlatline(const CEvent&, void*) } bool -CClientProxy1_0::getClipboard(ClipboardID id, IClipboard* clipboard) const +ClientProxy1_0::getClipboard(ClipboardID id, IClipboard* clipboard) const { - CClipboard::copy(clipboard, &m_clipboard[id].m_clipboard); + Clipboard::copy(clipboard, &m_clipboard[id].m_clipboard); return true; } void -CClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const +ClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const { x = m_info.m_x; y = m_info.m_y; @@ -246,7 +246,7 @@ CClientProxy1_0::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const } void -CClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const +ClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const { // note -- this returns the cursor pos from when we last got client info x = m_info.m_mx; @@ -254,138 +254,138 @@ CClientProxy1_0::getCursorPos(SInt32& x, SInt32& y) const } void -CClientProxy1_0::enter(SInt32 xAbs, SInt32 yAbs, +ClientProxy1_0::enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, bool) { LOG((CLOG_DEBUG1 "send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask)); - CProtocolUtil::writef(getStream(), kMsgCEnter, + ProtocolUtil::writef(getStream(), kMsgCEnter, xAbs, yAbs, seqNum, mask); } bool -CClientProxy1_0::leave() +ClientProxy1_0::leave() { LOG((CLOG_DEBUG1 "send leave to \"%s\"", getName().c_str())); - CProtocolUtil::writef(getStream(), kMsgCLeave); + ProtocolUtil::writef(getStream(), kMsgCLeave); // we can never prevent the user from leaving return true; } void -CClientProxy1_0::setClipboard(ClipboardID id, const IClipboard* clipboard) +ClientProxy1_0::setClipboard(ClipboardID id, const IClipboard* clipboard) { // ignore if this clipboard is already clean if (m_clipboard[id].m_dirty) { // this clipboard is now clean m_clipboard[id].m_dirty = false; - CClipboard::copy(&m_clipboard[id].m_clipboard, clipboard); + Clipboard::copy(&m_clipboard[id].m_clipboard, clipboard); - CString data = m_clipboard[id].m_clipboard.marshall(); + String data = m_clipboard[id].m_clipboard.marshall(); LOG((CLOG_DEBUG "send clipboard %d to \"%s\" size=%d", id, getName().c_str(), data.size())); - CProtocolUtil::writef(getStream(), kMsgDClipboard, id, 0, &data); + ProtocolUtil::writef(getStream(), kMsgDClipboard, id, 0, &data); } } void -CClientProxy1_0::grabClipboard(ClipboardID id) +ClientProxy1_0::grabClipboard(ClipboardID id) { LOG((CLOG_DEBUG "send grab clipboard %d to \"%s\"", id, getName().c_str())); - CProtocolUtil::writef(getStream(), kMsgCClipboard, id, 0); + ProtocolUtil::writef(getStream(), kMsgCClipboard, id, 0); // this clipboard is now dirty m_clipboard[id].m_dirty = true; } void -CClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty) +ClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty) { m_clipboard[id].m_dirty = dirty; } void -CClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask, KeyButton) +ClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask, KeyButton) { LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask)); - CProtocolUtil::writef(getStream(), kMsgDKeyDown1_0, key, mask); + ProtocolUtil::writef(getStream(), kMsgDKeyDown1_0, key, mask); } void -CClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask, +ClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton) { LOG((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count)); - CProtocolUtil::writef(getStream(), kMsgDKeyRepeat1_0, key, mask, count); + ProtocolUtil::writef(getStream(), kMsgDKeyRepeat1_0, key, mask, count); } void -CClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton) +ClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton) { LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask)); - CProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask); + ProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask); } void -CClientProxy1_0::mouseDown(ButtonID button) +ClientProxy1_0::mouseDown(ButtonID button) { LOG((CLOG_DEBUG1 "send mouse down to \"%s\" id=%d", getName().c_str(), button)); - CProtocolUtil::writef(getStream(), kMsgDMouseDown, button); + ProtocolUtil::writef(getStream(), kMsgDMouseDown, button); } void -CClientProxy1_0::mouseUp(ButtonID button) +ClientProxy1_0::mouseUp(ButtonID button) { LOG((CLOG_DEBUG1 "send mouse up to \"%s\" id=%d", getName().c_str(), button)); - CProtocolUtil::writef(getStream(), kMsgDMouseUp, button); + ProtocolUtil::writef(getStream(), kMsgDMouseUp, button); } void -CClientProxy1_0::mouseMove(SInt32 xAbs, SInt32 yAbs) +ClientProxy1_0::mouseMove(SInt32 xAbs, SInt32 yAbs) { LOG((CLOG_DEBUG2 "send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs)); - CProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs); + ProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs); } void -CClientProxy1_0::mouseRelativeMove(SInt32, SInt32) +ClientProxy1_0::mouseRelativeMove(SInt32, SInt32) { // ignore -- not supported in protocol 1.0 } void -CClientProxy1_0::mouseWheel(SInt32, SInt32 yDelta) +ClientProxy1_0::mouseWheel(SInt32, SInt32 yDelta) { // clients prior to 1.3 only support the y axis LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d", getName().c_str(), yDelta)); - CProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta); + ProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta); } void -CClientProxy1_0::sendDragInfo(UInt32 fileCount, const char* info, size_t size) +ClientProxy1_0::sendDragInfo(UInt32 fileCount, const char* info, size_t size) { // ignore -- not supported in protocol 1.0 LOG((CLOG_DEBUG "draggingInfoSending not supported")); } void -CClientProxy1_0::fileChunkSending(UInt8 mark, char* data, size_t dataSize) +ClientProxy1_0::fileChunkSending(UInt8 mark, char* data, size_t dataSize) { // ignore -- not supported in protocol 1.0 LOG((CLOG_DEBUG "fileChunkSending not supported")); } void -CClientProxy1_0::screensaver(bool on) +ClientProxy1_0::screensaver(bool on) { LOG((CLOG_DEBUG1 "send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0)); - CProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0); + ProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0); } void -CClientProxy1_0::resetOptions() +ClientProxy1_0::resetOptions() { LOG((CLOG_DEBUG1 "send reset options to \"%s\"", getName().c_str())); - CProtocolUtil::writef(getStream(), kMsgCResetOptions); + ProtocolUtil::writef(getStream(), kMsgCResetOptions); // reset heart rate and death resetHeartbeatRate(); @@ -394,10 +394,10 @@ CClientProxy1_0::resetOptions() } void -CClientProxy1_0::setOptions(const COptionsList& options) +ClientProxy1_0::setOptions(const OptionsList& options) { LOG((CLOG_DEBUG1 "send set options to \"%s\" size=%d", getName().c_str(), options.size())); - CProtocolUtil::writef(getStream(), kMsgDSetOptions, &options); + ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options); // check options for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { @@ -414,11 +414,11 @@ CClientProxy1_0::setOptions(const COptionsList& options) } bool -CClientProxy1_0::recvInfo() +ClientProxy1_0::recvInfo() { // parse the message SInt16 x, y, w, h, dummy1, mx, my; - if (!CProtocolUtil::readf(getStream(), kMsgDInfo + 4, + if (!ProtocolUtil::readf(getStream(), kMsgDInfo + 4, &x, &y, &w, &h, &dummy1, &mx, &my)) { return false; } @@ -443,18 +443,18 @@ CClientProxy1_0::recvInfo() // acknowledge receipt LOG((CLOG_DEBUG1 "send info ack to \"%s\"", getName().c_str())); - CProtocolUtil::writef(getStream(), kMsgCInfoAck); + ProtocolUtil::writef(getStream(), kMsgCInfoAck); return true; } bool -CClientProxy1_0::recvClipboard() +ClientProxy1_0::recvClipboard() { // parse message ClipboardID id; UInt32 seqNum; - CString data; - if (!CProtocolUtil::readf(getStream(), + String data; + if (!ProtocolUtil::readf(getStream(), kMsgDClipboard + 4, &id, &seqNum, &data)) { return false; } @@ -470,22 +470,22 @@ CClientProxy1_0::recvClipboard() m_clipboard[id].m_sequenceNumber = seqNum; // notify - CClipboardInfo* info = new CClipboardInfo; + ClipboardInfo* info = new ClipboardInfo; info->m_id = id; info->m_sequenceNumber = seqNum; - m_events->addEvent(CEvent(m_events->forCClientProxy().clipboardChanged(), + m_events->addEvent(Event(m_events->forClientProxy().clipboardChanged(), getEventTarget(), info)); return true; } bool -CClientProxy1_0::recvGrabClipboard() +ClientProxy1_0::recvGrabClipboard() { // parse message ClipboardID id; UInt32 seqNum; - if (!CProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) { + if (!ProtocolUtil::readf(getStream(), kMsgCClipboard + 4, &id, &seqNum)) { return false; } LOG((CLOG_DEBUG "received client \"%s\" grabbed clipboard %d seqnum=%d", getName().c_str(), id, seqNum)); @@ -496,10 +496,10 @@ CClientProxy1_0::recvGrabClipboard() } // notify - CClipboardInfo* info = new CClipboardInfo; + ClipboardInfo* info = new ClipboardInfo; info->m_id = id; info->m_sequenceNumber = seqNum; - m_events->addEvent(CEvent(m_events->forIScreen().clipboardGrabbed(), + m_events->addEvent(Event(m_events->forIScreen().clipboardGrabbed(), getEventTarget(), info)); return true; @@ -507,10 +507,10 @@ CClientProxy1_0::recvGrabClipboard() // -// CClientProxy1_0::CClientClipboard +// ClientProxy1_0::ClientClipboard // -CClientProxy1_0::CClientClipboard::CClientClipboard() : +ClientProxy1_0::ClientClipboard::ClientClipboard() : m_clipboard(), m_sequenceNumber(0), m_dirty(true) diff --git a/src/lib/server/ClientProxy1_0.h b/src/lib/server/ClientProxy1_0.h index 0bd8a68f..4e3dd28b 100644 --- a/src/lib/server/ClientProxy1_0.h +++ b/src/lib/server/ClientProxy1_0.h @@ -22,15 +22,15 @@ #include "synergy/Clipboard.h" #include "synergy/protocol_types.h" -class CEvent; -class CEventQueueTimer; +class Event; +class EventQueueTimer; class IEventQueue; //! Proxy for client implementing protocol version 1.0 -class CClientProxy1_0 : public CClientProxy { +class ClientProxy1_0 : public ClientProxy { public: - CClientProxy1_0(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events); - ~CClientProxy1_0(); + ClientProxy1_0(const String& name, synergy::IStream* adoptedStream, IEventQueue* events); + ~ClientProxy1_0(); // IScreen virtual bool getClipboard(ClipboardID id, IClipboard*) const; @@ -57,7 +57,7 @@ public: virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta); virtual void screensaver(bool activate); virtual void resetOptions(); - virtual void setOptions(const COptionsList& options); + virtual void setOptions(const OptionsList& options); virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size); virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize); @@ -75,31 +75,31 @@ private: void disconnect(); void removeHandlers(); - void handleData(const CEvent&, void*); - void handleDisconnect(const CEvent&, void*); - void handleWriteError(const CEvent&, void*); - void handleFlatline(const CEvent&, void*); + void handleData(const Event&, void*); + void handleDisconnect(const Event&, void*); + void handleWriteError(const Event&, void*); + void handleFlatline(const Event&, void*); bool recvInfo(); bool recvClipboard(); bool recvGrabClipboard(); private: - typedef bool (CClientProxy1_0::*MessageParser)(const UInt8*); - struct CClientClipboard { + typedef bool (ClientProxy1_0::*MessageParser)(const UInt8*); + struct ClientClipboard { public: - CClientClipboard(); + ClientClipboard(); public: - CClipboard m_clipboard; + Clipboard m_clipboard; UInt32 m_sequenceNumber; bool m_dirty; }; - CClientInfo m_info; - CClientClipboard m_clipboard[kClipboardEnd]; + ClientInfo m_info; + ClientClipboard m_clipboard[kClipboardEnd]; double m_heartbeatAlarm; - CEventQueueTimer* m_heartbeatTimer; + EventQueueTimer* m_heartbeatTimer; MessageParser m_parser; IEventQueue* m_events; }; diff --git a/src/lib/server/ClientProxy1_1.cpp b/src/lib/server/ClientProxy1_1.cpp index 5b9bf7ef..a6b377c5 100644 --- a/src/lib/server/ClientProxy1_1.cpp +++ b/src/lib/server/ClientProxy1_1.cpp @@ -24,38 +24,38 @@ #include // -// CClientProxy1_1 +// ClientProxy1_1 // -CClientProxy1_1::CClientProxy1_1(const CString& name, synergy::IStream* stream, IEventQueue* events) : - CClientProxy1_0(name, stream, events) +ClientProxy1_1::ClientProxy1_1(const String& name, synergy::IStream* stream, IEventQueue* events) : + ClientProxy1_0(name, stream, events) { // do nothing } -CClientProxy1_1::~CClientProxy1_1() +ClientProxy1_1::~ClientProxy1_1() { // do nothing } void -CClientProxy1_1::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) +ClientProxy1_1::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) { LOG((CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button)); - CProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button); + ProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button); } void -CClientProxy1_1::keyRepeat(KeyID key, KeyModifierMask mask, +ClientProxy1_1::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button) { LOG((CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d, button=0x%04x", getName().c_str(), key, mask, count, button)); - CProtocolUtil::writef(getStream(), kMsgDKeyRepeat, key, mask, count, button); + ProtocolUtil::writef(getStream(), kMsgDKeyRepeat, key, mask, count, button); } void -CClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) +ClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) { LOG((CLOG_DEBUG1 "send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button)); - CProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button); + ProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button); } diff --git a/src/lib/server/ClientProxy1_1.h b/src/lib/server/ClientProxy1_1.h index 3c520291..3ff0ee6d 100644 --- a/src/lib/server/ClientProxy1_1.h +++ b/src/lib/server/ClientProxy1_1.h @@ -21,10 +21,10 @@ #include "server/ClientProxy1_0.h" //! Proxy for client implementing protocol version 1.1 -class CClientProxy1_1 : public CClientProxy1_0 { +class ClientProxy1_1 : public ClientProxy1_0 { public: - CClientProxy1_1(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events); - ~CClientProxy1_1(); + ClientProxy1_1(const String& name, synergy::IStream* adoptedStream, IEventQueue* events); + ~ClientProxy1_1(); // IClient overrides virtual void keyDown(KeyID, KeyModifierMask, KeyButton); diff --git a/src/lib/server/ClientProxy1_2.cpp b/src/lib/server/ClientProxy1_2.cpp index 3e8662b1..a397629c 100644 --- a/src/lib/server/ClientProxy1_2.cpp +++ b/src/lib/server/ClientProxy1_2.cpp @@ -22,23 +22,23 @@ #include "base/Log.h" // -// CClientProxy1_1 +// ClientProxy1_1 // -CClientProxy1_2::CClientProxy1_2(const CString& name, synergy::IStream* stream, IEventQueue* events) : - CClientProxy1_1(name, stream, events) +ClientProxy1_2::ClientProxy1_2(const String& name, synergy::IStream* stream, IEventQueue* events) : + ClientProxy1_1(name, stream, events) { // do nothing } -CClientProxy1_2::~CClientProxy1_2() +ClientProxy1_2::~ClientProxy1_2() { // do nothing } void -CClientProxy1_2::mouseRelativeMove(SInt32 xRel, SInt32 yRel) +ClientProxy1_2::mouseRelativeMove(SInt32 xRel, SInt32 yRel) { LOG((CLOG_DEBUG2 "send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel)); - CProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel); + ProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel); } diff --git a/src/lib/server/ClientProxy1_2.h b/src/lib/server/ClientProxy1_2.h index 47e67a7d..c0e4f759 100644 --- a/src/lib/server/ClientProxy1_2.h +++ b/src/lib/server/ClientProxy1_2.h @@ -23,10 +23,10 @@ class IEventQueue; //! Proxy for client implementing protocol version 1.2 -class CClientProxy1_2 : public CClientProxy1_1 { +class ClientProxy1_2 : public ClientProxy1_1 { public: - CClientProxy1_2(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events); - ~CClientProxy1_2(); + ClientProxy1_2(const String& name, synergy::IStream* adoptedStream, IEventQueue* events); + ~ClientProxy1_2(); // IClient overrides virtual void mouseRelativeMove(SInt32 xRel, SInt32 yRel); diff --git a/src/lib/server/ClientProxy1_3.cpp b/src/lib/server/ClientProxy1_3.cpp index 65b041a9..26febd4d 100644 --- a/src/lib/server/ClientProxy1_3.cpp +++ b/src/lib/server/ClientProxy1_3.cpp @@ -27,11 +27,11 @@ #include // -// CClientProxy1_3 +// ClientProxy1_3 // -CClientProxy1_3::CClientProxy1_3(const CString& name, synergy::IStream* stream, IEventQueue* events) : - CClientProxy1_2(name, stream, events), +ClientProxy1_3::ClientProxy1_3(const String& name, synergy::IStream* stream, IEventQueue* events) : + ClientProxy1_2(name, stream, events), m_keepAliveRate(kKeepAliveRate), m_keepAliveTimer(NULL), m_events(events) @@ -39,21 +39,21 @@ CClientProxy1_3::CClientProxy1_3(const CString& name, synergy::IStream* stream, setHeartbeatRate(kKeepAliveRate, kKeepAliveRate * kKeepAlivesUntilDeath); } -CClientProxy1_3::~CClientProxy1_3() +ClientProxy1_3::~ClientProxy1_3() { // cannot do this in superclass or our override wouldn't get called removeHeartbeatTimer(); } void -CClientProxy1_3::mouseWheel(SInt32 xDelta, SInt32 yDelta) +ClientProxy1_3::mouseWheel(SInt32 xDelta, SInt32 yDelta) { LOG((CLOG_DEBUG2 "send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta)); - CProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta); + ProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta); } bool -CClientProxy1_3::parseMessage(const UInt8* code) +ClientProxy1_3::parseMessage(const UInt8* code) { // process message if (memcmp(code, kMsgCKeepAlive, 4) == 0) { @@ -62,68 +62,68 @@ CClientProxy1_3::parseMessage(const UInt8* code) return true; } else { - return CClientProxy1_2::parseMessage(code); + return ClientProxy1_2::parseMessage(code); } } void -CClientProxy1_3::resetHeartbeatRate() +ClientProxy1_3::resetHeartbeatRate() { setHeartbeatRate(kKeepAliveRate, kKeepAliveRate * kKeepAlivesUntilDeath); } void -CClientProxy1_3::setHeartbeatRate(double rate, double) +ClientProxy1_3::setHeartbeatRate(double rate, double) { m_keepAliveRate = rate; - CClientProxy1_2::setHeartbeatRate(rate, rate * kKeepAlivesUntilDeath); + ClientProxy1_2::setHeartbeatRate(rate, rate * kKeepAlivesUntilDeath); } void -CClientProxy1_3::resetHeartbeatTimer() +ClientProxy1_3::resetHeartbeatTimer() { // reset the alarm but not the keep alive timer - CClientProxy1_2::removeHeartbeatTimer(); - CClientProxy1_2::addHeartbeatTimer(); + ClientProxy1_2::removeHeartbeatTimer(); + ClientProxy1_2::addHeartbeatTimer(); } void -CClientProxy1_3::addHeartbeatTimer() +ClientProxy1_3::addHeartbeatTimer() { // create and install a timer to periodically send keep alives if (m_keepAliveRate > 0.0) { m_keepAliveTimer = m_events->newTimer(m_keepAliveRate, NULL); - m_events->adoptHandler(CEvent::kTimer, m_keepAliveTimer, - new TMethodEventJob(this, - &CClientProxy1_3::handleKeepAlive, NULL)); + m_events->adoptHandler(Event::kTimer, m_keepAliveTimer, + new TMethodEventJob(this, + &ClientProxy1_3::handleKeepAlive, NULL)); } // superclass does the alarm - CClientProxy1_2::addHeartbeatTimer(); + ClientProxy1_2::addHeartbeatTimer(); } void -CClientProxy1_3::removeHeartbeatTimer() +ClientProxy1_3::removeHeartbeatTimer() { // remove the timer that sends keep alives periodically if (m_keepAliveTimer != NULL) { - m_events->removeHandler(CEvent::kTimer, m_keepAliveTimer); + m_events->removeHandler(Event::kTimer, m_keepAliveTimer); m_events->deleteTimer(m_keepAliveTimer); m_keepAliveTimer = NULL; } // superclass does the alarm - CClientProxy1_2::removeHeartbeatTimer(); + ClientProxy1_2::removeHeartbeatTimer(); } void -CClientProxy1_3::handleKeepAlive(const CEvent&, void*) +ClientProxy1_3::handleKeepAlive(const Event&, void*) { keepAlive(); } void -CClientProxy1_3::keepAlive() +ClientProxy1_3::keepAlive() { - CProtocolUtil::writef(getStream(), kMsgCKeepAlive); + ProtocolUtil::writef(getStream(), kMsgCKeepAlive); } diff --git a/src/lib/server/ClientProxy1_3.h b/src/lib/server/ClientProxy1_3.h index a76a0669..5169773d 100644 --- a/src/lib/server/ClientProxy1_3.h +++ b/src/lib/server/ClientProxy1_3.h @@ -21,16 +21,16 @@ #include "server/ClientProxy1_2.h" //! Proxy for client implementing protocol version 1.3 -class CClientProxy1_3 : public CClientProxy1_2 { +class ClientProxy1_3 : public ClientProxy1_2 { public: - CClientProxy1_3(const CString& name, synergy::IStream* adoptedStream, IEventQueue* events); - ~CClientProxy1_3(); + ClientProxy1_3(const String& name, synergy::IStream* adoptedStream, IEventQueue* events); + ~ClientProxy1_3(); // IClient overrides virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta); protected: - // CClientProxy overrides + // ClientProxy overrides virtual bool parseMessage(const UInt8* code); virtual void resetHeartbeatRate(); virtual void setHeartbeatRate(double rate, double alarm); @@ -40,10 +40,10 @@ protected: virtual void keepAlive(); private: - void handleKeepAlive(const CEvent&, void*); + void handleKeepAlive(const Event&, void*); private: double m_keepAliveRate; - CEventQueueTimer* m_keepAliveTimer; + EventQueueTimer* m_keepAliveTimer; IEventQueue* m_events; }; diff --git a/src/lib/server/ClientProxy1_4.cpp b/src/lib/server/ClientProxy1_4.cpp index e85a8a7f..fedf6c14 100644 --- a/src/lib/server/ClientProxy1_4.cpp +++ b/src/lib/server/ClientProxy1_4.cpp @@ -29,61 +29,61 @@ #include // -// CClientProxy1_4 +// ClientProxy1_4 // -CClientProxy1_4::CClientProxy1_4(const CString& name, synergy::IStream* stream, CServer* server, IEventQueue* events) : - CClientProxy1_3(name, stream, events), m_server(server) +ClientProxy1_4::ClientProxy1_4(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) : + ClientProxy1_3(name, stream, events), m_server(server) { assert(m_server != NULL); } -CClientProxy1_4::~CClientProxy1_4() +ClientProxy1_4::~ClientProxy1_4() { } void -CClientProxy1_4::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) +ClientProxy1_4::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) { cryptoIv(); - CClientProxy1_3::keyDown(key, mask, button); + ClientProxy1_3::keyDown(key, mask, button); } void -CClientProxy1_4::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button) +ClientProxy1_4::keyRepeat(KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button) { cryptoIv(); - CClientProxy1_3::keyRepeat(key, mask, count, button); + ClientProxy1_3::keyRepeat(key, mask, count, button); } void -CClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) +ClientProxy1_4::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) { cryptoIv(); - CClientProxy1_3::keyUp(key, mask, button); + ClientProxy1_3::keyUp(key, mask, button); } void -CClientProxy1_4::keepAlive() +ClientProxy1_4::keepAlive() { cryptoIv(); - CClientProxy1_3::keepAlive(); + ClientProxy1_3::keepAlive(); } void -CClientProxy1_4::cryptoIv() +ClientProxy1_4::cryptoIv() { - CCryptoStream* cryptoStream = dynamic_cast(getStream()); + CryptoStream* cryptoStream = dynamic_cast(getStream()); if (cryptoStream == NULL) { return; } byte iv[CRYPTO_IV_SIZE]; cryptoStream->newIv(iv); - CString data(reinterpret_cast(iv), CRYPTO_IV_SIZE); + String data(reinterpret_cast(iv), CRYPTO_IV_SIZE); LOG((CLOG_DEBUG2 "send crypto iv change to \"%s\"", getName().c_str())); - CProtocolUtil::writef(getStream(), kMsgDCryptoIv, &data); + ProtocolUtil::writef(getStream(), kMsgDCryptoIv, &data); // change IV only after we've sent the current IV, otherwise // the client won't be able to decrypt the new IV. diff --git a/src/lib/server/ClientProxy1_4.h b/src/lib/server/ClientProxy1_4.h index 94ed647e..077d9210 100644 --- a/src/lib/server/ClientProxy1_4.h +++ b/src/lib/server/ClientProxy1_4.h @@ -20,19 +20,19 @@ #include "server/ClientProxy1_3.h" -class CServer; +class Server; //! Proxy for client implementing protocol version 1.4 -class CClientProxy1_4 : public CClientProxy1_3 { +class ClientProxy1_4 : public ClientProxy1_3 { public: - CClientProxy1_4(const CString& name, synergy::IStream* adoptedStream, CServer* server, IEventQueue* events); - ~CClientProxy1_4(); + ClientProxy1_4(const String& name, synergy::IStream* adoptedStream, Server* server, IEventQueue* events); + ~ClientProxy1_4(); //! @name accessors //@{ //! get server pointer - CServer* getServer() { return m_server; } + Server* getServer() { return m_server; } //@} @@ -45,5 +45,5 @@ public: //! Send IV to make void cryptoIv(); - CServer* m_server; + Server* m_server; }; diff --git a/src/lib/server/ClientProxy1_5.cpp b/src/lib/server/ClientProxy1_5.cpp index f7db42d0..280730f0 100644 --- a/src/lib/server/ClientProxy1_5.cpp +++ b/src/lib/server/ClientProxy1_5.cpp @@ -23,13 +23,13 @@ #include "base/Log.h" // -// CClientProxy1_5 +// ClientProxy1_5 // -const UInt16 CClientProxy1_5::m_intervalThreshold = 1; +const UInt16 ClientProxy1_5::m_intervalThreshold = 1; -CClientProxy1_5::CClientProxy1_5(const CString& name, synergy::IStream* stream, CServer* server, IEventQueue* events) : - CClientProxy1_4(name, stream, server, events), +ClientProxy1_5::ClientProxy1_5(const String& name, synergy::IStream* stream, Server* server, IEventQueue* events) : + ClientProxy1_4(name, stream, server, events), m_events(events), m_stopwatch(true), m_elapsedTime(0), @@ -37,22 +37,22 @@ CClientProxy1_5::CClientProxy1_5(const CString& name, synergy::IStream* stream, { } -CClientProxy1_5::~CClientProxy1_5() +ClientProxy1_5::~ClientProxy1_5() { } void -CClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size) +ClientProxy1_5::sendDragInfo(UInt32 fileCount, const char* info, size_t size) { - CString data(info, size); + String data(info, size); - CProtocolUtil::writef(getStream(), kMsgDDragInfo, fileCount, &data); + ProtocolUtil::writef(getStream(), kMsgDDragInfo, fileCount, &data); } void -CClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize) +ClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize) { - CString chunk(data, dataSize); + String chunk(data, dataSize); switch (mark) { case kFileStart: @@ -68,11 +68,11 @@ CClientProxy1_5::fileChunkSending(UInt8 mark, char* data, size_t dataSize) break; } - CProtocolUtil::writef(getStream(), kMsgDFileTransfer, mark, &chunk); + ProtocolUtil::writef(getStream(), kMsgDFileTransfer, mark, &chunk); } bool -CClientProxy1_5::parseMessage(const UInt8* code) +ClientProxy1_5::parseMessage(const UInt8* code) { if (memcmp(code, kMsgDFileTransfer, 4) == 0) { fileChunkReceived(); @@ -81,21 +81,21 @@ CClientProxy1_5::parseMessage(const UInt8* code) dragInfoReceived(); } else { - return CClientProxy1_4::parseMessage(code); + return ClientProxy1_4::parseMessage(code); } return true; } void -CClientProxy1_5::fileChunkReceived() +ClientProxy1_5::fileChunkReceived() { // parse UInt8 mark = 0; - CString content; - CProtocolUtil::readf(getStream(), kMsgDFileTransfer + 4, &mark, &content); + String content; + ProtocolUtil::readf(getStream(), kMsgDFileTransfer + 4, &mark, &content); - CServer* server = getServer(); + Server* server = getServer(); switch (mark) { case kFileStart: server->clearReceivedFileData(); @@ -125,7 +125,7 @@ CClientProxy1_5::fileChunkReceived() break; case kFileEnd: - m_events->addEvent(CEvent(m_events->forIScreen().fileRecieveCompleted(), server)); + m_events->addEvent(Event(m_events->forIScreen().fileRecieveCompleted(), server)); if (CLOG->getFilter() >= kDEBUG2) { LOG((CLOG_DEBUG2 "file data transfer finished")); m_elapsedTime += m_stopwatch.getTime(); @@ -139,12 +139,12 @@ CClientProxy1_5::fileChunkReceived() } void -CClientProxy1_5::dragInfoReceived() +ClientProxy1_5::dragInfoReceived() { // parse UInt32 fileNum = 0; - CString content; - CProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content); + String content; + ProtocolUtil::readf(getStream(), kMsgDDragInfo + 4, &fileNum, &content); m_server->dragInfoReceived(fileNum, content); } diff --git a/src/lib/server/ClientProxy1_5.h b/src/lib/server/ClientProxy1_5.h index 2c292826..ff7e6261 100644 --- a/src/lib/server/ClientProxy1_5.h +++ b/src/lib/server/ClientProxy1_5.h @@ -20,14 +20,14 @@ #include "server/ClientProxy1_4.h" #include "base/Stopwatch.h" -class CServer; +class Server; class IEventQueue; //! Proxy for client implementing protocol version 1.5 -class CClientProxy1_5 : public CClientProxy1_4 { +class ClientProxy1_5 : public ClientProxy1_4 { public: - CClientProxy1_5(const CString& name, synergy::IStream* adoptedStream, CServer* server, IEventQueue* events); - ~CClientProxy1_5(); + ClientProxy1_5(const String& name, synergy::IStream* adoptedStream, Server* server, IEventQueue* events); + ~ClientProxy1_5(); virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size); virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize); @@ -38,7 +38,7 @@ public: private: IEventQueue* m_events; - CStopwatch m_stopwatch; + Stopwatch m_stopwatch; double m_elapsedTime; size_t m_receivedDataSize; static const UInt16 m_intervalThreshold; diff --git a/src/lib/server/ClientProxyUnknown.cpp b/src/lib/server/ClientProxyUnknown.cpp index dd152be6..f1ddf6dd 100644 --- a/src/lib/server/ClientProxyUnknown.cpp +++ b/src/lib/server/ClientProxyUnknown.cpp @@ -36,10 +36,10 @@ #include "base/TMethodEventJob.h" // -// CClientProxyUnknown +// ClientProxyUnknown // -CClientProxyUnknown::CClientProxyUnknown(synergy::IStream* stream, double timeout, CServer* server, IEventQueue* events) : +ClientProxyUnknown::ClientProxyUnknown(synergy::IStream* stream, double timeout, Server* server, IEventQueue* events) : m_stream(stream), m_proxy(NULL), m_ready(false), @@ -48,19 +48,19 @@ CClientProxyUnknown::CClientProxyUnknown(synergy::IStream* stream, double timeou { assert(m_server != NULL); - m_events->adoptHandler(CEvent::kTimer, this, - new TMethodEventJob(this, - &CClientProxyUnknown::handleTimeout, NULL)); + m_events->adoptHandler(Event::kTimer, this, + new TMethodEventJob(this, + &ClientProxyUnknown::handleTimeout, NULL)); m_timer = m_events->newOneShotTimer(timeout, this); addStreamHandlers(); LOG((CLOG_DEBUG1 "saying hello")); - CProtocolUtil::writef(m_stream, kMsgHello, + ProtocolUtil::writef(m_stream, kMsgHello, kProtocolMajorVersion, kProtocolMinorVersion); } -CClientProxyUnknown::~CClientProxyUnknown() +ClientProxyUnknown::~ClientProxyUnknown() { removeHandlers(); removeTimer(); @@ -68,12 +68,12 @@ CClientProxyUnknown::~CClientProxyUnknown() delete m_proxy; } -CClientProxy* -CClientProxyUnknown::orphanClientProxy() +ClientProxy* +ClientProxyUnknown::orphanClientProxy() { if (m_ready) { removeHandlers(); - CClientProxy* proxy = m_proxy; + ClientProxy* proxy = m_proxy; m_proxy = NULL; return proxy; } @@ -83,64 +83,64 @@ CClientProxyUnknown::orphanClientProxy() } void -CClientProxyUnknown::sendSuccess() +ClientProxyUnknown::sendSuccess() { m_ready = true; removeTimer(); - m_events->addEvent(CEvent(m_events->forCClientProxyUnknown().success(), this)); + m_events->addEvent(Event(m_events->forClientProxyUnknown().success(), this)); } void -CClientProxyUnknown::sendFailure() +ClientProxyUnknown::sendFailure() { delete m_proxy; m_proxy = NULL; m_ready = false; removeHandlers(); removeTimer(); - m_events->addEvent(CEvent(m_events->forCClientProxyUnknown().failure(), this)); + m_events->addEvent(Event(m_events->forClientProxyUnknown().failure(), this)); } void -CClientProxyUnknown::addStreamHandlers() +ClientProxyUnknown::addStreamHandlers() { assert(m_stream != NULL); m_events->adoptHandler(m_events->forIStream().inputReady(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxyUnknown::handleData)); + new TMethodEventJob(this, + &ClientProxyUnknown::handleData)); m_events->adoptHandler(m_events->forIStream().outputError(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxyUnknown::handleWriteError)); + new TMethodEventJob(this, + &ClientProxyUnknown::handleWriteError)); m_events->adoptHandler(m_events->forIStream().inputShutdown(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxyUnknown::handleDisconnect)); + new TMethodEventJob(this, + &ClientProxyUnknown::handleDisconnect)); m_events->adoptHandler(m_events->forIStream().outputShutdown(), m_stream->getEventTarget(), - new TMethodEventJob(this, - &CClientProxyUnknown::handleWriteError)); + new TMethodEventJob(this, + &ClientProxyUnknown::handleWriteError)); } void -CClientProxyUnknown::addProxyHandlers() +ClientProxyUnknown::addProxyHandlers() { assert(m_proxy != NULL); - m_events->adoptHandler(m_events->forCClientProxy().ready(), + m_events->adoptHandler(m_events->forClientProxy().ready(), m_proxy, - new TMethodEventJob(this, - &CClientProxyUnknown::handleReady)); - m_events->adoptHandler(m_events->forCClientProxy().disconnected(), + new TMethodEventJob(this, + &ClientProxyUnknown::handleReady)); + m_events->adoptHandler(m_events->forClientProxy().disconnected(), m_proxy, - new TMethodEventJob(this, - &CClientProxyUnknown::handleDisconnect)); + new TMethodEventJob(this, + &ClientProxyUnknown::handleDisconnect)); } void -CClientProxyUnknown::removeHandlers() +ClientProxyUnknown::removeHandlers() { if (m_stream != NULL) { m_events->removeHandler(m_events->forIStream().inputReady(), @@ -153,29 +153,29 @@ CClientProxyUnknown::removeHandlers() m_stream->getEventTarget()); } if (m_proxy != NULL) { - m_events->removeHandler(m_events->forCClientProxy().ready(), + m_events->removeHandler(m_events->forClientProxy().ready(), m_proxy); - m_events->removeHandler(m_events->forCClientProxy().disconnected(), + m_events->removeHandler(m_events->forClientProxy().disconnected(), m_proxy); } } void -CClientProxyUnknown::removeTimer() +ClientProxyUnknown::removeTimer() { if (m_timer != NULL) { m_events->deleteTimer(m_timer); - m_events->removeHandler(CEvent::kTimer, this); + m_events->removeHandler(Event::kTimer, this); m_timer = NULL; } } void -CClientProxyUnknown::handleData(const CEvent&, void*) +ClientProxyUnknown::handleData(const Event&, void*) { LOG((CLOG_DEBUG1 "parsing hello reply")); - CString name(""); + String name(""); try { // limit the maximum length of the hello UInt32 n = m_stream->getSize(); @@ -186,7 +186,7 @@ CClientProxyUnknown::handleData(const CEvent&, void*) // parse the reply to hello SInt16 major, minor; - if (!CProtocolUtil::readf(m_stream, kMsgHelloBack, + if (!ProtocolUtil::readf(m_stream, kMsgHelloBack, &major, &minor, &name)) { throw XBadClient(); } @@ -205,27 +205,27 @@ CClientProxyUnknown::handleData(const CEvent&, void*) if (major == 1) { switch (minor) { case 0: - m_proxy = new CClientProxy1_0(name, m_stream, m_events); + m_proxy = new ClientProxy1_0(name, m_stream, m_events); break; case 1: - m_proxy = new CClientProxy1_1(name, m_stream, m_events); + m_proxy = new ClientProxy1_1(name, m_stream, m_events); break; case 2: - m_proxy = new CClientProxy1_2(name, m_stream, m_events); + m_proxy = new ClientProxy1_2(name, m_stream, m_events); break; case 3: - m_proxy = new CClientProxy1_3(name, m_stream, m_events); + m_proxy = new ClientProxy1_3(name, m_stream, m_events); break; case 4: - m_proxy = new CClientProxy1_4(name, m_stream, m_server, m_events); + m_proxy = new ClientProxy1_4(name, m_stream, m_server, m_events); break; case 5: - m_proxy = new CClientProxy1_5(name, m_stream, m_server, m_events); + m_proxy = new ClientProxy1_5(name, m_stream, m_server, m_events); break; } } @@ -246,14 +246,14 @@ CClientProxyUnknown::handleData(const CEvent&, void*) catch (XIncompatibleClient& e) { // client is incompatible LOG((CLOG_WARN "client \"%s\" has incompatible version %d.%d)", name.c_str(), e.getMajor(), e.getMinor())); - CProtocolUtil::writef(m_stream, + ProtocolUtil::writef(m_stream, kMsgEIncompatible, kProtocolMajorVersion, kProtocolMinorVersion); } catch (XBadClient&) { // client not behaving LOG((CLOG_WARN "protocol error from client \"%s\"", name.c_str())); - CProtocolUtil::writef(m_stream, kMsgEBad); + ProtocolUtil::writef(m_stream, kMsgEBad); } catch (XBase& e) { // misc error @@ -263,28 +263,28 @@ CClientProxyUnknown::handleData(const CEvent&, void*) } void -CClientProxyUnknown::handleWriteError(const CEvent&, void*) +ClientProxyUnknown::handleWriteError(const Event&, void*) { LOG((CLOG_NOTE "error communicating with new client")); sendFailure(); } void -CClientProxyUnknown::handleTimeout(const CEvent&, void*) +ClientProxyUnknown::handleTimeout(const Event&, void*) { LOG((CLOG_NOTE "new client is unresponsive")); sendFailure(); } void -CClientProxyUnknown::handleDisconnect(const CEvent&, void*) +ClientProxyUnknown::handleDisconnect(const Event&, void*) { LOG((CLOG_NOTE "new client disconnected")); sendFailure(); } void -CClientProxyUnknown::handleReady(const CEvent&, void*) +ClientProxyUnknown::handleReady(const Event&, void*) { sendSuccess(); } diff --git a/src/lib/server/ClientProxyUnknown.h b/src/lib/server/ClientProxyUnknown.h index 70e94766..aabfce52 100644 --- a/src/lib/server/ClientProxyUnknown.h +++ b/src/lib/server/ClientProxyUnknown.h @@ -21,16 +21,16 @@ #include "base/Event.h" #include "base/EventTypes.h" -class CClientProxy; -class CEventQueueTimer; +class ClientProxy; +class EventQueueTimer; namespace synergy { class IStream; } -class CServer; +class Server; class IEventQueue; -class CClientProxyUnknown { +class ClientProxyUnknown { public: - CClientProxyUnknown(synergy::IStream* stream, double timeout, CServer* server, IEventQueue* events); - ~CClientProxyUnknown(); + ClientProxyUnknown(synergy::IStream* stream, double timeout, Server* server, IEventQueue* events); + ~ClientProxyUnknown(); //! @name manipulators //@{ @@ -41,7 +41,7 @@ public: (i.e. when this object sends a success event). Returns NULL if the handshake is unsuccessful or incomplete. */ - CClientProxy* orphanClientProxy(); + ClientProxy* orphanClientProxy(); //@} @@ -52,17 +52,17 @@ private: void addProxyHandlers(); void removeHandlers(); void removeTimer(); - void handleData(const CEvent&, void*); - void handleWriteError(const CEvent&, void*); - void handleTimeout(const CEvent&, void*); - void handleDisconnect(const CEvent&, void*); - void handleReady(const CEvent&, void*); + void handleData(const Event&, void*); + void handleWriteError(const Event&, void*); + void handleTimeout(const Event&, void*); + void handleDisconnect(const Event&, void*); + void handleReady(const Event&, void*); private: synergy::IStream* m_stream; - CEventQueueTimer* m_timer; - CClientProxy* m_proxy; + EventQueueTimer* m_timer; + ClientProxy* m_proxy; bool m_ready; - CServer* m_server; + Server* m_server; IEventQueue* m_events; }; diff --git a/src/lib/server/Config.cpp b/src/lib/server/Config.cpp index ba8843e2..f43a0c6a 100644 --- a/src/lib/server/Config.cpp +++ b/src/lib/server/Config.cpp @@ -31,10 +31,10 @@ using namespace synergy::string; // -// CConfig +// Config // -CConfig::CConfig(IEventQueue* events) : +Config::Config(IEventQueue* events) : m_inputFilter(events), m_hasLockToScreenAction(false), m_events(events) @@ -42,13 +42,13 @@ CConfig::CConfig(IEventQueue* events) : // do nothing } -CConfig::~CConfig() +Config::~Config() { // do nothing } bool -CConfig::addScreen(const CString& name) +Config::addScreen(const String& name) { // alias name must not exist if (m_nameToCanonicalName.find(name) != m_nameToCanonicalName.end()) { @@ -56,7 +56,7 @@ CConfig::addScreen(const CString& name) } // add cell - m_map.insert(std::make_pair(name, CCell())); + m_map.insert(std::make_pair(name, Cell())); // add name m_nameToCanonicalName.insert(std::make_pair(name, name)); @@ -65,12 +65,12 @@ CConfig::addScreen(const CString& name) } bool -CConfig::renameScreen(const CString& oldName, - const CString& newName) +Config::renameScreen(const String& oldName, + const String& newName) { // get canonical name and find cell - CString oldCanonical = getCanonicalName(oldName); - CCellMap::iterator index = m_map.find(oldCanonical); + String oldCanonical = getCanonicalName(oldName); + CellMap::iterator index = m_map.find(oldCanonical); if (index == m_map.end()) { return false; } @@ -83,7 +83,7 @@ CConfig::renameScreen(const CString& oldName, } // update cell - CCell tmpCell = index->second; + Cell tmpCell = index->second; m_map.erase(index); m_map.insert(std::make_pair(newName, tmpCell)); @@ -92,14 +92,14 @@ CConfig::renameScreen(const CString& oldName, m_nameToCanonicalName.insert(std::make_pair(newName, newName)); // update connections - CName oldNameObj(this, oldName); + Name oldNameObj(this, oldName); for (index = m_map.begin(); index != m_map.end(); ++index) { index->second.rename(oldNameObj, newName); } // update alias targets if (CaselessCmp::equal(oldName, oldCanonical)) { - for (CNameMap::iterator iter = m_nameToCanonicalName.begin(); + for (NameMap::iterator iter = m_nameToCanonicalName.begin(); iter != m_nameToCanonicalName.end(); ++iter) { if (CaselessCmp::equal( iter->second, oldCanonical)) { @@ -112,11 +112,11 @@ CConfig::renameScreen(const CString& oldName, } void -CConfig::removeScreen(const CString& name) +Config::removeScreen(const String& name) { // get canonical name and find cell - CString canonical = getCanonicalName(name); - CCellMap::iterator index = m_map.find(canonical); + String canonical = getCanonicalName(name); + CellMap::iterator index = m_map.find(canonical); if (index == m_map.end()) { return; } @@ -125,13 +125,13 @@ CConfig::removeScreen(const CString& name) m_map.erase(index); // disconnect - CName nameObj(this, name); + Name nameObj(this, name); for (index = m_map.begin(); index != m_map.end(); ++index) { index->second.remove(nameObj); } // remove aliases (and canonical name) - for (CNameMap::iterator iter = m_nameToCanonicalName.begin(); + for (NameMap::iterator iter = m_nameToCanonicalName.begin(); iter != m_nameToCanonicalName.end(); ) { if (iter->second == canonical) { m_nameToCanonicalName.erase(iter++); @@ -143,14 +143,14 @@ CConfig::removeScreen(const CString& name) } void -CConfig::removeAllScreens() +Config::removeAllScreens() { m_map.clear(); m_nameToCanonicalName.clear(); } bool -CConfig::addAlias(const CString& canonical, const CString& alias) +Config::addAlias(const String& canonical, const String& alias) { // alias name must not exist if (m_nameToCanonicalName.find(alias) != m_nameToCanonicalName.end()) { @@ -169,7 +169,7 @@ CConfig::addAlias(const CString& canonical, const CString& alias) } bool -CConfig::removeAlias(const CString& alias) +Config::removeAlias(const String& alias) { // must not be a canonical name if (m_map.find(alias) != m_map.end()) { @@ -177,7 +177,7 @@ CConfig::removeAlias(const CString& alias) } // find alias - CNameMap::iterator index = m_nameToCanonicalName.find(alias); + NameMap::iterator index = m_nameToCanonicalName.find(alias); if (index == m_nameToCanonicalName.end()) { return false; } @@ -189,7 +189,7 @@ CConfig::removeAlias(const CString& alias) } bool -CConfig::removeAliases(const CString& canonical) +Config::removeAliases(const String& canonical) { // must be a canonical name if (m_map.find(canonical) == m_map.end()) { @@ -197,7 +197,7 @@ CConfig::removeAliases(const CString& canonical) } // find and removing matching aliases - for (CNameMap::iterator index = m_nameToCanonicalName.begin(); + for (NameMap::iterator index = m_nameToCanonicalName.begin(); index != m_nameToCanonicalName.end(); ) { if (index->second == canonical && index->first != canonical) { m_nameToCanonicalName.erase(index++); @@ -211,13 +211,13 @@ CConfig::removeAliases(const CString& canonical) } void -CConfig::removeAllAliases() +Config::removeAllAliases() { // remove all names m_nameToCanonicalName.clear(); // put the canonical names back in - for (CCellMap::iterator index = m_map.begin(); + for (CellMap::iterator index = m_map.begin(); index != m_map.end(); ++index) { m_nameToCanonicalName.insert( std::make_pair(index->first, index->first)); @@ -225,33 +225,33 @@ CConfig::removeAllAliases() } bool -CConfig::connect(const CString& srcName, +Config::connect(const String& srcName, EDirection srcSide, float srcStart, float srcEnd, - const CString& dstName, + const String& dstName, float dstStart, float dstEnd) { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); // find source cell - CCellMap::iterator index = m_map.find(getCanonicalName(srcName)); + CellMap::iterator index = m_map.find(getCanonicalName(srcName)); if (index == m_map.end()) { return false; } // add link - CCellEdge srcEdge(srcSide, CInterval(srcStart, srcEnd)); - CCellEdge dstEdge(dstName, srcSide, CInterval(dstStart, dstEnd)); + CellEdge srcEdge(srcSide, Interval(srcStart, srcEnd)); + CellEdge dstEdge(dstName, srcSide, Interval(dstStart, dstEnd)); return index->second.add(srcEdge, dstEdge); } bool -CConfig::disconnect(const CString& srcName, EDirection srcSide) +Config::disconnect(const String& srcName, EDirection srcSide) { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); // find source cell - CCellMap::iterator index = m_map.find(srcName); + CellMap::iterator index = m_map.find(srcName); if (index == m_map.end()) { return false; } @@ -263,12 +263,12 @@ CConfig::disconnect(const CString& srcName, EDirection srcSide) } bool -CConfig::disconnect(const CString& srcName, EDirection srcSide, float position) +Config::disconnect(const String& srcName, EDirection srcSide, float position) { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); // find source cell - CCellMap::iterator index = m_map.find(srcName); + CellMap::iterator index = m_map.find(srcName); if (index == m_map.end()) { return false; } @@ -280,21 +280,21 @@ CConfig::disconnect(const CString& srcName, EDirection srcSide, float position) } void -CConfig::setSynergyAddress(const CNetworkAddress& addr) +Config::setSynergyAddress(const NetworkAddress& addr) { m_synergyAddress = addr; } bool -CConfig::addOption(const CString& name, OptionID option, OptionValue value) +Config::addOption(const String& name, OptionID option, OptionValue value) { // find options - CScreenOptions* options = NULL; + ScreenOptions* options = NULL; if (name.empty()) { options = &m_globalOptions; } else { - CCellMap::iterator index = m_map.find(name); + CellMap::iterator index = m_map.find(name); if (index != m_map.end()) { options = &index->second.m_options; } @@ -309,15 +309,15 @@ CConfig::addOption(const CString& name, OptionID option, OptionValue value) } bool -CConfig::removeOption(const CString& name, OptionID option) +Config::removeOption(const String& name, OptionID option) { // find options - CScreenOptions* options = NULL; + ScreenOptions* options = NULL; if (name.empty()) { options = &m_globalOptions; } else { - CCellMap::iterator index = m_map.find(name); + CellMap::iterator index = m_map.find(name); if (index != m_map.end()) { options = &index->second.m_options; } @@ -332,15 +332,15 @@ CConfig::removeOption(const CString& name, OptionID option) } bool -CConfig::removeOptions(const CString& name) +Config::removeOptions(const String& name) { // find options - CScreenOptions* options = NULL; + ScreenOptions* options = NULL; if (name.empty()) { options = &m_globalOptions; } else { - CCellMap::iterator index = m_map.find(name); + CellMap::iterator index = m_map.find(name); if (index != m_map.end()) { options = &index->second.m_options; } @@ -355,7 +355,7 @@ CConfig::removeOptions(const CString& name) } bool -CConfig::isValidScreenName(const CString& name) const +Config::isValidScreenName(const String& name) const { // name is valid if matches validname // name ::= [_A-Za-z0-9] | [_A-Za-z0-9][-_A-Za-z0-9]*[_A-Za-z0-9] @@ -370,7 +370,7 @@ CConfig::isValidScreenName(const CString& name) const } // check each dot separated part - CString::size_type b = 0; + String::size_type b = 0; for (;;) { // accept trailing . if (b == name.size()) { @@ -378,8 +378,8 @@ CConfig::isValidScreenName(const CString& name) const } // find end of part - CString::size_type e = name.find('.', b); - if (e == CString::npos) { + String::size_type e = name.find('.', b); + if (e == String::npos) { e = name.size(); } @@ -395,7 +395,7 @@ CConfig::isValidScreenName(const CString& name) const } // check interior characters - for (CString::size_type i = b; i < e; ++i) { + for (String::size_type i = b; i < e; ++i) { if (!isalnum(name[i]) && name[i] != '_' && name[i] != '-') { return false; } @@ -412,69 +412,69 @@ CConfig::isValidScreenName(const CString& name) const return true; } -CConfig::const_iterator -CConfig::begin() const +Config::const_iterator +Config::begin() const { return const_iterator(m_map.begin()); } -CConfig::const_iterator -CConfig::end() const +Config::const_iterator +Config::end() const { return const_iterator(m_map.end()); } -CConfig::all_const_iterator -CConfig::beginAll() const +Config::all_const_iterator +Config::beginAll() const { return m_nameToCanonicalName.begin(); } -CConfig::all_const_iterator -CConfig::endAll() const +Config::all_const_iterator +Config::endAll() const { return m_nameToCanonicalName.end(); } bool -CConfig::isScreen(const CString& name) const +Config::isScreen(const String& name) const { return (m_nameToCanonicalName.count(name) > 0); } bool -CConfig::isCanonicalName(const CString& name) const +Config::isCanonicalName(const String& name) const { return (!name.empty() && CaselessCmp::equal(getCanonicalName(name), name)); } -CString -CConfig::getCanonicalName(const CString& name) const +String +Config::getCanonicalName(const String& name) const { - CNameMap::const_iterator index = m_nameToCanonicalName.find(name); + NameMap::const_iterator index = m_nameToCanonicalName.find(name); if (index == m_nameToCanonicalName.end()) { - return CString(); + return String(); } else { return index->second; } } -CString -CConfig::getNeighbor(const CString& srcName, EDirection srcSide, +String +Config::getNeighbor(const String& srcName, EDirection srcSide, float position, float* positionOut) const { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); // find source cell - CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); + CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); if (index == m_map.end()) { - return CString(); + return String(); } // find edge - const CCellEdge* srcEdge, *dstEdge; + const CellEdge* srcEdge, *dstEdge; if (!index->second.getLink(srcSide, position, srcEdge, dstEdge)) { // no neighbor return ""; @@ -492,58 +492,58 @@ CConfig::getNeighbor(const CString& srcName, EDirection srcSide, } bool -CConfig::hasNeighbor(const CString& srcName, EDirection srcSide) const +Config::hasNeighbor(const String& srcName, EDirection srcSide) const { return hasNeighbor(srcName, srcSide, 0.0f, 1.0f); } bool -CConfig::hasNeighbor(const CString& srcName, EDirection srcSide, +Config::hasNeighbor(const String& srcName, EDirection srcSide, float start, float end) const { assert(srcSide >= kFirstDirection && srcSide <= kLastDirection); // find source cell - CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); + CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); if (index == m_map.end()) { return false; } - return index->second.overlaps(CCellEdge(srcSide, CInterval(start, end))); + return index->second.overlaps(CellEdge(srcSide, Interval(start, end))); } -CConfig::link_const_iterator -CConfig::beginNeighbor(const CString& srcName) const +Config::link_const_iterator +Config::beginNeighbor(const String& srcName) const { - CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); + CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); assert(index != m_map.end()); return index->second.begin(); } -CConfig::link_const_iterator -CConfig::endNeighbor(const CString& srcName) const +Config::link_const_iterator +Config::endNeighbor(const String& srcName) const { - CCellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); + CellMap::const_iterator index = m_map.find(getCanonicalName(srcName)); assert(index != m_map.end()); return index->second.end(); } -const CNetworkAddress& -CConfig::getSynergyAddress() const +const NetworkAddress& +Config::getSynergyAddress() const { return m_synergyAddress; } -const CConfig::CScreenOptions* -CConfig::getOptions(const CString& name) const +const Config::ScreenOptions* +Config::getOptions(const String& name) const { // find options - const CScreenOptions* options = NULL; + const ScreenOptions* options = NULL; if (name.empty()) { options = &m_globalOptions; } else { - CCellMap::const_iterator index = m_map.find(name); + CellMap::const_iterator index = m_map.find(name); if (index != m_map.end()) { options = &index->second.m_options; } @@ -554,13 +554,13 @@ CConfig::getOptions(const CString& name) const } bool -CConfig::hasLockToScreenAction() const +Config::hasLockToScreenAction() const { return m_hasLockToScreenAction; } bool -CConfig::operator==(const CConfig& x) const +Config::operator==(const Config& x) const { if (m_synergyAddress != x.m_synergyAddress) { return false; @@ -577,7 +577,7 @@ CConfig::operator==(const CConfig& x) const return false; } - for (CCellMap::const_iterator index1 = m_map.begin(), + for (CellMap::const_iterator index1 = m_map.begin(), index2 = x.m_map.begin(); index1 != m_map.end(); ++index1, ++index2) { // compare names @@ -591,7 +591,7 @@ CConfig::operator==(const CConfig& x) const } } - for (CNameMap::const_iterator index1 = m_nameToCanonicalName.begin(), + for (NameMap::const_iterator index1 = m_nameToCanonicalName.begin(), index2 = x.m_nameToCanonicalName.begin(); index1 != m_nameToCanonicalName.end(); ++index1, ++index2) { @@ -610,15 +610,15 @@ CConfig::operator==(const CConfig& x) const } bool -CConfig::operator!=(const CConfig& x) const +Config::operator!=(const Config& x) const { return !operator==(x); } void -CConfig::read(CConfigReadContext& context) +Config::read(ConfigReadContext& context) { - CConfig tmp(m_events); + Config tmp(m_events); while (context.getStream()) { tmp.readSection(context); } @@ -626,7 +626,7 @@ CConfig::read(CConfigReadContext& context) } const char* -CConfig::dirName(EDirection dir) +Config::dirName(EDirection dir) { static const char* s_name[] = { "left", "right", "up", "down" }; @@ -635,14 +635,14 @@ CConfig::dirName(EDirection dir) return s_name[dir - kFirstDirection]; } -CInputFilter* -CConfig::getInputFilter() +InputFilter* +Config::getInputFilter() { return &m_inputFilter; } -CString -CConfig::formatInterval(const CInterval& x) +String +Config::formatInterval(const Interval& x) { if (x.first == 0.0f && x.second == 1.0f) { return ""; @@ -652,7 +652,7 @@ CConfig::formatInterval(const CInterval& x) } void -CConfig::readSection(CConfigReadContext& s) +Config::readSection(ConfigReadContext& s) { static const char s_section[] = "section:"; static const char s_options[] = "options"; @@ -660,7 +660,7 @@ CConfig::readSection(CConfigReadContext& s) static const char s_links[] = "links"; static const char s_aliases[] = "aliases"; - CString line; + String line; if (!s.readLine(line)) { // no more sections return; @@ -672,13 +672,13 @@ CConfig::readSection(CConfigReadContext& s) } // get section name - CString::size_type i = line.find_first_not_of(" \t", sizeof(s_section) - 1); - if (i == CString::npos) { + String::size_type i = line.find_first_not_of(" \t", sizeof(s_section) - 1); + if (i == String::npos) { throw XConfigRead(s, "section name is missing"); } - CString name = line.substr(i); + String name = line.substr(i); i = name.find_first_of(" \t"); - if (i != CString::npos) { + if (i != String::npos) { throw XConfigRead(s, "unexpected data after section name"); } @@ -701,9 +701,9 @@ CConfig::readSection(CConfigReadContext& s) } void -CConfig::readSectionOptions(CConfigReadContext& s) +Config::readSectionOptions(ConfigReadContext& s) { - CString line; + String line; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -714,9 +714,9 @@ CConfig::readSectionOptions(CConfigReadContext& s) // nameAndArgs := [(arg[,...])] // values := valueAndArgs[,valueAndArgs]... // valueAndArgs := [(arg[,...])] - CString::size_type i = 0; - CString name, value; - CConfigReadContext::ArgList nameArgs, valueArgs; + String::size_type i = 0; + String name, value; + ConfigReadContext::ArgList nameArgs, valueArgs; s.parseNameWithArgs("name", line, "=", i, name, nameArgs); ++i; s.parseNameWithArgs("value", line, ",;\n", i, value, valueArgs); @@ -724,12 +724,12 @@ CConfig::readSectionOptions(CConfigReadContext& s) bool handled = true; if (name == "address") { try { - m_synergyAddress = CNetworkAddress(value, kDefaultPort); + m_synergyAddress = NetworkAddress(value, kDefaultPort); m_synergyAddress.resolve(); } catch (XSocketAddress& e) { throw XConfigRead(s, - CString("invalid address argument ") + e.what()); + String("invalid address argument ") + e.what()); } } else if (name == "heartbeat") { @@ -777,7 +777,7 @@ CConfig::readSectionOptions(CConfigReadContext& s) } else { // make filter rule - CInputFilter::CRule rule(parseCondition(s, name, nameArgs)); + InputFilter::Rule rule(parseCondition(s, name, nameArgs)); // save first action (if any) if (!value.empty() || line[i] != ';') { @@ -795,7 +795,7 @@ CConfig::readSectionOptions(CConfigReadContext& s) if (i < line.length() && line[i] == ';') { // allow trailing ';' i = line.find_first_not_of(" \t", i + 1); - if (i == CString::npos) { + if (i == String::npos) { i = line.length(); } else { @@ -819,10 +819,10 @@ CConfig::readSectionOptions(CConfigReadContext& s) } void -CConfig::readSectionScreens(CConfigReadContext& s) +Config::readSectionScreens(ConfigReadContext& s) { - CString line; - CString screen; + String line; + String screen; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -849,21 +849,21 @@ CConfig::readSectionScreens(CConfigReadContext& s) } else { // parse argument: `=' - CString::size_type i = line.find_first_of(" \t="); + String::size_type i = line.find_first_of(" \t="); if (i == 0) { throw XConfigRead(s, "missing argument name"); } - if (i == CString::npos) { + if (i == String::npos) { throw XConfigRead(s, "missing ="); } - CString name = line.substr(0, i); + String name = line.substr(0, i); i = line.find_first_not_of(" \t", i); - if (i == CString::npos || line[i] != '=') { + if (i == String::npos || line[i] != '=') { throw XConfigRead(s, "missing ="); } i = line.find_first_not_of(" \t", i + 1); - CString value; - if (i != CString::npos) { + String value; + if (i != String::npos) { value = line.substr(i); } @@ -930,10 +930,10 @@ CConfig::readSectionScreens(CConfigReadContext& s) } void -CConfig::readSectionLinks(CConfigReadContext& s) +Config::readSectionLinks(ConfigReadContext& s) { - CString line; - CString screen; + String line; + String screen; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -961,14 +961,14 @@ CConfig::readSectionLinks(CConfigReadContext& s) // the stuff in brackets is optional. interval values must be // in the range [0,100] and start < end. if not given the // interval is taken to be (0,100). - CString::size_type i = 0; - CString side, dstScreen, srcArgString, dstArgString; - CConfigReadContext::ArgList srcArgs, dstArgs; + String::size_type i = 0; + String side, dstScreen, srcArgString, dstArgString; + ConfigReadContext::ArgList srcArgs, dstArgs; s.parseNameWithArgs("link", line, "=", i, side, srcArgs); ++i; s.parseNameWithArgs("screen", line, "", i, dstScreen, dstArgs); - CInterval srcInterval(s.parseInterval(srcArgs)); - CInterval dstInterval(s.parseInterval(dstArgs)); + Interval srcInterval(s.parseInterval(srcArgs)); + Interval dstInterval(s.parseInterval(dstArgs)); // handle argument EDirection dir; @@ -1003,10 +1003,10 @@ CConfig::readSectionLinks(CConfigReadContext& s) } void -CConfig::readSectionAliases(CConfigReadContext& s) +Config::readSectionAliases(ConfigReadContext& s) { - CString line; - CString screen; + String line; + String screen; while (s.readLine(line)) { // check for end of section if (line == "end") { @@ -1045,18 +1045,18 @@ CConfig::readSectionAliases(CConfigReadContext& s) } -CInputFilter::CCondition* -CConfig::parseCondition(CConfigReadContext& s, - const CString& name, const std::vector& args) +InputFilter::Condition* +Config::parseCondition(ConfigReadContext& s, + const String& name, const std::vector& args) { if (name == "keystroke") { if (args.size() != 1) { throw XConfigRead(s, "syntax for condition: keystroke(modifiers+key)"); } - IPlatformScreen::CKeyInfo* keyInfo = s.parseKeystroke(args[0]); + IPlatformScreen::KeyInfo* keyInfo = s.parseKeystroke(args[0]); - return new CInputFilter::CKeystrokeCondition(m_events, keyInfo); + return new InputFilter::KeystrokeCondition(m_events, keyInfo); } if (name == "mousebutton") { @@ -1064,9 +1064,9 @@ CConfig::parseCondition(CConfigReadContext& s, throw XConfigRead(s, "syntax for condition: mousebutton(modifiers+button)"); } - IPlatformScreen::CButtonInfo* mouseInfo = s.parseMouse(args[0]); + IPlatformScreen::ButtonInfo* mouseInfo = s.parseMouse(args[0]); - return new CInputFilter::CMouseButtonCondition(m_events, mouseInfo); + return new InputFilter::MouseButtonCondition(m_events, mouseInfo); } if (name == "connect") { @@ -1074,7 +1074,7 @@ CConfig::parseCondition(CConfigReadContext& s, throw XConfigRead(s, "syntax for condition: connect([screen])"); } - CString screen = args[0]; + String screen = args[0]; if (isScreen(screen)) { screen = getCanonicalName(screen); } @@ -1082,47 +1082,47 @@ CConfig::parseCondition(CConfigReadContext& s, throw XConfigRead(s, "unknown screen name \"%{1}\" in connect", screen); } - return new CInputFilter::CScreenConnectedCondition(m_events, screen); + return new InputFilter::ScreenConnectedCondition(m_events, screen); } throw XConfigRead(s, "unknown argument \"%{1}\"", name); } void -CConfig::parseAction(CConfigReadContext& s, - const CString& name, const std::vector& args, - CInputFilter::CRule& rule, bool activate) +Config::parseAction(ConfigReadContext& s, + const String& name, const std::vector& args, + InputFilter::Rule& rule, bool activate) { - CInputFilter::CAction* action; + InputFilter::Action* action; if (name == "keystroke" || name == "keyDown" || name == "keyUp") { if (args.size() < 1 || args.size() > 2) { throw XConfigRead(s, "syntax for action: keystroke(modifiers+key[,screens])"); } - IPlatformScreen::CKeyInfo* keyInfo; + IPlatformScreen::KeyInfo* keyInfo; if (args.size() == 1) { keyInfo = s.parseKeystroke(args[0]); } else { - std::set screens; + std::set screens; parseScreens(s, args[1], screens); keyInfo = s.parseKeystroke(args[0], screens); } if (name == "keystroke") { - IPlatformScreen::CKeyInfo* keyInfo2 = - IKeyState::CKeyInfo::alloc(*keyInfo); - action = new CInputFilter::CKeystrokeAction(m_events, keyInfo2, true); + IPlatformScreen::KeyInfo* keyInfo2 = + IKeyState::KeyInfo::alloc(*keyInfo); + action = new InputFilter::KeystrokeAction(m_events, keyInfo2, true); rule.adoptAction(action, true); - action = new CInputFilter::CKeystrokeAction(m_events, keyInfo, false); + action = new InputFilter::KeystrokeAction(m_events, keyInfo, false); activate = false; } else if (name == "keyDown") { - action = new CInputFilter::CKeystrokeAction(m_events, keyInfo, true); + action = new InputFilter::KeystrokeAction(m_events, keyInfo, true); } else { - action = new CInputFilter::CKeystrokeAction(m_events, keyInfo, false); + action = new InputFilter::KeystrokeAction(m_events, keyInfo, false); } } @@ -1132,21 +1132,21 @@ CConfig::parseAction(CConfigReadContext& s, throw XConfigRead(s, "syntax for action: mousebutton(modifiers+button)"); } - IPlatformScreen::CButtonInfo* mouseInfo = s.parseMouse(args[0]); + IPlatformScreen::ButtonInfo* mouseInfo = s.parseMouse(args[0]); if (name == "mousebutton") { - IPlatformScreen::CButtonInfo* mouseInfo2 = - IPlatformScreen::CButtonInfo::alloc(*mouseInfo); - action = new CInputFilter::CMouseButtonAction(m_events, mouseInfo2, true); + IPlatformScreen::ButtonInfo* mouseInfo2 = + IPlatformScreen::ButtonInfo::alloc(*mouseInfo); + action = new InputFilter::MouseButtonAction(m_events, mouseInfo2, true); rule.adoptAction(action, true); - action = new CInputFilter::CMouseButtonAction(m_events, mouseInfo, false); + action = new InputFilter::MouseButtonAction(m_events, mouseInfo, false); activate = false; } else if (name == "mouseDown") { - action = new CInputFilter::CMouseButtonAction(m_events, mouseInfo, true); + action = new InputFilter::MouseButtonAction(m_events, mouseInfo, true); } else { - action = new CInputFilter::CMouseButtonAction(m_events, mouseInfo, false); + action = new InputFilter::MouseButtonAction(m_events, mouseInfo, false); } } @@ -1158,7 +1158,7 @@ CConfig::parseAction(CConfigReadContext& s, KeyModifierMask mask = s.parseModifier(args[0]); - action = new CInputFilter::CModifierAction(mask, ~mask); + action = new InputFilter::ModifierAction(mask, ~mask); } */ @@ -1167,7 +1167,7 @@ CConfig::parseAction(CConfigReadContext& s, throw XConfigRead(s, "syntax for action: switchToScreen(name)"); } - CString screen = args[0]; + String screen = args[0]; if (isScreen(screen)) { screen = getCanonicalName(screen); } @@ -1175,7 +1175,7 @@ CConfig::parseAction(CConfigReadContext& s, throw XConfigRead(s, "unknown screen name in switchToScreen"); } - action = new CInputFilter::CSwitchToScreenAction(m_events, screen); + action = new InputFilter::SwitchToScreenAction(m_events, screen); } else if (name == "switchInDirection") { @@ -1200,7 +1200,7 @@ CConfig::parseAction(CConfigReadContext& s, throw XConfigRead(s, "unknown direction \"%{1}\" in switchToScreen", args[0]); } - action = new CInputFilter::CSwitchInDirectionAction(m_events, direction); + action = new InputFilter::SwitchInDirectionAction(m_events, direction); } else if (name == "lockCursorToScreen") { @@ -1208,28 +1208,28 @@ CConfig::parseAction(CConfigReadContext& s, throw XConfigRead(s, "syntax for action: lockCursorToScreen([{off|on|toggle}])"); } - CInputFilter::CLockCursorToScreenAction::Mode mode = - CInputFilter::CLockCursorToScreenAction::kToggle; + InputFilter::LockCursorToScreenAction::Mode mode = + InputFilter::LockCursorToScreenAction::kToggle; if (args.size() == 1) { if (args[0] == "off") { - mode = CInputFilter::CLockCursorToScreenAction::kOff; + mode = InputFilter::LockCursorToScreenAction::kOff; } else if (args[0] == "on") { - mode = CInputFilter::CLockCursorToScreenAction::kOn; + mode = InputFilter::LockCursorToScreenAction::kOn; } else if (args[0] == "toggle") { - mode = CInputFilter::CLockCursorToScreenAction::kToggle; + mode = InputFilter::LockCursorToScreenAction::kToggle; } else { throw XConfigRead(s, "syntax for action: lockCursorToScreen([{off|on|toggle}])"); } } - if (mode != CInputFilter::CLockCursorToScreenAction::kOff) { + if (mode != InputFilter::LockCursorToScreenAction::kOff) { m_hasLockToScreenAction = true; } - action = new CInputFilter::CLockCursorToScreenAction(m_events, mode); + action = new InputFilter::LockCursorToScreenAction(m_events, mode); } else if (name == "keyboardBroadcast") { @@ -1237,29 +1237,29 @@ CConfig::parseAction(CConfigReadContext& s, throw XConfigRead(s, "syntax for action: keyboardBroadcast([{off|on|toggle}[,screens]])"); } - CInputFilter::CKeyboardBroadcastAction::Mode mode = - CInputFilter::CKeyboardBroadcastAction::kToggle; + InputFilter::KeyboardBroadcastAction::Mode mode = + InputFilter::KeyboardBroadcastAction::kToggle; if (args.size() >= 1) { if (args[0] == "off") { - mode = CInputFilter::CKeyboardBroadcastAction::kOff; + mode = InputFilter::KeyboardBroadcastAction::kOff; } else if (args[0] == "on") { - mode = CInputFilter::CKeyboardBroadcastAction::kOn; + mode = InputFilter::KeyboardBroadcastAction::kOn; } else if (args[0] == "toggle") { - mode = CInputFilter::CKeyboardBroadcastAction::kToggle; + mode = InputFilter::KeyboardBroadcastAction::kToggle; } else { throw XConfigRead(s, "syntax for action: keyboardBroadcast([{off|on|toggle}[,screens]])"); } } - std::set screens; + std::set screens; if (args.size() >= 2) { parseScreens(s, args[1], screens); } - action = new CInputFilter::CKeyboardBroadcastAction(m_events, mode, screens); + action = new InputFilter::KeyboardBroadcastAction(m_events, mode, screens); } else { @@ -1270,21 +1270,21 @@ CConfig::parseAction(CConfigReadContext& s, } void -CConfig::parseScreens(CConfigReadContext& c, - const CString& s, std::set& screens) const +Config::parseScreens(ConfigReadContext& c, + const String& s, std::set& screens) const { screens.clear(); - CString::size_type i = 0; + String::size_type i = 0; while (i < s.size()) { // find end of next screen name - CString::size_type j = s.find(':', i); - if (j == CString::npos) { + String::size_type j = s.find(':', i); + if (j == String::npos) { j = s.size(); } // extract name - CString rawName; + String rawName; i = s.find_first_not_of(" \t", i); if (i < j) { rawName = s.substr(i, s.find_last_not_of(" \t", j - 1) - i + 1); @@ -1295,7 +1295,7 @@ CConfig::parseScreens(CConfigReadContext& c, screens.insert("*"); } else if (!rawName.empty()) { - CString name = getCanonicalName(rawName); + String name = getCanonicalName(rawName); if (name.empty()) { throw XConfigRead(c, "unknown screen name \"%{1}\"", rawName); } @@ -1308,7 +1308,7 @@ CConfig::parseScreens(CConfigReadContext& c, } const char* -CConfig::getOptionName(OptionID id) +Config::getOptionName(OptionID id) { if (id == kOptionHalfDuplexCapsLock) { return "halfDuplexCapsLock"; @@ -1379,8 +1379,8 @@ CConfig::getOptionName(OptionID id) return NULL; } -CString -CConfig::getOptionValue(OptionID id, OptionValue value) +String +Config::getOptionValue(OptionID id, OptionValue value) { if (id == kOptionHalfDuplexCapsLock || id == kOptionHalfDuplexNumLock || @@ -1452,10 +1452,10 @@ CConfig::getOptionValue(OptionID id, OptionValue value) // -// CConfig::CName +// Config::Name // -CConfig::CName::CName(CConfig* config, const CString& name) : +Config::Name::Name(Config* config, const String& name) : m_config(config), m_name(config->getCanonicalName(name)) { @@ -1463,23 +1463,23 @@ CConfig::CName::CName(CConfig* config, const CString& name) : } bool -CConfig::CName::operator==(const CString& name) const +Config::Name::operator==(const String& name) const { - CString canonical = m_config->getCanonicalName(name); + String canonical = m_config->getCanonicalName(name); return CaselessCmp::equal(canonical, m_name); } // -// CConfig::CCellEdge +// Config::CellEdge // -CConfig::CCellEdge::CCellEdge(EDirection side, float position) +Config::CellEdge::CellEdge(EDirection side, float position) { - init("", side, CInterval(position, position)); + init("", side, Interval(position, position)); } -CConfig::CCellEdge::CCellEdge(EDirection side, const CInterval& interval) +Config::CellEdge::CellEdge(EDirection side, const Interval& interval) { assert(interval.first >= 0.0f); assert(interval.second <= 1.0f); @@ -1488,8 +1488,8 @@ CConfig::CCellEdge::CCellEdge(EDirection side, const CInterval& interval) init("", side, interval); } -CConfig::CCellEdge::CCellEdge(const CString& name, - EDirection side, const CInterval& interval) +Config::CellEdge::CellEdge(const String& name, + EDirection side, const Interval& interval) { assert(interval.first >= 0.0f); assert(interval.second <= 1.0f); @@ -1498,14 +1498,14 @@ CConfig::CCellEdge::CCellEdge(const CString& name, init(name, side, interval); } -CConfig::CCellEdge::~CCellEdge() +Config::CellEdge::~CellEdge() { // do nothing } void -CConfig::CCellEdge::init(const CString& name, EDirection side, - const CInterval& interval) +Config::CellEdge::init(const String& name, EDirection side, + const Interval& interval) { assert(side != kNoDirection); @@ -1514,35 +1514,35 @@ CConfig::CCellEdge::init(const CString& name, EDirection side, m_interval = interval; } -CConfig::CInterval -CConfig::CCellEdge::getInterval() const +Config::Interval +Config::CellEdge::getInterval() const { return m_interval; } void -CConfig::CCellEdge::setName(const CString& newName) +Config::CellEdge::setName(const String& newName) { m_name = newName; } -CString -CConfig::CCellEdge::getName() const +String +Config::CellEdge::getName() const { return m_name; } EDirection -CConfig::CCellEdge::getSide() const +Config::CellEdge::getSide() const { return m_side; } bool -CConfig::CCellEdge::overlaps(const CCellEdge& edge) const +Config::CellEdge::overlaps(const CellEdge& edge) const { - const CInterval& x = m_interval; - const CInterval& y = edge.m_interval; + const Interval& x = m_interval; + const Interval& y = edge.m_interval; if (m_side != edge.m_side) { return false; } @@ -1553,26 +1553,26 @@ CConfig::CCellEdge::overlaps(const CCellEdge& edge) const } bool -CConfig::CCellEdge::isInside(float x) const +Config::CellEdge::isInside(float x) const { return (x >= m_interval.first && x < m_interval.second); } float -CConfig::CCellEdge::transform(float x) const +Config::CellEdge::transform(float x) const { return (x - m_interval.first) / (m_interval.second - m_interval.first); } float -CConfig::CCellEdge::inverseTransform(float x) const +Config::CellEdge::inverseTransform(float x) const { return x * (m_interval.second - m_interval.first) + m_interval.first; } bool -CConfig::CCellEdge::operator<(const CCellEdge& o) const +Config::CellEdge::operator<(const CellEdge& o) const { if (static_cast(m_side) < static_cast(o.m_side)) { return true; @@ -1585,24 +1585,24 @@ CConfig::CCellEdge::operator<(const CCellEdge& o) const } bool -CConfig::CCellEdge::operator==(const CCellEdge& x) const +Config::CellEdge::operator==(const CellEdge& x) const { return (m_side == x.m_side && m_interval == x.m_interval); } bool -CConfig::CCellEdge::operator!=(const CCellEdge& x) const +Config::CellEdge::operator!=(const CellEdge& x) const { return !operator==(x); } // -// CConfig::CCell +// Config::Cell // bool -CConfig::CCell::add(const CCellEdge& src, const CCellEdge& dst) +Config::Cell::add(const CellEdge& src, const CellEdge& dst) { // cannot add an edge that overlaps other existing edges but we // can exactly replace an edge. @@ -1616,9 +1616,9 @@ CConfig::CCell::add(const CCellEdge& src, const CCellEdge& dst) } void -CConfig::CCell::remove(EDirection side) +Config::Cell::remove(EDirection side) { - for (CEdgeLinks::iterator j = m_neighbors.begin(); + for (EdgeLinks::iterator j = m_neighbors.begin(); j != m_neighbors.end(); ) { if (j->first.getSide() == side) { m_neighbors.erase(j++); @@ -1630,9 +1630,9 @@ CConfig::CCell::remove(EDirection side) } void -CConfig::CCell::remove(EDirection side, float position) +Config::Cell::remove(EDirection side, float position) { - for (CEdgeLinks::iterator j = m_neighbors.begin(); + for (EdgeLinks::iterator j = m_neighbors.begin(); j != m_neighbors.end(); ++j) { if (j->first.getSide() == side && j->first.isInside(position)) { m_neighbors.erase(j); @@ -1641,9 +1641,9 @@ CConfig::CCell::remove(EDirection side, float position) } } void -CConfig::CCell::remove(const CName& name) +Config::Cell::remove(const Name& name) { - for (CEdgeLinks::iterator j = m_neighbors.begin(); + for (EdgeLinks::iterator j = m_neighbors.begin(); j != m_neighbors.end(); ) { if (name == j->second.getName()) { m_neighbors.erase(j++); @@ -1655,9 +1655,9 @@ CConfig::CCell::remove(const CName& name) } void -CConfig::CCell::rename(const CName& oldName, const CString& newName) +Config::Cell::rename(const Name& oldName, const String& newName) { - for (CEdgeLinks::iterator j = m_neighbors.begin(); + for (EdgeLinks::iterator j = m_neighbors.begin(); j != m_neighbors.end(); ++j) { if (oldName == j->second.getName()) { j->second.setName(newName); @@ -1666,16 +1666,16 @@ CConfig::CCell::rename(const CName& oldName, const CString& newName) } bool -CConfig::CCell::hasEdge(const CCellEdge& edge) const +Config::Cell::hasEdge(const CellEdge& edge) const { - CEdgeLinks::const_iterator i = m_neighbors.find(edge); + EdgeLinks::const_iterator i = m_neighbors.find(edge); return (i != m_neighbors.end() && i->first == edge); } bool -CConfig::CCell::overlaps(const CCellEdge& edge) const +Config::Cell::overlaps(const CellEdge& edge) const { - CEdgeLinks::const_iterator i = m_neighbors.upper_bound(edge); + EdgeLinks::const_iterator i = m_neighbors.upper_bound(edge); if (i != m_neighbors.end() && i->first.overlaps(edge)) { return true; } @@ -1686,11 +1686,11 @@ CConfig::CCell::overlaps(const CCellEdge& edge) const } bool -CConfig::CCell::getLink(EDirection side, float position, - const CCellEdge*& src, const CCellEdge*& dst) const +Config::Cell::getLink(EDirection side, float position, + const CellEdge*& src, const CellEdge*& dst) const { - CCellEdge edge(side, position); - CEdgeLinks::const_iterator i = m_neighbors.upper_bound(edge); + CellEdge edge(side, position); + EdgeLinks::const_iterator i = m_neighbors.upper_bound(edge); if (i == m_neighbors.begin()) { return false; } @@ -1704,7 +1704,7 @@ CConfig::CCell::getLink(EDirection side, float position, } bool -CConfig::CCell::operator==(const CCell& x) const +Config::Cell::operator==(const Cell& x) const { // compare options if (m_options != x.m_options) { @@ -1715,7 +1715,7 @@ CConfig::CCell::operator==(const CCell& x) const if (m_neighbors.size() != x.m_neighbors.size()) { return false; } - for (CEdgeLinks::const_iterator index1 = m_neighbors.begin(), + for (EdgeLinks::const_iterator index1 = m_neighbors.begin(), index2 = x.m_neighbors.begin(); index1 != m_neighbors.end(); ++index1, ++index2) { @@ -1737,51 +1737,51 @@ CConfig::CCell::operator==(const CCell& x) const } bool -CConfig::CCell::operator!=(const CCell& x) const +Config::Cell::operator!=(const Cell& x) const { return !operator==(x); } -CConfig::CCell::const_iterator -CConfig::CCell::begin() const +Config::Cell::const_iterator +Config::Cell::begin() const { return m_neighbors.begin(); } -CConfig::CCell::const_iterator -CConfig::CCell::end() const +Config::Cell::const_iterator +Config::Cell::end() const { return m_neighbors.end(); } // -// CConfig I/O +// Config I/O // std::istream& -operator>>(std::istream& s, CConfig& config) +operator>>(std::istream& s, Config& config) { - CConfigReadContext context(s); + ConfigReadContext context(s); config.read(context); return s; } std::ostream& -operator<<(std::ostream& s, const CConfig& config) +operator<<(std::ostream& s, const Config& config) { // screens section s << "section: screens" << std::endl; - for (CConfig::const_iterator screen = config.begin(); + for (Config::const_iterator screen = config.begin(); screen != config.end(); ++screen) { s << "\t" << screen->c_str() << ":" << std::endl; - const CConfig::CScreenOptions* options = config.getOptions(*screen); + const Config::ScreenOptions* options = config.getOptions(*screen); if (options != NULL && options->size() > 0) { - for (CConfig::CScreenOptions::const_iterator + for (Config::ScreenOptions::const_iterator option = options->begin(); option != options->end(); ++option) { - const char* name = CConfig::getOptionName(option->first); - CString value = CConfig::getOptionValue(option->first, + const char* name = Config::getOptionName(option->first); + String value = Config::getOptionValue(option->first, option->second); if (name != NULL && !value.empty()) { s << "\t\t" << name << " = " << value << std::endl; @@ -1792,19 +1792,19 @@ operator<<(std::ostream& s, const CConfig& config) s << "end" << std::endl; // links section - CString neighbor; + String neighbor; s << "section: links" << std::endl; - for (CConfig::const_iterator screen = config.begin(); + for (Config::const_iterator screen = config.begin(); screen != config.end(); ++screen) { s << "\t" << screen->c_str() << ":" << std::endl; - for (CConfig::link_const_iterator + for (Config::link_const_iterator link = config.beginNeighbor(*screen), nend = config.endNeighbor(*screen); link != nend; ++link) { - s << "\t\t" << CConfig::dirName(link->first.getSide()) << - CConfig::formatInterval(link->first.getInterval()) << + s << "\t\t" << Config::dirName(link->first.getSide()) << + Config::formatInterval(link->first.getInterval()) << " = " << link->second.getName().c_str() << - CConfig::formatInterval(link->second.getInterval()) << + Config::formatInterval(link->second.getInterval()) << std::endl; } } @@ -1813,10 +1813,10 @@ operator<<(std::ostream& s, const CConfig& config) // aliases section (if there are any) if (config.m_map.size() != config.m_nameToCanonicalName.size()) { // map canonical to alias - typedef std::multimap CMNameMap; CMNameMap aliases; - for (CConfig::CNameMap::const_iterator + for (Config::NameMap::const_iterator index = config.m_nameToCanonicalName.begin(); index != config.m_nameToCanonicalName.end(); ++index) { @@ -1826,7 +1826,7 @@ operator<<(std::ostream& s, const CConfig& config) } // dump it - CString screen; + String screen; s << "section: aliases" << std::endl; for (CMNameMap::const_iterator index = aliases.begin(); index != aliases.end(); ++index) { @@ -1841,13 +1841,13 @@ operator<<(std::ostream& s, const CConfig& config) // options section s << "section: options" << std::endl; - const CConfig::CScreenOptions* options = config.getOptions(""); + const Config::ScreenOptions* options = config.getOptions(""); if (options != NULL && options->size() > 0) { - for (CConfig::CScreenOptions::const_iterator + for (Config::ScreenOptions::const_iterator option = options->begin(); option != options->end(); ++option) { - const char* name = CConfig::getOptionName(option->first); - CString value = CConfig::getOptionValue(option->first, + const char* name = Config::getOptionName(option->first); + String value = Config::getOptionValue(option->first, option->second); if (name != NULL && !value.empty()) { s << "\t" << name << " = " << value << std::endl; @@ -1866,39 +1866,39 @@ operator<<(std::ostream& s, const CConfig& config) // -// CConfigReadContext +// ConfigReadContext // -CConfigReadContext::CConfigReadContext(std::istream& s, SInt32 firstLine) : +ConfigReadContext::ConfigReadContext(std::istream& s, SInt32 firstLine) : m_stream(s), m_line(firstLine - 1) { // do nothing } -CConfigReadContext::~CConfigReadContext() +ConfigReadContext::~ConfigReadContext() { // do nothing } bool -CConfigReadContext::readLine(CString& line) +ConfigReadContext::readLine(String& line) { ++m_line; while (std::getline(m_stream, line)) { // strip leading whitespace - CString::size_type i = line.find_first_not_of(" \t"); - if (i != CString::npos) { + String::size_type i = line.find_first_not_of(" \t"); + if (i != String::npos) { line.erase(0, i); } // strip comments and then trailing whitespace i = line.find('#'); - if (i != CString::npos) { + if (i != String::npos) { line.erase(i); } i = line.find_last_not_of(" \r\t"); - if (i != CString::npos) { + if (i != String::npos) { line.erase(i + 1); } @@ -1923,19 +1923,19 @@ CConfigReadContext::readLine(CString& line) } UInt32 -CConfigReadContext::getLineNumber() const +ConfigReadContext::getLineNumber() const { return m_line; } bool -CConfigReadContext::operator!() const +ConfigReadContext::operator!() const { return !m_stream; } OptionValue -CConfigReadContext::parseBoolean(const CString& arg) const +ConfigReadContext::parseBoolean(const String& arg) const { if (CaselessCmp::equal(arg, "true")) { return static_cast(true); @@ -1947,7 +1947,7 @@ CConfigReadContext::parseBoolean(const CString& arg) const } OptionValue -CConfigReadContext::parseInt(const CString& arg) const +ConfigReadContext::parseInt(const String& arg) const { const char* s = arg.c_str(); char* end; @@ -1965,7 +1965,7 @@ CConfigReadContext::parseInt(const CString& arg) const } OptionValue -CConfigReadContext::parseModifierKey(const CString& arg) const +ConfigReadContext::parseModifierKey(const String& arg) const { if (CaselessCmp::equal(arg, "shift")) { return static_cast(kKeyModifierIDShift); @@ -1992,7 +1992,7 @@ CConfigReadContext::parseModifierKey(const CString& arg) const } OptionValue -CConfigReadContext::parseCorner(const CString& arg) const +ConfigReadContext::parseCorner(const String& arg) const { if (CaselessCmp::equal(arg, "left")) { return kTopLeftMask | kBottomLeftMask; @@ -2028,21 +2028,21 @@ CConfigReadContext::parseCorner(const CString& arg) const } OptionValue -CConfigReadContext::parseCorners(const CString& args) const +ConfigReadContext::parseCorners(const String& args) const { // find first token - CString::size_type i = args.find_first_not_of(" \t", 0); - if (i == CString::npos) { + String::size_type i = args.find_first_not_of(" \t", 0); + if (i == String::npos) { throw XConfigRead(*this, "missing corner argument"); } - CString::size_type j = args.find_first_of(" \t", i); + String::size_type j = args.find_first_of(" \t", i); // parse first corner token OptionValue corners = parseCorner(args.substr(i, j - i)); // get +/- i = args.find_first_not_of(" \t", j); - while (i != CString::npos) { + while (i != String::npos) { // parse +/- bool add; if (args[i] == '-') { @@ -2054,13 +2054,13 @@ CConfigReadContext::parseCorners(const CString& args) const else { throw XConfigRead(*this, "invalid corner operator \"%{1}\"", - CString(args.c_str() + i, 1)); + String(args.c_str() + i, 1)); } // get next corner token i = args.find_first_not_of(" \t", i + 1); j = args.find_first_of(" \t", i); - if (i == CString::npos) { + if (i == String::npos) { throw XConfigRead(*this, "missing corner argument"); } @@ -2077,11 +2077,11 @@ CConfigReadContext::parseCorners(const CString& args) const return corners; } -CConfig::CInterval -CConfigReadContext::parseInterval(const ArgList& args) const +Config::Interval +ConfigReadContext::parseInterval(const ArgList& args) const { if (args.size() == 0) { - return CConfig::CInterval(0.0f, 1.0f); + return Config::Interval(0.0f, 1.0f); } if (args.size() != 2 || args[0].empty() || args[1].empty()) { throw XConfigRead(*this, "invalid interval \"%{1}\"", concatArgs(args)); @@ -2103,24 +2103,24 @@ CConfigReadContext::parseInterval(const ArgList& args) const throw XConfigRead(*this, "invalid interval \"%{1}\"", concatArgs(args)); } - return CConfig::CInterval(startValue / 100.0f, endValue / 100.0f); + return Config::Interval(startValue / 100.0f, endValue / 100.0f); } void -CConfigReadContext::parseNameWithArgs( - const CString& type, const CString& line, - const CString& delim, CString::size_type& index, - CString& name, ArgList& args) const +ConfigReadContext::parseNameWithArgs( + const String& type, const String& line, + const String& delim, String::size_type& index, + String& name, ArgList& args) const { // skip leading whitespace - CString::size_type i = line.find_first_not_of(" \t", index); - if (i == CString::npos) { - throw XConfigRead(*this, CString("missing ") + type); + String::size_type i = line.find_first_not_of(" \t", index); + if (i == String::npos) { + throw XConfigRead(*this, String("missing ") + type); } // find end of name - CString::size_type j = line.find_first_of(" \t(" + delim, i); - if (j == CString::npos) { + String::size_type j = line.find_first_of(" \t(" + delim, i); + if (j == String::npos) { j = line.length(); } @@ -2129,15 +2129,15 @@ CConfigReadContext::parseNameWithArgs( args.clear(); // is it okay to not find a delimiter? - bool needDelim = (!delim.empty() && delim.find('\n') == CString::npos); + bool needDelim = (!delim.empty() && delim.find('\n') == String::npos); // skip whitespace i = line.find_first_not_of(" \t", j); - if (i == CString::npos && needDelim) { + if (i == String::npos && needDelim) { // expected delimiter but didn't find it - throw XConfigRead(*this, CString("missing ") + delim[0]); + throw XConfigRead(*this, String("missing ") + delim[0]); } - if (i == CString::npos) { + if (i == String::npos) { // no arguments index = line.length(); return; @@ -2153,18 +2153,18 @@ CConfigReadContext::parseNameWithArgs( // parse arguments j = line.find_first_of(",)", i); - while (j != CString::npos) { + while (j != String::npos) { // extract arg - CString arg(line.substr(i, j - i)); + String arg(line.substr(i, j - i)); i = j; // trim whitespace j = arg.find_first_not_of(" \t"); - if (j != CString::npos) { + if (j != String::npos) { arg.erase(0, j); } j = arg.find_last_not_of(" \t"); - if (j != CString::npos) { + if (j != String::npos) { arg.erase(j + 1); } @@ -2184,7 +2184,7 @@ CConfigReadContext::parseNameWithArgs( } // verify ')' - if (j == CString::npos) { + if (j == String::npos) { // expected ) throw XConfigRead(*this, "missing )"); } @@ -2194,17 +2194,17 @@ CConfigReadContext::parseNameWithArgs( // skip whitespace j = line.find_first_not_of(" \t", i); - if (j == CString::npos && needDelim) { + if (j == String::npos && needDelim) { // expected delimiter but didn't find it - throw XConfigRead(*this, CString("missing ") + delim[0]); + throw XConfigRead(*this, String("missing ") + delim[0]); } // verify delimiter - if (needDelim && delim.find(line[j]) == CString::npos) { - throw XConfigRead(*this, CString("expected ") + delim[0]); + if (needDelim && delim.find(line[j]) == String::npos) { + throw XConfigRead(*this, String("expected ") + delim[0]); } - if (j == CString::npos) { + if (j == String::npos) { j = line.length(); } @@ -2212,25 +2212,25 @@ CConfigReadContext::parseNameWithArgs( return; } -IPlatformScreen::CKeyInfo* -CConfigReadContext::parseKeystroke(const CString& keystroke) const +IPlatformScreen::KeyInfo* +ConfigReadContext::parseKeystroke(const String& keystroke) const { - return parseKeystroke(keystroke, std::set()); + return parseKeystroke(keystroke, std::set()); } -IPlatformScreen::CKeyInfo* -CConfigReadContext::parseKeystroke(const CString& keystroke, - const std::set& screens) const +IPlatformScreen::KeyInfo* +ConfigReadContext::parseKeystroke(const String& keystroke, + const std::set& screens) const { - CString s = keystroke; + String s = keystroke; KeyModifierMask mask; - if (!CKeyMap::parseModifiers(s, mask)) { + if (!synergy::KeyMap::parseModifiers(s, mask)) { throw XConfigRead(*this, "unable to parse key modifiers"); } KeyID key; - if (!CKeyMap::parseKey(s, key)) { + if (!synergy::KeyMap::parseKey(s, key)) { throw XConfigRead(*this, "unable to parse key"); } @@ -2238,16 +2238,16 @@ CConfigReadContext::parseKeystroke(const CString& keystroke, throw XConfigRead(*this, "missing key and/or modifiers in keystroke"); } - return IPlatformScreen::CKeyInfo::alloc(key, mask, 0, 0, screens); + return IPlatformScreen::KeyInfo::alloc(key, mask, 0, 0, screens); } -IPlatformScreen::CButtonInfo* -CConfigReadContext::parseMouse(const CString& mouse) const +IPlatformScreen::ButtonInfo* +ConfigReadContext::parseMouse(const String& mouse) const { - CString s = mouse; + String s = mouse; KeyModifierMask mask; - if (!CKeyMap::parseModifiers(s, mask)) { + if (!synergy::KeyMap::parseModifiers(s, mask)) { throw XConfigRead(*this, "unable to parse button modifiers"); } @@ -2260,16 +2260,16 @@ CConfigReadContext::parseMouse(const CString& mouse) const throw XConfigRead(*this, "invalid button"); } - return IPlatformScreen::CButtonInfo::alloc(button, mask); + return IPlatformScreen::ButtonInfo::alloc(button, mask); } KeyModifierMask -CConfigReadContext::parseModifier(const CString& modifiers) const +ConfigReadContext::parseModifier(const String& modifiers) const { - CString s = modifiers; + String s = modifiers; KeyModifierMask mask; - if (!CKeyMap::parseModifiers(s, mask)) { + if (!synergy::KeyMap::parseModifiers(s, mask)) { throw XConfigRead(*this, "unable to parse modifiers"); } @@ -2280,10 +2280,10 @@ CConfigReadContext::parseModifier(const CString& modifiers) const return mask; } -CString -CConfigReadContext::concatArgs(const ArgList& args) +String +ConfigReadContext::concatArgs(const ArgList& args) { - CString s("("); + String s("("); for (size_t i = 0; i < args.size(); ++i) { if (i != 0) { s += ","; @@ -2296,19 +2296,19 @@ CConfigReadContext::concatArgs(const ArgList& args) // -// CConfig I/O exceptions +// Config I/O exceptions // -XConfigRead::XConfigRead(const CConfigReadContext& context, - const CString& error) : +XConfigRead::XConfigRead(const ConfigReadContext& context, + const String& error) : m_error(synergy::string::sprintf("line %d: %s", context.getLineNumber(), error.c_str())) { // do nothing } -XConfigRead::XConfigRead(const CConfigReadContext& context, - const char* errorFmt, const CString& arg) : +XConfigRead::XConfigRead(const ConfigReadContext& context, + const char* errorFmt, const String& arg) : m_error(synergy::string::sprintf("line %d: ", context.getLineNumber()) + synergy::string::format(errorFmt, arg.c_str())) { @@ -2320,7 +2320,7 @@ XConfigRead::~XConfigRead() _NOEXCEPT // do nothing } -CString +String XConfigRead::getWhat() const throw() { return format("XConfigRead", "read error: %{1}", m_error.c_str()); diff --git a/src/lib/server/Config.h b/src/lib/server/Config.h index 24cba524..60dfa663 100644 --- a/src/lib/server/Config.h +++ b/src/lib/server/Config.h @@ -30,18 +30,18 @@ #include -class CConfig; -class CConfigReadContext; +class Config; +class ConfigReadContext; class IEventQueue; namespace std { template <> -struct iterator_traits { - typedef CString value_type; +struct iterator_traits { + typedef String value_type; typedef ptrdiff_t difference_type; typedef bidirectional_iterator_tag iterator_category; - typedef CString* pointer; - typedef CString& reference; + typedef String* pointer; + typedef String& reference; }; }; @@ -55,23 +55,23 @@ Note that case is preserved in screen names but is ignored when comparing names. Screen names and their aliases share a namespace and must be unique. */ -class CConfig { +class Config { public: - typedef std::map CScreenOptions; - typedef std::pair CInterval; + typedef std::map ScreenOptions; + typedef std::pair Interval; - class CCellEdge { + class CellEdge { public: - CCellEdge(EDirection side, float position); - CCellEdge(EDirection side, const CInterval&); - CCellEdge(const CString& name, EDirection side, const CInterval&); - ~CCellEdge(); + CellEdge(EDirection side, float position); + CellEdge(EDirection side, const Interval&); + CellEdge(const String& name, EDirection side, const Interval&); + ~CellEdge(); - CInterval getInterval() const; - void setName(const CString& newName); - CString getName() const; + Interval getInterval() const; + void setName(const String& newName); + String getName() const; EDirection getSide() const; - bool overlaps(const CCellEdge&) const; + bool overlaps(const CellEdge&) const; bool isInside(float x) const; // transform position to [0,1] @@ -81,73 +81,73 @@ public: float inverseTransform(float x) const; // compares side and start of interval - bool operator<(const CCellEdge&) const; + bool operator<(const CellEdge&) const; // compares side and interval - bool operator==(const CCellEdge&) const; - bool operator!=(const CCellEdge&) const; + bool operator==(const CellEdge&) const; + bool operator!=(const CellEdge&) const; private: - void init(const CString& name, EDirection side, - const CInterval&); + void init(const String& name, EDirection side, + const Interval&); private: - CString m_name; + String m_name; EDirection m_side; - CInterval m_interval; + Interval m_interval; }; private: - class CName { + class Name { public: - CName(CConfig*, const CString& name); + Name(Config*, const String& name); - bool operator==(const CString& name) const; + bool operator==(const String& name) const; private: - CConfig* m_config; - CString m_name; + Config* m_config; + String m_name; }; - class CCell { + class Cell { private: - typedef std::map CEdgeLinks; + typedef std::map EdgeLinks; public: - typedef CEdgeLinks::const_iterator const_iterator; + typedef EdgeLinks::const_iterator const_iterator; - bool add(const CCellEdge& src, const CCellEdge& dst); + bool add(const CellEdge& src, const CellEdge& dst); void remove(EDirection side); void remove(EDirection side, float position); - void remove(const CName& destinationName); - void rename(const CName& oldName, const CString& newName); + void remove(const Name& destinationName); + void rename(const Name& oldName, const String& newName); - bool hasEdge(const CCellEdge&) const; - bool overlaps(const CCellEdge&) const; + bool hasEdge(const CellEdge&) const; + bool overlaps(const CellEdge&) const; bool getLink(EDirection side, float position, - const CCellEdge*& src, const CCellEdge*& dst) const; + const CellEdge*& src, const CellEdge*& dst) const; - bool operator==(const CCell&) const; - bool operator!=(const CCell&) const; + bool operator==(const Cell&) const; + bool operator!=(const Cell&) const; const_iterator begin() const; const_iterator end() const; private: - CEdgeLinks m_neighbors; + EdgeLinks m_neighbors; public: - CScreenOptions m_options; + ScreenOptions m_options; }; - typedef std::map CCellMap; - typedef std::map CNameMap; + typedef std::map CellMap; + typedef std::map NameMap; public: - typedef CCell::const_iterator link_const_iterator; - typedef CCellMap::const_iterator internal_const_iterator; - typedef CNameMap::const_iterator all_const_iterator; - class const_iterator : std::iterator_traits { + typedef Cell::const_iterator link_const_iterator; + typedef CellMap::const_iterator internal_const_iterator; + typedef NameMap::const_iterator all_const_iterator; + class const_iterator : std::iterator_traits { public: explicit const_iterator() : m_i() { } explicit const_iterator(const internal_const_iterator& i) : m_i(i) { } @@ -156,8 +156,8 @@ public: m_i = i.m_i; return *this; } - CString operator*() { return m_i->first; } - const CString* operator->() { return &(m_i->first); } + String operator*() { return m_i->first; } + const String* operator->() { return &(m_i->first); } const_iterator& operator++() { ++m_i; return *this; } const_iterator operator++(int) { return const_iterator(m_i++); } const_iterator& operator--() { --m_i; return *this; } @@ -173,11 +173,11 @@ public: internal_const_iterator m_i; }; - CConfig(IEventQueue* events); - virtual ~CConfig(); + Config(IEventQueue* events); + virtual ~Config(); #ifdef TEST_ENV - CConfig() : m_inputFilter(NULL) { } + Config() : m_inputFilter(NULL) { } #endif //! @name manipulators @@ -188,15 +188,15 @@ public: Adds a screen, returning true iff successful. If a screen or alias with the given name exists then it fails. */ - bool addScreen(const CString& name); + bool addScreen(const String& name); //! Rename screen /*! Renames a screen. All references to the name are updated. Returns true iff successful. */ - bool renameScreen(const CString& oldName, - const CString& newName); + bool renameScreen(const String& oldName, + const String& newName); //! Remove screen /*! @@ -204,7 +204,7 @@ public: disconnects any connections to the screen. \c name may be an alias. */ - void removeScreen(const CString& name); + void removeScreen(const String& name); //! Remove all screens /*! @@ -219,22 +219,22 @@ public: Returns false if the alias name already exists or the canonical name is unknown, otherwise returns true. */ - bool addAlias(const CString& canonical, - const CString& alias); + bool addAlias(const String& canonical, + const String& alias); //! Remove alias /*! Removes an alias for a screen name. It returns false if the alias is unknown or a canonical name, otherwise returns true. */ - bool removeAlias(const CString& alias); + bool removeAlias(const String& alias); //! Remove aliases /*! Removes all aliases for a canonical screen name. It returns false if the canonical name is unknown, otherwise returns true. */ - bool removeAliases(const CString& canonical); + bool removeAliases(const String& canonical); //! Remove all aliases /*! @@ -258,10 +258,10 @@ public: and all of \c srcStart, \c srcEnd, \c dstStart, or \c dstEnd must be inside the range [0,1]. */ - bool connect(const CString& srcName, + bool connect(const String& srcName, EDirection srcSide, float srcStart, float srcEnd, - const CString& dstName, + const String& dstName, float dstStart, float dstEnd); //! Disconnect screens @@ -269,7 +269,7 @@ public: Removes all connections created by connect() on side \c srcSide. Returns false if \c srcName is unknown. */ - bool disconnect(const CString& srcName, + bool disconnect(const String& srcName, EDirection srcSide); //! Disconnect screens @@ -278,7 +278,7 @@ public: covering position \c position. Returns false if \c srcName is unknown. */ - bool disconnect(const CString& srcName, + bool disconnect(const String& srcName, EDirection srcSide, float position); //! Set server address @@ -286,7 +286,7 @@ public: Set the synergy listen addresses. There is no default address so this must be called to run a server using this configuration. */ - void setSynergyAddress(const CNetworkAddress&); + void setSynergyAddress(const NetworkAddress&); //! Add a screen option /*! @@ -294,7 +294,7 @@ public: existing option's value if there is one. Returns true iff \c name is a known screen. */ - bool addOption(const CString& name, + bool addOption(const String& name, OptionID option, OptionValue value); //! Remove a screen option @@ -303,21 +303,21 @@ public: nothing if the option doesn't exist on the screen. Returns true iff \c name is a known screen. */ - bool removeOption(const CString& name, OptionID option); + bool removeOption(const String& name, OptionID option); //! Remove a screen options /*! Removes all options and values from the named screen. Returns true iff \c name is a known screen. */ - bool removeOptions(const CString& name); + bool removeOptions(const String& name); //! Get the hot key input filter /*! Returns the hot key input filter. Clients can modify hotkeys using that object. */ - virtual CInputFilter* + virtual InputFilter* getInputFilter(); //@} @@ -328,7 +328,7 @@ public: /*! Returns true iff \c name is a valid screen name. */ - bool isValidScreenName(const CString& name) const; + bool isValidScreenName(const String& name) const; //! Get beginning (canonical) screen name iterator const_iterator begin() const; @@ -344,20 +344,20 @@ public: /*! Returns true iff \c name names a screen. */ - virtual bool isScreen(const CString& name) const; + virtual bool isScreen(const String& name) const; //! Test for canonical screen name /*! Returns true iff \c name is the canonical name of a screen. */ - bool isCanonicalName(const CString& name) const; + bool isCanonicalName(const String& name) const; //! Get canonical name /*! Returns the canonical name of a screen or the empty string if the name is unknown. Returns the canonical name if one is given. */ - CString getCanonicalName(const CString& name) const; + String getCanonicalName(const String& name) const; //! Get neighbor /*! @@ -367,7 +367,7 @@ public: saves the position on the neighbor in \c positionOut if it's not \c NULL. */ - CString getNeighbor(const CString&, EDirection, + String getNeighbor(const String&, EDirection, float position, float* positionOut) const; //! Check for neighbor @@ -375,23 +375,23 @@ public: Returns \c true if the screen has a neighbor anywhere along the edge given by the direction. */ - bool hasNeighbor(const CString&, EDirection) const; + bool hasNeighbor(const String&, EDirection) const; //! Check for neighbor /*! Returns \c true if the screen has a neighbor in the given range along the edge given by the direction. */ - bool hasNeighbor(const CString&, EDirection, + bool hasNeighbor(const String&, EDirection, float start, float end) const; //! Get beginning neighbor iterator - link_const_iterator beginNeighbor(const CString&) const; + link_const_iterator beginNeighbor(const String&) const; //! Get ending neighbor iterator - link_const_iterator endNeighbor(const CString&) const; + link_const_iterator endNeighbor(const String&) const; //! Get the server address - const CNetworkAddress& getSynergyAddress() const; + const NetworkAddress& getSynergyAddress() const; //! Get the screen options /*! @@ -399,7 +399,7 @@ public: if the screen is unknown and an empty collection if there are no options. */ - const CScreenOptions* getOptions(const CString& name) const; + const ScreenOptions* getOptions(const String& name) const; //! Check for lock to screen action /*! @@ -409,28 +409,28 @@ public: bool hasLockToScreenAction() const; //! Compare configurations - bool operator==(const CConfig&) const; + bool operator==(const Config&) const; //! Compare configurations - bool operator!=(const CConfig&) const; + bool operator!=(const Config&) const; //! Read configuration /*! Reads a configuration from a context. Throws XConfigRead on error and context is unchanged. */ - void read(CConfigReadContext& context); + void read(ConfigReadContext& context); //! Read configuration /*! Reads a configuration from a stream. Throws XConfigRead on error. */ - friend std::istream& operator>>(std::istream&, CConfig&); + friend std::istream& operator>>(std::istream&, Config&); //! Write configuration /*! Writes a configuration to a stream. */ - friend std::ostream& operator<<(std::ostream&, const CConfig&); + friend std::ostream& operator<<(std::ostream&, const Config&); //! Get direction name /*! @@ -442,37 +442,37 @@ public: /*! Returns an interval as a parseable string. */ - static CString formatInterval(const CInterval&); + static String formatInterval(const Interval&); //@} private: - void readSection(CConfigReadContext&); - void readSectionOptions(CConfigReadContext&); - void readSectionScreens(CConfigReadContext&); - void readSectionLinks(CConfigReadContext&); - void readSectionAliases(CConfigReadContext&); + void readSection(ConfigReadContext&); + void readSectionOptions(ConfigReadContext&); + void readSectionScreens(ConfigReadContext&); + void readSectionLinks(ConfigReadContext&); + void readSectionAliases(ConfigReadContext&); - CInputFilter::CCondition* - parseCondition(CConfigReadContext&, - const CString& condition, - const std::vector& args); - void parseAction(CConfigReadContext&, - const CString& action, - const std::vector& args, - CInputFilter::CRule&, bool activate); + InputFilter::Condition* + parseCondition(ConfigReadContext&, + const String& condition, + const std::vector& args); + void parseAction(ConfigReadContext&, + const String& action, + const std::vector& args, + InputFilter::Rule&, bool activate); - void parseScreens(CConfigReadContext&, const CString&, - std::set& screens) const; + void parseScreens(ConfigReadContext&, const String&, + std::set& screens) const; static const char* getOptionName(OptionID); - static CString getOptionValue(OptionID, OptionValue); + static String getOptionValue(OptionID, OptionValue); private: - CCellMap m_map; - CNameMap m_nameToCanonicalName; - CNetworkAddress m_synergyAddress; - CScreenOptions m_globalOptions; - CInputFilter m_inputFilter; + CellMap m_map; + NameMap m_nameToCanonicalName; + NetworkAddress m_synergyAddress; + ScreenOptions m_globalOptions; + InputFilter m_inputFilter; bool m_hasLockToScreenAction; IEventQueue* m_events; }; @@ -481,44 +481,44 @@ private: /*! Maintains a context when reading a configuration from a stream. */ -class CConfigReadContext { +class ConfigReadContext { public: - typedef std::vector ArgList; + typedef std::vector ArgList; - CConfigReadContext(std::istream&, SInt32 firstLine = 1); - ~CConfigReadContext(); + ConfigReadContext(std::istream&, SInt32 firstLine = 1); + ~ConfigReadContext(); - bool readLine(CString&); + bool readLine(String&); UInt32 getLineNumber() const; bool operator!() const; - OptionValue parseBoolean(const CString&) const; - OptionValue parseInt(const CString&) const; - OptionValue parseModifierKey(const CString&) const; - OptionValue parseCorner(const CString&) const; - OptionValue parseCorners(const CString&) const; - CConfig::CInterval + OptionValue parseBoolean(const String&) const; + OptionValue parseInt(const String&) const; + OptionValue parseModifierKey(const String&) const; + OptionValue parseCorner(const String&) const; + OptionValue parseCorners(const String&) const; + Config::Interval parseInterval(const ArgList& args) const; void parseNameWithArgs( - const CString& type, const CString& line, - const CString& delim, CString::size_type& index, - CString& name, ArgList& args) const; - IPlatformScreen::CKeyInfo* - parseKeystroke(const CString& keystroke) const; - IPlatformScreen::CKeyInfo* - parseKeystroke(const CString& keystroke, - const std::set& screens) const; - IPlatformScreen::CButtonInfo* - parseMouse(const CString& mouse) const; - KeyModifierMask parseModifier(const CString& modifiers) const; + const String& type, const String& line, + const String& delim, String::size_type& index, + String& name, ArgList& args) const; + IPlatformScreen::KeyInfo* + parseKeystroke(const String& keystroke) const; + IPlatformScreen::KeyInfo* + parseKeystroke(const String& keystroke, + const std::set& screens) const; + IPlatformScreen::ButtonInfo* + parseMouse(const String& mouse) const; + KeyModifierMask parseModifier(const String& modifiers) const; std::istream& getStream() const { return m_stream; }; private: // not implemented - CConfigReadContext& operator=(const CConfigReadContext&); + ConfigReadContext& operator=(const ConfigReadContext&); - static CString concatArgs(const ArgList& args); + static String concatArgs(const ArgList& args); private: std::istream& m_stream; @@ -531,15 +531,15 @@ Thrown when a configuration stream cannot be parsed. */ class XConfigRead : public XBase { public: - XConfigRead(const CConfigReadContext& context, const CString&); - XConfigRead(const CConfigReadContext& context, - const char* errorFmt, const CString& arg); + XConfigRead(const ConfigReadContext& context, const String&); + XConfigRead(const ConfigReadContext& context, + const char* errorFmt, const String& arg); virtual ~XConfigRead() _NOEXCEPT; protected: // XBase overrides - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: - CString m_error; + String m_error; }; diff --git a/src/lib/server/InputFilter.cpp b/src/lib/server/InputFilter.cpp index 8b37a12c..2b1d96fc 100644 --- a/src/lib/server/InputFilter.cpp +++ b/src/lib/server/InputFilter.cpp @@ -30,30 +30,30 @@ // ----------------------------------------------------------------------------- // Input Filter Condition Classes // ----------------------------------------------------------------------------- -CInputFilter::CCondition::CCondition() +InputFilter::Condition::Condition() { // do nothing } -CInputFilter::CCondition::~CCondition() +InputFilter::Condition::~Condition() { // do nothing } void -CInputFilter::CCondition::enablePrimary(CPrimaryClient*) +InputFilter::Condition::enablePrimary(PrimaryClient*) { // do nothing } void -CInputFilter::CCondition::disablePrimary(CPrimaryClient*) +InputFilter::Condition::disablePrimary(PrimaryClient*) { // do nothing } -CInputFilter::CKeystrokeCondition::CKeystrokeCondition( - IEventQueue* events, IPlatformScreen::CKeyInfo* info) : +InputFilter::KeystrokeCondition::KeystrokeCondition( + IEventQueue* events, IPlatformScreen::KeyInfo* info) : m_id(0), m_key(info->m_key), m_mask(info->m_mask), @@ -62,7 +62,7 @@ CInputFilter::CKeystrokeCondition::CKeystrokeCondition( free(info); } -CInputFilter::CKeystrokeCondition::CKeystrokeCondition( +InputFilter::KeystrokeCondition::KeystrokeCondition( IEventQueue* events, KeyID key, KeyModifierMask mask) : m_id(0), m_key(key), @@ -72,43 +72,43 @@ CInputFilter::CKeystrokeCondition::CKeystrokeCondition( // do nothing } -CInputFilter::CKeystrokeCondition::~CKeystrokeCondition() +InputFilter::KeystrokeCondition::~KeystrokeCondition() { // do nothing } KeyID -CInputFilter::CKeystrokeCondition::getKey() const +InputFilter::KeystrokeCondition::getKey() const { return m_key; } KeyModifierMask -CInputFilter::CKeystrokeCondition::getMask() const +InputFilter::KeystrokeCondition::getMask() const { return m_mask; } -CInputFilter::CCondition* -CInputFilter::CKeystrokeCondition::clone() const +InputFilter::Condition* +InputFilter::KeystrokeCondition::clone() const { - return new CKeystrokeCondition(m_events, m_key, m_mask); + return new KeystrokeCondition(m_events, m_key, m_mask); } -CString -CInputFilter::CKeystrokeCondition::format() const +String +InputFilter::KeystrokeCondition::format() const { return synergy::string::sprintf("keystroke(%s)", - CKeyMap::formatKey(m_key, m_mask).c_str()); + synergy::KeyMap::formatKey(m_key, m_mask).c_str()); } -CInputFilter::EFilterStatus -CInputFilter::CKeystrokeCondition::match(const CEvent& event) +InputFilter::EFilterStatus +InputFilter::KeystrokeCondition::match(const Event& event) { EFilterStatus status; // check for hotkey events - CEvent::Type type = event.getType(); + Event::Type type = event.getType(); if (type == m_events->forIPrimaryScreen().hotKeyDown()) { status = kActivate; } @@ -120,8 +120,8 @@ CInputFilter::CKeystrokeCondition::match(const CEvent& event) } // check if it's our hotkey - IPrimaryScreen::CHotKeyInfo* kinfo = - reinterpret_cast(event.getData()); + IPrimaryScreen::HotKeyInfo* kinfo = + reinterpret_cast(event.getData()); if (kinfo->m_id != m_id) { return kNoMatch; } @@ -130,20 +130,20 @@ CInputFilter::CKeystrokeCondition::match(const CEvent& event) } void -CInputFilter::CKeystrokeCondition::enablePrimary(CPrimaryClient* primary) +InputFilter::KeystrokeCondition::enablePrimary(PrimaryClient* primary) { m_id = primary->registerHotKey(m_key, m_mask); } void -CInputFilter::CKeystrokeCondition::disablePrimary(CPrimaryClient* primary) +InputFilter::KeystrokeCondition::disablePrimary(PrimaryClient* primary) { primary->unregisterHotKey(m_id); m_id = 0; } -CInputFilter::CMouseButtonCondition::CMouseButtonCondition( - IEventQueue* events, IPlatformScreen::CButtonInfo* info) : +InputFilter::MouseButtonCondition::MouseButtonCondition( + IEventQueue* events, IPlatformScreen::ButtonInfo* info) : m_button(info->m_button), m_mask(info->m_mask), m_events(events) @@ -151,7 +151,7 @@ CInputFilter::CMouseButtonCondition::CMouseButtonCondition( free(info); } -CInputFilter::CMouseButtonCondition::CMouseButtonCondition( +InputFilter::MouseButtonCondition::MouseButtonCondition( IEventQueue* events, ButtonID button, KeyModifierMask mask) : m_button(button), m_mask(mask), @@ -160,41 +160,41 @@ CInputFilter::CMouseButtonCondition::CMouseButtonCondition( // do nothing } -CInputFilter::CMouseButtonCondition::~CMouseButtonCondition() +InputFilter::MouseButtonCondition::~MouseButtonCondition() { // do nothing } ButtonID -CInputFilter::CMouseButtonCondition::getButton() const +InputFilter::MouseButtonCondition::getButton() const { return m_button; } KeyModifierMask -CInputFilter::CMouseButtonCondition::getMask() const +InputFilter::MouseButtonCondition::getMask() const { return m_mask; } -CInputFilter::CCondition* -CInputFilter::CMouseButtonCondition::clone() const +InputFilter::Condition* +InputFilter::MouseButtonCondition::clone() const { - return new CMouseButtonCondition(m_events, m_button, m_mask); + return new MouseButtonCondition(m_events, m_button, m_mask); } -CString -CInputFilter::CMouseButtonCondition::format() const +String +InputFilter::MouseButtonCondition::format() const { - CString key = CKeyMap::formatKey(kKeyNone, m_mask); + String key = synergy::KeyMap::formatKey(kKeyNone, m_mask); if (!key.empty()) { key += "+"; } return synergy::string::sprintf("mousebutton(%s%d)", key.c_str(), m_button); } -CInputFilter::EFilterStatus -CInputFilter::CMouseButtonCondition::match(const CEvent& event) +InputFilter::EFilterStatus +InputFilter::MouseButtonCondition::match(const Event& event) { static const KeyModifierMask s_ignoreMask = KeyModifierAltGr | KeyModifierCapsLock | @@ -203,7 +203,7 @@ CInputFilter::CMouseButtonCondition::match(const CEvent& event) EFilterStatus status; // check for hotkey events - CEvent::Type type = event.getType(); + Event::Type type = event.getType(); if (type == m_events->forIPrimaryScreen().buttonDown()) { status = kActivate; } @@ -216,8 +216,8 @@ CInputFilter::CMouseButtonCondition::match(const CEvent& event) // check if it's the right button and modifiers. ignore modifiers // that cannot be combined with a mouse button. - IPlatformScreen::CButtonInfo* minfo = - reinterpret_cast(event.getData()); + IPlatformScreen::ButtonInfo* minfo = + reinterpret_cast(event.getData()); if (minfo->m_button != m_button || (minfo->m_mask & ~s_ignoreMask) != m_mask) { return kNoMatch; @@ -226,37 +226,37 @@ CInputFilter::CMouseButtonCondition::match(const CEvent& event) return status; } -CInputFilter::CScreenConnectedCondition::CScreenConnectedCondition( - IEventQueue* events, const CString& screen) : +InputFilter::ScreenConnectedCondition::ScreenConnectedCondition( + IEventQueue* events, const String& screen) : m_screen(screen), m_events(events) { // do nothing } -CInputFilter::CScreenConnectedCondition::~CScreenConnectedCondition() +InputFilter::ScreenConnectedCondition::~ScreenConnectedCondition() { // do nothing } -CInputFilter::CCondition* -CInputFilter::CScreenConnectedCondition::clone() const +InputFilter::Condition* +InputFilter::ScreenConnectedCondition::clone() const { - return new CScreenConnectedCondition(m_events, m_screen); + return new ScreenConnectedCondition(m_events, m_screen); } -CString -CInputFilter::CScreenConnectedCondition::format() const +String +InputFilter::ScreenConnectedCondition::format() const { return synergy::string::sprintf("connect(%s)", m_screen.c_str()); } -CInputFilter::EFilterStatus -CInputFilter::CScreenConnectedCondition::match(const CEvent& event) +InputFilter::EFilterStatus +InputFilter::ScreenConnectedCondition::match(const Event& event) { - if (event.getType() == m_events->forCServer().connected()) { - CServer::CScreenConnectedInfo* info = - reinterpret_cast(event.getData()); + if (event.getType() == m_events->forServer().connected()) { + Server::ScreenConnectedInfo* info = + reinterpret_cast(event.getData()); if (m_screen == info->m_screen || m_screen.empty()) { return kActivate; } @@ -268,17 +268,17 @@ CInputFilter::CScreenConnectedCondition::match(const CEvent& event) // ----------------------------------------------------------------------------- // Input Filter Action Classes // ----------------------------------------------------------------------------- -CInputFilter::CAction::CAction() +InputFilter::Action::Action() { // do nothing } -CInputFilter::CAction::~CAction() +InputFilter::Action::~Action() { // do nothing } -CInputFilter::CLockCursorToScreenAction::CLockCursorToScreenAction( +InputFilter::LockCursorToScreenAction::LockCursorToScreenAction( IEventQueue* events, Mode mode) : m_mode(mode), m_events(events) @@ -286,20 +286,20 @@ CInputFilter::CLockCursorToScreenAction::CLockCursorToScreenAction( // do nothing } -CInputFilter::CLockCursorToScreenAction::Mode -CInputFilter::CLockCursorToScreenAction::getMode() const +InputFilter::LockCursorToScreenAction::Mode +InputFilter::LockCursorToScreenAction::getMode() const { return m_mode; } -CInputFilter::CAction* -CInputFilter::CLockCursorToScreenAction::clone() const +InputFilter::Action* +InputFilter::LockCursorToScreenAction::clone() const { - return new CLockCursorToScreenAction(*this); + return new LockCursorToScreenAction(*this); } -CString -CInputFilter::CLockCursorToScreenAction::format() const +String +InputFilter::LockCursorToScreenAction::format() const { static const char* s_mode[] = { "off", "on", "toggle" }; @@ -307,69 +307,69 @@ CInputFilter::CLockCursorToScreenAction::format() const } void -CInputFilter::CLockCursorToScreenAction::perform(const CEvent& event) +InputFilter::LockCursorToScreenAction::perform(const Event& event) { - static const CServer::CLockCursorToScreenInfo::State s_state[] = { - CServer::CLockCursorToScreenInfo::kOff, - CServer::CLockCursorToScreenInfo::kOn, - CServer::CLockCursorToScreenInfo::kToggle + static const Server::LockCursorToScreenInfo::State s_state[] = { + Server::LockCursorToScreenInfo::kOff, + Server::LockCursorToScreenInfo::kOn, + Server::LockCursorToScreenInfo::kToggle }; // send event - CServer::CLockCursorToScreenInfo* info = - CServer::CLockCursorToScreenInfo::alloc(s_state[m_mode]); - m_events->addEvent(CEvent(m_events->forCServer().lockCursorToScreen(), + Server::LockCursorToScreenInfo* info = + Server::LockCursorToScreenInfo::alloc(s_state[m_mode]); + m_events->addEvent(Event(m_events->forServer().lockCursorToScreen(), event.getTarget(), info, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); } -CInputFilter::CSwitchToScreenAction::CSwitchToScreenAction( - IEventQueue* events, const CString& screen) : +InputFilter::SwitchToScreenAction::SwitchToScreenAction( + IEventQueue* events, const String& screen) : m_screen(screen), m_events(events) { // do nothing } -CString -CInputFilter::CSwitchToScreenAction::getScreen() const +String +InputFilter::SwitchToScreenAction::getScreen() const { return m_screen; } -CInputFilter::CAction* -CInputFilter::CSwitchToScreenAction::clone() const +InputFilter::Action* +InputFilter::SwitchToScreenAction::clone() const { - return new CSwitchToScreenAction(*this); + return new SwitchToScreenAction(*this); } -CString -CInputFilter::CSwitchToScreenAction::format() const +String +InputFilter::SwitchToScreenAction::format() const { return synergy::string::sprintf("switchToScreen(%s)", m_screen.c_str()); } void -CInputFilter::CSwitchToScreenAction::perform(const CEvent& event) +InputFilter::SwitchToScreenAction::perform(const Event& event) { // pick screen name. if m_screen is empty then use the screen from // event if it has one. - CString screen = m_screen; - if (screen.empty() && event.getType() == m_events->forCServer().connected()) { - CServer::CScreenConnectedInfo* info = - reinterpret_cast(event.getData()); + String screen = m_screen; + if (screen.empty() && event.getType() == m_events->forServer().connected()) { + Server::ScreenConnectedInfo* info = + reinterpret_cast(event.getData()); screen = info->m_screen; } // send event - CServer::CSwitchToScreenInfo* info = - CServer::CSwitchToScreenInfo::alloc(screen); - m_events->addEvent(CEvent(m_events->forCServer().switchToScreen(), + Server::SwitchToScreenInfo* info = + Server::SwitchToScreenInfo::alloc(screen); + m_events->addEvent(Event(m_events->forServer().switchToScreen(), event.getTarget(), info, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); } -CInputFilter::CSwitchInDirectionAction::CSwitchInDirectionAction( +InputFilter::SwitchInDirectionAction::SwitchInDirectionAction( IEventQueue* events, EDirection direction) : m_direction(direction), m_events(events) @@ -378,19 +378,19 @@ CInputFilter::CSwitchInDirectionAction::CSwitchInDirectionAction( } EDirection -CInputFilter::CSwitchInDirectionAction::getDirection() const +InputFilter::SwitchInDirectionAction::getDirection() const { return m_direction; } -CInputFilter::CAction* -CInputFilter::CSwitchInDirectionAction::clone() const +InputFilter::Action* +InputFilter::SwitchInDirectionAction::clone() const { - return new CSwitchInDirectionAction(*this); + return new SwitchInDirectionAction(*this); } -CString -CInputFilter::CSwitchInDirectionAction::format() const +String +InputFilter::SwitchInDirectionAction::format() const { static const char* s_names[] = { "", @@ -404,16 +404,16 @@ CInputFilter::CSwitchInDirectionAction::format() const } void -CInputFilter::CSwitchInDirectionAction::perform(const CEvent& event) +InputFilter::SwitchInDirectionAction::perform(const Event& event) { - CServer::CSwitchInDirectionInfo* info = - CServer::CSwitchInDirectionInfo::alloc(m_direction); - m_events->addEvent(CEvent(m_events->forCServer().switchInDirection(), + Server::SwitchInDirectionInfo* info = + Server::SwitchInDirectionInfo::alloc(m_direction); + m_events->addEvent(Event(m_events->forServer().switchInDirection(), event.getTarget(), info, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); } -CInputFilter::CKeyboardBroadcastAction::CKeyboardBroadcastAction( +InputFilter::KeyboardBroadcastAction::KeyboardBroadcastAction( IEventQueue* events, Mode mode) : m_mode(mode), m_events(events) @@ -421,39 +421,39 @@ CInputFilter::CKeyboardBroadcastAction::CKeyboardBroadcastAction( // do nothing } -CInputFilter::CKeyboardBroadcastAction::CKeyboardBroadcastAction( +InputFilter::KeyboardBroadcastAction::KeyboardBroadcastAction( IEventQueue* events, Mode mode, - const std::set& screens) : + const std::set& screens) : m_mode(mode), - m_screens(IKeyState::CKeyInfo::join(screens)), + m_screens(IKeyState::KeyInfo::join(screens)), m_events(events) { // do nothing } -CInputFilter::CKeyboardBroadcastAction::Mode -CInputFilter::CKeyboardBroadcastAction::getMode() const +InputFilter::KeyboardBroadcastAction::Mode +InputFilter::KeyboardBroadcastAction::getMode() const { return m_mode; } -std::set -CInputFilter::CKeyboardBroadcastAction::getScreens() const +std::set +InputFilter::KeyboardBroadcastAction::getScreens() const { - std::set screens; - IKeyState::CKeyInfo::split(m_screens.c_str(), screens); + std::set screens; + IKeyState::KeyInfo::split(m_screens.c_str(), screens); return screens; } -CInputFilter::CAction* -CInputFilter::CKeyboardBroadcastAction::clone() const +InputFilter::Action* +InputFilter::KeyboardBroadcastAction::clone() const { - return new CKeyboardBroadcastAction(*this); + return new KeyboardBroadcastAction(*this); } -CString -CInputFilter::CKeyboardBroadcastAction::format() const +String +InputFilter::KeyboardBroadcastAction::format() const { static const char* s_mode[] = { "off", "on", "toggle" }; static const char* s_name = "keyboardBroadcast"; @@ -469,24 +469,24 @@ CInputFilter::CKeyboardBroadcastAction::format() const } void -CInputFilter::CKeyboardBroadcastAction::perform(const CEvent& event) +InputFilter::KeyboardBroadcastAction::perform(const Event& event) { - static const CServer::CKeyboardBroadcastInfo::State s_state[] = { - CServer::CKeyboardBroadcastInfo::kOff, - CServer::CKeyboardBroadcastInfo::kOn, - CServer::CKeyboardBroadcastInfo::kToggle + static const Server::KeyboardBroadcastInfo::State s_state[] = { + Server::KeyboardBroadcastInfo::kOff, + Server::KeyboardBroadcastInfo::kOn, + Server::KeyboardBroadcastInfo::kToggle }; // send event - CServer::CKeyboardBroadcastInfo* info = - CServer::CKeyboardBroadcastInfo::alloc(s_state[m_mode], m_screens); - m_events->addEvent(CEvent(m_events->forCServer().keyboardBroadcast(), + Server::KeyboardBroadcastInfo* info = + Server::KeyboardBroadcastInfo::alloc(s_state[m_mode], m_screens); + m_events->addEvent(Event(m_events->forServer().keyboardBroadcast(), event.getTarget(), info, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); } -CInputFilter::CKeystrokeAction::CKeystrokeAction( - IEventQueue* events, IPlatformScreen::CKeyInfo* info, bool press) : +InputFilter::KeystrokeAction::KeystrokeAction( + IEventQueue* events, IPlatformScreen::KeyInfo* info, bool press) : m_keyInfo(info), m_press(press), m_events(events) @@ -494,55 +494,55 @@ CInputFilter::CKeystrokeAction::CKeystrokeAction( // do nothing } -CInputFilter::CKeystrokeAction::~CKeystrokeAction() +InputFilter::KeystrokeAction::~KeystrokeAction() { free(m_keyInfo); } void -CInputFilter::CKeystrokeAction::adoptInfo(IPlatformScreen::CKeyInfo* info) +InputFilter::KeystrokeAction::adoptInfo(IPlatformScreen::KeyInfo* info) { free(m_keyInfo); m_keyInfo = info; } -const IPlatformScreen::CKeyInfo* -CInputFilter::CKeystrokeAction::getInfo() const +const IPlatformScreen::KeyInfo* +InputFilter::KeystrokeAction::getInfo() const { return m_keyInfo; } bool -CInputFilter::CKeystrokeAction::isOnPress() const +InputFilter::KeystrokeAction::isOnPress() const { return m_press; } -CInputFilter::CAction* -CInputFilter::CKeystrokeAction::clone() const +InputFilter::Action* +InputFilter::KeystrokeAction::clone() const { - IKeyState::CKeyInfo* info = IKeyState::CKeyInfo::alloc(*m_keyInfo); - return new CKeystrokeAction(m_events, info, m_press); + IKeyState::KeyInfo* info = IKeyState::KeyInfo::alloc(*m_keyInfo); + return new KeystrokeAction(m_events, info, m_press); } -CString -CInputFilter::CKeystrokeAction::format() const +String +InputFilter::KeystrokeAction::format() const { const char* type = formatName(); if (m_keyInfo->m_screens[0] == '\0') { return synergy::string::sprintf("%s(%s)", type, - CKeyMap::formatKey(m_keyInfo->m_key, + synergy::KeyMap::formatKey(m_keyInfo->m_key, m_keyInfo->m_mask).c_str()); } else if (m_keyInfo->m_screens[0] == '*') { return synergy::string::sprintf("%s(%s,*)", type, - CKeyMap::formatKey(m_keyInfo->m_key, + synergy::KeyMap::formatKey(m_keyInfo->m_key, m_keyInfo->m_mask).c_str()); } else { return synergy::string::sprintf("%s(%s,%.*s)", type, - CKeyMap::formatKey(m_keyInfo->m_key, + synergy::KeyMap::formatKey(m_keyInfo->m_key, m_keyInfo->m_mask).c_str(), strlen(m_keyInfo->m_screens + 1) - 1, m_keyInfo->m_screens + 1); @@ -550,31 +550,31 @@ CInputFilter::CKeystrokeAction::format() const } void -CInputFilter::CKeystrokeAction::perform(const CEvent& event) +InputFilter::KeystrokeAction::perform(const Event& event) { - CEvent::Type type = m_press ? + Event::Type type = m_press ? m_events->forIKeyState().keyDown() : m_events->forIKeyState().keyUp(); - m_events->addEvent(CEvent(m_events->forIPrimaryScreen().fakeInputBegin(), + m_events->addEvent(Event(m_events->forIPrimaryScreen().fakeInputBegin(), event.getTarget(), NULL, - CEvent::kDeliverImmediately)); - m_events->addEvent(CEvent(type, event.getTarget(), m_keyInfo, - CEvent::kDeliverImmediately | - CEvent::kDontFreeData)); - m_events->addEvent(CEvent(m_events->forIPrimaryScreen().fakeInputEnd(), + Event::kDeliverImmediately)); + m_events->addEvent(Event(type, event.getTarget(), m_keyInfo, + Event::kDeliverImmediately | + Event::kDontFreeData)); + m_events->addEvent(Event(m_events->forIPrimaryScreen().fakeInputEnd(), event.getTarget(), NULL, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); } const char* -CInputFilter::CKeystrokeAction::formatName() const +InputFilter::KeystrokeAction::formatName() const { return (m_press ? "keyDown" : "keyUp"); } -CInputFilter::CMouseButtonAction::CMouseButtonAction( - IEventQueue* events, IPlatformScreen::CButtonInfo* info, bool press) : +InputFilter::MouseButtonAction::MouseButtonAction( + IEventQueue* events, IPlatformScreen::ButtonInfo* info, bool press) : m_buttonInfo(info), m_press(press), m_events(events) @@ -582,100 +582,100 @@ CInputFilter::CMouseButtonAction::CMouseButtonAction( // do nothing } -CInputFilter::CMouseButtonAction::~CMouseButtonAction() +InputFilter::MouseButtonAction::~MouseButtonAction() { free(m_buttonInfo); } -const IPlatformScreen::CButtonInfo* -CInputFilter::CMouseButtonAction::getInfo() const +const IPlatformScreen::ButtonInfo* +InputFilter::MouseButtonAction::getInfo() const { return m_buttonInfo; } bool -CInputFilter::CMouseButtonAction::isOnPress() const +InputFilter::MouseButtonAction::isOnPress() const { return m_press; } -CInputFilter::CAction* -CInputFilter::CMouseButtonAction::clone() const +InputFilter::Action* +InputFilter::MouseButtonAction::clone() const { - IPlatformScreen::CButtonInfo* info = - IPrimaryScreen::CButtonInfo::alloc(*m_buttonInfo); - return new CMouseButtonAction(m_events, info, m_press); + IPlatformScreen::ButtonInfo* info = + IPrimaryScreen::ButtonInfo::alloc(*m_buttonInfo); + return new MouseButtonAction(m_events, info, m_press); } -CString -CInputFilter::CMouseButtonAction::format() const +String +InputFilter::MouseButtonAction::format() const { const char* type = formatName(); - CString key = CKeyMap::formatKey(kKeyNone, m_buttonInfo->m_mask); + String key = synergy::KeyMap::formatKey(kKeyNone, m_buttonInfo->m_mask); return synergy::string::sprintf("%s(%s%s%d)", type, key.c_str(), key.empty() ? "" : "+", m_buttonInfo->m_button); } void -CInputFilter::CMouseButtonAction::perform(const CEvent& event) +InputFilter::MouseButtonAction::perform(const Event& event) { // send modifiers - IPlatformScreen::CKeyInfo* modifierInfo = NULL; + IPlatformScreen::KeyInfo* modifierInfo = NULL; if (m_buttonInfo->m_mask != 0) { KeyID key = m_press ? kKeySetModifiers : kKeyClearModifiers; modifierInfo = - IKeyState::CKeyInfo::alloc(key, m_buttonInfo->m_mask, 0, 1); - m_events->addEvent(CEvent(m_events->forIKeyState().keyDown(), + IKeyState::KeyInfo::alloc(key, m_buttonInfo->m_mask, 0, 1); + m_events->addEvent(Event(m_events->forIKeyState().keyDown(), event.getTarget(), modifierInfo, - CEvent::kDeliverImmediately)); + Event::kDeliverImmediately)); } // send button - CEvent::Type type = m_press ? m_events->forIPrimaryScreen().buttonDown() : + Event::Type type = m_press ? m_events->forIPrimaryScreen().buttonDown() : m_events->forIPrimaryScreen().buttonUp(); - m_events->addEvent(CEvent(type, event.getTarget(), m_buttonInfo, - CEvent::kDeliverImmediately | - CEvent::kDontFreeData)); + m_events->addEvent(Event(type, event.getTarget(), m_buttonInfo, + Event::kDeliverImmediately | + Event::kDontFreeData)); } const char* -CInputFilter::CMouseButtonAction::formatName() const +InputFilter::MouseButtonAction::formatName() const { return (m_press ? "mouseDown" : "mouseUp"); } // -// CInputFilter::CRule +// InputFilter::Rule // -CInputFilter::CRule::CRule() : +InputFilter::Rule::Rule() : m_condition(NULL) { // do nothing } -CInputFilter::CRule::CRule(CCondition* adoptedCondition) : +InputFilter::Rule::Rule(Condition* adoptedCondition) : m_condition(adoptedCondition) { // do nothing } -CInputFilter::CRule::CRule(const CRule& rule) : +InputFilter::Rule::Rule(const Rule& rule) : m_condition(NULL) { copy(rule); } -CInputFilter::CRule::~CRule() +InputFilter::Rule::~Rule() { clear(); } -CInputFilter::CRule& -CInputFilter::CRule::operator=(const CRule& rule) +InputFilter::Rule& +InputFilter::Rule::operator=(const Rule& rule) { if (&rule != this) { copy(rule); @@ -684,14 +684,14 @@ CInputFilter::CRule::operator=(const CRule& rule) } void -CInputFilter::CRule::clear() +InputFilter::Rule::clear() { delete m_condition; - for (CActionList::iterator i = m_activateActions.begin(); + for (ActionList::iterator i = m_activateActions.begin(); i != m_activateActions.end(); ++i) { delete *i; } - for (CActionList::iterator i = m_deactivateActions.begin(); + for (ActionList::iterator i = m_deactivateActions.begin(); i != m_deactivateActions.end(); ++i) { delete *i; } @@ -702,31 +702,31 @@ CInputFilter::CRule::clear() } void -CInputFilter::CRule::copy(const CRule& rule) +InputFilter::Rule::copy(const Rule& rule) { clear(); if (rule.m_condition != NULL) { m_condition = rule.m_condition->clone(); } - for (CActionList::const_iterator i = rule.m_activateActions.begin(); + for (ActionList::const_iterator i = rule.m_activateActions.begin(); i != rule.m_activateActions.end(); ++i) { m_activateActions.push_back((*i)->clone()); } - for (CActionList::const_iterator i = rule.m_deactivateActions.begin(); + for (ActionList::const_iterator i = rule.m_deactivateActions.begin(); i != rule.m_deactivateActions.end(); ++i) { m_deactivateActions.push_back((*i)->clone()); } } void -CInputFilter::CRule::setCondition(CCondition* adopted) +InputFilter::Rule::setCondition(Condition* adopted) { delete m_condition; m_condition = adopted; } void -CInputFilter::CRule::adoptAction(CAction* action, bool onActivation) +InputFilter::Rule::adoptAction(Action* action, bool onActivation) { if (action != NULL) { if (onActivation) { @@ -739,7 +739,7 @@ CInputFilter::CRule::adoptAction(CAction* action, bool onActivation) } void -CInputFilter::CRule::removeAction(bool onActivation, UInt32 index) +InputFilter::Rule::removeAction(bool onActivation, UInt32 index) { if (onActivation) { delete m_activateActions[index]; @@ -752,7 +752,7 @@ CInputFilter::CRule::removeAction(bool onActivation, UInt32 index) } void -CInputFilter::CRule::replaceAction(CAction* adopted, +InputFilter::Rule::replaceAction(Action* adopted, bool onActivation, UInt32 index) { if (adopted == NULL) { @@ -769,7 +769,7 @@ CInputFilter::CRule::replaceAction(CAction* adopted, } void -CInputFilter::CRule::enable(CPrimaryClient* primaryClient) +InputFilter::Rule::enable(PrimaryClient* primaryClient) { if (m_condition != NULL) { m_condition->enablePrimary(primaryClient); @@ -777,7 +777,7 @@ CInputFilter::CRule::enable(CPrimaryClient* primaryClient) } void -CInputFilter::CRule::disable(CPrimaryClient* primaryClient) +InputFilter::Rule::disable(PrimaryClient* primaryClient) { if (m_condition != NULL) { m_condition->disablePrimary(primaryClient); @@ -785,7 +785,7 @@ CInputFilter::CRule::disable(CPrimaryClient* primaryClient) } bool -CInputFilter::CRule::handleEvent(const CEvent& event) +InputFilter::Rule::handleEvent(const Event& event) { // NULL condition never matches if (m_condition == NULL) { @@ -793,7 +793,7 @@ CInputFilter::CRule::handleEvent(const CEvent& event) } // match - const CActionList* actions; + const ActionList* actions; switch (m_condition->match(event)) { default: // not handled @@ -811,7 +811,7 @@ CInputFilter::CRule::handleEvent(const CEvent& event) } // perform actions - for (CActionList::const_iterator i = actions->begin(); + for (ActionList::const_iterator i = actions->begin(); i != actions->end(); ++i) { LOG((CLOG_DEBUG1 "hotkey: %s", (*i)->format().c_str())); (*i)->perform(event); @@ -820,17 +820,17 @@ CInputFilter::CRule::handleEvent(const CEvent& event) return true; } -CString -CInputFilter::CRule::format() const +String +InputFilter::Rule::format() const { - CString s; + String s; if (m_condition != NULL) { // condition s += m_condition->format(); s += " = "; // activate actions - CActionList::const_iterator i = m_activateActions.begin(); + ActionList::const_iterator i = m_activateActions.begin(); if (i != m_activateActions.end()) { s += (*i)->format(); while (++i != m_activateActions.end()) { @@ -855,14 +855,14 @@ CInputFilter::CRule::format() const return s; } -const CInputFilter::CCondition* -CInputFilter::CRule::getCondition() const +const InputFilter::Condition* +InputFilter::Rule::getCondition() const { return m_condition; } UInt32 -CInputFilter::CRule::getNumActions(bool onActivation) const +InputFilter::Rule::getNumActions(bool onActivation) const { if (onActivation) { return static_cast(m_activateActions.size()); @@ -872,8 +872,8 @@ CInputFilter::CRule::getNumActions(bool onActivation) const } } -const CInputFilter::CAction& -CInputFilter::CRule::getAction(bool onActivation, UInt32 index) const +const InputFilter::Action& +InputFilter::Rule::getAction(bool onActivation, UInt32 index) const { if (onActivation) { return *m_activateActions[index]; @@ -887,14 +887,14 @@ CInputFilter::CRule::getAction(bool onActivation, UInt32 index) const // ----------------------------------------------------------------------------- // Input Filter Class // ----------------------------------------------------------------------------- -CInputFilter::CInputFilter(IEventQueue* events) : +InputFilter::InputFilter(IEventQueue* events) : m_primaryClient(NULL), m_events(events) { // do nothing } -CInputFilter::CInputFilter(const CInputFilter& x) : +InputFilter::InputFilter(const InputFilter& x) : m_ruleList(x.m_ruleList), m_primaryClient(NULL), m_events(x.m_events) @@ -902,16 +902,16 @@ CInputFilter::CInputFilter(const CInputFilter& x) : setPrimaryClient(x.m_primaryClient); } -CInputFilter::~CInputFilter() +InputFilter::~InputFilter() { setPrimaryClient(NULL); } -CInputFilter& -CInputFilter::operator=(const CInputFilter& x) +InputFilter& +InputFilter::operator=(const InputFilter& x) { if (&x != this) { - CPrimaryClient* oldClient = m_primaryClient; + PrimaryClient* oldClient = m_primaryClient; setPrimaryClient(NULL); m_ruleList = x.m_ruleList; @@ -922,7 +922,7 @@ CInputFilter::operator=(const CInputFilter& x) } void -CInputFilter::addFilterRule(const CRule& rule) +InputFilter::addFilterRule(const Rule& rule) { m_ruleList.push_back(rule); if (m_primaryClient != NULL) { @@ -931,7 +931,7 @@ CInputFilter::addFilterRule(const CRule& rule) } void -CInputFilter::removeFilterRule(UInt32 index) +InputFilter::removeFilterRule(UInt32 index) { if (m_primaryClient != NULL) { m_ruleList[index].disable(m_primaryClient); @@ -939,21 +939,21 @@ CInputFilter::removeFilterRule(UInt32 index) m_ruleList.erase(m_ruleList.begin() + index); } -CInputFilter::CRule& -CInputFilter::getRule(UInt32 index) +InputFilter::Rule& +InputFilter::getRule(UInt32 index) { return m_ruleList[index]; } void -CInputFilter::setPrimaryClient(CPrimaryClient* client) +InputFilter::setPrimaryClient(PrimaryClient* client) { if (m_primaryClient == client) { return; } if (m_primaryClient != NULL) { - for (CRuleList::iterator rule = m_ruleList.begin(); + for (RuleList::iterator rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) { rule->disable(m_primaryClient); } @@ -972,7 +972,7 @@ CInputFilter::setPrimaryClient(CPrimaryClient* client) m_primaryClient->getEventTarget()); m_events->removeHandler(m_events->forIPrimaryScreen().hotKeyUp(), m_primaryClient->getEventTarget()); - m_events->removeHandler(m_events->forCServer().connected(), + m_events->removeHandler(m_events->forServer().connected(), m_primaryClient->getEventTarget()); } @@ -981,49 +981,49 @@ CInputFilter::setPrimaryClient(CPrimaryClient* client) if (m_primaryClient != NULL) { m_events->adoptHandler(m_events->forIKeyState().keyDown(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); m_events->adoptHandler(m_events->forIKeyState().keyUp(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); m_events->adoptHandler(m_events->forIKeyState().keyRepeat(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().buttonDown(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().buttonUp(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().hotKeyDown(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().hotKeyUp(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); - m_events->adoptHandler(m_events->forCServer().connected(), + new TMethodEventJob(this, + &InputFilter::handleEvent)); + m_events->adoptHandler(m_events->forServer().connected(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CInputFilter::handleEvent)); + new TMethodEventJob(this, + &InputFilter::handleEvent)); - for (CRuleList::iterator rule = m_ruleList.begin(); + for (RuleList::iterator rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) { rule->enable(m_primaryClient); } } } -CString -CInputFilter::format(const CString& linePrefix) const +String +InputFilter::format(const String& linePrefix) const { - CString s; - for (CRuleList::const_iterator i = m_ruleList.begin(); + String s; + for (RuleList::const_iterator i = m_ruleList.begin(); i != m_ruleList.end(); ++i) { s += linePrefix; s += i->format(); @@ -1033,13 +1033,13 @@ CInputFilter::format(const CString& linePrefix) const } UInt32 -CInputFilter::getNumRules() const +InputFilter::getNumRules() const { return static_cast(m_ruleList.size()); } bool -CInputFilter::operator==(const CInputFilter& x) const +InputFilter::operator==(const InputFilter& x) const { // if there are different numbers of rules then we can't be equal if (m_ruleList.size() != x.m_ruleList.size()) { @@ -1048,12 +1048,12 @@ CInputFilter::operator==(const CInputFilter& x) const // compare rule lists. the easiest way to do that is to format each // rule into a string, sort the strings, then compare the results. - std::vector aList, bList; - for (CRuleList::const_iterator i = m_ruleList.begin(); + std::vector aList, bList; + for (RuleList::const_iterator i = m_ruleList.begin(); i != m_ruleList.end(); ++i) { aList.push_back(i->format()); } - for (CRuleList::const_iterator i = x.m_ruleList.begin(); + for (RuleList::const_iterator i = x.m_ruleList.begin(); i != x.m_ruleList.end(); ++i) { bList.push_back(i->format()); } @@ -1063,21 +1063,21 @@ CInputFilter::operator==(const CInputFilter& x) const } bool -CInputFilter::operator!=(const CInputFilter& x) const +InputFilter::operator!=(const InputFilter& x) const { return !operator==(x); } void -CInputFilter::handleEvent(const CEvent& event, void*) +InputFilter::handleEvent(const Event& event, void*) { // copy event and adjust target - CEvent myEvent(event.getType(), this, event.getData(), - event.getFlags() | CEvent::kDontFreeData | - CEvent::kDeliverImmediately); + Event myEvent(event.getType(), this, event.getData(), + event.getFlags() | Event::kDontFreeData | + Event::kDeliverImmediately); // let each rule try to match the event until one does - for (CRuleList::iterator rule = m_ruleList.begin(); + for (RuleList::iterator rule = m_ruleList.begin(); rule != m_ruleList.end(); ++rule) { if (rule->handleEvent(myEvent)) { // handled diff --git a/src/lib/server/InputFilter.h b/src/lib/server/InputFilter.h index 714b483c..972acfa2 100644 --- a/src/lib/server/InputFilter.h +++ b/src/lib/server/InputFilter.h @@ -26,11 +26,11 @@ #include "common/stdmap.h" #include "common/stdset.h" -class CPrimaryClient; -class CEvent; +class PrimaryClient; +class Event; class IEventQueue; -class CInputFilter { +class InputFilter { public: // ------------------------------------------------------------------------- // Input Filter Condition Classes @@ -41,36 +41,36 @@ public: kDeactivate }; - class CCondition { + class Condition { public: - CCondition(); - virtual ~CCondition(); + Condition(); + virtual ~Condition(); - virtual CCondition* clone() const = 0; - virtual CString format() const = 0; + virtual Condition* clone() const = 0; + virtual String format() const = 0; - virtual EFilterStatus match(const CEvent&) = 0; + virtual EFilterStatus match(const Event&) = 0; - virtual void enablePrimary(CPrimaryClient*); - virtual void disablePrimary(CPrimaryClient*); + virtual void enablePrimary(PrimaryClient*); + virtual void disablePrimary(PrimaryClient*); }; - // CKeystrokeCondition - class CKeystrokeCondition : public CCondition { + // KeystrokeCondition + class KeystrokeCondition : public Condition { public: - CKeystrokeCondition(IEventQueue* events, IPlatformScreen::CKeyInfo*); - CKeystrokeCondition(IEventQueue* events, KeyID key, KeyModifierMask mask); - virtual ~CKeystrokeCondition(); + KeystrokeCondition(IEventQueue* events, IPlatformScreen::KeyInfo*); + KeystrokeCondition(IEventQueue* events, KeyID key, KeyModifierMask mask); + virtual ~KeystrokeCondition(); KeyID getKey() const; KeyModifierMask getMask() const; - // CCondition overrides - virtual CCondition* clone() const; - virtual CString format() const; - virtual EFilterStatus match(const CEvent&); - virtual void enablePrimary(CPrimaryClient*); - virtual void disablePrimary(CPrimaryClient*); + // Condition overrides + virtual Condition* clone() const; + virtual String format() const; + virtual EFilterStatus match(const Event&); + virtual void enablePrimary(PrimaryClient*); + virtual void disablePrimary(PrimaryClient*); private: UInt32 m_id; @@ -79,20 +79,20 @@ public: IEventQueue* m_events; }; - // CMouseButtonCondition - class CMouseButtonCondition : public CCondition { + // MouseButtonCondition + class MouseButtonCondition : public Condition { public: - CMouseButtonCondition(IEventQueue* events, IPlatformScreen::CButtonInfo*); - CMouseButtonCondition(IEventQueue* events, ButtonID, KeyModifierMask mask); - virtual ~CMouseButtonCondition(); + MouseButtonCondition(IEventQueue* events, IPlatformScreen::ButtonInfo*); + MouseButtonCondition(IEventQueue* events, ButtonID, KeyModifierMask mask); + virtual ~MouseButtonCondition(); ButtonID getButton() const; KeyModifierMask getMask() const; - // CCondition overrides - virtual CCondition* clone() const; - virtual CString format() const; - virtual EFilterStatus match(const CEvent&); + // Condition overrides + virtual Condition* clone() const; + virtual String format() const; + virtual EFilterStatus match(const Event&); private: ButtonID m_button; @@ -100,19 +100,19 @@ public: IEventQueue* m_events; }; - // CScreenConnectedCondition - class CScreenConnectedCondition : public CCondition { + // ScreenConnectedCondition + class ScreenConnectedCondition : public Condition { public: - CScreenConnectedCondition(IEventQueue* events, const CString& screen); - virtual ~CScreenConnectedCondition(); + ScreenConnectedCondition(IEventQueue* events, const String& screen); + virtual ~ScreenConnectedCondition(); - // CCondition overrides - virtual CCondition* clone() const; - virtual CString format() const; - virtual EFilterStatus match(const CEvent&); + // Condition overrides + virtual Condition* clone() const; + virtual String format() const; + virtual EFilterStatus match(const Event&); private: - CString m_screen; + String m_screen; IEventQueue* m_events; }; @@ -120,242 +120,242 @@ public: // Input Filter Action Classes // ------------------------------------------------------------------------- - class CAction { + class Action { public: - CAction(); - virtual ~CAction(); + Action(); + virtual ~Action(); - virtual CAction* clone() const = 0; - virtual CString format() const = 0; + virtual Action* clone() const = 0; + virtual String format() const = 0; - virtual void perform(const CEvent&) = 0; + virtual void perform(const Event&) = 0; }; - // CLockCursorToScreenAction - class CLockCursorToScreenAction : public CAction { + // LockCursorToScreenAction + class LockCursorToScreenAction : public Action { public: enum Mode { kOff, kOn, kToggle }; - CLockCursorToScreenAction(IEventQueue* events, Mode = kToggle); + LockCursorToScreenAction(IEventQueue* events, Mode = kToggle); Mode getMode() const; - // CAction overrides - virtual CAction* clone() const; - virtual CString format() const; - virtual void perform(const CEvent&); + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); private: Mode m_mode; IEventQueue* m_events; }; - // CSwitchToScreenAction - class CSwitchToScreenAction : public CAction { + // SwitchToScreenAction + class SwitchToScreenAction : public Action { public: - CSwitchToScreenAction(IEventQueue* events, const CString& screen); + SwitchToScreenAction(IEventQueue* events, const String& screen); - CString getScreen() const; + String getScreen() const; - // CAction overrides - virtual CAction* clone() const; - virtual CString format() const; - virtual void perform(const CEvent&); + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); private: - CString m_screen; + String m_screen; IEventQueue* m_events; }; - // CSwitchInDirectionAction - class CSwitchInDirectionAction : public CAction { + // SwitchInDirectionAction + class SwitchInDirectionAction : public Action { public: - CSwitchInDirectionAction(IEventQueue* events, EDirection); + SwitchInDirectionAction(IEventQueue* events, EDirection); EDirection getDirection() const; - // CAction overrides - virtual CAction* clone() const; - virtual CString format() const; - virtual void perform(const CEvent&); + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); private: EDirection m_direction; IEventQueue* m_events; }; - // CKeyboardBroadcastAction - class CKeyboardBroadcastAction : public CAction { + // KeyboardBroadcastAction + class KeyboardBroadcastAction : public Action { public: enum Mode { kOff, kOn, kToggle }; - CKeyboardBroadcastAction(IEventQueue* events, Mode = kToggle); - CKeyboardBroadcastAction(IEventQueue* events, Mode, const std::set& screens); + KeyboardBroadcastAction(IEventQueue* events, Mode = kToggle); + KeyboardBroadcastAction(IEventQueue* events, Mode, const std::set& screens); Mode getMode() const; - std::set getScreens() const; + std::set getScreens() const; - // CAction overrides - virtual CAction* clone() const; - virtual CString format() const; - virtual void perform(const CEvent&); + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); private: Mode m_mode; - CString m_screens; + String m_screens; IEventQueue* m_events; }; - // CKeystrokeAction - class CKeystrokeAction : public CAction { + // KeystrokeAction + class KeystrokeAction : public Action { public: - CKeystrokeAction(IEventQueue* events, IPlatformScreen::CKeyInfo* adoptedInfo, bool press); - ~CKeystrokeAction(); + KeystrokeAction(IEventQueue* events, IPlatformScreen::KeyInfo* adoptedInfo, bool press); + ~KeystrokeAction(); - void adoptInfo(IPlatformScreen::CKeyInfo*); - const IPlatformScreen::CKeyInfo* + void adoptInfo(IPlatformScreen::KeyInfo*); + const IPlatformScreen::KeyInfo* getInfo() const; bool isOnPress() const; - // CAction overrides - virtual CAction* clone() const; - virtual CString format() const; - virtual void perform(const CEvent&); + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); protected: virtual const char* formatName() const; private: - IPlatformScreen::CKeyInfo* m_keyInfo; + IPlatformScreen::KeyInfo* m_keyInfo; bool m_press; IEventQueue* m_events; }; - // CMouseButtonAction -- modifier combinations not implemented yet - class CMouseButtonAction : public CAction { + // MouseButtonAction -- modifier combinations not implemented yet + class MouseButtonAction : public Action { public: - CMouseButtonAction(IEventQueue* events, - IPlatformScreen::CButtonInfo* adoptedInfo, + MouseButtonAction(IEventQueue* events, + IPlatformScreen::ButtonInfo* adoptedInfo, bool press); - ~CMouseButtonAction(); + ~MouseButtonAction(); - const IPlatformScreen::CButtonInfo* + const IPlatformScreen::ButtonInfo* getInfo() const; bool isOnPress() const; - // CAction overrides - virtual CAction* clone() const; - virtual CString format() const; - virtual void perform(const CEvent&); + // Action overrides + virtual Action* clone() const; + virtual String format() const; + virtual void perform(const Event&); protected: virtual const char* formatName() const; private: - IPlatformScreen::CButtonInfo* m_buttonInfo; + IPlatformScreen::ButtonInfo* m_buttonInfo; bool m_press; IEventQueue* m_events; }; - class CRule { + class Rule { public: - CRule(); - CRule(CCondition* adopted); - CRule(const CRule&); - ~CRule(); + Rule(); + Rule(Condition* adopted); + Rule(const Rule&); + ~Rule(); - CRule& operator=(const CRule&); + Rule& operator=(const Rule&); // replace the condition - void setCondition(CCondition* adopted); + void setCondition(Condition* adopted); // add an action to the rule - void adoptAction(CAction*, bool onActivation); + void adoptAction(Action*, bool onActivation); // remove an action from the rule void removeAction(bool onActivation, UInt32 index); // replace an action in the rule - void replaceAction(CAction* adopted, + void replaceAction(Action* adopted, bool onActivation, UInt32 index); // enable/disable - void enable(CPrimaryClient*); - void disable(CPrimaryClient*); + void enable(PrimaryClient*); + void disable(PrimaryClient*); // event handling - bool handleEvent(const CEvent&); + bool handleEvent(const Event&); // convert rule to a string - CString format() const; + String format() const; // get the rule's condition - const CCondition* + const Condition* getCondition() const; // get number of actions UInt32 getNumActions(bool onActivation) const; // get action by index - const CAction& getAction(bool onActivation, UInt32 index) const; + const Action& getAction(bool onActivation, UInt32 index) const; private: void clear(); - void copy(const CRule&); + void copy(const Rule&); private: - typedef std::vector CActionList; + typedef std::vector ActionList; - CCondition* m_condition; - CActionList m_activateActions; - CActionList m_deactivateActions; + Condition* m_condition; + ActionList m_activateActions; + ActionList m_deactivateActions; }; // ------------------------------------------------------------------------- // Input Filter Class // ------------------------------------------------------------------------- - typedef std::vector CRuleList; + typedef std::vector RuleList; - CInputFilter(IEventQueue* events); - CInputFilter(const CInputFilter&); - virtual ~CInputFilter(); + InputFilter(IEventQueue* events); + InputFilter(const InputFilter&); + virtual ~InputFilter(); #ifdef TEST_ENV - CInputFilter() : m_primaryClient(NULL) { } + InputFilter() : m_primaryClient(NULL) { } #endif - CInputFilter& operator=(const CInputFilter&); + InputFilter& operator=(const InputFilter&); // add rule, adopting the condition and the actions - void addFilterRule(const CRule& rule); + void addFilterRule(const Rule& rule); // remove a rule void removeFilterRule(UInt32 index); // get rule by index - CRule& getRule(UInt32 index); + Rule& getRule(UInt32 index); // enable event filtering using the given primary client. disable // if client is NULL. - virtual void setPrimaryClient(CPrimaryClient* client); + virtual void setPrimaryClient(PrimaryClient* client); // convert rules to a string - CString format(const CString& linePrefix) const; + String format(const String& linePrefix) const; // get number of rules UInt32 getNumRules() const; //! Compare filters - bool operator==(const CInputFilter&) const; + bool operator==(const InputFilter&) const; //! Compare filters - bool operator!=(const CInputFilter&) const; + bool operator!=(const InputFilter&) const; private: // event handling - void handleEvent(const CEvent&, void*); + void handleEvent(const Event&, void*); private: - CRuleList m_ruleList; - CPrimaryClient* m_primaryClient; + RuleList m_ruleList; + PrimaryClient* m_primaryClient; IEventQueue* m_events; }; diff --git a/src/lib/server/PrimaryClient.cpp b/src/lib/server/PrimaryClient.cpp index 5fcd1b3e..c1b2e953 100644 --- a/src/lib/server/PrimaryClient.cpp +++ b/src/lib/server/PrimaryClient.cpp @@ -23,11 +23,11 @@ #include "base/Log.h" // -// CPrimaryClient +// PrimaryClient // -CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) : - CBaseClientProxy(name), +PrimaryClient::PrimaryClient(const String& name, Screen* screen) : + BaseClientProxy(name), m_screen(screen), m_fakeInputCount(0) { @@ -37,31 +37,31 @@ CPrimaryClient::CPrimaryClient(const CString& name, CScreen* screen) : } } -CPrimaryClient::~CPrimaryClient() +PrimaryClient::~PrimaryClient() { // do nothing } void -CPrimaryClient::reconfigure(UInt32 activeSides) +PrimaryClient::reconfigure(UInt32 activeSides) { m_screen->reconfigure(activeSides); } UInt32 -CPrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask) +PrimaryClient::registerHotKey(KeyID key, KeyModifierMask mask) { return m_screen->registerHotKey(key, mask); } void -CPrimaryClient::unregisterHotKey(UInt32 id) +PrimaryClient::unregisterHotKey(UInt32 id) { m_screen->unregisterHotKey(id); } void -CPrimaryClient::fakeInputBegin() +PrimaryClient::fakeInputBegin() { if (++m_fakeInputCount == 1) { m_screen->fakeInputBegin(); @@ -69,7 +69,7 @@ CPrimaryClient::fakeInputBegin() } void -CPrimaryClient::fakeInputEnd() +PrimaryClient::fakeInputEnd() { if (--m_fakeInputCount == 0) { m_screen->fakeInputEnd(); @@ -77,68 +77,68 @@ CPrimaryClient::fakeInputEnd() } SInt32 -CPrimaryClient::getJumpZoneSize() const +PrimaryClient::getJumpZoneSize() const { return m_screen->getJumpZoneSize(); } void -CPrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const +PrimaryClient::getCursorCenter(SInt32& x, SInt32& y) const { m_screen->getCursorCenter(x, y); } KeyModifierMask -CPrimaryClient::getToggleMask() const +PrimaryClient::getToggleMask() const { return m_screen->pollActiveModifiers(); } bool -CPrimaryClient::isLockedToScreen() const +PrimaryClient::isLockedToScreen() const { return m_screen->isLockedToScreen(); } void* -CPrimaryClient::getEventTarget() const +PrimaryClient::getEventTarget() const { return m_screen->getEventTarget(); } bool -CPrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const +PrimaryClient::getClipboard(ClipboardID id, IClipboard* clipboard) const { return m_screen->getClipboard(id, clipboard); } void -CPrimaryClient::getShape(SInt32& x, SInt32& y, +PrimaryClient::getShape(SInt32& x, SInt32& y, SInt32& width, SInt32& height) const { m_screen->getShape(x, y, width, height); } void -CPrimaryClient::getCursorPos(SInt32& x, SInt32& y) const +PrimaryClient::getCursorPos(SInt32& x, SInt32& y) const { m_screen->getCursorPos(x, y); } void -CPrimaryClient::enable() +PrimaryClient::enable() { m_screen->enable(); } void -CPrimaryClient::disable() +PrimaryClient::disable() { m_screen->disable(); } void -CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs, +PrimaryClient::enter(SInt32 xAbs, SInt32 yAbs, UInt32 seqNum, KeyModifierMask mask, bool screensaver) { m_screen->setSequenceNumber(seqNum); @@ -149,13 +149,13 @@ CPrimaryClient::enter(SInt32 xAbs, SInt32 yAbs, } bool -CPrimaryClient::leave() +PrimaryClient::leave() { return m_screen->leave(); } void -CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard) +PrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard) { // ignore if this clipboard is already clean if (m_clipboardDirty[id]) { @@ -168,7 +168,7 @@ CPrimaryClient::setClipboard(ClipboardID id, const IClipboard* clipboard) } void -CPrimaryClient::grabClipboard(ClipboardID id) +PrimaryClient::grabClipboard(ClipboardID id) { // grab clipboard m_screen->grabClipboard(id); @@ -178,13 +178,13 @@ CPrimaryClient::grabClipboard(ClipboardID id) } void -CPrimaryClient::setClipboardDirty(ClipboardID id, bool dirty) +PrimaryClient::setClipboardDirty(ClipboardID id, bool dirty) { m_clipboardDirty[id] = dirty; } void -CPrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) +PrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) { if (m_fakeInputCount > 0) { // XXX -- don't forward keystrokes to primary screen for now @@ -196,13 +196,13 @@ CPrimaryClient::keyDown(KeyID key, KeyModifierMask mask, KeyButton button) } void -CPrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton) +PrimaryClient::keyRepeat(KeyID, KeyModifierMask, SInt32, KeyButton) { // ignore } void -CPrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) +PrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) { if (m_fakeInputCount > 0) { // XXX -- don't forward keystrokes to primary screen for now @@ -214,61 +214,61 @@ CPrimaryClient::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) } void -CPrimaryClient::mouseDown(ButtonID) +PrimaryClient::mouseDown(ButtonID) { // ignore } void -CPrimaryClient::mouseUp(ButtonID) +PrimaryClient::mouseUp(ButtonID) { // ignore } void -CPrimaryClient::mouseMove(SInt32 x, SInt32 y) +PrimaryClient::mouseMove(SInt32 x, SInt32 y) { m_screen->warpCursor(x, y); } void -CPrimaryClient::mouseRelativeMove(SInt32, SInt32) +PrimaryClient::mouseRelativeMove(SInt32, SInt32) { // ignore } void -CPrimaryClient::mouseWheel(SInt32, SInt32) +PrimaryClient::mouseWheel(SInt32, SInt32) { // ignore } void -CPrimaryClient::screensaver(bool) +PrimaryClient::screensaver(bool) { // ignore } void -CPrimaryClient::sendDragInfo(UInt32 fileCount, const char* info, size_t size) +PrimaryClient::sendDragInfo(UInt32 fileCount, const char* info, size_t size) { // ignore } void -CPrimaryClient::fileChunkSending(UInt8 mark, char* data, size_t dataSize) +PrimaryClient::fileChunkSending(UInt8 mark, char* data, size_t dataSize) { // ignore } void -CPrimaryClient::resetOptions() +PrimaryClient::resetOptions() { m_screen->resetOptions(); } void -CPrimaryClient::setOptions(const COptionsList& options) +PrimaryClient::setOptions(const OptionsList& options) { m_screen->setOptions(options); } diff --git a/src/lib/server/PrimaryClient.h b/src/lib/server/PrimaryClient.h index 7fcdf0be..fe4f2534 100644 --- a/src/lib/server/PrimaryClient.h +++ b/src/lib/server/PrimaryClient.h @@ -21,7 +21,7 @@ #include "server/BaseClientProxy.h" #include "synergy/protocol_types.h" -class CScreen; +class Screen; //! Primary screen as pseudo-client /*! @@ -29,16 +29,16 @@ The primary screen does not have a client associated with it. This class provides a pseudo-client to allow the primary screen to be treated as if it was a client. */ -class CPrimaryClient : public CBaseClientProxy { +class PrimaryClient : public BaseClientProxy { public: /*! \c name is the name of the server and \p screen is primary screen. */ - CPrimaryClient(const CString& name, CScreen* screen); - ~CPrimaryClient(); + PrimaryClient(const String& name, Screen* screen); + ~PrimaryClient(); #ifdef TEST_ENV - CPrimaryClient() : CBaseClientProxy("") { } + PrimaryClient() : BaseClientProxy("") { } #endif //! @name manipulators @@ -142,12 +142,12 @@ public: virtual void mouseWheel(SInt32 xDelta, SInt32 yDelta); virtual void screensaver(bool activate); virtual void resetOptions(); - virtual void setOptions(const COptionsList& options); + virtual void setOptions(const OptionsList& options); virtual void sendDragInfo(UInt32 fileCount, const char* info, size_t size); virtual void fileChunkSending(UInt8 mark, char* data, size_t dataSize); private: - CScreen* m_screen; + Screen* m_screen; bool m_clipboardDirty[kClipboardEnd]; SInt32 m_fakeInputCount; }; diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index ef69f152..71c6d118 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -47,13 +47,13 @@ #include // -// CServer +// Server // -CServer::CServer( - CConfig& config, - CPrimaryClient* primaryClient, - CScreen* screen, +Server::Server( + Config& config, + PrimaryClient* primaryClient, + Screen* screen, IEventQueue* events, bool enableDragDrop) : m_mock(false), @@ -95,11 +95,11 @@ CServer::CServer( assert(config.isScreen(primaryClient->getName())); assert(m_screen != NULL); - CString primaryName = getName(primaryClient); + String primaryName = getName(primaryClient); // clear clipboards for (ClipboardID id = 0; id < kClipboardEnd; ++id) { - CClipboardInfo& clipboard = m_clipboards[id]; + ClipboardInfo& clipboard = m_clipboards[id]; clipboard.m_clipboardOwner = primaryName; clipboard.m_clipboardSeqNum = m_seqNum; if (clipboard.m_clipboard.open(0)) { @@ -110,83 +110,83 @@ CServer::CServer( } // install event handlers - m_events->adoptHandler(CEvent::kTimer, this, - new TMethodEventJob(this, - &CServer::handleSwitchWaitTimeout)); + m_events->adoptHandler(Event::kTimer, this, + new TMethodEventJob(this, + &Server::handleSwitchWaitTimeout)); m_events->adoptHandler(m_events->forIKeyState().keyDown(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleKeyDownEvent)); + new TMethodEventJob(this, + &Server::handleKeyDownEvent)); m_events->adoptHandler(m_events->forIKeyState().keyUp(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleKeyUpEvent)); + new TMethodEventJob(this, + &Server::handleKeyUpEvent)); m_events->adoptHandler(m_events->forIKeyState().keyRepeat(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleKeyRepeatEvent)); + new TMethodEventJob(this, + &Server::handleKeyRepeatEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().buttonDown(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleButtonDownEvent)); + new TMethodEventJob(this, + &Server::handleButtonDownEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().buttonUp(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleButtonUpEvent)); + new TMethodEventJob(this, + &Server::handleButtonUpEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().motionOnPrimary(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleMotionPrimaryEvent)); + new TMethodEventJob(this, + &Server::handleMotionPrimaryEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().motionOnSecondary(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleMotionSecondaryEvent)); + new TMethodEventJob(this, + &Server::handleMotionSecondaryEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().wheel(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleWheelEvent)); + new TMethodEventJob(this, + &Server::handleWheelEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().screensaverActivated(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleScreensaverActivatedEvent)); + new TMethodEventJob(this, + &Server::handleScreensaverActivatedEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().screensaverDeactivated(), m_primaryClient->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleScreensaverDeactivatedEvent)); - m_events->adoptHandler(m_events->forCServer().switchToScreen(), + new TMethodEventJob(this, + &Server::handleScreensaverDeactivatedEvent)); + m_events->adoptHandler(m_events->forServer().switchToScreen(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleSwitchToScreenEvent)); - m_events->adoptHandler(m_events->forCServer().switchInDirection(), + new TMethodEventJob(this, + &Server::handleSwitchToScreenEvent)); + m_events->adoptHandler(m_events->forServer().switchInDirection(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleSwitchInDirectionEvent)); - m_events->adoptHandler(m_events->forCServer().keyboardBroadcast(), + new TMethodEventJob(this, + &Server::handleSwitchInDirectionEvent)); + m_events->adoptHandler(m_events->forServer().keyboardBroadcast(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleKeyboardBroadcastEvent)); - m_events->adoptHandler(m_events->forCServer().lockCursorToScreen(), + new TMethodEventJob(this, + &Server::handleKeyboardBroadcastEvent)); + m_events->adoptHandler(m_events->forServer().lockCursorToScreen(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleLockCursorToScreenEvent)); + new TMethodEventJob(this, + &Server::handleLockCursorToScreenEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().fakeInputBegin(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleFakeInputBeginEvent)); + new TMethodEventJob(this, + &Server::handleFakeInputBeginEvent)); m_events->adoptHandler(m_events->forIPrimaryScreen().fakeInputEnd(), m_inputFilter, - new TMethodEventJob(this, - &CServer::handleFakeInputEndEvent)); + new TMethodEventJob(this, + &Server::handleFakeInputEndEvent)); if (m_enableDragDrop) { m_events->adoptHandler(m_events->forIScreen().fileChunkSending(), this, - new TMethodEventJob(this, - &CServer::handleFileChunkSendingEvent)); + new TMethodEventJob(this, + &Server::handleFileChunkSendingEvent)); m_events->adoptHandler(m_events->forIScreen().fileRecieveCompleted(), this, - new TMethodEventJob(this, - &CServer::handleFileRecieveCompletedEvent)); + new TMethodEventJob(this, + &Server::handleFileRecieveCompletedEvent)); } // add connection @@ -207,7 +207,7 @@ CServer::CServer( } -CServer::~CServer() +Server::~Server() { if (m_mock) { return; @@ -238,17 +238,17 @@ CServer::~CServer() m_inputFilter); m_events->removeHandler(m_events->forIPrimaryScreen().fakeInputEnd(), m_inputFilter); - m_events->removeHandler(CEvent::kTimer, this); + m_events->removeHandler(Event::kTimer, this); stopSwitch(); // force immediate disconnection of secondary clients disconnect(); - for (COldClients::iterator index = m_oldClients.begin(); + for (OldClients::iterator index = m_oldClients.begin(); index != m_oldClients.begin(); ++index) { - CBaseClientProxy* client = index->first; + BaseClientProxy* client = index->first; m_events->deleteTimer(index->second); - m_events->removeHandler(CEvent::kTimer, client); - m_events->removeHandler(m_events->forCClientProxy().disconnected(), client); + m_events->removeHandler(Event::kTimer, client); + m_events->removeHandler(m_events->forClientProxy().disconnected(), client); delete client; } @@ -261,7 +261,7 @@ CServer::~CServer() } bool -CServer::setConfig(const CConfig& config) +Server::setConfig(const Config& config) { // refuse configuration if it doesn't include the primary screen if (!config.isScreen(m_primaryClient->getName())) { @@ -280,13 +280,13 @@ CServer::setConfig(const CConfig& config) // the user configurable hotkey mechanism. if the user has already // registered ScrollLock for something else then that will win but // we will unfortunately generate a warning. if the user has - // configured a CLockCursorToScreenAction then we don't add + // configured a LockCursorToScreenAction then we don't add // ScrollLock as a hotkey. if (!m_config->hasLockToScreenAction()) { - IPlatformScreen::CKeyInfo* key = - IPlatformScreen::CKeyInfo::alloc(kKeyScrollLock, 0, 0, 0); - CInputFilter::CRule rule(new CInputFilter::CKeystrokeCondition(m_events, key)); - rule.adoptAction(new CInputFilter::CLockCursorToScreenAction(m_events), true); + IPlatformScreen::KeyInfo* key = + IPlatformScreen::KeyInfo::alloc(kKeyScrollLock, 0, 0, 0); + InputFilter::Rule rule(new InputFilter::KeystrokeCondition(m_events, key)); + rule.adoptAction(new InputFilter::LockCursorToScreenAction(m_events), true); m_inputFilter->addFilterRule(rule); } @@ -294,9 +294,9 @@ CServer::setConfig(const CConfig& config) m_primaryClient->reconfigure(getActivePrimarySides()); // tell all (connected) clients about current options - for (CClientList::const_iterator index = m_clients.begin(); + for (ClientList::const_iterator index = m_clients.begin(); index != m_clients.end(); ++index) { - CBaseClientProxy* client = index->second; + BaseClientProxy* client = index->second; sendOptions(client); } @@ -304,14 +304,14 @@ CServer::setConfig(const CConfig& config) } void -CServer::adoptClient(CBaseClientProxy* client) +Server::adoptClient(BaseClientProxy* client) { assert(client != NULL); // watch for client disconnection - m_events->adoptHandler(m_events->forCClientProxy().disconnected(), client, - new TMethodEventJob(this, - &CServer::handleClientDisconnected, client)); + m_events->adoptHandler(m_events->forClientProxy().disconnected(), client, + new TMethodEventJob(this, + &Server::handleClientDisconnected, client)); // name must be in our configuration if (!m_config->isScreen(client->getName())) { @@ -338,45 +338,45 @@ CServer::adoptClient(CBaseClientProxy* client) } // send notification - CServer::CScreenConnectedInfo* info = - new CServer::CScreenConnectedInfo(getName(client)); - m_events->addEvent(CEvent(m_events->forCServer().connected(), + Server::ScreenConnectedInfo* info = + new Server::ScreenConnectedInfo(getName(client)); + m_events->addEvent(Event(m_events->forServer().connected(), m_primaryClient->getEventTarget(), info)); } void -CServer::disconnect() +Server::disconnect() { // close all secondary clients if (m_clients.size() > 1 || !m_oldClients.empty()) { - CConfig emptyConfig(m_events); + Config emptyConfig(m_events); closeClients(emptyConfig); } else { - m_events->addEvent(CEvent(m_events->forCServer().disconnected(), this)); + m_events->addEvent(Event(m_events->forServer().disconnected(), this)); } } UInt32 -CServer::getNumClients() const +Server::getNumClients() const { return (SInt32)m_clients.size(); } void -CServer::getClients(std::vector& list) const +Server::getClients(std::vector& list) const { list.clear(); - for (CClientList::const_iterator index = m_clients.begin(); + for (ClientList::const_iterator index = m_clients.begin(); index != m_clients.end(); ++index) { list.push_back(index->first); } } -CString -CServer::getName(const CBaseClientProxy* client) const +String +Server::getName(const BaseClientProxy* client) const { - CString name = m_config->getCanonicalName(client->getName()); + String name = m_config->getCanonicalName(client->getName()); if (name.empty()) { name = client->getName(); } @@ -384,7 +384,7 @@ CServer::getName(const CBaseClientProxy* client) const } UInt32 -CServer::getActivePrimarySides() const +Server::getActivePrimarySides() const { UInt32 sides = 0; if (!isLockedToScreenServer()) { @@ -405,14 +405,14 @@ CServer::getActivePrimarySides() const } bool -CServer::isLockedToScreenServer() const +Server::isLockedToScreenServer() const { // locked if scroll-lock is toggled on return m_lockedToScreen; } bool -CServer::isLockedToScreen() const +Server::isLockedToScreen() const { // locked if we say we're locked if (isLockedToScreenServer()) { @@ -430,7 +430,7 @@ CServer::isLockedToScreen() const } SInt32 -CServer::getJumpZoneSize(CBaseClientProxy* client) const +Server::getJumpZoneSize(BaseClientProxy* client) const { if (client == m_primaryClient) { return m_primaryClient->getJumpZoneSize(); @@ -441,7 +441,7 @@ CServer::getJumpZoneSize(CBaseClientProxy* client) const } void -CServer::switchScreen(CBaseClientProxy* dst, +Server::switchScreen(BaseClientProxy* dst, SInt32 x, SInt32 y, bool forScreensaver) { assert(dst != NULL); @@ -482,7 +482,7 @@ CServer::switchScreen(CBaseClientProxy* dst, // primary screen. if (m_active == m_primaryClient) { for (ClipboardID id = 0; id < kClipboardEnd; ++id) { - CClipboardInfo& clipboard = m_clipboards[id]; + ClipboardInfo& clipboard = m_clipboards[id]; if (clipboard.m_clipboardOwner == getName(m_primaryClient)) { onClipboardChanged(m_primaryClient, id, clipboard.m_clipboardSeqNum); @@ -506,9 +506,9 @@ CServer::switchScreen(CBaseClientProxy* dst, m_active->setClipboard(id, &m_clipboards[id].m_clipboard); } - CServer::CSwitchToScreenInfo* info = - CServer::CSwitchToScreenInfo::alloc(m_active->getName()); - m_events->addEvent(CEvent(m_events->forCServer().screenSwitched(), this, info)); + Server::SwitchToScreenInfo* info = + Server::SwitchToScreenInfo::alloc(m_active->getName()); + m_events->addEvent(Event(m_events->forServer().screenSwitched(), this, info)); } else { m_active->mouseMove(x, y); @@ -516,7 +516,7 @@ CServer::switchScreen(CBaseClientProxy* dst, } void -CServer::jumpToScreen(CBaseClientProxy* newScreen) +Server::jumpToScreen(BaseClientProxy* newScreen) { assert(newScreen != NULL); @@ -531,7 +531,7 @@ CServer::jumpToScreen(CBaseClientProxy* newScreen) } float -CServer::mapToFraction(CBaseClientProxy* client, +Server::mapToFraction(BaseClientProxy* client, EDirection dir, SInt32 x, SInt32 y) const { SInt32 sx, sy, sw, sh; @@ -553,7 +553,7 @@ CServer::mapToFraction(CBaseClientProxy* client, } void -CServer::mapToPixel(CBaseClientProxy* client, +Server::mapToPixel(BaseClientProxy* client, EDirection dir, float f, SInt32& x, SInt32& y) const { SInt32 sx, sy, sw, sh; @@ -576,15 +576,15 @@ CServer::mapToPixel(CBaseClientProxy* client, } bool -CServer::hasAnyNeighbor(CBaseClientProxy* client, EDirection dir) const +Server::hasAnyNeighbor(BaseClientProxy* client, EDirection dir) const { assert(client != NULL); return m_config->hasNeighbor(getName(client), dir); } -CBaseClientProxy* -CServer::getNeighbor(CBaseClientProxy* src, +BaseClientProxy* +Server::getNeighbor(BaseClientProxy* src, EDirection dir, SInt32& x, SInt32& y) const { // note -- must be locked on entry @@ -592,9 +592,9 @@ CServer::getNeighbor(CBaseClientProxy* src, assert(src != NULL); // get source screen name - CString srcName = getName(src); + String srcName = getName(src); assert(!srcName.empty()); - LOG((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", CConfig::dirName(dir), srcName.c_str())); + LOG((CLOG_DEBUG2 "find neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str())); // convert position to fraction float t = mapToFraction(src, dir, x, y); @@ -602,28 +602,28 @@ CServer::getNeighbor(CBaseClientProxy* src, // search for the closest neighbor that exists in direction dir float tTmp; for (;;) { - CString dstName(m_config->getNeighbor(srcName, dir, t, &tTmp)); + String dstName(m_config->getNeighbor(srcName, dir, t, &tTmp)); // if nothing in that direction then return NULL. if the // destination is the source then we can make no more // progress in this direction. since we haven't found a // connected neighbor we return NULL. if (dstName.empty()) { - LOG((CLOG_DEBUG2 "no neighbor on %s of \"%s\"", CConfig::dirName(dir), srcName.c_str())); + LOG((CLOG_DEBUG2 "no neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str())); return NULL; } // look up neighbor cell. if the screen is connected and // ready then we can stop. - CClientList::const_iterator index = m_clients.find(dstName); + ClientList::const_iterator index = m_clients.find(dstName); if (index != m_clients.end()) { - LOG((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), CConfig::dirName(dir), srcName.c_str(), t)); + LOG((CLOG_DEBUG2 "\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), Config::dirName(dir), srcName.c_str(), t)); mapToPixel(index->second, dir, tTmp, x, y); return index->second; } // skip over unconnected screen - LOG((CLOG_DEBUG2 "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), CConfig::dirName(dir), srcName.c_str())); + LOG((CLOG_DEBUG2 "ignored \"%s\" on %s of \"%s\"", dstName.c_str(), Config::dirName(dir), srcName.c_str())); srcName = dstName; // use position on skipped screen @@ -631,8 +631,8 @@ CServer::getNeighbor(CBaseClientProxy* src, } } -CBaseClientProxy* -CServer::mapToNeighbor(CBaseClientProxy* src, +BaseClientProxy* +Server::mapToNeighbor(BaseClientProxy* src, EDirection srcSide, SInt32& x, SInt32& y) const { // note -- must be locked on entry @@ -640,14 +640,14 @@ CServer::mapToNeighbor(CBaseClientProxy* src, assert(src != NULL); // get the first neighbor - CBaseClientProxy* dst = getNeighbor(src, srcSide, x, y); + BaseClientProxy* dst = getNeighbor(src, srcSide, x, y); if (dst == NULL) { return NULL; } // get the source screen's size SInt32 dx, dy, dw, dh; - CBaseClientProxy* lastGoodScreen = src; + BaseClientProxy* lastGoodScreen = src; lastGoodScreen->getShape(dx, dy, dw, dh); // find destination screen, adjusting x or y (but not both). the @@ -739,7 +739,7 @@ CServer::mapToNeighbor(CBaseClientProxy* src, } void -CServer::avoidJumpZone(CBaseClientProxy* dst, +Server::avoidJumpZone(BaseClientProxy* dst, EDirection dir, SInt32& x, SInt32& y) const { // we only need to avoid jump zones on the primary screen @@ -747,7 +747,7 @@ CServer::avoidJumpZone(CBaseClientProxy* dst, return; } - const CString dstName(getName(dst)); + const String dstName(getName(dst)); SInt32 dx, dy, dw, dh; dst->getShape(dx, dy, dw, dh); float t = mapToFraction(dst, dir, x, y); @@ -787,17 +787,17 @@ CServer::avoidJumpZone(CBaseClientProxy* dst, } bool -CServer::isSwitchOkay(CBaseClientProxy* newScreen, +Server::isSwitchOkay(BaseClientProxy* newScreen, EDirection dir, SInt32 x, SInt32 y, SInt32 xActive, SInt32 yActive) { - LOG((CLOG_DEBUG1 "try to leave \"%s\" on %s", getName(m_active).c_str(), CConfig::dirName(dir))); + LOG((CLOG_DEBUG1 "try to leave \"%s\" on %s", getName(m_active).c_str(), Config::dirName(dir))); // is there a neighbor? if (newScreen == NULL) { // there's no neighbor. we don't want to switch and we don't // want to try to switch later. - LOG((CLOG_DEBUG1 "no neighbor %s", CConfig::dirName(dir))); + LOG((CLOG_DEBUG1 "no neighbor %s", Config::dirName(dir))); stopSwitch(); return false; } @@ -839,14 +839,14 @@ CServer::isSwitchOkay(CBaseClientProxy* newScreen, // are we in a locked corner? first check if screen has the option set // and, if not, check the global options. - const CConfig::CScreenOptions* options = + const Config::ScreenOptions* options = m_config->getOptions(getName(m_active)); if (options == NULL || options->count(kOptionScreenSwitchCorners) == 0) { options = m_config->getOptions(""); } if (options != NULL && options->count(kOptionScreenSwitchCorners) > 0) { // get corner mask and size - CConfig::CScreenOptions::const_iterator i = + Config::ScreenOptions::const_iterator i = options->find(kOptionScreenSwitchCorners); UInt32 corners = static_cast(i->second); i = options->find(kOptionScreenSwitchCornerSize); @@ -888,14 +888,14 @@ CServer::isSwitchOkay(CBaseClientProxy* newScreen, } void -CServer::noSwitch(SInt32 x, SInt32 y) +Server::noSwitch(SInt32 x, SInt32 y) { armSwitchTwoTap(x, y); stopSwitchWait(); } void -CServer::stopSwitch() +Server::stopSwitch() { if (m_switchScreen != NULL) { m_switchScreen = NULL; @@ -906,7 +906,7 @@ CServer::stopSwitch() } void -CServer::startSwitchTwoTap() +Server::startSwitchTwoTap() { m_switchTwoTapEngaged = true; m_switchTwoTapArmed = false; @@ -915,7 +915,7 @@ CServer::startSwitchTwoTap() } void -CServer::armSwitchTwoTap(SInt32 x, SInt32 y) +Server::armSwitchTwoTap(SInt32 x, SInt32 y) { if (m_switchTwoTapEngaged) { if (m_switchTwoTapTimer.getTime() > m_switchTwoTapDelay) { @@ -962,20 +962,20 @@ CServer::armSwitchTwoTap(SInt32 x, SInt32 y) } void -CServer::stopSwitchTwoTap() +Server::stopSwitchTwoTap() { m_switchTwoTapEngaged = false; m_switchTwoTapArmed = false; } bool -CServer::isSwitchTwoTapStarted() const +Server::isSwitchTwoTapStarted() const { return m_switchTwoTapEngaged; } bool -CServer::shouldSwitchTwoTap() const +Server::shouldSwitchTwoTap() const { // this is the second tap if two-tap is armed and this tap // came fast enough @@ -984,7 +984,7 @@ CServer::shouldSwitchTwoTap() const } void -CServer::startSwitchWait(SInt32 x, SInt32 y) +Server::startSwitchWait(SInt32 x, SInt32 y) { stopSwitchWait(); m_switchWaitX = x; @@ -994,7 +994,7 @@ CServer::startSwitchWait(SInt32 x, SInt32 y) } void -CServer::stopSwitchWait() +Server::stopSwitchWait() { if (m_switchWaitTimer != NULL) { m_events->deleteTimer(m_switchWaitTimer); @@ -1003,13 +1003,13 @@ CServer::stopSwitchWait() } bool -CServer::isSwitchWaitStarted() const +Server::isSwitchWaitStarted() const { return (m_switchWaitTimer != NULL); } UInt32 -CServer::getCorner(CBaseClientProxy* client, +Server::getCorner(BaseClientProxy* client, SInt32 x, SInt32 y, SInt32 size) const { assert(client != NULL); @@ -1066,7 +1066,7 @@ CServer::getCorner(CBaseClientProxy* client, } void -CServer::stopRelativeMoves() +Server::stopRelativeMoves() { if (m_relativeMoves && m_active != m_primaryClient) { // warp to the center of the active client so we know where we are @@ -1084,17 +1084,17 @@ CServer::stopRelativeMoves() } void -CServer::sendOptions(CBaseClientProxy* client) const +Server::sendOptions(BaseClientProxy* client) const { - COptionsList optionsList; + OptionsList optionsList; // look up options for client - const CConfig::CScreenOptions* options = + const Config::ScreenOptions* options = m_config->getOptions(getName(client)); if (options != NULL) { // convert options to a more convenient form for sending optionsList.reserve(2 * options->size()); - for (CConfig::CScreenOptions::const_iterator index = options->begin(); + for (Config::ScreenOptions::const_iterator index = options->begin(); index != options->end(); ++index) { optionsList.push_back(index->first); optionsList.push_back(static_cast(index->second)); @@ -1106,7 +1106,7 @@ CServer::sendOptions(CBaseClientProxy* client) const if (options != NULL) { // convert options to a more convenient form for sending optionsList.reserve(optionsList.size() + 2 * options->size()); - for (CConfig::CScreenOptions::const_iterator index = options->begin(); + for (Config::ScreenOptions::const_iterator index = options->begin(); index != options->end(); ++index) { optionsList.push_back(index->first); optionsList.push_back(static_cast(index->second)); @@ -1119,9 +1119,9 @@ CServer::sendOptions(CBaseClientProxy* client) const } void -CServer::processOptions() +Server::processOptions() { - const CConfig::CScreenOptions* options = m_config->getOptions(""); + const Config::ScreenOptions* options = m_config->getOptions(""); if (options == NULL) { return; } @@ -1131,7 +1131,7 @@ CServer::processOptions() m_switchNeedsAlt = false; // doesnt' work correct. bool newRelativeMoves = m_relativeMoves; - for (CConfig::CScreenOptions::const_iterator index = options->begin(); + for (Config::ScreenOptions::const_iterator index = options->begin(); index != options->end(); ++index) { const OptionID id = index->first; const OptionValue value = index->second; @@ -1169,10 +1169,10 @@ CServer::processOptions() } void -CServer::handleShapeChanged(const CEvent&, void* vclient) +Server::handleShapeChanged(const Event&, void* vclient) { // ignore events from unknown clients - CBaseClientProxy* client = reinterpret_cast(vclient); + BaseClientProxy* client = reinterpret_cast(vclient); if (m_clientSet.count(client) == 0) { return; } @@ -1202,19 +1202,19 @@ CServer::handleShapeChanged(const CEvent&, void* vclient) } void -CServer::handleClipboardGrabbed(const CEvent& event, void* vclient) +Server::handleClipboardGrabbed(const Event& event, void* vclient) { // ignore events from unknown clients - CBaseClientProxy* grabber = reinterpret_cast(vclient); + BaseClientProxy* grabber = reinterpret_cast(vclient); if (m_clientSet.count(grabber) == 0) { return; } - const IScreen::CClipboardInfo* info = - reinterpret_cast(event.getData()); + const IScreen::ClipboardInfo* info = + reinterpret_cast(event.getData()); // ignore grab if sequence number is old. always allow primary // screen to grab. - CClipboardInfo& clipboard = m_clipboards[info->m_id]; + ClipboardInfo& clipboard = m_clipboards[info->m_id]; if (grabber != m_primaryClient && info->m_sequenceNumber < clipboard.m_clipboardSeqNum) { LOG((CLOG_INFO "ignored screen \"%s\" grab of clipboard %d", getName(grabber).c_str(), info->m_id)); @@ -1235,9 +1235,9 @@ CServer::handleClipboardGrabbed(const CEvent& event, void* vclient) // tell all other screens to take ownership of clipboard. tell the // grabber that it's clipboard isn't dirty. - for (CClientList::iterator index = m_clients.begin(); + for (ClientList::iterator index = m_clients.begin(); index != m_clients.end(); ++index) { - CBaseClientProxy* client = index->second; + BaseClientProxy* client = index->second; if (client == grabber) { client->setClipboardDirty(info->m_id, false); } @@ -1248,96 +1248,96 @@ CServer::handleClipboardGrabbed(const CEvent& event, void* vclient) } void -CServer::handleClipboardChanged(const CEvent& event, void* vclient) +Server::handleClipboardChanged(const Event& event, void* vclient) { // ignore events from unknown clients - CBaseClientProxy* sender = reinterpret_cast(vclient); + BaseClientProxy* sender = reinterpret_cast(vclient); if (m_clientSet.count(sender) == 0) { return; } - const IScreen::CClipboardInfo* info = - reinterpret_cast(event.getData()); + const IScreen::ClipboardInfo* info = + reinterpret_cast(event.getData()); onClipboardChanged(sender, info->m_id, info->m_sequenceNumber); } void -CServer::handleKeyDownEvent(const CEvent& event, void*) +Server::handleKeyDownEvent(const Event& event, void*) { - IPlatformScreen::CKeyInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::KeyInfo* info = + reinterpret_cast(event.getData()); onKeyDown(info->m_key, info->m_mask, info->m_button, info->m_screens); } void -CServer::handleKeyUpEvent(const CEvent& event, void*) +Server::handleKeyUpEvent(const Event& event, void*) { - IPlatformScreen::CKeyInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::KeyInfo* info = + reinterpret_cast(event.getData()); onKeyUp(info->m_key, info->m_mask, info->m_button, info->m_screens); } void -CServer::handleKeyRepeatEvent(const CEvent& event, void*) +Server::handleKeyRepeatEvent(const Event& event, void*) { - IPlatformScreen::CKeyInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::KeyInfo* info = + reinterpret_cast(event.getData()); onKeyRepeat(info->m_key, info->m_mask, info->m_count, info->m_button); } void -CServer::handleButtonDownEvent(const CEvent& event, void*) +Server::handleButtonDownEvent(const Event& event, void*) { - IPlatformScreen::CButtonInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::ButtonInfo* info = + reinterpret_cast(event.getData()); onMouseDown(info->m_button); } void -CServer::handleButtonUpEvent(const CEvent& event, void*) +Server::handleButtonUpEvent(const Event& event, void*) { - IPlatformScreen::CButtonInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::ButtonInfo* info = + reinterpret_cast(event.getData()); onMouseUp(info->m_button); } void -CServer::handleMotionPrimaryEvent(const CEvent& event, void*) +Server::handleMotionPrimaryEvent(const Event& event, void*) { - IPlatformScreen::CMotionInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::MotionInfo* info = + reinterpret_cast(event.getData()); onMouseMovePrimary(info->m_x, info->m_y); } void -CServer::handleMotionSecondaryEvent(const CEvent& event, void*) +Server::handleMotionSecondaryEvent(const Event& event, void*) { - IPlatformScreen::CMotionInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::MotionInfo* info = + reinterpret_cast(event.getData()); onMouseMoveSecondary(info->m_x, info->m_y); } void -CServer::handleWheelEvent(const CEvent& event, void*) +Server::handleWheelEvent(const Event& event, void*) { - IPlatformScreen::CWheelInfo* info = - reinterpret_cast(event.getData()); + IPlatformScreen::WheelInfo* info = + reinterpret_cast(event.getData()); onMouseWheel(info->m_xDelta, info->m_yDelta); } void -CServer::handleScreensaverActivatedEvent(const CEvent&, void*) +Server::handleScreensaverActivatedEvent(const Event&, void*) { onScreensaver(true); } void -CServer::handleScreensaverDeactivatedEvent(const CEvent&, void*) +Server::handleScreensaverDeactivatedEvent(const Event&, void*) { onScreensaver(false); } void -CServer::handleSwitchWaitTimeout(const CEvent&, void*) +Server::handleSwitchWaitTimeout(const Event&, void*) { // ignore if mouse is locked to screen if (isLockedToScreen()) { @@ -1351,33 +1351,33 @@ CServer::handleSwitchWaitTimeout(const CEvent&, void*) } void -CServer::handleClientDisconnected(const CEvent&, void* vclient) +Server::handleClientDisconnected(const Event&, void* vclient) { // client has disconnected. it might be an old client or an // active client. we don't care so just handle it both ways. - CBaseClientProxy* client = reinterpret_cast(vclient); + BaseClientProxy* client = reinterpret_cast(vclient); removeActiveClient(client); removeOldClient(client); delete client; } void -CServer::handleClientCloseTimeout(const CEvent&, void* vclient) +Server::handleClientCloseTimeout(const Event&, void* vclient) { // client took too long to disconnect. just dump it. - CBaseClientProxy* client = reinterpret_cast(vclient); + BaseClientProxy* client = reinterpret_cast(vclient); LOG((CLOG_NOTE "forced disconnection of client \"%s\"", getName(client).c_str())); removeOldClient(client); delete client; } void -CServer::handleSwitchToScreenEvent(const CEvent& event, void*) +Server::handleSwitchToScreenEvent(const Event& event, void*) { - CSwitchToScreenInfo* info = - reinterpret_cast(event.getData()); + SwitchToScreenInfo* info = + reinterpret_cast(event.getData()); - CClientList::const_iterator index = m_clients.find(info->m_screen); + ClientList::const_iterator index = m_clients.find(info->m_screen); if (index == m_clients.end()) { LOG((CLOG_DEBUG1 "screen \"%s\" not active", info->m_screen)); } @@ -1387,17 +1387,17 @@ CServer::handleSwitchToScreenEvent(const CEvent& event, void*) } void -CServer::handleSwitchInDirectionEvent(const CEvent& event, void*) +Server::handleSwitchInDirectionEvent(const Event& event, void*) { - CSwitchInDirectionInfo* info = - reinterpret_cast(event.getData()); + SwitchInDirectionInfo* info = + reinterpret_cast(event.getData()); // jump to screen in chosen direction from center of this screen SInt32 x = m_x, y = m_y; - CBaseClientProxy* newScreen = + BaseClientProxy* newScreen = getNeighbor(m_active, info->m_direction, x, y); if (newScreen == NULL) { - LOG((CLOG_DEBUG1 "no neighbor %s", CConfig::dirName(info->m_direction))); + LOG((CLOG_DEBUG1 "no neighbor %s", Config::dirName(info->m_direction))); } else { jumpToScreen(newScreen); @@ -1405,23 +1405,23 @@ CServer::handleSwitchInDirectionEvent(const CEvent& event, void*) } void -CServer::handleKeyboardBroadcastEvent(const CEvent& event, void*) +Server::handleKeyboardBroadcastEvent(const Event& event, void*) { - CKeyboardBroadcastInfo* info = (CKeyboardBroadcastInfo*)event.getData(); + KeyboardBroadcastInfo* info = (KeyboardBroadcastInfo*)event.getData(); // choose new state bool newState; switch (info->m_state) { - case CKeyboardBroadcastInfo::kOff: + case KeyboardBroadcastInfo::kOff: newState = false; break; default: - case CKeyboardBroadcastInfo::kOn: + case KeyboardBroadcastInfo::kOn: newState = true; break; - case CKeyboardBroadcastInfo::kToggle: + case KeyboardBroadcastInfo::kToggle: newState = !m_keyboardBroadcasting; break; } @@ -1436,23 +1436,23 @@ CServer::handleKeyboardBroadcastEvent(const CEvent& event, void*) } void -CServer::handleLockCursorToScreenEvent(const CEvent& event, void*) +Server::handleLockCursorToScreenEvent(const Event& event, void*) { - CLockCursorToScreenInfo* info = (CLockCursorToScreenInfo*)event.getData(); + LockCursorToScreenInfo* info = (LockCursorToScreenInfo*)event.getData(); // choose new state bool newState; switch (info->m_state) { - case CLockCursorToScreenInfo::kOff: + case LockCursorToScreenInfo::kOff: newState = false; break; default: - case CLockCursorToScreenInfo::kOn: + case LockCursorToScreenInfo::kOn: newState = true; break; - case CLockCursorToScreenInfo::kToggle: + case LockCursorToScreenInfo::kToggle: newState = !m_lockedToScreen; break; } @@ -1470,34 +1470,34 @@ CServer::handleLockCursorToScreenEvent(const CEvent& event, void*) } void -CServer::handleFakeInputBeginEvent(const CEvent&, void*) +Server::handleFakeInputBeginEvent(const Event&, void*) { m_primaryClient->fakeInputBegin(); } void -CServer::handleFakeInputEndEvent(const CEvent&, void*) +Server::handleFakeInputEndEvent(const Event&, void*) { m_primaryClient->fakeInputEnd(); } void -CServer::handleFileChunkSendingEvent(const CEvent& event, void*) +Server::handleFileChunkSendingEvent(const Event& event, void*) { onFileChunkSending(event.getData()); } void -CServer::handleFileRecieveCompletedEvent(const CEvent& event, void*) +Server::handleFileRecieveCompletedEvent(const Event& event, void*) { onFileRecieveCompleted(); } void -CServer::onClipboardChanged(CBaseClientProxy* sender, +Server::onClipboardChanged(BaseClientProxy* sender, ClipboardID id, UInt32 seqNum) { - CClipboardInfo& clipboard = m_clipboards[id]; + ClipboardInfo& clipboard = m_clipboards[id]; // ignore update if sequence number is old if (seqNum < clipboard.m_clipboardSeqNum) { @@ -1512,7 +1512,7 @@ CServer::onClipboardChanged(CBaseClientProxy* sender, sender->getClipboard(id, &clipboard.m_clipboard); // ignore if data hasn't changed - CString data = clipboard.m_clipboard.marshall(); + String data = clipboard.m_clipboard.marshall(); if (data == clipboard.m_clipboardData) { LOG((CLOG_DEBUG "ignored screen \"%s\" update of clipboard %d (unchanged)", clipboard.m_clipboardOwner.c_str(), id)); return; @@ -1523,9 +1523,9 @@ CServer::onClipboardChanged(CBaseClientProxy* sender, clipboard.m_clipboardData = data; // tell all clients except the sender that the clipboard is dirty - for (CClientList::const_iterator index = m_clients.begin(); + for (ClientList::const_iterator index = m_clients.begin(); index != m_clients.end(); ++index) { - CBaseClientProxy* client = index->second; + BaseClientProxy* client = index->second; client->setClipboardDirty(id, client != sender); } @@ -1534,7 +1534,7 @@ CServer::onClipboardChanged(CBaseClientProxy* sender, } void -CServer::onScreensaver(bool activated) +Server::onScreensaver(bool activated) { LOG((CLOG_DEBUG "onScreenSaver %s", activated ? "activated" : "deactivated")); @@ -1555,7 +1555,7 @@ CServer::onScreensaver(bool activated) // changed resolutions while the screen saver was running. if (m_activeSaver != NULL && m_activeSaver != m_primaryClient) { // check position - CBaseClientProxy* screen = m_activeSaver; + BaseClientProxy* screen = m_activeSaver; SInt32 x, y, w, h; screen->getShape(x, y, w, h); SInt32 zoneSize = getJumpZoneSize(screen); @@ -1581,34 +1581,34 @@ CServer::onScreensaver(bool activated) } // send message to all clients - for (CClientList::const_iterator index = m_clients.begin(); + for (ClientList::const_iterator index = m_clients.begin(); index != m_clients.end(); ++index) { - CBaseClientProxy* client = index->second; + BaseClientProxy* client = index->second; client->screensaver(activated); } } void -CServer::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, +Server::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const char* screens) { LOG((CLOG_DEBUG1 "onKeyDown id=%d mask=0x%04x button=0x%04x", id, mask, button)); assert(m_active != NULL); // relay - if (!m_keyboardBroadcasting && IKeyState::CKeyInfo::isDefault(screens)) { + if (!m_keyboardBroadcasting && IKeyState::KeyInfo::isDefault(screens)) { m_active->keyDown(id, mask, button); } else { if (!screens && m_keyboardBroadcasting) { screens = m_keyboardBroadcastingScreens.c_str(); - if (IKeyState::CKeyInfo::isDefault(screens)) { + if (IKeyState::KeyInfo::isDefault(screens)) { screens = "*"; } } - for (CClientList::const_iterator index = m_clients.begin(); + for (ClientList::const_iterator index = m_clients.begin(); index != m_clients.end(); ++index) { - if (IKeyState::CKeyInfo::contains(screens, index->first)) { + if (IKeyState::KeyInfo::contains(screens, index->first)) { index->second->keyDown(id, mask, button); } } @@ -1616,26 +1616,26 @@ CServer::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, } void -CServer::onKeyUp(KeyID id, KeyModifierMask mask, KeyButton button, +Server::onKeyUp(KeyID id, KeyModifierMask mask, KeyButton button, const char* screens) { LOG((CLOG_DEBUG1 "onKeyUp id=%d mask=0x%04x button=0x%04x", id, mask, button)); assert(m_active != NULL); // relay - if (!m_keyboardBroadcasting && IKeyState::CKeyInfo::isDefault(screens)) { + if (!m_keyboardBroadcasting && IKeyState::KeyInfo::isDefault(screens)) { m_active->keyUp(id, mask, button); } else { if (!screens && m_keyboardBroadcasting) { screens = m_keyboardBroadcastingScreens.c_str(); - if (IKeyState::CKeyInfo::isDefault(screens)) { + if (IKeyState::KeyInfo::isDefault(screens)) { screens = "*"; } } - for (CClientList::const_iterator index = m_clients.begin(); + for (ClientList::const_iterator index = m_clients.begin(); index != m_clients.end(); ++index) { - if (IKeyState::CKeyInfo::contains(screens, index->first)) { + if (IKeyState::KeyInfo::contains(screens, index->first)) { index->second->keyUp(id, mask, button); } } @@ -1643,7 +1643,7 @@ CServer::onKeyUp(KeyID id, KeyModifierMask mask, KeyButton button, } void -CServer::onKeyRepeat(KeyID id, KeyModifierMask mask, +Server::onKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) { LOG((CLOG_DEBUG1 "onKeyRepeat id=%d mask=0x%04x count=%d button=0x%04x", id, mask, count, button)); @@ -1654,7 +1654,7 @@ CServer::onKeyRepeat(KeyID id, KeyModifierMask mask, } void -CServer::onMouseDown(ButtonID id) +Server::onMouseDown(ButtonID id) { LOG((CLOG_DEBUG1 "onMouseDown id=%d", id)); assert(m_active != NULL); @@ -1667,7 +1667,7 @@ CServer::onMouseDown(ButtonID id) } void -CServer::onMouseUp(ButtonID id) +Server::onMouseUp(ButtonID id) { LOG((CLOG_DEBUG1 "onMouseUp id=%d", id)); assert(m_active != NULL); @@ -1682,7 +1682,7 @@ CServer::onMouseUp(ButtonID id) if (m_enableDragDrop) { if (!m_screen->isOnScreen()) { - CString& file = m_screen->getDraggingFilename(); + String& file = m_screen->getDraggingFilename(); if (!file.empty()) { sendFileToClient(file.c_str()); } @@ -1694,7 +1694,7 @@ CServer::onMouseUp(ButtonID id) } bool -CServer::onMouseMovePrimary(SInt32 x, SInt32 y) +Server::onMouseMovePrimary(SInt32 x, SInt32 y) { LOG((CLOG_DEBUG4 "onMouseMovePrimary %d,%d", x, y)); @@ -1761,7 +1761,7 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y) } // get jump destination - CBaseClientProxy* newScreen = mapToNeighbor(m_active, dir, x, y); + BaseClientProxy* newScreen = mapToNeighbor(m_active, dir, x, y); // should we switch or not? if (isSwitchOkay(newScreen, dir, x, y, xc, yc)) { @@ -1770,10 +1770,10 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y) && m_active != newScreen && m_waitDragInfoThread) { if (m_getDragInfoThread == NULL) { - m_getDragInfoThread = new CThread( - new TMethodJob( + m_getDragInfoThread = new Thread( + new TMethodJob( this, - &CServer::getDragInfoThread)); + &Server::getDragInfoThread)); } return false; } @@ -1798,12 +1798,12 @@ CServer::onMouseMovePrimary(SInt32 x, SInt32 y) } void -CServer::getDragInfoThread(void*) +Server::getDragInfoThread(void*) { m_dragFileList.clear(); - CString& dragFileList = m_screen->getDraggingFilename(); + String& dragFileList = m_screen->getDraggingFilename(); if (!dragFileList.empty()) { - CDragInformation di; + DragInformation di; di.setFilename(dragFileList); m_dragFileList.push_back(di); } @@ -1821,10 +1821,10 @@ CServer::getDragInfoThread(void*) } void -CServer::sendDragInfo(CBaseClientProxy* newScreen) +Server::sendDragInfo(BaseClientProxy* newScreen) { - CString infoString; - UInt32 fileCount = CDragInformation::setupDragInfo(m_dragFileList, infoString); + String infoString; + UInt32 fileCount = DragInformation::setupDragInfo(m_dragFileList, infoString); if (fileCount > 0) { char* info = NULL; @@ -1840,7 +1840,7 @@ CServer::sendDragInfo(CBaseClientProxy* newScreen) } void -CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy) +Server::onMouseMoveSecondary(SInt32 dx, SInt32 dy) { LOG((CLOG_DEBUG2 "onMouseMoveSecondary %+d,%+d", dx, dy)); @@ -1885,7 +1885,7 @@ CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy) // find direction of neighbor and get the neighbor bool jump = true; - CBaseClientProxy* newScreen; + BaseClientProxy* newScreen; do { // clamp position to screen SInt32 xc = m_x, yc = m_y; @@ -2001,7 +2001,7 @@ CServer::onMouseMoveSecondary(SInt32 dx, SInt32 dy) } void -CServer::onMouseWheel(SInt32 xDelta, SInt32 yDelta) +Server::onMouseWheel(SInt32 xDelta, SInt32 yDelta) { LOG((CLOG_DEBUG1 "onMouseWheel %+d,%+d", xDelta, yDelta)); assert(m_active != NULL); @@ -2011,9 +2011,9 @@ CServer::onMouseWheel(SInt32 xDelta, SInt32 yDelta) } void -CServer::onFileChunkSending(const void* data) +Server::onFileChunkSending(const void* data) { - CFileChunker::CFileChunk* fileChunk = reinterpret_cast(const_cast(data)); + FileChunker::FileChunk* fileChunk = reinterpret_cast(const_cast(data)); LOG((CLOG_DEBUG1 "onFileChunkSending")); assert(m_active != NULL); @@ -2023,17 +2023,17 @@ CServer::onFileChunkSending(const void* data) } void -CServer::onFileRecieveCompleted() +Server::onFileRecieveCompleted() { if (isReceivedFileSizeValid()) { - m_writeToDropDirThread = new CThread( - new TMethodJob( - this, &CServer::writeToDropDirThread)); + m_writeToDropDirThread = new Thread( + new TMethodJob( + this, &Server::writeToDropDirThread)); } } void -CServer::writeToDropDirThread(void*) +Server::writeToDropDirThread(void*) { LOG((CLOG_DEBUG "starting write to drop dir thread")); @@ -2041,14 +2041,14 @@ CServer::writeToDropDirThread(void*) ARCH->sleep(.1f); } - CDropHelper::writeToDir(m_screen->getDropTarget(), m_dragFileList, + DropHelper::writeToDir(m_screen->getDropTarget(), m_dragFileList, m_receivedFileData); } bool -CServer::addClient(CBaseClientProxy* client) +Server::addClient(BaseClientProxy* client) { - CString name = getName(client); + String name = getName(client); if (m_clients.count(name) != 0) { return false; } @@ -2056,16 +2056,16 @@ CServer::addClient(CBaseClientProxy* client) // add event handlers m_events->adoptHandler(m_events->forIScreen().shapeChanged(), client->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleShapeChanged, client)); + new TMethodEventJob(this, + &Server::handleShapeChanged, client)); m_events->adoptHandler(m_events->forIScreen().clipboardGrabbed(), client->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleClipboardGrabbed, client)); - m_events->adoptHandler(m_events->forCClientProxy().clipboardChanged(), + new TMethodEventJob(this, + &Server::handleClipboardGrabbed, client)); + m_events->adoptHandler(m_events->forClientProxy().clipboardChanged(), client->getEventTarget(), - new TMethodEventJob(this, - &CServer::handleClipboardChanged, client)); + new TMethodEventJob(this, + &Server::handleClipboardChanged, client)); // add to list m_clientSet.insert(client); @@ -2083,10 +2083,10 @@ CServer::addClient(CBaseClientProxy* client) } bool -CServer::removeClient(CBaseClientProxy* client) +Server::removeClient(BaseClientProxy* client) { // return false if not in list - CClientSet::iterator i = m_clientSet.find(client); + ClientSet::iterator i = m_clientSet.find(client); if (i == m_clientSet.end()) { return false; } @@ -2096,7 +2096,7 @@ CServer::removeClient(CBaseClientProxy* client) client->getEventTarget()); m_events->removeHandler(m_events->forIScreen().clipboardGrabbed(), client->getEventTarget()); - m_events->removeHandler(m_events->forCClientProxy().clipboardChanged(), + m_events->removeHandler(m_events->forClientProxy().clipboardChanged(), client->getEventTarget()); // remove from list @@ -2107,7 +2107,7 @@ CServer::removeClient(CBaseClientProxy* client) } void -CServer::closeClient(CBaseClientProxy* client, const char* msg) +Server::closeClient(BaseClientProxy* client, const char* msg) { assert(client != m_primaryClient); assert(msg != NULL); @@ -2124,14 +2124,14 @@ CServer::closeClient(CBaseClientProxy* client, const char* msg) // send message // FIXME -- avoid type cast (kinda hard, though) - ((CClientProxy*)client)->close(msg); + ((ClientProxy*)client)->close(msg); // install timer. wait timeout seconds for client to close. double timeout = 5.0; - CEventQueueTimer* timer = m_events->newOneShotTimer(timeout, NULL); - m_events->adoptHandler(CEvent::kTimer, timer, - new TMethodEventJob(this, - &CServer::handleClientCloseTimeout, client)); + EventQueueTimer* timer = m_events->newOneShotTimer(timeout, NULL); + m_events->adoptHandler(Event::kTimer, timer, + new TMethodEventJob(this, + &Server::handleClientCloseTimeout, client)); // move client to closing list removeClient(client); @@ -2143,13 +2143,13 @@ CServer::closeClient(CBaseClientProxy* client, const char* msg) } void -CServer::closeClients(const CConfig& config) +Server::closeClients(const Config& config) { // collect the clients that are connected but are being dropped // from the configuration (or who's canonical name is changing). - typedef std::set CRemovedClients; - CRemovedClients removed; - for (CClientList::iterator index = m_clients.begin(); + typedef std::set RemovedClients; + RemovedClients removed; + for (ClientList::iterator index = m_clients.begin(); index != m_clients.end(); ++index) { if (!config.isCanonicalName(index->first)) { removed.insert(index->second); @@ -2161,43 +2161,43 @@ CServer::closeClients(const CConfig& config) // now close them. we collect the list then close in two steps // because closeClient() modifies the collection we iterate over. - for (CRemovedClients::iterator index = removed.begin(); + for (RemovedClients::iterator index = removed.begin(); index != removed.end(); ++index) { closeClient(*index, kMsgCClose); } } void -CServer::removeActiveClient(CBaseClientProxy* client) +Server::removeActiveClient(BaseClientProxy* client) { if (removeClient(client)) { forceLeaveClient(client); - m_events->removeHandler(m_events->forCClientProxy().disconnected(), client); + m_events->removeHandler(m_events->forClientProxy().disconnected(), client); if (m_clients.size() == 1 && m_oldClients.empty()) { - m_events->addEvent(CEvent(m_events->forCServer().disconnected(), this)); + m_events->addEvent(Event(m_events->forServer().disconnected(), this)); } } } void -CServer::removeOldClient(CBaseClientProxy* client) +Server::removeOldClient(BaseClientProxy* client) { - COldClients::iterator i = m_oldClients.find(client); + OldClients::iterator i = m_oldClients.find(client); if (i != m_oldClients.end()) { - m_events->removeHandler(m_events->forCClientProxy().disconnected(), client); - m_events->removeHandler(CEvent::kTimer, i->second); + m_events->removeHandler(m_events->forClientProxy().disconnected(), client); + m_events->removeHandler(Event::kTimer, i->second); m_events->deleteTimer(i->second); m_oldClients.erase(i); if (m_clients.size() == 1 && m_oldClients.empty()) { - m_events->addEvent(CEvent(m_events->forCServer().disconnected(), this)); + m_events->addEvent(Event(m_events->forServer().disconnected(), this)); } } } void -CServer::forceLeaveClient(CBaseClientProxy* client) +Server::forceLeaveClient(BaseClientProxy* client) { - CBaseClientProxy* active = + BaseClientProxy* active = (m_activeSaver != NULL) ? m_activeSaver : m_active; if (active == client) { // record new position (center of primary screen) @@ -2236,10 +2236,10 @@ CServer::forceLeaveClient(CBaseClientProxy* client) // -// CServer::CClipboardInfo +// Server::ClipboardInfo // -CServer::CClipboardInfo::CClipboardInfo() : +Server::ClipboardInfo::ClipboardInfo() : m_clipboard(), m_clipboardData(), m_clipboardOwner(), @@ -2250,28 +2250,28 @@ CServer::CClipboardInfo::CClipboardInfo() : // -// CServer::CLockCursorToScreenInfo +// Server::LockCursorToScreenInfo // -CServer::CLockCursorToScreenInfo* -CServer::CLockCursorToScreenInfo::alloc(State state) +Server::LockCursorToScreenInfo* +Server::LockCursorToScreenInfo::alloc(State state) { - CLockCursorToScreenInfo* info = - (CLockCursorToScreenInfo*)malloc(sizeof(CLockCursorToScreenInfo)); + LockCursorToScreenInfo* info = + (LockCursorToScreenInfo*)malloc(sizeof(LockCursorToScreenInfo)); info->m_state = state; return info; } // -// CServer::CSwitchToScreenInfo +// Server::SwitchToScreenInfo // -CServer::CSwitchToScreenInfo* -CServer::CSwitchToScreenInfo::alloc(const CString& screen) +Server::SwitchToScreenInfo* +Server::SwitchToScreenInfo::alloc(const String& screen) { - CSwitchToScreenInfo* info = - (CSwitchToScreenInfo*)malloc(sizeof(CSwitchToScreenInfo) + + SwitchToScreenInfo* info = + (SwitchToScreenInfo*)malloc(sizeof(SwitchToScreenInfo) + screen.size()); strcpy(info->m_screen, screen.c_str()); return info; @@ -2279,37 +2279,37 @@ CServer::CSwitchToScreenInfo::alloc(const CString& screen) // -// CServer::CSwitchInDirectionInfo +// Server::SwitchInDirectionInfo // -CServer::CSwitchInDirectionInfo* -CServer::CSwitchInDirectionInfo::alloc(EDirection direction) +Server::SwitchInDirectionInfo* +Server::SwitchInDirectionInfo::alloc(EDirection direction) { - CSwitchInDirectionInfo* info = - (CSwitchInDirectionInfo*)malloc(sizeof(CSwitchInDirectionInfo)); + SwitchInDirectionInfo* info = + (SwitchInDirectionInfo*)malloc(sizeof(SwitchInDirectionInfo)); info->m_direction = direction; return info; } // -// CServer::CKeyboardBroadcastInfo +// Server::KeyboardBroadcastInfo // -CServer::CKeyboardBroadcastInfo* -CServer::CKeyboardBroadcastInfo::alloc(State state) +Server::KeyboardBroadcastInfo* +Server::KeyboardBroadcastInfo::alloc(State state) { - CKeyboardBroadcastInfo* info = - (CKeyboardBroadcastInfo*)malloc(sizeof(CKeyboardBroadcastInfo)); + KeyboardBroadcastInfo* info = + (KeyboardBroadcastInfo*)malloc(sizeof(KeyboardBroadcastInfo)); info->m_state = state; info->m_screens[0] = '\0'; return info; } -CServer::CKeyboardBroadcastInfo* -CServer::CKeyboardBroadcastInfo::alloc(State state, const CString& screens) +Server::KeyboardBroadcastInfo* +Server::KeyboardBroadcastInfo::alloc(State state, const String& screens) { - CKeyboardBroadcastInfo* info = - (CKeyboardBroadcastInfo*)malloc(sizeof(CKeyboardBroadcastInfo) + + KeyboardBroadcastInfo* info = + (KeyboardBroadcastInfo*)malloc(sizeof(KeyboardBroadcastInfo) + screens.size()); info->m_state = state; strcpy(info->m_screens, screens.c_str()); @@ -2317,46 +2317,46 @@ CServer::CKeyboardBroadcastInfo::alloc(State state, const CString& screens) } void -CServer::clearReceivedFileData() +Server::clearReceivedFileData() { m_receivedFileData.clear(); } void -CServer::setExpectedFileSize(CString data) +Server::setExpectedFileSize(String data) { std::istringstream iss(data); iss >> m_expectedFileSize; } void -CServer::fileChunkReceived(CString data) +Server::fileChunkReceived(String data) { m_receivedFileData += data; } bool -CServer::isReceivedFileSizeValid() +Server::isReceivedFileSizeValid() { return m_expectedFileSize == m_receivedFileData.size(); } void -CServer::sendFileToClient(const char* filename) +Server::sendFileToClient(const char* filename) { - m_sendFileThread = new CThread( - new TMethodJob( - this, &CServer::sendFileThread, + m_sendFileThread = new Thread( + new TMethodJob( + this, &Server::sendFileThread, reinterpret_cast(const_cast(filename)))); } void -CServer::sendFileThread(void* data) +Server::sendFileThread(void* data) { try { char* filename = reinterpret_cast(data); LOG((CLOG_DEBUG "sending file to client, filename=%s", filename)); - CFileChunker::sendFileChunks(filename, m_events, this); + FileChunker::sendFileChunks(filename, m_events, this); } catch (std::runtime_error error) { LOG((CLOG_ERR "failed sending file chunks, error: %s", error.what())); @@ -2366,14 +2366,14 @@ CServer::sendFileThread(void* data) } void -CServer::dragInfoReceived(UInt32 fileNum, CString content) +Server::dragInfoReceived(UInt32 fileNum, String content) { if (!m_enableDragDrop) { LOG((CLOG_DEBUG "drag drop not enabled, ignoring drag info.")); return; } - CDragInformation::parseDragInfo(m_dragFileList, fileNum, content); + DragInformation::parseDragInfo(m_dragFileList, fileNum, content); m_screen->startDraggingFiles(m_dragFileList); } diff --git a/src/lib/server/Server.h b/src/lib/server/Server.h index 1d23b4cb..a578434e 100644 --- a/src/lib/server/Server.h +++ b/src/lib/server/Server.h @@ -32,35 +32,35 @@ #include "common/stdset.h" #include "common/stdvector.h" -class CBaseClientProxy; -class CEventQueueTimer; -class CPrimaryClient; -class CInputFilter; -class CScreen; +class BaseClientProxy; +class EventQueueTimer; +class PrimaryClient; +class InputFilter; +class Screen; class IEventQueue; -class CThread; +class Thread; //! Synergy server /*! This class implements the top-level server algorithms for synergy. */ -class CServer : public INode { +class Server : public INode { public: //! Lock cursor to screen data - class CLockCursorToScreenInfo { + class LockCursorToScreenInfo { public: enum State { kOff, kOn, kToggle }; - static CLockCursorToScreenInfo* alloc(State state = kToggle); + static LockCursorToScreenInfo* alloc(State state = kToggle); public: State m_state; }; //! Switch to screen data - class CSwitchToScreenInfo { + class SwitchToScreenInfo { public: - static CSwitchToScreenInfo* alloc(const CString& screen); + static SwitchToScreenInfo* alloc(const String& screen); public: // this is a C-string; this type is a variable size structure @@ -68,31 +68,31 @@ public: }; //! Switch in direction data - class CSwitchInDirectionInfo { + class SwitchInDirectionInfo { public: - static CSwitchInDirectionInfo* alloc(EDirection direction); + static SwitchInDirectionInfo* alloc(EDirection direction); public: EDirection m_direction; }; //! Screen connected data - class CScreenConnectedInfo { + class ScreenConnectedInfo { public: - CScreenConnectedInfo(CString screen) : m_screen(screen) { } + ScreenConnectedInfo(String screen) : m_screen(screen) { } public: - CString m_screen; // was char[1] + String m_screen; // was char[1] }; //! Keyboard broadcast data - class CKeyboardBroadcastInfo { + class KeyboardBroadcastInfo { public: enum State { kOff, kOn, kToggle }; - static CKeyboardBroadcastInfo* alloc(State state = kToggle); - static CKeyboardBroadcastInfo* alloc(State state, - const CString& screens); + static KeyboardBroadcastInfo* alloc(State state = kToggle); + static KeyboardBroadcastInfo* alloc(State state, + const String& screens); public: State m_state; @@ -104,12 +104,12 @@ public: client (local screen) \p primaryClient. The client retains ownership of \p primaryClient. */ - CServer(CConfig& config, CPrimaryClient* primaryClient, CScreen* screen, IEventQueue* events, bool enableDragDrop); - ~CServer(); + Server(Config& config, PrimaryClient* primaryClient, Screen* screen, IEventQueue* events, bool enableDragDrop); + ~Server(); #ifdef TEST_ENV - CServer() : m_mock(true), m_config(NULL) { } - void setActive(CBaseClientProxy* active) { m_active = active; } + Server() : m_mock(true), m_config(NULL) { } + void setActive(BaseClientProxy* active) { m_active = active; } #endif //! @name manipulators @@ -121,14 +121,14 @@ public: configuration was accepted (it must include the server's name). This will disconnect any clients no longer in the configuration. */ - bool setConfig(const CConfig&); + bool setConfig(const Config&); //! Add a client /*! Adds \p client to the server. The client is adopted and will be destroyed when the client disconnects or is disconnected. */ - void adoptClient(CBaseClientProxy* client); + void adoptClient(BaseClientProxy* client); //! Disconnect clients /*! @@ -143,16 +143,16 @@ public: void clearReceivedFileData(); //! Set the expected size of receiving file - void setExpectedFileSize(CString data); + void setExpectedFileSize(String data); //! Received a chunk of file data - void fileChunkReceived(CString data); + void fileChunkReceived(String data); //! Create a new thread and use it to send file to client void sendFileToClient(const char* filename); //! Received dragging information from client - void dragInfoReceived(UInt32 fileNum, CString content); + void dragInfoReceived(UInt32 fileNum, String content); //@} //! @name accessors @@ -168,7 +168,7 @@ public: /*! Set the \c list to the names of the currently connected clients. */ - void getClients(std::vector& list) const; + void getClients(std::vector& list) const; //! Return true if recieved file size is valid bool isReceivedFileSizeValid(); @@ -180,7 +180,7 @@ public: private: // get canonical name of client - CString getName(const CBaseClientProxy*) const; + String getName(const BaseClientProxy*) const; // get the sides of the primary screen that have neighbors UInt32 getActivePrimarySides() const; @@ -195,32 +195,32 @@ private: bool isLockedToScreen() const; // returns the jump zone of the client - SInt32 getJumpZoneSize(CBaseClientProxy*) const; + SInt32 getJumpZoneSize(BaseClientProxy*) const; // change the active screen - void switchScreen(CBaseClientProxy*, + void switchScreen(BaseClientProxy*, SInt32 x, SInt32 y, bool forScreenSaver); // jump to screen - void jumpToScreen(CBaseClientProxy*); + void jumpToScreen(BaseClientProxy*); // convert pixel position to fraction, using x or y depending on the // direction. - float mapToFraction(CBaseClientProxy*, EDirection, + float mapToFraction(BaseClientProxy*, EDirection, SInt32 x, SInt32 y) const; // convert fraction to pixel position, writing only x or y depending // on the direction. - void mapToPixel(CBaseClientProxy*, EDirection, float f, + void mapToPixel(BaseClientProxy*, EDirection, float f, SInt32& x, SInt32& y) const; // returns true if the client has a neighbor anywhere along the edge // indicated by the direction. - bool hasAnyNeighbor(CBaseClientProxy*, EDirection) const; + bool hasAnyNeighbor(BaseClientProxy*, EDirection) const; // lookup neighboring screen, mapping the coordinate independent of // the direction to the neighbor's coordinate space. - CBaseClientProxy* getNeighbor(CBaseClientProxy*, EDirection, + BaseClientProxy* getNeighbor(BaseClientProxy*, EDirection, SInt32& x, SInt32& y) const; // lookup neighboring screen. given a position relative to the @@ -228,18 +228,18 @@ private: // if the position is sufficiently far from the source then we // cross multiple screens. if there is no suitable screen then // return NULL and x,y are not modified. - CBaseClientProxy* mapToNeighbor(CBaseClientProxy*, EDirection, + BaseClientProxy* mapToNeighbor(BaseClientProxy*, EDirection, SInt32& x, SInt32& y) const; // adjusts x and y or neither to avoid ending up in a jump zone // after entering the client in the given direction. - void avoidJumpZone(CBaseClientProxy*, EDirection, + void avoidJumpZone(BaseClientProxy*, EDirection, SInt32& x, SInt32& y) const; // test if a switch is permitted. this includes testing user // options like switch delay and tracking any state required to // implement them. returns true iff a switch is permitted. - bool isSwitchOkay(CBaseClientProxy* dst, EDirection, + bool isSwitchOkay(BaseClientProxy* dst, EDirection, SInt32 x, SInt32 y, SInt32 xActive, SInt32 yActive); // update switch state due to a mouse move at \p x, \p y that @@ -275,46 +275,46 @@ private: // returns the corner (EScreenSwitchCornerMasks) where x,y is on the // given client. corners have the given size. - UInt32 getCorner(CBaseClientProxy*, + UInt32 getCorner(BaseClientProxy*, SInt32 x, SInt32 y, SInt32 size) const; // stop relative mouse moves void stopRelativeMoves(); // send screen options to \c client - void sendOptions(CBaseClientProxy* client) const; + void sendOptions(BaseClientProxy* client) const; // process options from configuration void processOptions(); // event handlers - void handleShapeChanged(const CEvent&, void*); - void handleClipboardGrabbed(const CEvent&, void*); - void handleClipboardChanged(const CEvent&, void*); - void handleKeyDownEvent(const CEvent&, void*); - void handleKeyUpEvent(const CEvent&, void*); - void handleKeyRepeatEvent(const CEvent&, void*); - void handleButtonDownEvent(const CEvent&, void*); - void handleButtonUpEvent(const CEvent&, void*); - void handleMotionPrimaryEvent(const CEvent&, void*); - void handleMotionSecondaryEvent(const CEvent&, void*); - void handleWheelEvent(const CEvent&, void*); - void handleScreensaverActivatedEvent(const CEvent&, void*); - void handleScreensaverDeactivatedEvent(const CEvent&, void*); - void handleSwitchWaitTimeout(const CEvent&, void*); - void handleClientDisconnected(const CEvent&, void*); - void handleClientCloseTimeout(const CEvent&, void*); - void handleSwitchToScreenEvent(const CEvent&, void*); - void handleSwitchInDirectionEvent(const CEvent&, void*); - void handleKeyboardBroadcastEvent(const CEvent&,void*); - void handleLockCursorToScreenEvent(const CEvent&, void*); - void handleFakeInputBeginEvent(const CEvent&, void*); - void handleFakeInputEndEvent(const CEvent&, void*); - void handleFileChunkSendingEvent(const CEvent&, void*); - void handleFileRecieveCompletedEvent(const CEvent&, void*); + void handleShapeChanged(const Event&, void*); + void handleClipboardGrabbed(const Event&, void*); + void handleClipboardChanged(const Event&, void*); + void handleKeyDownEvent(const Event&, void*); + void handleKeyUpEvent(const Event&, void*); + void handleKeyRepeatEvent(const Event&, void*); + void handleButtonDownEvent(const Event&, void*); + void handleButtonUpEvent(const Event&, void*); + void handleMotionPrimaryEvent(const Event&, void*); + void handleMotionSecondaryEvent(const Event&, void*); + void handleWheelEvent(const Event&, void*); + void handleScreensaverActivatedEvent(const Event&, void*); + void handleScreensaverDeactivatedEvent(const Event&, void*); + void handleSwitchWaitTimeout(const Event&, void*); + void handleClientDisconnected(const Event&, void*); + void handleClientCloseTimeout(const Event&, void*); + void handleSwitchToScreenEvent(const Event&, void*); + void handleSwitchInDirectionEvent(const Event&, void*); + void handleKeyboardBroadcastEvent(const Event&,void*); + void handleLockCursorToScreenEvent(const Event&, void*); + void handleFakeInputBeginEvent(const Event&, void*); + void handleFakeInputEndEvent(const Event&, void*); + void handleFileChunkSendingEvent(const Event&, void*); + void handleFileRecieveCompletedEvent(const Event&, void*); // event processing - void onClipboardChanged(CBaseClientProxy* sender, + void onClipboardChanged(BaseClientProxy* sender, ClipboardID id, UInt32 seqNum); void onScreensaver(bool activated); void onKeyDown(KeyID, KeyModifierMask, KeyButton, @@ -331,27 +331,27 @@ private: void onFileRecieveCompleted(); // add client to list and attach event handlers for client - bool addClient(CBaseClientProxy*); + bool addClient(BaseClientProxy*); // remove client from list and detach event handlers for client - bool removeClient(CBaseClientProxy*); + bool removeClient(BaseClientProxy*); // close a client - void closeClient(CBaseClientProxy*, const char* msg); + void closeClient(BaseClientProxy*, const char* msg); // close clients not in \p config - void closeClients(const CConfig& config); + void closeClients(const Config& config); // close all clients whether they've completed the handshake or not, // except the primary client void closeAllClients(); // remove clients from internal state - void removeActiveClient(CBaseClientProxy*); - void removeOldClient(CBaseClientProxy*); + void removeActiveClient(BaseClientProxy*); + void removeOldClient(BaseClientProxy*); // force the cursor off of \p client - void forceLeaveClient(CBaseClientProxy* client); + void forceLeaveClient(BaseClientProxy* client); // thread funciton for sending file void sendFileThread(void*); @@ -363,38 +363,38 @@ private: void getDragInfoThread(void*); // send drag info to new client screen - void sendDragInfo(CBaseClientProxy* newScreen); + void sendDragInfo(BaseClientProxy* newScreen); public: bool m_mock; private: - class CClipboardInfo { + class ClipboardInfo { public: - CClipboardInfo(); + ClipboardInfo(); public: - CClipboard m_clipboard; - CString m_clipboardData; - CString m_clipboardOwner; + Clipboard m_clipboard; + String m_clipboardData; + String m_clipboardOwner; UInt32 m_clipboardSeqNum; }; // the primary screen client - CPrimaryClient* m_primaryClient; + PrimaryClient* m_primaryClient; // all clients (including the primary client) indexed by name - typedef std::map CClientList; - typedef std::set CClientSet; - CClientList m_clients; - CClientSet m_clientSet; + typedef std::map ClientList; + typedef std::set ClientSet; + ClientList m_clients; + ClientSet m_clientSet; // all old connections that we're waiting to hangup - typedef std::map COldClients; - COldClients m_oldClients; + typedef std::map OldClients; + OldClients m_oldClients; // the client with focus - CBaseClientProxy* m_active; + BaseClientProxy* m_active; // the sequence number of enter messages UInt32 m_seqNum; @@ -411,31 +411,31 @@ private: SInt32 m_xDelta2, m_yDelta2; // current configuration - CConfig* m_config; + Config* m_config; // input filter (from m_config); - CInputFilter* m_inputFilter; + InputFilter* m_inputFilter; // clipboard cache - CClipboardInfo m_clipboards[kClipboardEnd]; + ClipboardInfo m_clipboards[kClipboardEnd]; // state saved when screen saver activates - CBaseClientProxy* m_activeSaver; + BaseClientProxy* m_activeSaver; SInt32 m_xSaver, m_ySaver; // common state for screen switch tests. all tests are always // trying to reach the same screen in the same direction. EDirection m_switchDir; - CBaseClientProxy* m_switchScreen; + BaseClientProxy* m_switchScreen; // state for delayed screen switching double m_switchWaitDelay; - CEventQueueTimer* m_switchWaitTimer; + EventQueueTimer* m_switchWaitTimer; SInt32 m_switchWaitX, m_switchWaitY; // state for double-tap screen switching double m_switchTwoTapDelay; - CStopwatch m_switchTwoTapTimer; + Stopwatch m_switchTwoTapTimer; bool m_switchTwoTapEngaged; bool m_switchTwoTapArmed; SInt32 m_switchTwoTapZone; @@ -451,26 +451,26 @@ private: // flag whether or not we have broadcasting enabled and the screens to // which we should send broadcasted keys. bool m_keyboardBroadcasting; - CString m_keyboardBroadcastingScreens; + String m_keyboardBroadcastingScreens; // screen locking (former scroll lock) bool m_lockedToScreen; // server screen - CScreen* m_screen; + Screen* m_screen; IEventQueue* m_events; // file transfer size_t m_expectedFileSize; - CString m_receivedFileData; - CDragFileList m_dragFileList; - CThread* m_sendFileThread; - CThread* m_writeToDropDirThread; - CString m_dragFileExt; + String m_receivedFileData; + DragFileList m_dragFileList; + Thread* m_sendFileThread; + Thread* m_writeToDropDirThread; + String m_dragFileExt; bool m_ignoreFileTransfer; bool m_enableDragDrop; - CThread* m_getDragInfoThread; + Thread* m_getDragInfoThread; bool m_waitDragInfoThread; }; diff --git a/src/lib/synergy/App.cpp b/src/lib/synergy/App.cpp index bbfc20cd..700ad041 100644 --- a/src/lib/synergy/App.cpp +++ b/src/lib/synergy/App.cpp @@ -50,13 +50,13 @@ #include "platform/OSXDragSimulator.h" #endif -CApp* CApp::s_instance = nullptr; +App* App::s_instance = nullptr; // -// CApp +// App // -CApp::CApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, CArgsBase* args) : +App::App(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, ArgsBase* args) : m_bye(&exit), m_taskBarReceiver(NULL), m_suspended(false), @@ -70,14 +70,14 @@ CApp::CApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, s_instance = this; } -CApp::~CApp() +App::~App() { s_instance = nullptr; delete m_args; } void -CApp::version() +App::version() { char buffer[500]; sprintf( @@ -94,7 +94,7 @@ CApp::version() } int -CApp::run(int argc, char** argv) +App::run(int argc, char** argv) { #if MAC_OS_X_VERSION_10_7 // dock hide only supported on lion :( @@ -136,28 +136,28 @@ CApp::run(int argc, char** argv) } int -CApp::daemonMainLoop(int, const char**) +App::daemonMainLoop(int, const char**) { #if SYSAPI_WIN32 - CSystemLogger sysLogger(daemonName(), false); + SystemLogger sysLogger(daemonName(), false); #else - CSystemLogger sysLogger(daemonName(), true); + SystemLogger sysLogger(daemonName(), true); #endif return mainLoop(); } void -CApp::setupFileLogging() +App::setupFileLogging() { if (argsBase().m_logFile != NULL) { - m_fileLog = new CFileLogOutputter(argsBase().m_logFile); + m_fileLog = new FileLogOutputter(argsBase().m_logFile); CLOG->insert(m_fileLog); LOG((CLOG_DEBUG1 "logging to file (%s) enabled", argsBase().m_logFile)); } } void -CApp::loggingFilterWarning() +App::loggingFilterWarning() { if (CLOG->getFilter() > CLOG->getConsoleMaxLevel()) { if (argsBase().m_logFile == NULL) { @@ -168,7 +168,7 @@ CApp::loggingFilterWarning() } void -CApp::initApp(int argc, const char** argv) +App::initApp(int argc, const char** argv) { // parse command line parseArgs(argc, argv); @@ -195,7 +195,7 @@ CApp::initApp(int argc, const char** argv) // create a log buffer so we can show the latest message // as a tray icon tooltip - CBufferedLogOutputter* logBuffer = new CBufferedLogOutputter(1000); + BufferedLogOutputter* logBuffer = new BufferedLogOutputter(1000); CLOG->insert(logBuffer, true); // make the task bar receiver. the user can control this app @@ -205,36 +205,36 @@ CApp::initApp(int argc, const char** argv) } void -CApp::initIpcClient() +App::initIpcClient() { - m_ipcClient = new CIpcClient(m_events, m_socketMultiplexer); + m_ipcClient = new IpcClient(m_events, m_socketMultiplexer); m_ipcClient->connect(); m_events->adoptHandler( - m_events->forCIpcClient().messageReceived(), m_ipcClient, - new TMethodEventJob(this, &CApp::handleIpcMessage)); + m_events->forIpcClient().messageReceived(), m_ipcClient, + new TMethodEventJob(this, &App::handleIpcMessage)); } void -CApp::cleanupIpcClient() +App::cleanupIpcClient() { m_ipcClient->disconnect(); - m_events->removeHandler(m_events->forCIpcClient().messageReceived(), m_ipcClient); + m_events->removeHandler(m_events->forIpcClient().messageReceived(), m_ipcClient); delete m_ipcClient; } void -CApp::handleIpcMessage(const CEvent& e, void*) +App::handleIpcMessage(const Event& e, void*) { - CIpcMessage* m = static_cast(e.getDataObject()); + IpcMessage* m = static_cast(e.getDataObject()); if (m->type() == kIpcShutdown) { LOG((CLOG_INFO "got ipc shutdown message")); - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } } void -CApp::runEventsLoop(void*) +App::runEventsLoop(void*) { m_events->loop(); diff --git a/src/lib/synergy/App.h b/src/lib/synergy/App.h index 6f7f28c0..059e937a 100644 --- a/src/lib/synergy/App.h +++ b/src/lib/synergy/App.h @@ -32,22 +32,22 @@ #endif class IArchTaskBarReceiver; -class CBufferedLogOutputter; +class BufferedLogOutputter; class ILogOutputter; -class CFileLogOutputter; -class CScreen; +class FileLogOutputter; +class Screen; class IEventQueue; -class CSocketMultiplexer; +class SocketMultiplexer; -typedef IArchTaskBarReceiver* (*CreateTaskBarReceiverFunc)(const CBufferedLogOutputter*, IEventQueue* events); +typedef IArchTaskBarReceiver* (*CreateTaskBarReceiverFunc)(const BufferedLogOutputter*, IEventQueue* events); -class CApp : public IApp { +class App : public IApp { public: - CApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, CArgsBase* args); - virtual ~CApp(); + App(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver, ArgsBase* args); + virtual ~App(); // Returns args that are common between server and client. - CArgsBase& argsBase() const { return *m_args; } + ArgsBase& argsBase() const { return *m_args; } // Prints the current compiled version. virtual void version(); @@ -63,7 +63,7 @@ public: int daemonMainLoop(int, const char**); virtual void loadConfig() = 0; - virtual bool loadConfig(const CString& pathname) = 0; + virtual bool loadConfig(const String& pathname) = 0; // A description of the daemon (used only on Windows). virtual const char* daemonInfo() const = 0; @@ -72,7 +72,7 @@ public: // TODO: this is old C code - use inheritance to normalize void (*m_bye)(int); - static CApp& instance() { assert(s_instance != nullptr); return *s_instance; } + static App& instance() { assert(s_instance != nullptr); return *s_instance; } // If --log was specified in args, then add a file logger. void setupFileLogging(); @@ -95,13 +95,13 @@ public: virtual IEventQueue* getEvents() const { return m_events; } - void setSocketMultiplexer(CSocketMultiplexer* sm) { m_socketMultiplexer = sm; } - CSocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer; } + void setSocketMultiplexer(SocketMultiplexer* sm) { m_socketMultiplexer = sm; } + SocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer; } void setEvents(CEventQueue& events) { m_events = &events; } private: - void handleIpcMessage(const CEvent&, void*); + void handleIpcMessage(const Event&, void*); protected: void initIpcClient(); @@ -113,13 +113,13 @@ protected: IEventQueue* m_events; private: - CArgsBase* m_args; - static CApp* s_instance; - CFileLogOutputter* m_fileLog; + ArgsBase* m_args; + static App* s_instance; + FileLogOutputter* m_fileLog; CreateTaskBarReceiverFunc m_createTaskBarReceiver; ARCH_APP_UTIL m_appUtil; - CIpcClient* m_ipcClient; - CSocketMultiplexer* m_socketMultiplexer; + IpcClient* m_ipcClient; + SocketMultiplexer* m_socketMultiplexer; }; class CMinimalApp : public CApp { @@ -147,7 +147,7 @@ private: }; #if WINAPI_MSWINDOWS -#define DAEMON_RUNNING(running_) CArchMiscWindows::daemonRunning(running_) +#define DAEMON_RUNNING(running_) ArchMiscWindows::daemonRunning(running_) #else #define DAEMON_RUNNING(running_) #endif diff --git a/src/lib/synergy/AppUtil.cpp b/src/lib/synergy/AppUtil.cpp index af60fea0..ba78d877 100644 --- a/src/lib/synergy/AppUtil.cpp +++ b/src/lib/synergy/AppUtil.cpp @@ -18,34 +18,34 @@ #include "synergy/AppUtil.h" -CAppUtil* CAppUtil::s_instance = nullptr; +AppUtil* AppUtil::s_instance = nullptr; -CAppUtil::CAppUtil() : +AppUtil::AppUtil() : m_app(nullptr) { s_instance = this; } -CAppUtil::~CAppUtil() +AppUtil::~AppUtil() { } void -CAppUtil::adoptApp(IApp* app) +AppUtil::adoptApp(IApp* app) { app->setByeFunc(&exitAppStatic); m_app = app; } IApp& -CAppUtil::app() const +AppUtil::app() const { assert(m_app != nullptr); return *m_app; } -CAppUtil& -CAppUtil::instance() +AppUtil& +AppUtil::instance() { assert(s_instance != nullptr); return *s_instance; diff --git a/src/lib/synergy/AppUtil.h b/src/lib/synergy/AppUtil.h index fa105d64..0dc629dd 100644 --- a/src/lib/synergy/AppUtil.h +++ b/src/lib/synergy/AppUtil.h @@ -21,20 +21,20 @@ #include "synergy/IAppUtil.h" #include "synergy/XSynergy.h" -class CAppUtil : public IAppUtil { +class AppUtil : public IAppUtil { public: - CAppUtil(); - virtual ~CAppUtil(); + AppUtil(); + virtual ~AppUtil(); virtual void adoptApp(IApp* app); IApp& app() const; virtual void exitApp(int code) { throw XExitApp(code); } - static CAppUtil& instance(); + static AppUtil& instance(); static void exitAppStatic(int code) { instance().exitApp(code); } virtual void beforeAppExit() {} private: IApp* m_app; - static CAppUtil* s_instance; + static AppUtil* s_instance; }; diff --git a/src/lib/synergy/ArgParser.cpp b/src/lib/synergy/ArgParser.cpp index 3b8ff6f3..639ce842 100644 --- a/src/lib/synergy/ArgParser.cpp +++ b/src/lib/synergy/ArgParser.cpp @@ -24,15 +24,15 @@ #include "synergy/ArgsBase.h" #include "base/Log.h" -CArgsBase* CArgParser::m_argsBase = NULL; +ArgsBase* ArgParser::m_argsBase = NULL; -CArgParser::CArgParser(CApp* app) : +ArgParser::ArgParser(App* app) : m_app(app) { } bool -CArgParser::parseServerArgs(CServerArgs& args, int argc, const char* const* argv) +ArgParser::parseServerArgs(ServerArgs& args, int argc, const char* const* argv) { setArgsBase(args); updateCommonArgs(argv); @@ -66,7 +66,7 @@ CArgParser::parseServerArgs(CServerArgs& args, int argc, const char* const* argv } bool -CArgParser::parseClientArgs(CClientArgs& args, int argc, const char* const* argv) +ArgParser::parseClientArgs(ClientArgs& args, int argc, const char* const* argv) { setArgsBase(args); updateCommonArgs(argv); @@ -115,7 +115,7 @@ CArgParser::parseClientArgs(CClientArgs& args, int argc, const char* const* argv } bool -CArgParser::parsePlatformArg(CArgsBase& argsBase, const int& argc, const char* const* argv, int& i) +ArgParser::parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i) { #if WINAPI_MSWINDOWS if (isArg(i, argc, argv, NULL, "--service")) { @@ -174,7 +174,7 @@ CArgParser::parseToolArgs(CToolArgs& args, int argc, const char* const* argv) } bool -CArgParser::parseGenericArgs(int argc, const char* const* argv, int& i) +ArgParser::parseGenericArgs(int argc, const char* const* argv, int& i) { if (isArg(i, argc, argv, "-d", "--debug", 1)) { // change logging level @@ -273,7 +273,7 @@ CArgParser::parseGenericArgs(int argc, const char* const* argv, int& i) } bool -CArgParser::isArg( +ArgParser::isArg( int argi, int argc, const char* const* argv, const char* name1, const char* name2, int minRequiredParameters) @@ -295,7 +295,7 @@ CArgParser::isArg( } void -CArgParser::splitCommandString(CString& command, std::vector& argv) +ArgParser::splitCommandString(String& command, std::vector& argv) { if (command.empty()) { return ; @@ -308,7 +308,7 @@ CArgParser::splitCommandString(CString& command, std::vector& argv) size_t startPos = 0; size_t space = command.find(" ", startPos); - while (space != CString::npos) { + while (space != String::npos) { bool ignoreThisSpace = false; // check if the space is between two double quotes @@ -320,7 +320,7 @@ CArgParser::splitCommandString(CString& command, std::vector& argv) } if (!ignoreThisSpace) { - CString subString = command.substr(startPos, space - startPos); + String subString = command.substr(startPos, space - startPos); removeDoubleQuotes(subString); argv.push_back(subString); @@ -336,22 +336,22 @@ CArgParser::splitCommandString(CString& command, std::vector& argv) } } - CString subString = command.substr(startPos, command.size()); + String subString = command.substr(startPos, command.size()); removeDoubleQuotes(subString); argv.push_back(subString); } bool -CArgParser::searchDoubleQuotes(CString& command, size_t& left, size_t& right, size_t startPos) +ArgParser::searchDoubleQuotes(String& command, size_t& left, size_t& right, size_t startPos) { bool result = false; - left = CString::npos; - right = CString::npos; + left = String::npos; + right = String::npos; left = command.find("\"", startPos); - if (left != CString::npos) { + if (left != String::npos) { right = command.find("\"", left + 1); - if (right != CString::npos) { + if (right != String::npos) { result = true; } } @@ -365,7 +365,7 @@ CArgParser::searchDoubleQuotes(CString& command, size_t& left, size_t& right, si } void -CArgParser::removeDoubleQuotes(CString& arg) +ArgParser::removeDoubleQuotes(String& arg) { // if string is surrounded by double quotes, remove them if (arg[0] == '\"' && @@ -375,7 +375,7 @@ CArgParser::removeDoubleQuotes(CString& arg) } const char** -CArgParser::getArgv(std::vector& argsArray) +ArgParser::getArgv(std::vector& argsArray) { size_t argc = argsArray.size(); @@ -392,19 +392,19 @@ CArgParser::getArgv(std::vector& argsArray) return argv; } -CString -CArgParser::assembleCommand(std::vector& argsArray, CString ignoreArg, int parametersRequired) +String +ArgParser::assembleCommand(std::vector& argsArray, String ignoreArg, int parametersRequired) { - CString result; + String result; - for (std::vector::iterator it = argsArray.begin(); it != argsArray.end(); ++it) { + for (std::vector::iterator it = argsArray.begin(); it != argsArray.end(); ++it) { if (it->compare(ignoreArg) == 0) { it = it + parametersRequired; continue; } // if there is a space in this arg, use double quotes surround it - if ((*it).find(" ") != CString::npos) { + if ((*it).find(" ") != String::npos) { (*it).insert(0, "\""); (*it).push_back('\"'); } @@ -423,14 +423,14 @@ CArgParser::assembleCommand(std::vector& argsArray, CString ignoreArg, } void -CArgParser::updateCommonArgs(const char* const* argv) +ArgParser::updateCommonArgs(const char* const* argv) { argsBase().m_name = ARCH->getHostName(); argsBase().m_pname = ARCH->getBasename(argv[0]); } bool -CArgParser::checkUnexpectedArgs() +ArgParser::checkUnexpectedArgs() { #if SYSAPI_WIN32 // suggest that user installs as a windows service. when launched as diff --git a/src/lib/synergy/ArgParser.h b/src/lib/synergy/ArgParser.h index 0fc56546..3ed3c025 100644 --- a/src/lib/synergy/ArgParser.h +++ b/src/lib/synergy/ArgParser.h @@ -20,43 +20,43 @@ #include "base/String.h" #include "common/stdvector.h" -class CServerArgs; -class CClientArgs; -class CToolArgs; -class CArgsBase; -class CApp; +class ServerArgs; +class ClientArgs; +class ToolArgs; +class ArgsBase; +class App; -class CArgParser { +class ArgParser { public: - CArgParser(CApp* app); + ArgParser(App* app); - bool parseServerArgs(CServerArgs& args, int argc, const char* const* argv); - bool parseClientArgs(CClientArgs& args, int argc, const char* const* argv); - bool parsePlatformArg(CArgsBase& argsBase, const int& argc, const char* const* argv, int& i); - bool parseToolArgs(CToolArgs& args, int argc, const char* const* argv); + bool parseServerArgs(ServerArgs& args, int argc, const char* const* argv); + bool parseClientArgs(ClientArgs& args, int argc, const char* const* argv); + bool parsePlatformArg(ArgsBase& argsBase, const int& argc, const char* const* argv, int& i); + bool parseToolArgs(ToolArgs& args, int argc, const char* const* argv); bool parseGenericArgs(int argc, const char* const* argv, int& i); - void setArgsBase(CArgsBase& argsBase) { m_argsBase = &argsBase; } + void setArgsBase(ArgsBase& argsBase) { m_argsBase = &argsBase; } static bool isArg(int argi, int argc, const char* const* argv, const char* name1, const char* name2, int minRequiredParameters = 0); - static void splitCommandString(CString& command, std::vector& argv); - static bool searchDoubleQuotes(CString& command, size_t& left, + static void splitCommandString(String& command, std::vector& argv); + static bool searchDoubleQuotes(String& command, size_t& left, size_t& right, size_t startPos = 0); - static void removeDoubleQuotes(CString& arg); - static const char** getArgv(std::vector& argsArray); - static CString assembleCommand(std::vector& argsArray, - CString ignoreArg = "", int parametersRequired = 0); + static void removeDoubleQuotes(String& arg); + static const char** getArgv(std::vector& argsArray); + static String assembleCommand(std::vector& argsArray, + String ignoreArg = "", int parametersRequired = 0); private: void updateCommonArgs(const char* const* argv); bool checkUnexpectedArgs(); - static CArgsBase& argsBase() { return *m_argsBase; } + static ArgsBase& argsBase() { return *m_argsBase; } private: - CApp* m_app; + App* m_app; - static CArgsBase* m_argsBase; + static ArgsBase* m_argsBase; }; diff --git a/src/lib/synergy/ArgsBase.cpp b/src/lib/synergy/ArgsBase.cpp index b03dfbc3..ecb456c9 100644 --- a/src/lib/synergy/ArgsBase.cpp +++ b/src/lib/synergy/ArgsBase.cpp @@ -18,7 +18,7 @@ #include "synergy/ArgsBase.h" -CArgsBase::CArgsBase() : +ArgsBase::ArgsBase() : #if SYSAPI_WIN32 m_daemon(false), // daemon mode not supported on windows (use --service) m_debugServiceWait(false), @@ -45,6 +45,6 @@ m_synergyAddress() { } -CArgsBase::~CArgsBase() +ArgsBase::~ArgsBase() { } diff --git a/src/lib/synergy/ArgsBase.h b/src/lib/synergy/ArgsBase.h index 4405d459..158e72ea 100644 --- a/src/lib/synergy/ArgsBase.h +++ b/src/lib/synergy/ArgsBase.h @@ -21,10 +21,10 @@ #include "base/String.h" #include "io/CryptoOptions.h" -class CArgsBase { +class ArgsBase { public: - CArgsBase(); - virtual ~CArgsBase(); + ArgsBase(); + virtual ~ArgsBase(); bool m_daemon; bool m_backend; bool m_restartable; @@ -33,10 +33,10 @@ public: const char* m_logFilter; const char* m_logFile; const char* m_display; - CString m_name; + String m_name; bool m_disableTray; bool m_enableIpc; - CCryptoOptions m_crypto; + CryptoOptions m_crypto; bool m_enableDragDrop; #if SYSAPI_WIN32 bool m_debugServiceWait; @@ -47,5 +47,5 @@ public: bool m_disableXInitThreads; #endif bool m_shouldExit; - CString m_synergyAddress; + String m_synergyAddress; }; diff --git a/src/lib/synergy/ClientApp.cpp b/src/lib/synergy/ClientApp.cpp index 0449d416..be7a828a 100644 --- a/src/lib/synergy/ClientApp.cpp +++ b/src/lib/synergy/ClientApp.cpp @@ -62,22 +62,22 @@ #define RETRY_TIME 1.0 -CClientApp::CClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) : - CApp(events, createTaskBarReceiver, new CClientArgs()), +ClientApp::ClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) : + App(events, createTaskBarReceiver, new ClientArgs()), m_client(NULL), m_clientScreen(NULL), m_serverAddress(NULL) { } -CClientApp::~CClientApp() +ClientApp::~ClientApp() { } void -CClientApp::parseArgs(int argc, const char* const* argv) +ClientApp::parseArgs(int argc, const char* const* argv) { - CArgParser argParser(this); + ArgParser argParser(this); bool result = argParser.parseClientArgs(args(), argc, argv); if (!result || args().m_shouldExit) { @@ -87,7 +87,7 @@ CClientApp::parseArgs(int argc, const char* const* argv) // save server address if (!args().m_synergyAddress.empty()) { try { - *m_serverAddress = CNetworkAddress(args().m_synergyAddress, kDefaultPort); + *m_serverAddress = NetworkAddress(args().m_synergyAddress, kDefaultPort); m_serverAddress->resolve(); } catch (XSocketAddress& e) { @@ -106,7 +106,7 @@ CClientApp::parseArgs(int argc, const char* const* argv) } void -CClientApp::help() +ClientApp::help() { #if WINAPI_XWINDOWS # define WINAPI_ARG \ @@ -150,7 +150,7 @@ CClientApp::help() } const char* -CClientApp::daemonName() const +ClientApp::daemonName() const { #if SYSAPI_WIN32 return "Synergy Client"; @@ -160,7 +160,7 @@ CClientApp::daemonName() const } const char* -CClientApp::daemonInfo() const +ClientApp::daemonInfo() const { #if SYSAPI_WIN32 return "Allows another computer to share it's keyboard and mouse with this computer."; @@ -169,30 +169,30 @@ CClientApp::daemonInfo() const #endif } -CScreen* -CClientApp::createScreen() +Screen* +ClientApp::createScreen() { #if WINAPI_MSWINDOWS - return new CScreen(new CMSWindowsScreen( + return new Screen(new CMSWindowsScreen( false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events); #elif WINAPI_XWINDOWS - return new CScreen(new CXWindowsScreen( + return new Screen(new CXWindowsScreen( args().m_display, false, args().m_disableXInitThreads, args().m_yscroll, m_events), m_events); #elif WINAPI_CARBON - return new CScreen(new COSXScreen(m_events, false), m_events); + return new Screen(new OSXScreen(m_events, false), m_events); #endif } void -CClientApp::updateStatus() +ClientApp::updateStatus() { updateStatus(""); } void -CClientApp::updateStatus(const CString& msg) +ClientApp::updateStatus(const String& msg) { if (m_taskBarReceiver) { @@ -202,7 +202,7 @@ CClientApp::updateStatus(const CString& msg) void -CClientApp::resetRestartTimeout() +ClientApp::resetRestartTimeout() { // retry time can nolonger be changed //s_retryTime = 0.0; @@ -210,7 +210,7 @@ CClientApp::resetRestartTimeout() double -CClientApp::nextRestartTimeout() +ClientApp::nextRestartTimeout() { // retry at a constant rate (Issue 52) return RETRY_TIME; @@ -233,28 +233,28 @@ CClientApp::nextRestartTimeout() void -CClientApp::handleScreenError(const CEvent&, void*) +ClientApp::handleScreenError(const Event&, void*) { LOG((CLOG_CRIT "error on screen")); - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } -CScreen* -CClientApp::openClientScreen() +Screen* +ClientApp::openClientScreen() { - CScreen* screen = createScreen(); + Screen* screen = createScreen(); screen->setEnableDragDrop(argsBase().m_enableDragDrop); m_events->adoptHandler(m_events->forIScreen().error(), screen->getEventTarget(), - new TMethodEventJob( - this, &CClientApp::handleScreenError)); + new TMethodEventJob( + this, &ClientApp::handleScreenError)); return screen; } void -CClientApp::closeClientScreen(CScreen* screen) +ClientApp::closeClientScreen(Screen* screen) { if (screen != NULL) { m_events->removeHandler(m_events->forIScreen().error(), @@ -265,12 +265,12 @@ CClientApp::closeClientScreen(CScreen* screen) void -CClientApp::handleClientRestart(const CEvent&, void* vtimer) +ClientApp::handleClientRestart(const Event&, void* vtimer) { // discard old timer - CEventQueueTimer* timer = reinterpret_cast(vtimer); + EventQueueTimer* timer = reinterpret_cast(vtimer); m_events->deleteTimer(timer); - m_events->removeHandler(CEvent::kTimer, timer); + m_events->removeHandler(Event::kTimer, timer); // reconnect startClient(); @@ -278,18 +278,18 @@ CClientApp::handleClientRestart(const CEvent&, void* vtimer) void -CClientApp::scheduleClientRestart(double retryTime) +ClientApp::scheduleClientRestart(double retryTime) { // install a timer and handler to retry later LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime)); - CEventQueueTimer* timer = m_events->newOneShotTimer(retryTime, NULL); - m_events->adoptHandler(CEvent::kTimer, timer, - new TMethodEventJob(this, &CClientApp::handleClientRestart, timer)); + EventQueueTimer* timer = m_events->newOneShotTimer(retryTime, NULL); + m_events->adoptHandler(Event::kTimer, timer, + new TMethodEventJob(this, &ClientApp::handleClientRestart, timer)); } void -CClientApp::handleClientConnected(const CEvent&, void*) +ClientApp::handleClientConnected(const Event&, void*) { LOG((CLOG_NOTE "connected to server")); resetRestartTimeout(); @@ -298,15 +298,15 @@ CClientApp::handleClientConnected(const CEvent&, void*) void -CClientApp::handleClientFailed(const CEvent& e, void*) +ClientApp::handleClientFailed(const Event& e, void*) { - CClient::CFailInfo* info = - reinterpret_cast(e.getData()); + Client::FailInfo* info = + reinterpret_cast(e.getData()); - updateStatus(CString("Failed to connect to server: ") + info->m_what); + updateStatus(String("Failed to connect to server: ") + info->m_what); if (!args().m_restartable || !info->m_retry) { LOG((CLOG_ERR "failed to connect to server: %s", info->m_what.c_str())); - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } else { LOG((CLOG_WARN "failed to connect to server: %s", info->m_what.c_str())); @@ -319,11 +319,11 @@ CClientApp::handleClientFailed(const CEvent& e, void*) void -CClientApp::handleClientDisconnected(const CEvent&, void*) +ClientApp::handleClientDisconnected(const Event&, void*) { LOG((CLOG_NOTE "disconnected from server")); if (!args().m_restartable) { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } else if (!m_suspended) { m_client->connect(); @@ -332,10 +332,10 @@ CClientApp::handleClientDisconnected(const CEvent&, void*) } -CClient* -CClientApp::openClient(const CString& name, const CNetworkAddress& address, CScreen* screen, const CCryptoOptions& crypto) +Client* +ClientApp::openClient(const String& name, const NetworkAddress& address, Screen* screen, const CryptoOptions& crypto) { - CClient* client = new CClient( + Client* client = new Client( m_events, name, address, @@ -347,19 +347,19 @@ CClientApp::openClient(const CString& name, const CNetworkAddress& address, CScr try { m_events->adoptHandler( - m_events->forCClient().connected(), + m_events->forClient().connected(), client->getEventTarget(), - new TMethodEventJob(this, &CClientApp::handleClientConnected)); + new TMethodEventJob(this, &ClientApp::handleClientConnected)); m_events->adoptHandler( - m_events->forCClient().connectionFailed(), + m_events->forClient().connectionFailed(), client->getEventTarget(), - new TMethodEventJob(this, &CClientApp::handleClientFailed)); + new TMethodEventJob(this, &ClientApp::handleClientFailed)); m_events->adoptHandler( - m_events->forCClient().disconnected(), + m_events->forClient().disconnected(), client->getEventTarget(), - new TMethodEventJob(this, &CClientApp::handleClientDisconnected)); + new TMethodEventJob(this, &ClientApp::handleClientDisconnected)); } catch (std::bad_alloc &ba) { delete client; @@ -371,20 +371,20 @@ CClientApp::openClient(const CString& name, const CNetworkAddress& address, CScr void -CClientApp::closeClient(CClient* client) +ClientApp::closeClient(Client* client) { if (client == NULL) { return; } - m_events->removeHandler(m_events->forCClient().connected(), client); - m_events->removeHandler(m_events->forCClient().connectionFailed(), client); - m_events->removeHandler(m_events->forCClient().disconnected(), client); + m_events->removeHandler(m_events->forClient().connected(), client); + m_events->removeHandler(m_events->forClient().connectionFailed(), client); + m_events->removeHandler(m_events->forClient().disconnected(), client); delete client; } int -CClientApp::foregroundStartup(int argc, char** argv) +ClientApp::foregroundStartup(int argc, char** argv) { initApp(argc, argv); @@ -393,10 +393,10 @@ CClientApp::foregroundStartup(int argc, char** argv) } bool -CClientApp::startClient() +ClientApp::startClient() { double retryTime; - CScreen* clientScreen = NULL; + Screen* clientScreen = NULL; try { if (m_clientScreen == NULL) { clientScreen = openClientScreen(); @@ -414,7 +414,7 @@ CClientApp::startClient() catch (XScreenUnavailable& e) { LOG((CLOG_WARN "secondary screen unavailable: %s", e.what())); closeClientScreen(clientScreen); - updateStatus(CString("secondary screen unavailable: ") + e.what()); + updateStatus(String("secondary screen unavailable: ") + e.what()); retryTime = e.getRetryTime(); } catch (XScreenOpenFailure& e) { @@ -440,7 +440,7 @@ CClientApp::startClient() void -CClientApp::stopClient() +ClientApp::stopClient() { closeClient(m_client); closeClientScreen(m_clientScreen); @@ -450,11 +450,11 @@ CClientApp::stopClient() int -CClientApp::mainLoop() +ClientApp::mainLoop() { // create socket multiplexer. this must happen after daemonization // on unix because threads evaporate across a fork(). - CSocketMultiplexer multiplexer; + SocketMultiplexer multiplexer; setSocketMultiplexer(&multiplexer); // start client, etc @@ -476,13 +476,13 @@ CClientApp::mainLoop() #if defined(MAC_OS_X_VERSION_10_7) - CThread thread( - new TMethodJob( - this, &CClientApp::runEventsLoop, + Thread thread( + new TMethodJob( + this, &ClientApp::runEventsLoop, NULL)); // wait until carbon loop is ready - COSXScreen* screen = dynamic_cast( + OSXScreen* screen = dynamic_cast( m_clientScreen->getPlatformScreen()); screen->waitForCarbonLoop(); @@ -510,11 +510,11 @@ static int daemonMainLoopStatic(int argc, const char** argv) { - return CClientApp::instance().daemonMainLoop(argc, argv); + return ClientApp::instance().daemonMainLoop(argc, argv); } int -CClientApp::standardStartup(int argc, char** argv) +ClientApp::standardStartup(int argc, char** argv) { initApp(argc, argv); @@ -528,10 +528,10 @@ CClientApp::standardStartup(int argc, char** argv) } int -CClientApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup) +ClientApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup) { // general initialization - m_serverAddress = new CNetworkAddress; + m_serverAddress = new NetworkAddress; args().m_pname = ARCH->getBasename(argv[0]); // install caller's output filter @@ -562,7 +562,7 @@ CClientApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFun } void -CClientApp::startNode() +ClientApp::startNode() { // start the client. if this return false then we've failed and // we shouldn't retry. diff --git a/src/lib/synergy/ClientApp.h b/src/lib/synergy/ClientApp.h index 67e83bf8..d0abe700 100644 --- a/src/lib/synergy/ClientApp.h +++ b/src/lib/synergy/ClientApp.h @@ -20,18 +20,18 @@ #include "synergy/App.h" -class CScreen; -class CEvent; -class CClient; -class CNetworkAddress; -class CThread; -class CClientArgs; -class CCryptoOptions; +class Screen; +class Event; +class Client; +class NetworkAddress; +class Thread; +class ClientArgs; +class CryptoOptions; -class CClientApp : public CApp { +class ClientApp : public App { public: - CClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver); - virtual ~CClientApp(); + ClientApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver); + virtual ~ClientApp(); // Parse client specific command line arguments. void parseArgs(int argc, const char* const* argv); @@ -40,44 +40,44 @@ public: void help(); // Returns arguments that are common and for client. - CClientArgs& args() const { return (CClientArgs&)argsBase(); } + ClientArgs& args() const { return (ClientArgs&)argsBase(); } const char* daemonName() const; const char* daemonInfo() const; // TODO: move to server only (not supported on client) void loadConfig() { } - bool loadConfig(const CString& pathname) { return false; } + bool loadConfig(const String& pathname) { return false; } int foregroundStartup(int argc, char** argv); int standardStartup(int argc, char** argv); int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup); - CScreen* createScreen(); + Screen* createScreen(); void updateStatus(); - void updateStatus(const CString& msg); + void updateStatus(const String& msg); void resetRestartTimeout(); double nextRestartTimeout(); - void handleScreenError(const CEvent&, void*); - CScreen* openClientScreen(); - void closeClientScreen(CScreen* screen); - void handleClientRestart(const CEvent&, void* vtimer); + void handleScreenError(const Event&, void*); + Screen* openClientScreen(); + void closeClientScreen(Screen* screen); + void handleClientRestart(const Event&, void* vtimer); void scheduleClientRestart(double retryTime); - void handleClientConnected(const CEvent&, void*); - void handleClientFailed(const CEvent& e, void*); - void handleClientDisconnected(const CEvent&, void*); - CClient* openClient(const CString& name, const CNetworkAddress& address, CScreen* screen, const CCryptoOptions& crypto); - void closeClient(CClient* client); + void handleClientConnected(const Event&, void*); + void handleClientFailed(const Event& e, void*); + void handleClientDisconnected(const Event&, void*); + Client* openClient(const String& name, const NetworkAddress& address, Screen* screen, const CryptoOptions& crypto); + void closeClient(Client* client); bool startClient(); void stopClient(); int mainLoop(); void startNode(); - static CClientApp& instance() { return (CClientApp&)CApp::instance(); } + static ClientApp& instance() { return (ClientApp&)App::instance(); } - CClient* getClientPtr() { return m_client; } + Client* getClientPtr() { return m_client; } private: - CClient* m_client; - CScreen* m_clientScreen; - CNetworkAddress* m_serverAddress; + Client* m_client; + Screen* m_clientScreen; + NetworkAddress* m_serverAddress; }; diff --git a/src/lib/synergy/ClientArgs.cpp b/src/lib/synergy/ClientArgs.cpp index 55a8d2b9..c997f3cc 100644 --- a/src/lib/synergy/ClientArgs.cpp +++ b/src/lib/synergy/ClientArgs.cpp @@ -17,7 +17,7 @@ #include "synergy/ClientArgs.h" -CClientArgs::CClientArgs() : +ClientArgs::ClientArgs() : m_yscroll(0) { } diff --git a/src/lib/synergy/ClientArgs.h b/src/lib/synergy/ClientArgs.h index 9c9e68af..db749b3e 100644 --- a/src/lib/synergy/ClientArgs.h +++ b/src/lib/synergy/ClientArgs.h @@ -19,11 +19,11 @@ #include "synergy/ArgsBase.h" -class CNetworkAddress; +class NetworkAddress; -class CClientArgs : public CArgsBase { +class ClientArgs : public ArgsBase { public: - CClientArgs(); + ClientArgs(); public: int m_yscroll; diff --git a/src/lib/synergy/ClientTaskBarReceiver.cpp b/src/lib/synergy/ClientTaskBarReceiver.cpp index 2c44d228..f66de096 100644 --- a/src/lib/synergy/ClientTaskBarReceiver.cpp +++ b/src/lib/synergy/ClientTaskBarReceiver.cpp @@ -25,23 +25,23 @@ #include "common/Version.h" // -// CClientTaskBarReceiver +// ClientTaskBarReceiver // -CClientTaskBarReceiver::CClientTaskBarReceiver(IEventQueue* events) : +ClientTaskBarReceiver::ClientTaskBarReceiver(IEventQueue* events) : m_state(kNotRunning), m_events(events) { // do nothing } -CClientTaskBarReceiver::~CClientTaskBarReceiver() +ClientTaskBarReceiver::~ClientTaskBarReceiver() { // do nothing } void -CClientTaskBarReceiver::updateStatus(CClient* client, const CString& errorMsg) +ClientTaskBarReceiver::updateStatus(Client* client, const String& errorMsg) { { // update our status @@ -76,44 +76,44 @@ CClientTaskBarReceiver::updateStatus(CClient* client, const CString& errorMsg) ARCH->updateReceiver(this); } -CClientTaskBarReceiver::EState -CClientTaskBarReceiver::getStatus() const +ClientTaskBarReceiver::EState +ClientTaskBarReceiver::getStatus() const { return m_state; } -const CString& -CClientTaskBarReceiver::getErrorMessage() const +const String& +ClientTaskBarReceiver::getErrorMessage() const { return m_errorMessage; } void -CClientTaskBarReceiver::quit() +ClientTaskBarReceiver::quit() { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } void -CClientTaskBarReceiver::onStatusChanged(CClient*) +ClientTaskBarReceiver::onStatusChanged(Client*) { // do nothing } void -CClientTaskBarReceiver::lock() const +ClientTaskBarReceiver::lock() const { // do nothing } void -CClientTaskBarReceiver::unlock() const +ClientTaskBarReceiver::unlock() const { // do nothing } std::string -CClientTaskBarReceiver::getToolTip() const +ClientTaskBarReceiver::getToolTip() const { switch (m_state) { case kNotRunning: diff --git a/src/lib/synergy/ClientTaskBarReceiver.h b/src/lib/synergy/ClientTaskBarReceiver.h index 969451f9..1c051646 100644 --- a/src/lib/synergy/ClientTaskBarReceiver.h +++ b/src/lib/synergy/ClientTaskBarReceiver.h @@ -27,10 +27,10 @@ class IEventQueue; //! Implementation of IArchTaskBarReceiver for the synergy server -class CClientTaskBarReceiver : public IArchTaskBarReceiver { +class ClientTaskBarReceiver : public IArchTaskBarReceiver { public: - CClientTaskBarReceiver(IEventQueue* events); - virtual ~CClientTaskBarReceiver(); + ClientTaskBarReceiver(IEventQueue* events); + virtual ~ClientTaskBarReceiver(); //! @name manipulators //@{ @@ -39,9 +39,9 @@ public: /*! Determine the status and query required information from the client. */ - void updateStatus(CClient*, const CString& errorMsg); + void updateStatus(Client*, const String& errorMsg); - void updateStatus(INode* n, const CString& errorMsg) { updateStatus((CClient*)n, errorMsg); } + void updateStatus(INode* n, const String& errorMsg) { updateStatus((Client*)n, errorMsg); } //@} @@ -69,7 +69,7 @@ protected: EState getStatus() const; //! Get error message - const CString& getErrorMessage() const; + const String& getErrorMessage() const; //! Quit app /*! @@ -81,15 +81,15 @@ protected: /*! Called when status changes. The default implementation does nothing. */ - virtual void onStatusChanged(CClient* client); + virtual void onStatusChanged(Client* client); private: EState m_state; - CString m_errorMessage; - CString m_server; + String m_errorMessage; + String m_server; IEventQueue* m_events; }; -IArchTaskBarReceiver* createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events); +IArchTaskBarReceiver* createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events); #endif diff --git a/src/lib/synergy/Clipboard.cpp b/src/lib/synergy/Clipboard.cpp index c0eded08..1f9ff7c6 100644 --- a/src/lib/synergy/Clipboard.cpp +++ b/src/lib/synergy/Clipboard.cpp @@ -19,10 +19,10 @@ #include "synergy/Clipboard.h" // -// CClipboard +// Clipboard // -CClipboard::CClipboard() : +Clipboard::Clipboard() : m_open(false), m_owner(false) { @@ -31,13 +31,13 @@ CClipboard::CClipboard() : close(); } -CClipboard::~CClipboard() +Clipboard::~Clipboard() { // do nothing } bool -CClipboard::empty() +Clipboard::empty() { assert(m_open); @@ -57,7 +57,7 @@ CClipboard::empty() } void -CClipboard::add(EFormat format, const CString& data) +Clipboard::add(EFormat format, const String& data) { assert(m_open); assert(m_owner); @@ -67,7 +67,7 @@ CClipboard::add(EFormat format, const CString& data) } bool -CClipboard::open(Time time) const +Clipboard::open(Time time) const { assert(!m_open); @@ -78,41 +78,41 @@ CClipboard::open(Time time) const } void -CClipboard::close() const +Clipboard::close() const { assert(m_open); m_open = false; } -CClipboard::Time -CClipboard::getTime() const +Clipboard::Time +Clipboard::getTime() const { return m_timeOwned; } bool -CClipboard::has(EFormat format) const +Clipboard::has(EFormat format) const { assert(m_open); return m_added[format]; } -CString -CClipboard::get(EFormat format) const +String +Clipboard::get(EFormat format) const { assert(m_open); return m_data[format]; } void -CClipboard::unmarshall(const CString& data, Time time) +Clipboard::unmarshall(const String& data, Time time) { IClipboard::unmarshall(this, data, time); } -CString -CClipboard::marshall() const +String +Clipboard::marshall() const { return IClipboard::marshall(this); } diff --git a/src/lib/synergy/Clipboard.h b/src/lib/synergy/Clipboard.h index 3c2caf2b..271148ec 100644 --- a/src/lib/synergy/Clipboard.h +++ b/src/lib/synergy/Clipboard.h @@ -24,10 +24,10 @@ /*! This class implements a clipboard that stores data in memory. */ -class CClipboard : public IClipboard { +class Clipboard : public IClipboard { public: - CClipboard(); - virtual ~CClipboard(); + Clipboard(); + virtual ~Clipboard(); //! @name manipulators //@{ @@ -37,7 +37,7 @@ public: Extract marshalled clipboard data and store it in this clipboard. Sets the clipboard time to \c time. */ - void unmarshall(const CString& data, Time time); + void unmarshall(const String& data, Time time); //@} //! @name accessors @@ -48,18 +48,18 @@ public: Merge this clipboard's data into a single buffer that can be later unmarshalled to restore the clipboard and return the buffer. */ - CString marshall() const; + String marshall() const; //@} // IClipboard overrides virtual bool empty(); - virtual void add(EFormat, const CString& data); + virtual void add(EFormat, const String& data); virtual bool open(Time) const; virtual void close() const; virtual Time getTime() const; virtual bool has(EFormat) const; - virtual CString get(EFormat) const; + virtual String get(EFormat) const; private: mutable bool m_open; @@ -67,5 +67,5 @@ private: bool m_owner; Time m_timeOwned; bool m_added[kNumFormats]; - CString m_data[kNumFormats]; + String m_data[kNumFormats]; }; diff --git a/src/lib/synergy/DaemonApp.cpp b/src/lib/synergy/DaemonApp.cpp index dbaae1d4..80378a73 100644 --- a/src/lib/synergy/DaemonApp.cpp +++ b/src/lib/synergy/DaemonApp.cpp @@ -58,12 +58,12 @@ using namespace std; -CDaemonApp* CDaemonApp::s_instance = NULL; +DaemonApp* DaemonApp::s_instance = NULL; int mainLoopStatic() { - CDaemonApp::s_instance->mainLoop(true); + DaemonApp::s_instance->mainLoop(true); return kExitSuccess; } @@ -77,11 +77,11 @@ unixMainLoopStatic(int, const char**) int winMainLoopStatic(int, const char**) { - return CArchMiscWindows::runDaemon(mainLoopStatic); + return ArchMiscWindows::runDaemon(mainLoopStatic); } #endif -CDaemonApp::CDaemonApp() : +DaemonApp::DaemonApp() : m_ipcServer(nullptr), m_ipcLogOutputter(nullptr), #if SYSAPI_WIN32 @@ -93,23 +93,23 @@ CDaemonApp::CDaemonApp() : s_instance = this; } -CDaemonApp::~CDaemonApp() +DaemonApp::~DaemonApp() { } int -CDaemonApp::run(int argc, char** argv) +DaemonApp::run(int argc, char** argv) { #if SYSAPI_WIN32 // win32 instance needed for threading, etc. - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CLog log; - CEventQueue events; + Log log; + EventQueue events; m_events = &events; bool uninstall = false; @@ -168,8 +168,8 @@ CDaemonApp::run(int argc, char** argv) return kExitSuccess; } catch (XArch& e) { - CString message = e.what(); - if (uninstall && (message.find("The service has not been started") != CString::npos)) { + String message = e.what(); + if (uninstall && (message.find("The service has not been started") != String::npos)) { // TODO: if we're keeping this use error code instead (what is it?!). // HACK: this message happens intermittently, not sure where from but // it's quite misleading for the user. they thing something has gone @@ -192,7 +192,7 @@ CDaemonApp::run(int argc, char** argv) } void -CDaemonApp::mainLoop(bool logToFile) +DaemonApp::mainLoop(bool logToFile) { try { @@ -205,13 +205,13 @@ CDaemonApp::mainLoop(bool logToFile) // create socket multiplexer. this must happen after daemonization // on unix because threads evaporate across a fork(). - CSocketMultiplexer multiplexer; + SocketMultiplexer multiplexer; // uses event queue, must be created here. - m_ipcServer = new CIpcServer(m_events, &multiplexer); + m_ipcServer = new IpcServer(m_events, &multiplexer); // send logging to gui via ipc, log system adopts outputter. - m_ipcLogOutputter = new CIpcLogOutputter(*m_ipcServer); + m_ipcLogOutputter = new IpcLogOutputter(*m_ipcServer); CLOG->insert(m_ipcLogOutputter); #if SYSAPI_WIN32 @@ -220,8 +220,8 @@ CDaemonApp::mainLoop(bool logToFile) #endif m_events->adoptHandler( - m_events->forCIpcServer().messageReceived(), m_ipcServer, - new TMethodEventJob(this, &CDaemonApp::handleIpcMessage)); + m_events->forIpcServer().messageReceived(), m_ipcServer, + new TMethodEventJob(this, &DaemonApp::handleIpcMessage)); m_ipcServer->listen(); @@ -230,7 +230,7 @@ CDaemonApp::mainLoop(bool logToFile) // install the platform event queue to handle service stop events. m_events->adoptBuffer(new CMSWindowsEventQueueBuffer(m_events)); - CString command = ARCH->setting("Command"); + String command = ARCH->setting("Command"); bool elevate = ARCH->setting("Elevate") == "1"; if (command != "") { LOG((CLOG_INFO "using last known command: %s", command.c_str())); @@ -247,7 +247,7 @@ CDaemonApp::mainLoop(bool logToFile) #endif m_events->removeHandler( - m_events->forCIpcServer().messageReceived(), m_ipcServer); + m_events->forIpcServer().messageReceived(), m_ipcServer); CLOG->remove(m_ipcLogOutputter); delete m_ipcLogOutputter; @@ -264,7 +264,7 @@ CDaemonApp::mainLoop(bool logToFile) } void -CDaemonApp::foregroundError(const char* message) +DaemonApp::foregroundError(const char* message) { #if SYSAPI_WIN32 MessageBox(NULL, message, "Synergy Service", MB_OK | MB_ICONERROR); @@ -274,7 +274,7 @@ CDaemonApp::foregroundError(const char* message) } std::string -CDaemonApp::logFilename() +DaemonApp::logFilename() { string logFilename; logFilename = ARCH->setting("LogFilename"); @@ -288,13 +288,13 @@ CDaemonApp::logFilename() } void -CDaemonApp::handleIpcMessage(const CEvent& e, void*) +DaemonApp::handleIpcMessage(const Event& e, void*) { - CIpcMessage* m = static_cast(e.getDataObject()); + IpcMessage* m = static_cast(e.getDataObject()); switch (m->type()) { case kIpcCommand: { - CIpcCommandMessage* cm = static_cast(m); - CString command = cm->command(); + IpcCommandMessage* cm = static_cast(m); + String command = cm->command(); // if empty quotes, clear. if (command == "\"\"") { @@ -304,15 +304,15 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) if (!command.empty()) { LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str())); - std::vector argsArray; - CArgParser::splitCommandString(command, argsArray); - CArgParser argParser(NULL); + std::vector argsArray; + ArgParser::splitCommandString(command, argsArray); + ArgParser argParser(NULL); const char** argv = argParser.getArgv(argsArray); - CServerArgs serverArgs; - CClientArgs clientArgs; + ServerArgs serverArgs; + ClientArgs clientArgs; int argc = static_cast(argsArray.size()); - bool server = argsArray[0].find("synergys") != CString::npos ? true : false; - CArgsBase* argBase = NULL; + bool server = argsArray[0].find("synergys") != String::npos ? true : false; + ArgsBase* argBase = NULL; if (server) { argParser.parseServerArgs(serverArgs, argc, argv); @@ -325,7 +325,7 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) delete[] argv; - CString logLevel(argBase->m_logFilter); + String logLevel(argBase->m_logFilter); if (!logLevel.empty()) { try { // change log level based on that in the command string @@ -365,7 +365,7 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) ARCH->setting("Command", command); // TODO: it would be nice to store bools/ints... - ARCH->setting("Elevate", CString(cm->elevate() ? "1" : "0")); + ARCH->setting("Elevate", String(cm->elevate() ? "1" : "0")); } catch (XArch& e) { LOG((CLOG_ERR "failed to save settings, %s", e.what())); @@ -381,8 +381,8 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) } case kIpcHello: - CIpcHelloMessage* hm = static_cast(m); - CString type; + IpcHelloMessage* hm = static_cast(m); + String type; switch (hm->clientType()) { case kIpcClientGui: type = "gui"; break; case kIpcClientNode: type = "node"; break; @@ -392,7 +392,7 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*) LOG((CLOG_DEBUG "ipc hello, type=%s", type.c_str())); #if SYSAPI_WIN32 - CString watchdogStatus = m_watchdog->isProcessActive() ? "ok" : "error"; + String watchdogStatus = m_watchdog->isProcessActive() ? "ok" : "error"; LOG((CLOG_INFO "watchdog status: %s", watchdogStatus.c_str())); #endif diff --git a/src/lib/synergy/DaemonApp.h b/src/lib/synergy/DaemonApp.h index 7de4a931..9520336d 100644 --- a/src/lib/synergy/DaemonApp.h +++ b/src/lib/synergy/DaemonApp.h @@ -23,19 +23,19 @@ #include -class CEvent; -class CIpcLogOutputter; -class CFileLogOutputter; +class Event; +class IpcLogOutputter; +class FileLogOutputter; #if SYSAPI_WIN32 class CMSWindowsWatchdog; #endif -class CDaemonApp { +class DaemonApp { public: - CDaemonApp(); - virtual ~CDaemonApp(); + DaemonApp(); + virtual ~DaemonApp(); int run(int argc, char** argv); void mainLoop(bool logToFile); @@ -43,20 +43,20 @@ private: void daemonize(); void foregroundError(const char* message); std::string logFilename(); - void handleIpcMessage(const CEvent&, void*); + void handleIpcMessage(const Event&, void*); public: - static CDaemonApp* s_instance; + static DaemonApp* s_instance; #if SYSAPI_WIN32 - CMSWindowsWatchdog* m_watchdog; + MSWindowsWatchdog* m_watchdog; #endif private: - CIpcServer* m_ipcServer; - CIpcLogOutputter* m_ipcLogOutputter; + IpcServer* m_ipcServer; + IpcLogOutputter* m_ipcLogOutputter; IEventQueue* m_events; - CFileLogOutputter* m_fileLogOutputter; + FileLogOutputter* m_fileLogOutputter; }; #define LOG_FILENAME "synergyd.log" diff --git a/src/lib/synergy/DragInformation.cpp b/src/lib/synergy/DragInformation.cpp index fe1d8b56..a96a5bbd 100644 --- a/src/lib/synergy/DragInformation.cpp +++ b/src/lib/synergy/DragInformation.cpp @@ -24,20 +24,20 @@ using namespace std; -CDragInformation::CDragInformation() : +DragInformation::DragInformation() : m_filename(), m_filesize(0) { } void -CDragInformation::parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CString data) +DragInformation::parseDragInfo(DragFileList& dragFileList, UInt32 fileNum, String data) { size_t startPos = 0; size_t findResult1 = 0; size_t findResult2 = 0; dragFileList.clear(); - CString slash("\\"); + String slash("\\"); if (data.find("/", startPos) != string::npos) { slash = "/"; } @@ -54,9 +54,9 @@ CDragInformation::parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CSt // set filename if (findResult1 - findResult2 > 1) { - CString filename = data.substr(findResult2 + 1, + String filename = data.substr(findResult2 + 1, findResult1 - findResult2 - 1); - CDragInformation di; + DragInformation di; di.setFilename(filename); dragFileList.push_back(di); } @@ -65,7 +65,7 @@ CDragInformation::parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CSt //set filesize findResult2 = data.find(',', startPos); if (findResult2 - findResult1 > 1) { - CString filesize = data.substr(findResult1 + 1, + String filesize = data.substr(findResult1 + 1, findResult2 - findResult1 - 1); size_t size = stringToNum(filesize); dragFileList.at(index).setFilesize(size); @@ -85,8 +85,8 @@ CDragInformation::parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CSt } } -CString -CDragInformation::getDragFileExtension(CString filename) +String +DragInformation::getDragFileExtension(String filename) { size_t findResult = string::npos; findResult = filename.find_last_of(".", filename.size()); @@ -99,13 +99,13 @@ CDragInformation::getDragFileExtension(CString filename) } int -CDragInformation::setupDragInfo(CDragFileList& fileList, CString& output) +DragInformation::setupDragInfo(DragFileList& fileList, String& output) { int size = fileList.size(); for (int i = 0; i < size; ++i) { output.append(fileList.at(i).getFilename()); output.append(","); - CString filesize = getFileSize(fileList.at(i).getFilename()); + String filesize = getFileSize(fileList.at(i).getFilename()); output.append(filesize); output.append(","); } @@ -113,7 +113,7 @@ CDragInformation::setupDragInfo(CDragFileList& fileList, CString& output) } bool -CDragInformation::isFileValid(CString filename) +DragInformation::isFileValid(String filename) { bool result = false; std::fstream file(filename.c_str(), ios::in|ios::binary); @@ -128,7 +128,7 @@ CDragInformation::isFileValid(CString filename) } size_t -CDragInformation::stringToNum(CString& str) +DragInformation::stringToNum(String& str) { istringstream iss(str.c_str()); size_t size; @@ -136,8 +136,8 @@ CDragInformation::stringToNum(CString& str) return size; } -CString -CDragInformation::getFileSize(CString& filename) +String +DragInformation::getFileSize(String& filename) { std::fstream file(filename.c_str(), ios::in|ios::binary); diff --git a/src/lib/synergy/DragInformation.h b/src/lib/synergy/DragInformation.h index 8b6bcc48..4605d9fc 100644 --- a/src/lib/synergy/DragInformation.h +++ b/src/lib/synergy/DragInformation.h @@ -21,33 +21,33 @@ #include "base/String.h" #include "base/EventTypes.h" -class CDragInformation; -typedef std::vector CDragFileList; +class DragInformation; +typedef std::vector DragFileList; -class CDragInformation { +class DragInformation { public: - CDragInformation(); - ~CDragInformation() { } + DragInformation(); + ~DragInformation() { } - CString& getFilename() { return m_filename; } - void setFilename(CString& name) { m_filename = name; } + String& getFilename() { return m_filename; } + void setFilename(String& name) { m_filename = name; } size_t getFilesize() { return m_filesize; } void setFilesize(size_t size) { m_filesize = size; } - static void parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CString data); - static CString getDragFileExtension(CString filename); + static void parseDragInfo(DragFileList& dragFileList, UInt32 fileNum, String data); + static String getDragFileExtension(String filename); // helper function to setup drag info // example: filename1,filesize1,filename2,filesize2, // return file count - static int setupDragInfo(CDragFileList& fileList, CString& output); + static int setupDragInfo(DragFileList& fileList, String& output); - static bool isFileValid(CString filename); + static bool isFileValid(String filename); private: - static size_t stringToNum(CString& str); - static CString getFileSize(CString& filename); + static size_t stringToNum(String& str); + static String getFileSize(String& filename); private: - CString m_filename; + String m_filename; size_t m_filesize; }; diff --git a/src/lib/synergy/DropHelper.cpp b/src/lib/synergy/DropHelper.cpp index 19d54963..c386ff5e 100644 --- a/src/lib/synergy/DropHelper.cpp +++ b/src/lib/synergy/DropHelper.cpp @@ -22,13 +22,13 @@ #include void -CDropHelper::writeToDir(const CString& destination, CDragFileList& fileList, CString& data) +DropHelper::writeToDir(const String& destination, DragFileList& fileList, String& data) { LOG((CLOG_DEBUG "dropping file, files=%i target=%s", fileList.size(), destination.c_str())); if (!destination.empty() && fileList.size() > 0) { std::fstream file; - CString dropTarget = destination; + String dropTarget = destination; #ifdef SYSAPI_WIN32 dropTarget.append("\\"); #else diff --git a/src/lib/synergy/DropHelper.h b/src/lib/synergy/DropHelper.h index afe65a31..2f23fc34 100644 --- a/src/lib/synergy/DropHelper.h +++ b/src/lib/synergy/DropHelper.h @@ -20,8 +20,8 @@ #include "synergy/DragInformation.h" #include "base/String.h" -class CDropHelper { +class DropHelper { public: - static void writeToDir(const CString& destination, - CDragFileList& fileList, CString& data); + static void writeToDir(const String& destination, + DragFileList& fileList, String& data); }; diff --git a/src/lib/synergy/FileChunker.cpp b/src/lib/synergy/FileChunker.cpp index e27ba8a5..81e4a913 100644 --- a/src/lib/synergy/FileChunker.cpp +++ b/src/lib/synergy/FileChunker.cpp @@ -33,10 +33,10 @@ using namespace std; -const size_t CFileChunker::m_chunkSize = 512 * 1024; // 512kb +const size_t FileChunker::m_chunkSize = 512 * 1024; // 512kb void -CFileChunker::sendFileChunks(char* filename, IEventQueue* events, void* eventTarget) +FileChunker::sendFileChunks(char* filename, IEventQueue* events, void* eventTarget) { std::fstream file(reinterpret_cast(filename), std::ios::in | std::ios::binary); @@ -49,20 +49,20 @@ CFileChunker::sendFileChunks(char* filename, IEventQueue* events, void* eventTar size_t size = (size_t)file.tellg(); // send first message (file size) - CString fileSize = intToString(size); + String fileSize = intToString(size); size_t sizeLength = fileSize.size(); - CFileChunk* sizeMessage = new CFileChunk(sizeLength + 2); + FileChunk* sizeMessage = new FileChunk(sizeLength + 2); char* chunkData = sizeMessage->m_chunk; chunkData[0] = kFileStart; memcpy(&chunkData[1], fileSize.c_str(), sizeLength); chunkData[sizeLength + 1] = '\0'; - events->addEvent(CEvent(events->forIScreen().fileChunkSending(), eventTarget, sizeMessage)); + events->addEvent(Event(events->forIScreen().fileChunkSending(), eventTarget, sizeMessage)); // send chunk messages with a fixed chunk size size_t sentLength = 0; size_t chunkSize = m_chunkSize; - CStopwatch stopwatch; + Stopwatch stopwatch; stopwatch.start(); file.seekg (0, std::ios::beg); while (true) { @@ -73,13 +73,13 @@ CFileChunker::sendFileChunks(char* filename, IEventQueue* events, void* eventTar } // for fileChunk->m_chunk, the first byte is the chunk mark, last is \0 - CFileChunk* fileChunk = new CFileChunk(chunkSize + 2); + FileChunk* fileChunk = new FileChunk(chunkSize + 2); char* chunkData = fileChunk->m_chunk; chunkData[0] = kFileChunk; file.read(&chunkData[1], chunkSize); chunkData[chunkSize + 1] = '\0'; - events->addEvent(CEvent(events->forIScreen().fileChunkSending(), eventTarget, fileChunk)); + events->addEvent(Event(events->forIScreen().fileChunkSending(), eventTarget, fileChunk)); sentLength += chunkSize; file.seekg (sentLength, std::ios::beg); @@ -93,18 +93,18 @@ CFileChunker::sendFileChunks(char* filename, IEventQueue* events, void* eventTar } // send last message - CFileChunk* transferFinished = new CFileChunk(2); + FileChunk* transferFinished = new FileChunk(2); chunkData = transferFinished->m_chunk; chunkData[0] = kFileEnd; chunkData[1] = '\0'; - events->addEvent(CEvent(events->forIScreen().fileChunkSending(), eventTarget, transferFinished)); + events->addEvent(Event(events->forIScreen().fileChunkSending(), eventTarget, transferFinished)); file.close(); } -CString -CFileChunker::intToString(size_t i) +String +FileChunker::intToString(size_t i) { stringstream ss; ss << i; diff --git a/src/lib/synergy/FileChunker.h b/src/lib/synergy/FileChunker.h index bafc95fa..d809ed4e 100644 --- a/src/lib/synergy/FileChunker.h +++ b/src/lib/synergy/FileChunker.h @@ -21,17 +21,17 @@ class IEventQueue; -class CFileChunker { +class FileChunker { public: //! FileChunk data - class CFileChunk { + class FileChunk { public: - CFileChunk(size_t chunkSize) : m_dataSize(chunkSize - 2) + FileChunk(size_t chunkSize) : m_dataSize(chunkSize - 2) { m_chunk = new char[chunkSize]; } - ~CFileChunk() { delete[] m_chunk; } + ~FileChunk() { delete[] m_chunk; } public: const size_t m_dataSize; @@ -39,7 +39,7 @@ public: }; static void sendFileChunks(char* filename, IEventQueue* events, void* eventTarget); - static CString intToString(size_t i); + static String intToString(size_t i); private: static const size_t m_chunkSize; diff --git a/src/lib/synergy/IApp.h b/src/lib/synergy/IApp.h index d43ca8f1..648990e6 100644 --- a/src/lib/synergy/IApp.h +++ b/src/lib/synergy/IApp.h @@ -23,16 +23,16 @@ typedef int (*StartupFunc)(int, char**); class ILogOutputter; -class CArgsBase; +class ArgsBase; class IArchTaskBarReceiver; -class CScreen; +class Screen; class IEventQueue; class IApp : public IInterface { public: virtual void setByeFunc(void(*bye)(int)) = 0; - virtual CArgsBase& argsBase() const = 0; + virtual ArgsBase& argsBase() const = 0; virtual int standardStartup(int argc, char** argv) = 0; virtual int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup) = 0; virtual void startNode() = 0; @@ -42,6 +42,6 @@ public: virtual void initApp(int argc, const char** argv) = 0; virtual const char* daemonName() const = 0; virtual int foregroundStartup(int argc, char** argv) = 0; - virtual CScreen* createScreen() = 0; + virtual Screen* createScreen() = 0; virtual IEventQueue* getEvents() const = 0; }; diff --git a/src/lib/synergy/IClient.h b/src/lib/synergy/IClient.h index 91319e9f..b80e4a65 100644 --- a/src/lib/synergy/IClient.h +++ b/src/lib/synergy/IClient.h @@ -153,7 +153,7 @@ public: Set options to given values. Ignore unknown options and don't modify our options that aren't given in \c options. */ - virtual void setOptions(const COptionsList& options) = 0; + virtual void setOptions(const OptionsList& options) = 0; //@} //! @name accessors @@ -163,7 +163,7 @@ public: /*! Return the client's name. */ - virtual CString getName() const = 0; + virtual String getName() const = 0; //@} diff --git a/src/lib/synergy/IClipboard.cpp b/src/lib/synergy/IClipboard.cpp index a03f69ee..96f9ad63 100644 --- a/src/lib/synergy/IClipboard.cpp +++ b/src/lib/synergy/IClipboard.cpp @@ -24,7 +24,7 @@ // void -IClipboard::unmarshall(IClipboard* clipboard, const CString& data, Time time) +IClipboard::unmarshall(IClipboard* clipboard, const String& data, Time time) { assert(clipboard != NULL); @@ -53,7 +53,7 @@ IClipboard::unmarshall(IClipboard* clipboard, const CString& data, Time time) // or server supports more clipboard formats than the other // then one of them will get a format >= kNumFormats here. if (format add(format, CString(index, size)); + clipboard->add(format, String(index, size)); } index += size; } @@ -62,14 +62,14 @@ IClipboard::unmarshall(IClipboard* clipboard, const CString& data, Time time) clipboard->close(); } -CString +String IClipboard::marshall(const IClipboard* clipboard) { assert(clipboard != NULL); - CString data; + String data; - std::vector formatData; + std::vector formatData; formatData.resize(IClipboard::kNumFormats); // FIXME -- use current time clipboard->open(0); @@ -150,7 +150,7 @@ IClipboard::readUInt32(const char* buf) } void -IClipboard::writeUInt32(CString* buf, UInt32 v) +IClipboard::writeUInt32(String* buf, UInt32 v) { *buf += static_cast((v >> 24) & 0xff); *buf += static_cast((v >> 16) & 0xff); diff --git a/src/lib/synergy/IClipboard.h b/src/lib/synergy/IClipboard.h index 71f2f290..4a76ec36 100644 --- a/src/lib/synergy/IClipboard.h +++ b/src/lib/synergy/IClipboard.h @@ -79,7 +79,7 @@ public: Add data in the given format to the clipboard. May only be called after a successful empty(). */ - virtual void add(EFormat, const CString& data) = 0; + virtual void add(EFormat, const String& data) = 0; //@} //! @name accessors @@ -125,14 +125,14 @@ public: if there is no data in that format. Must be called between a successful open() and close(). */ - virtual CString get(EFormat) const = 0; + virtual String get(EFormat) const = 0; //! Marshall clipboard data /*! Merge \p clipboard's data into a single buffer that can be later unmarshalled to restore the clipboard and return the buffer. */ - static CString marshall(const IClipboard* clipboard); + static String marshall(const IClipboard* clipboard); //! Unmarshall clipboard data /*! @@ -140,7 +140,7 @@ public: Sets the clipboard time to \c time. */ static void unmarshall(IClipboard* clipboard, - const CString& data, Time time); + const String& data, Time time); //! Copy clipboard /*! @@ -165,5 +165,5 @@ public: private: static UInt32 readUInt32(const char*); - static void writeUInt32(CString*, UInt32); + static void writeUInt32(String*, UInt32); }; diff --git a/src/lib/synergy/IKeyState.cpp b/src/lib/synergy/IKeyState.cpp index f79d0986..0ca7af18 100644 --- a/src/lib/synergy/IKeyState.cpp +++ b/src/lib/synergy/IKeyState.cpp @@ -31,14 +31,14 @@ IKeyState::IKeyState(IEventQueue* events) } // -// IKeyState::CKeyInfo +// IKeyState::KeyInfo // -IKeyState::CKeyInfo* -IKeyState::CKeyInfo::alloc(KeyID id, +IKeyState::KeyInfo* +IKeyState::KeyInfo::alloc(KeyID id, KeyModifierMask mask, KeyButton button, SInt32 count) { - CKeyInfo* info = (CKeyInfo*)malloc(sizeof(CKeyInfo)); + KeyInfo* info = (KeyInfo*)malloc(sizeof(KeyInfo)); info->m_key = id; info->m_mask = mask; info->m_button = button; @@ -48,15 +48,15 @@ IKeyState::CKeyInfo::alloc(KeyID id, return info; } -IKeyState::CKeyInfo* -IKeyState::CKeyInfo::alloc(KeyID id, +IKeyState::KeyInfo* +IKeyState::KeyInfo::alloc(KeyID id, KeyModifierMask mask, KeyButton button, SInt32 count, - const std::set& destinations) + const std::set& destinations) { - CString screens = join(destinations); + String screens = join(destinations); // build structure - CKeyInfo* info = (CKeyInfo*)malloc(sizeof(CKeyInfo) + screens.size()); + KeyInfo* info = (KeyInfo*)malloc(sizeof(KeyInfo) + screens.size()); info->m_key = id; info->m_mask = mask; info->m_button = button; @@ -66,10 +66,10 @@ IKeyState::CKeyInfo::alloc(KeyID id, return info; } -IKeyState::CKeyInfo* -IKeyState::CKeyInfo::alloc(const CKeyInfo& x) +IKeyState::KeyInfo* +IKeyState::KeyInfo::alloc(const KeyInfo& x) { - CKeyInfo* info = (CKeyInfo*)malloc(sizeof(CKeyInfo) + + KeyInfo* info = (KeyInfo*)malloc(sizeof(KeyInfo) + strlen(x.m_screensBuffer)); info->m_key = x.m_key; info->m_mask = x.m_mask; @@ -81,13 +81,13 @@ IKeyState::CKeyInfo::alloc(const CKeyInfo& x) } bool -IKeyState::CKeyInfo::isDefault(const char* screens) +IKeyState::KeyInfo::isDefault(const char* screens) { return (screens == NULL || screens[0] == '\0'); } bool -IKeyState::CKeyInfo::contains(const char* screens, const CString& name) +IKeyState::KeyInfo::contains(const char* screens, const String& name) { // special cases if (isDefault(screens)) { @@ -98,7 +98,7 @@ IKeyState::CKeyInfo::contains(const char* screens, const CString& name) } // search - CString match; + String match; match.reserve(name.size() + 2); match += ":"; match += name; @@ -107,7 +107,7 @@ IKeyState::CKeyInfo::contains(const char* screens, const CString& name) } bool -IKeyState::CKeyInfo::equal(const CKeyInfo* a, const CKeyInfo* b) +IKeyState::KeyInfo::equal(const KeyInfo* a, const KeyInfo* b) { return (a->m_key == b->m_key && a->m_mask == b->m_mask && @@ -116,14 +116,14 @@ IKeyState::CKeyInfo::equal(const CKeyInfo* a, const CKeyInfo* b) strcmp(a->m_screensBuffer, b->m_screensBuffer) == 0); } -CString -IKeyState::CKeyInfo::join(const std::set& destinations) +String +IKeyState::KeyInfo::join(const std::set& destinations) { // collect destinations into a string. names are surrounded by ':' // which makes searching easy. the string is empty if there are no // destinations and "*" means all destinations. - CString screens; - for (std::set::const_iterator i = destinations.begin(); + String screens; + for (std::set::const_iterator i = destinations.begin(); i != destinations.end(); ++i) { if (*i == "*") { screens = "*"; @@ -141,7 +141,7 @@ IKeyState::CKeyInfo::join(const std::set& destinations) } void -IKeyState::CKeyInfo::split(const char* screens, std::set& dst) +IKeyState::KeyInfo::split(const char* screens, std::set& dst) { dst.clear(); if (isDefault(screens)) { @@ -155,7 +155,7 @@ IKeyState::CKeyInfo::split(const char* screens, std::set& dst) const char* i = screens + 1; while (*i != '\0') { const char* j = strchr(i, ':'); - dst.insert(CString(i, j - i)); + dst.insert(String(i, j - i)); i = j + 1; } } diff --git a/src/lib/synergy/IKeyState.h b/src/lib/synergy/IKeyState.h index 66bca97f..ca800277 100644 --- a/src/lib/synergy/IKeyState.h +++ b/src/lib/synergy/IKeyState.h @@ -40,18 +40,18 @@ public: }; //! Key event data - class CKeyInfo { + class KeyInfo { public: - static CKeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count); - static CKeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count, - const std::set& destinations); - static CKeyInfo* alloc(const CKeyInfo&); + static KeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count); + static KeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count, + const std::set& destinations); + static KeyInfo* alloc(const KeyInfo&); static bool isDefault(const char* screens); - static bool contains(const char* screens, const CString& name); - static bool equal(const CKeyInfo*, const CKeyInfo*); - static CString join(const std::set& destinations); - static void split(const char* screens, std::set&); + static bool contains(const char* screens, const String& name); + static bool equal(const KeyInfo*, const KeyInfo*); + static String join(const std::set& destinations); + static void split(const char* screens, std::set&); public: KeyID m_key; diff --git a/src/lib/synergy/IPlatformScreen.h b/src/lib/synergy/IPlatformScreen.h index 3235a0c2..04745a76 100644 --- a/src/lib/synergy/IPlatformScreen.h +++ b/src/lib/synergy/IPlatformScreen.h @@ -122,7 +122,7 @@ public: Set options to given values. Ignore unknown options and don't modify options that aren't given in \c options. */ - virtual void setOptions(const COptionsList& options) = 0; + virtual void setOptions(const OptionsList& options) = 0; //! Set clipboard sequence number /*! @@ -188,13 +188,13 @@ public: virtual SInt32 pollActiveGroup() const = 0; virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const = 0; - virtual CString& getDraggingFilename() = 0; + virtual String& getDraggingFilename() = 0; virtual void clearDraggingFilename() = 0; virtual bool isDraggingStarted() = 0; virtual bool isFakeDraggingStarted() = 0; - virtual void fakeDraggingFiles(CDragFileList fileList) = 0; - virtual const CString& + virtual void fakeDraggingFiles(DragFileList fileList) = 0; + virtual const String& getDropTarget() const = 0; protected: @@ -203,7 +203,7 @@ protected: A platform screen is expected to install a handler for system events in its c'tor like so: \code - m_events->adoptHandler(CEvent::kSystem, + m_events->adoptHandler(Event::kSystem, m_events->getSystemTarget(), new TMethodEventJob(this, &CXXXPlatformScreen::handleSystemEvent)); @@ -214,13 +214,13 @@ protected: A primary screen has further responsibilities. It should post the events in \c IPrimaryScreen as appropriate. It should also - call \c onKey() on its \c CKeyState whenever a key is pressed + call \c onKey() on its \c KeyState whenever a key is pressed or released (but not for key repeats). And it should call - \c updateKeyMap() on its \c CKeyState if necessary when the keyboard + \c updateKeyMap() on its \c KeyState if necessary when the keyboard mapping changes. The target of all events should be the value returned by \c getEventTarget(). */ - virtual void handleSystemEvent(const CEvent& event, void*) = 0; + virtual void handleSystemEvent(const Event& event, void*) = 0; }; diff --git a/src/lib/synergy/IPrimaryScreen.cpp b/src/lib/synergy/IPrimaryScreen.cpp index cff475ab..6d678342 100644 --- a/src/lib/synergy/IPrimaryScreen.cpp +++ b/src/lib/synergy/IPrimaryScreen.cpp @@ -22,42 +22,42 @@ #include // -// IPrimaryScreen::CButtonInfo +// IPrimaryScreen::ButtonInfo // -IPrimaryScreen::CButtonInfo* -IPrimaryScreen::CButtonInfo::alloc(ButtonID id, KeyModifierMask mask) +IPrimaryScreen::ButtonInfo* +IPrimaryScreen::ButtonInfo::alloc(ButtonID id, KeyModifierMask mask) { - CButtonInfo* info = (CButtonInfo*)malloc(sizeof(CButtonInfo)); + ButtonInfo* info = (ButtonInfo*)malloc(sizeof(ButtonInfo)); info->m_button = id; info->m_mask = mask; return info; } -IPrimaryScreen::CButtonInfo* -IPrimaryScreen::CButtonInfo::alloc(const CButtonInfo& x) +IPrimaryScreen::ButtonInfo* +IPrimaryScreen::ButtonInfo::alloc(const ButtonInfo& x) { - CButtonInfo* info = (CButtonInfo*)malloc(sizeof(CButtonInfo)); + ButtonInfo* info = (ButtonInfo*)malloc(sizeof(ButtonInfo)); info->m_button = x.m_button; info->m_mask = x.m_mask; return info; } bool -IPrimaryScreen::CButtonInfo::equal(const CButtonInfo* a, const CButtonInfo* b) +IPrimaryScreen::ButtonInfo::equal(const ButtonInfo* a, const ButtonInfo* b) { return (a->m_button == b->m_button && a->m_mask == b->m_mask); } // -// IPrimaryScreen::CMotionInfo +// IPrimaryScreen::MotionInfo // -IPrimaryScreen::CMotionInfo* -IPrimaryScreen::CMotionInfo::alloc(SInt32 x, SInt32 y) +IPrimaryScreen::MotionInfo* +IPrimaryScreen::MotionInfo::alloc(SInt32 x, SInt32 y) { - CMotionInfo* info = (CMotionInfo*)malloc(sizeof(CMotionInfo)); + MotionInfo* info = (MotionInfo*)malloc(sizeof(MotionInfo)); info->m_x = x; info->m_y = y; return info; @@ -65,13 +65,13 @@ IPrimaryScreen::CMotionInfo::alloc(SInt32 x, SInt32 y) // -// IPrimaryScreen::CWheelInfo +// IPrimaryScreen::WheelInfo // -IPrimaryScreen::CWheelInfo* -IPrimaryScreen::CWheelInfo::alloc(SInt32 xDelta, SInt32 yDelta) +IPrimaryScreen::WheelInfo* +IPrimaryScreen::WheelInfo::alloc(SInt32 xDelta, SInt32 yDelta) { - CWheelInfo* info = (CWheelInfo*)malloc(sizeof(CWheelInfo)); + WheelInfo* info = (WheelInfo*)malloc(sizeof(WheelInfo)); info->m_xDelta = xDelta; info->m_yDelta = yDelta; return info; @@ -79,13 +79,13 @@ IPrimaryScreen::CWheelInfo::alloc(SInt32 xDelta, SInt32 yDelta) // -// IPrimaryScreen::CHotKeyInfo +// IPrimaryScreen::HotKeyInfo // -IPrimaryScreen::CHotKeyInfo* -IPrimaryScreen::CHotKeyInfo::alloc(UInt32 id) +IPrimaryScreen::HotKeyInfo* +IPrimaryScreen::HotKeyInfo::alloc(UInt32 id) { - CHotKeyInfo* info = (CHotKeyInfo*)malloc(sizeof(CHotKeyInfo)); + HotKeyInfo* info = (HotKeyInfo*)malloc(sizeof(HotKeyInfo)); info->m_id = id; return info; } diff --git a/src/lib/synergy/IPrimaryScreen.h b/src/lib/synergy/IPrimaryScreen.h index f2342e7f..f381b8b2 100644 --- a/src/lib/synergy/IPrimaryScreen.h +++ b/src/lib/synergy/IPrimaryScreen.h @@ -32,39 +32,39 @@ primary screen implementations. class IPrimaryScreen : public IInterface { public: //! Button event data - class CButtonInfo { + class ButtonInfo { public: - static CButtonInfo* alloc(ButtonID, KeyModifierMask); - static CButtonInfo* alloc(const CButtonInfo&); + static ButtonInfo* alloc(ButtonID, KeyModifierMask); + static ButtonInfo* alloc(const ButtonInfo&); - static bool equal(const CButtonInfo*, const CButtonInfo*); + static bool equal(const ButtonInfo*, const ButtonInfo*); public: ButtonID m_button; KeyModifierMask m_mask; }; //! Motion event data - class CMotionInfo { + class MotionInfo { public: - static CMotionInfo* alloc(SInt32 x, SInt32 y); + static MotionInfo* alloc(SInt32 x, SInt32 y); public: SInt32 m_x; SInt32 m_y; }; //! Wheel motion event data - class CWheelInfo { + class WheelInfo { public: - static CWheelInfo* alloc(SInt32 xDelta, SInt32 yDelta); + static WheelInfo* alloc(SInt32 xDelta, SInt32 yDelta); public: SInt32 m_xDelta; SInt32 m_yDelta; }; //! Hot key event data - class CHotKeyInfo { + class HotKeyInfo { public: - static CHotKeyInfo* alloc(UInt32 id); + static HotKeyInfo* alloc(UInt32 id); public: UInt32 m_id; diff --git a/src/lib/synergy/IScreen.h b/src/lib/synergy/IScreen.h index 3b75b5fb..435f79d3 100644 --- a/src/lib/synergy/IScreen.h +++ b/src/lib/synergy/IScreen.h @@ -31,7 +31,7 @@ This interface defines the methods common to all screens. */ class IScreen : public IInterface { public: - struct CClipboardInfo { + struct ClipboardInfo { public: ClipboardID m_id; UInt32 m_sequenceNumber; diff --git a/src/lib/synergy/KeyMap.cpp b/src/lib/synergy/KeyMap.cpp index 68cdfad8..70b275cb 100644 --- a/src/lib/synergy/KeyMap.cpp +++ b/src/lib/synergy/KeyMap.cpp @@ -24,12 +24,14 @@ #include #include -CKeyMap::CNameToKeyMap* CKeyMap::s_nameToKeyMap = NULL; -CKeyMap::CNameToModifierMap* CKeyMap::s_nameToModifierMap = NULL; -CKeyMap::CKeyToNameMap* CKeyMap::s_keyToNameMap = NULL; -CKeyMap::CModifierToNameMap* CKeyMap::s_modifierToNameMap = NULL; +namespace synergy { -CKeyMap::CKeyMap() : +KeyMap::NameToKeyMap* KeyMap::s_nameToKeyMap = NULL; +KeyMap::NameToModifierMap* KeyMap::s_nameToModifierMap = NULL; +KeyMap::KeyToNameMap* KeyMap::s_keyToNameMap = NULL; +KeyMap::ModifierToNameMap* KeyMap::s_modifierToNameMap = NULL; + +KeyMap::KeyMap() : m_numGroups(0), m_composeAcrossGroups(false) { @@ -44,13 +46,13 @@ CKeyMap::CKeyMap() : m_modifierKeyItem.m_client = 0; } -CKeyMap::~CKeyMap() +KeyMap::~KeyMap() { // do nothing } void -CKeyMap::swap(CKeyMap& x) +KeyMap::swap(KeyMap& x) { m_keyIDMap.swap(x.m_keyIDMap); m_modifierKeys.swap(x.m_modifierKeys); @@ -65,7 +67,7 @@ CKeyMap::swap(CKeyMap& x) } void -CKeyMap::addKeyEntry(const KeyItem& item) +KeyMap::addKeyEntry(const KeyItem& item) { // ignore kKeyNone if (item.m_id == kKeyNone) { @@ -107,7 +109,7 @@ CKeyMap::addKeyEntry(const KeyItem& item) } void -CKeyMap::addKeyAliasEntry(KeyID targetID, SInt32 group, +KeyMap::addKeyAliasEntry(KeyID targetID, SInt32 group, KeyModifierMask targetRequired, KeyModifierMask targetSensitive, KeyID sourceID, @@ -127,7 +129,7 @@ CKeyMap::addKeyAliasEntry(KeyID targetID, SInt32 group, findCompatibleKey(sourceID, eg, sourceRequired, sourceSensitive); if (sourceEntry != NULL && sourceEntry->size() == 1) { - CKeyMap::KeyItem targetItem = sourceEntry->back(); + KeyMap::KeyItem targetItem = sourceEntry->back(); targetItem.m_id = targetID; targetItem.m_group = eg; addKeyEntry(targetItem); @@ -137,7 +139,7 @@ CKeyMap::addKeyAliasEntry(KeyID targetID, SInt32 group, } bool -CKeyMap::addKeyCombinationEntry(KeyID id, SInt32 group, +KeyMap::addKeyCombinationEntry(KeyID id, SInt32 group, const KeyID* keys, UInt32 numKeys) { // disallow kKeyNone @@ -198,31 +200,31 @@ CKeyMap::addKeyCombinationEntry(KeyID id, SInt32 group, } void -CKeyMap::allowGroupSwitchDuringCompose() +KeyMap::allowGroupSwitchDuringCompose() { m_composeAcrossGroups = true; } void -CKeyMap::addHalfDuplexButton(KeyButton button) +KeyMap::addHalfDuplexButton(KeyButton button) { m_halfDuplex.insert(button); } void -CKeyMap::clearHalfDuplexModifiers() +KeyMap::clearHalfDuplexModifiers() { m_halfDuplexMods.clear(); } void -CKeyMap::addHalfDuplexModifier(KeyID key) +KeyMap::addHalfDuplexModifier(KeyID key) { m_halfDuplexMods.insert(key); } void -CKeyMap::finish() +KeyMap::finish() { m_numGroups = findNumGroups(); @@ -237,7 +239,7 @@ CKeyMap::finish() } void -CKeyMap::foreachKey(ForeachKeyCallback cb, void* userData) +KeyMap::foreachKey(ForeachKeyCallback cb, void* userData) { for (KeyIDMap::iterator i = m_keyIDMap.begin(); i != m_keyIDMap.end(); ++i) { @@ -255,8 +257,8 @@ CKeyMap::foreachKey(ForeachKeyCallback cb, void* userData) } } -const CKeyMap::KeyItem* -CKeyMap::mapKey(Keystrokes& keys, KeyID id, SInt32 group, +const KeyMap::KeyItem* +KeyMap::mapKey(Keystrokes& keys, KeyID id, SInt32 group, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredMask, @@ -330,19 +332,19 @@ CKeyMap::mapKey(Keystrokes& keys, KeyID id, SInt32 group, } SInt32 -CKeyMap::getNumGroups() const +KeyMap::getNumGroups() const { return m_numGroups; } SInt32 -CKeyMap::getEffectiveGroup(SInt32 group, SInt32 offset) const +KeyMap::getEffectiveGroup(SInt32 group, SInt32 offset) const { return (group + offset + getNumGroups()) % getNumGroups(); } -const CKeyMap::KeyItemList* -CKeyMap::findCompatibleKey(KeyID id, SInt32 group, +const KeyMap::KeyItemList* +KeyMap::findCompatibleKey(KeyID id, SInt32 group, KeyModifierMask required, KeyModifierMask sensitive) const { assert(group >= 0 && group < getNumGroups()); @@ -365,19 +367,19 @@ CKeyMap::findCompatibleKey(KeyID id, SInt32 group, } bool -CKeyMap::isHalfDuplex(KeyID key, KeyButton button) const +KeyMap::isHalfDuplex(KeyID key, KeyButton button) const { return (m_halfDuplex.count(button) + m_halfDuplexMods.count(key) > 0); } bool -CKeyMap::isCommand(KeyModifierMask mask) const +KeyMap::isCommand(KeyModifierMask mask) const { return ((mask & getCommandModifiers()) != 0); } KeyModifierMask -CKeyMap::getCommandModifiers() const +KeyMap::getCommandModifiers() const { // we currently treat ctrl, alt, meta and super as command modifiers. // some platforms may have a more limited set (OS X only needs Alt) @@ -390,7 +392,7 @@ CKeyMap::getCommandModifiers() const } void -CKeyMap::collectButtons(const ModifierToKeys& mods, ButtonToKeyMap& keys) +KeyMap::collectButtons(const ModifierToKeys& mods, ButtonToKeyMap& keys) { keys.clear(); for (ModifierToKeys::const_iterator i = mods.begin(); @@ -400,7 +402,7 @@ CKeyMap::collectButtons(const ModifierToKeys& mods, ButtonToKeyMap& keys) } void -CKeyMap::initModifierKey(KeyItem& item) +KeyMap::initModifierKey(KeyItem& item) { item.m_generates = 0; item.m_lock = false; @@ -456,7 +458,7 @@ CKeyMap::initModifierKey(KeyItem& item) } SInt32 -CKeyMap::findNumGroups() const +KeyMap::findNumGroups() const { size_t max = 0; for (KeyIDMap::const_iterator i = m_keyIDMap.begin(); @@ -469,7 +471,7 @@ CKeyMap::findNumGroups() const } void -CKeyMap::setModifierKeys() +KeyMap::setModifierKeys() { m_modifierKeys.clear(); m_modifierKeys.resize(kKeyModifierNumBits * getNumGroups()); @@ -503,8 +505,8 @@ CKeyMap::setModifierKeys() } } -const CKeyMap::KeyItem* -CKeyMap::mapCommandKey(Keystrokes& keys, KeyID id, SInt32 group, +const KeyMap::KeyItem* +KeyMap::mapCommandKey(Keystrokes& keys, KeyID id, SInt32 group, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredMask, @@ -593,8 +595,8 @@ CKeyMap::mapCommandKey(Keystrokes& keys, KeyID id, SInt32 group, return keyItem; } -const CKeyMap::KeyItem* -CKeyMap::mapCharacterKey(Keystrokes& keys, KeyID id, SInt32 group, +const KeyMap::KeyItem* +KeyMap::mapCharacterKey(Keystrokes& keys, KeyID id, SInt32 group, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredMask, @@ -673,8 +675,8 @@ CKeyMap::mapCharacterKey(Keystrokes& keys, KeyID id, SInt32 group, return &keyItem; } -const CKeyMap::KeyItem* -CKeyMap::mapModifierKey(Keystrokes& keys, KeyID id, SInt32 group, +const KeyMap::KeyItem* +KeyMap::mapModifierKey(Keystrokes& keys, KeyID id, SInt32 group, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredMask, @@ -685,7 +687,7 @@ CKeyMap::mapModifierKey(Keystrokes& keys, KeyID id, SInt32 group, } SInt32 -CKeyMap::findBestKey(const KeyEntryList& entryList, +KeyMap::findBestKey(const KeyEntryList& entryList, KeyModifierMask /*currentState*/, KeyModifierMask desiredState) const { @@ -720,8 +722,8 @@ CKeyMap::findBestKey(const KeyEntryList& entryList, } -const CKeyMap::KeyItem* -CKeyMap::keyForModifier(KeyButton button, SInt32 group, +const KeyMap::KeyItem* +KeyMap::keyForModifier(KeyButton button, SInt32 group, SInt32 modifierBit) const { assert(modifierBit >= 0 && modifierBit < kKeyModifierNumBits); @@ -744,7 +746,7 @@ CKeyMap::keyForModifier(KeyButton button, SInt32 group, } bool -CKeyMap::keysForKeyItem(const KeyItem& keyItem, SInt32& group, +KeyMap::keysForKeyItem(const KeyItem& keyItem, SInt32& group, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredState, KeyModifierMask overrideModifiers, @@ -817,7 +819,7 @@ CKeyMap::keysForKeyItem(const KeyItem& keyItem, SInt32& group, } bool -CKeyMap::keysToRestoreModifiers(const KeyItem& keyItem, SInt32, +KeyMap::keysToRestoreModifiers(const KeyItem& keyItem, SInt32, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, const ModifierToKeys& desiredModifiers, @@ -864,7 +866,7 @@ CKeyMap::keysToRestoreModifiers(const KeyItem& keyItem, SInt32, } bool -CKeyMap::keysForModifierState(KeyButton button, SInt32 group, +KeyMap::keysForModifierState(KeyButton button, SInt32 group, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask requiredState, KeyModifierMask sensitiveMask, @@ -959,7 +961,7 @@ CKeyMap::keysForModifierState(KeyButton button, SInt32 group, } void -CKeyMap::addKeystrokes(EKeystroke type, const KeyItem& keyItem, +KeyMap::addKeystrokes(EKeystroke type, const KeyItem& keyItem, ModifierToKeys& activeModifiers, KeyModifierMask& currentState, Keystrokes& keystrokes) const @@ -1069,7 +1071,7 @@ CKeyMap::addKeystrokes(EKeystroke type, const KeyItem& keyItem, } SInt32 -CKeyMap::getNumModifiers(KeyModifierMask state) +KeyMap::getNumModifiers(KeyModifierMask state) { SInt32 n = 0; for (; state != 0; state >>= 1) { @@ -1081,13 +1083,13 @@ CKeyMap::getNumModifiers(KeyModifierMask state) } bool -CKeyMap::isDeadKey(KeyID key) +KeyMap::isDeadKey(KeyID key) { return (key == kKeyCompose || (key >= 0x0300 && key <= 0x036f)); } KeyID -CKeyMap::getDeadKey(KeyID key) +KeyMap::getDeadKey(KeyID key) { if (isDeadKey(key)) { // already dead @@ -1144,13 +1146,13 @@ CKeyMap::getDeadKey(KeyID key) } } -CString -CKeyMap::formatKey(KeyID key, KeyModifierMask mask) +String +KeyMap::formatKey(KeyID key, KeyModifierMask mask) { // initialize tables initKeyNameMaps(); - CString x; + String x; for (SInt32 i = 0; i < kKeyModifierNumBits; ++i) { KeyModifierMask mod = (1u << i); if ((mask & mod) != 0 && s_modifierToNameMap->count(mod) > 0) { @@ -1178,7 +1180,7 @@ CKeyMap::formatKey(KeyID key, KeyModifierMask mask) } bool -CKeyMap::parseKey(const CString& x, KeyID& key) +KeyMap::parseKey(const String& x, KeyID& key) { // initialize tables initKeyNameMaps(); @@ -1213,20 +1215,20 @@ CKeyMap::parseKey(const CString& x, KeyID& key) } bool -CKeyMap::parseModifiers(CString& x, KeyModifierMask& mask) +KeyMap::parseModifiers(String& x, KeyModifierMask& mask) { // initialize tables initKeyNameMaps(); mask = 0; - CString::size_type tb = x.find_first_not_of(" \t", 0); - while (tb != CString::npos) { + String::size_type tb = x.find_first_not_of(" \t", 0); + while (tb != String::npos) { // get next component - CString::size_type te = x.find_first_of(" \t+)", tb); - if (te == CString::npos) { + String::size_type te = x.find_first_of(" \t+)", tb); + if (te == String::npos) { te = x.size(); } - CString c = x.substr(tb, te - tb); + String c = x.substr(tb, te - tb); if (c.empty()) { // missing component return false; @@ -1243,9 +1245,9 @@ CKeyMap::parseModifiers(CString& x, KeyModifierMask& mask) else { // unknown string x.erase(0, tb); - CString::size_type tb = x.find_first_not_of(" \t"); - CString::size_type te = x.find_last_not_of(" \t"); - if (tb == CString::npos) { + String::size_type tb = x.find_first_not_of(" \t"); + String::size_type te = x.find_last_not_of(" \t"); + if (tb == String::npos) { x = ""; } else { @@ -1256,7 +1258,7 @@ CKeyMap::parseModifiers(CString& x, KeyModifierMask& mask) // check for '+' or end of string tb = x.find_first_not_of(" \t", te); - if (tb != CString::npos) { + if (tb != String::npos) { if (x[tb] != '+') { // expected '+' return false; @@ -1271,20 +1273,20 @@ CKeyMap::parseModifiers(CString& x, KeyModifierMask& mask) } void -CKeyMap::initKeyNameMaps() +KeyMap::initKeyNameMaps() { // initialize tables if (s_nameToKeyMap == NULL) { - s_nameToKeyMap = new CNameToKeyMap; - s_keyToNameMap = new CKeyToNameMap; + s_nameToKeyMap = new NameToKeyMap; + s_keyToNameMap = new KeyToNameMap; for (const KeyNameMapEntry* i = kKeyNameMap; i->m_name != NULL; ++i) { (*s_nameToKeyMap)[i->m_name] = i->m_id; (*s_keyToNameMap)[i->m_id] = i->m_name; } } if (s_nameToModifierMap == NULL) { - s_nameToModifierMap = new CNameToModifierMap; - s_modifierToNameMap = new CModifierToNameMap; + s_nameToModifierMap = new NameToModifierMap; + s_modifierToNameMap = new ModifierToNameMap; for (const KeyModifierNameMapEntry* i = kModifierNameMap; i->m_name != NULL; ++i) { (*s_nameToModifierMap)[i->m_name] = i->m_mask; @@ -1295,11 +1297,11 @@ CKeyMap::initKeyNameMaps() // -// CKeyMap::KeyItem +// KeyMap::KeyItem // bool -CKeyMap::KeyItem::operator==(const KeyItem& x) const +KeyMap::KeyItem::operator==(const KeyItem& x) const { return (m_id == x.m_id && m_group == x.m_group && @@ -1314,10 +1316,10 @@ CKeyMap::KeyItem::operator==(const KeyItem& x) const // -// CKeyMap::Keystroke +// KeyMap::Keystroke // -CKeyMap::Keystroke::Keystroke(KeyButton button, +KeyMap::Keystroke::Keystroke(KeyButton button, bool press, bool repeat, UInt32 data) : m_type(kButton) { @@ -1327,10 +1329,12 @@ CKeyMap::Keystroke::Keystroke(KeyButton button, m_data.m_button.m_client = data; } -CKeyMap::Keystroke::Keystroke(SInt32 group, bool absolute, bool restore) : +KeyMap::Keystroke::Keystroke(SInt32 group, bool absolute, bool restore) : m_type(kGroup) { m_data.m_group.m_group = group; m_data.m_group.m_absolute = absolute; m_data.m_group.m_restore = restore; } + +} diff --git a/src/lib/synergy/KeyMap.h b/src/lib/synergy/KeyMap.h index 2a89eccb..0787a894 100644 --- a/src/lib/synergy/KeyMap.h +++ b/src/lib/synergy/KeyMap.h @@ -24,14 +24,16 @@ #include "common/stdset.h" #include "common/stdvector.h" +namespace synergy { + //! Key map /*! This class provides a keyboard mapping. */ -class CKeyMap { +class KeyMap { public: - CKeyMap(); - virtual ~CKeyMap(); + KeyMap(); + virtual ~KeyMap(); //! KeyID synthesis info /*! @@ -82,27 +84,27 @@ public: Keystroke(SInt32 group, bool absolute, bool restore); public: - struct CButton { + struct Button { public: KeyButton m_button; //!< Button to synthesize bool m_press; //!< \c true iff press bool m_repeat; //!< \c true iff for an autorepeat UInt32 m_client; //!< Client data }; - struct CGroup { + struct Group { public: SInt32 m_group; //!< Group/offset to change to/by bool m_absolute; //!< \c true iff change to, else by bool m_restore; //!< \c true iff for restoring state }; - union CData { + union Data { public: - CButton m_button; - CGroup m_group; + Button m_button; + Group m_group; }; EType m_type; - CData m_data; + Data m_data; }; //! A sequence of keystrokes @@ -121,8 +123,8 @@ public: //! @name manipulators //@{ - //! Swap with another \c CKeyMap - virtual void swap(CKeyMap&); + //! Swap with another \c KeyMap + virtual void swap(KeyMap&); //! Add a key entry /*! @@ -302,14 +304,14 @@ public: Converts a key and modifier mask into a string representing the combination. */ - static CString formatKey(KeyID key, KeyModifierMask); + static String formatKey(KeyID key, KeyModifierMask); //! Parse a string into a key /*! Converts a string into a key. Returns \c true on success and \c false if the string cannot be parsed. */ - static bool parseKey(const CString&, KeyID&); + static bool parseKey(const String&, KeyID&); //! Parse a string into a modifier mask /*! @@ -318,7 +320,7 @@ public: remaining leading and trailing whitespace is stripped from the input string. */ - static bool parseModifiers(CString&, KeyModifierMask&); + static bool parseModifiers(String&, KeyModifierMask&); //@} @@ -438,8 +440,8 @@ private: static void initKeyNameMaps(); // not implemented - CKeyMap(const CKeyMap&); - CKeyMap& operator=(const CKeyMap&); + KeyMap(const KeyMap&); + KeyMap& operator=(const KeyMap&); private: // Ways to synthesize a KeyID over multiple keyboard groups @@ -461,12 +463,12 @@ private: typedef std::set KeyButtonSet; // Key maps for parsing/formatting - typedef std::map CNameToKeyMap; - typedef std::map CNameToModifierMap; - typedef std::map CKeyToNameMap; - typedef std::map CModifierToNameMap; + typedef std::map NameToKeyMap; + typedef std::map NameToModifierMap; + typedef std::map KeyToNameMap; + typedef std::map ModifierToNameMap; // KeyID info KeyIDMap m_keyIDMap; @@ -484,8 +486,10 @@ private: KeyItem m_modifierKeyItem; // parsing/formatting tables - static CNameToKeyMap* s_nameToKeyMap; - static CNameToModifierMap* s_nameToModifierMap; - static CKeyToNameMap* s_keyToNameMap; - static CModifierToNameMap* s_modifierToNameMap; + static NameToKeyMap* s_nameToKeyMap; + static NameToModifierMap* s_nameToModifierMap; + static KeyToNameMap* s_keyToNameMap; + static ModifierToNameMap* s_modifierToNameMap; }; + +} diff --git a/src/lib/synergy/KeyState.cpp b/src/lib/synergy/KeyState.cpp index aad593be..0603aea6 100644 --- a/src/lib/synergy/KeyState.cpp +++ b/src/lib/synergy/KeyState.cpp @@ -380,12 +380,12 @@ static const KeyID s_numpadTable[] = { }; // -// CKeyState +// KeyState // -CKeyState::CKeyState(IEventQueue* events) : +KeyState::KeyState(IEventQueue* events) : IKeyState(events), - m_keyMapPtr(new CKeyMap()), + m_keyMapPtr(new synergy::KeyMap()), m_keyMap(*m_keyMapPtr), m_mask(0), m_events(events) @@ -393,7 +393,7 @@ CKeyState::CKeyState(IEventQueue* events) : init(); } -CKeyState::CKeyState(IEventQueue* events, CKeyMap& keyMap) : +KeyState::KeyState(IEventQueue* events, synergy::KeyMap& keyMap) : IKeyState(events), m_keyMapPtr(0), m_keyMap(keyMap), @@ -403,14 +403,14 @@ CKeyState::CKeyState(IEventQueue* events, CKeyMap& keyMap) : init(); } -CKeyState::~CKeyState() +KeyState::~KeyState() { if (m_keyMapPtr) delete m_keyMapPtr; } void -CKeyState::init() +KeyState::init() { memset(&m_keys, 0, sizeof(m_keys)); memset(&m_syntheticKeys, 0, sizeof(m_syntheticKeys)); @@ -419,7 +419,7 @@ CKeyState::init() } void -CKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState) +KeyState::onKey(KeyButton button, bool down, KeyModifierMask newState) { // update modifier state m_mask = newState; @@ -443,7 +443,7 @@ CKeyState::onKey(KeyButton button, bool down, KeyModifierMask newState) } void -CKeyState::sendKeyEvent( +KeyState::sendKeyEvent( void* target, bool press, bool isAutoRepeat, KeyID key, KeyModifierMask mask, SInt32 count, KeyButton button) @@ -453,33 +453,33 @@ CKeyState::sendKeyEvent( // ignore auto-repeat on half-duplex keys } else { - m_events->addEvent(CEvent(m_events->forIKeyState().keyDown(), target, - CKeyInfo::alloc(key, mask, button, 1))); - m_events->addEvent(CEvent(m_events->forIKeyState().keyUp(), target, - CKeyInfo::alloc(key, mask, button, 1))); + m_events->addEvent(Event(m_events->forIKeyState().keyDown(), target, + KeyInfo::alloc(key, mask, button, 1))); + m_events->addEvent(Event(m_events->forIKeyState().keyUp(), target, + KeyInfo::alloc(key, mask, button, 1))); } } else { if (isAutoRepeat) { - m_events->addEvent(CEvent(m_events->forIKeyState().keyRepeat(), target, - CKeyInfo::alloc(key, mask, button, count))); + m_events->addEvent(Event(m_events->forIKeyState().keyRepeat(), target, + KeyInfo::alloc(key, mask, button, count))); } else if (press) { - m_events->addEvent(CEvent(m_events->forIKeyState().keyDown(), target, - CKeyInfo::alloc(key, mask, button, 1))); + m_events->addEvent(Event(m_events->forIKeyState().keyDown(), target, + KeyInfo::alloc(key, mask, button, 1))); } else { - m_events->addEvent(CEvent(m_events->forIKeyState().keyUp(), target, - CKeyInfo::alloc(key, mask, button, 1))); + m_events->addEvent(Event(m_events->forIKeyState().keyUp(), target, + KeyInfo::alloc(key, mask, button, 1))); } } } void -CKeyState::updateKeyMap() +KeyState::updateKeyMap() { // get the current keyboard map - CKeyMap keyMap; + synergy::KeyMap keyMap; getKeyMap(keyMap); m_keyMap.swap(keyMap); m_keyMap.finish(); @@ -491,7 +491,7 @@ CKeyState::updateKeyMap() } void -CKeyState::updateKeyState() +KeyState::updateKeyState() { // reset our state memset(&m_keys, 0, sizeof(m_keys)); @@ -512,19 +512,19 @@ CKeyState::updateKeyState() m_mask = pollActiveModifiers(); // set active modifiers - CAddActiveModifierContext addModifierContext(pollActiveGroup(), m_mask, + AddActiveModifierContext addModifierContext(pollActiveGroup(), m_mask, m_activeModifiers); - m_keyMap.foreachKey(&CKeyState::addActiveModifierCB, &addModifierContext); + m_keyMap.foreachKey(&KeyState::addActiveModifierCB, &addModifierContext); LOG((CLOG_DEBUG1 "modifiers on update: 0x%04x", m_mask)); } void -CKeyState::addActiveModifierCB(KeyID, SInt32 group, - CKeyMap::KeyItem& keyItem, void* vcontext) +KeyState::addActiveModifierCB(KeyID, SInt32 group, + synergy::KeyMap::KeyItem& keyItem, void* vcontext) { - CAddActiveModifierContext* context = - reinterpret_cast(vcontext); + AddActiveModifierContext* context = + reinterpret_cast(vcontext); if (group == context->m_activeGroup && (keyItem.m_generates & context->m_mask) != 0) { context->m_activeModifiers.insert(std::make_pair( @@ -533,7 +533,7 @@ CKeyState::addActiveModifierCB(KeyID, SInt32 group, } void -CKeyState::setHalfDuplexMask(KeyModifierMask mask) +KeyState::setHalfDuplexMask(KeyModifierMask mask) { m_keyMap.clearHalfDuplexModifiers(); if ((mask & KeyModifierCapsLock) != 0) { @@ -548,7 +548,7 @@ CKeyState::setHalfDuplexMask(KeyModifierMask mask) } void -CKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID) +KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID) { // if this server key is already down then this is probably a // mis-reported autorepeat. @@ -567,7 +567,7 @@ CKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID) // get keys for key press Keystrokes keys; ModifierToKeys oldActiveModifiers = m_activeModifiers; - const CKeyMap::KeyItem* keyItem = + const synergy::KeyMap::KeyItem* keyItem = m_keyMap.mapKey(keys, id, pollActiveGroup(), m_activeModifiers, getActiveModifiersRValue(), mask, false); if (keyItem == NULL) { @@ -588,7 +588,7 @@ CKeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID) } bool -CKeyState::fakeKeyRepeat( +KeyState::fakeKeyRepeat( KeyID id, KeyModifierMask mask, SInt32 count, KeyButton serverID) { @@ -603,7 +603,7 @@ CKeyState::fakeKeyRepeat( // get keys for key repeat Keystrokes keys; ModifierToKeys oldActiveModifiers = m_activeModifiers; - const CKeyMap::KeyItem* keyItem = + const synergy::KeyMap::KeyItem* keyItem = m_keyMap.mapKey(keys, id, pollActiveGroup(), m_activeModifiers, getActiveModifiersRValue(), mask, true); if (keyItem == NULL) { @@ -650,7 +650,7 @@ CKeyState::fakeKeyRepeat( } bool -CKeyState::fakeKeyUp(KeyButton serverID) +KeyState::fakeKeyUp(KeyButton serverID) { // if we haven't seen this button go down then ignore it KeyButton localID = m_serverKeys[serverID & kButtonMask]; @@ -695,7 +695,7 @@ CKeyState::fakeKeyUp(KeyButton serverID) } void -CKeyState::fakeAllKeysUp() +KeyState::fakeAllKeysUp() { Keystrokes keys; for (KeyButton i = 0; i < IKeyState::kNumButtons; ++i) { @@ -712,31 +712,31 @@ CKeyState::fakeAllKeysUp() } bool -CKeyState::isKeyDown(KeyButton button) const +KeyState::isKeyDown(KeyButton button) const { return (m_keys[button & kButtonMask] > 0); } KeyModifierMask -CKeyState::getActiveModifiers() const +KeyState::getActiveModifiers() const { return m_mask; } KeyModifierMask& -CKeyState::getActiveModifiersRValue() +KeyState::getActiveModifiersRValue() { return m_mask; } SInt32 -CKeyState::getEffectiveGroup(SInt32 group, SInt32 offset) const +KeyState::getEffectiveGroup(SInt32 group, SInt32 offset) const { return m_keyMap.getEffectiveGroup(group, offset); } bool -CKeyState::isIgnoredKey(KeyID key, KeyModifierMask) const +KeyState::isIgnoredKey(KeyID key, KeyModifierMask) const { switch (key) { case kKeyCapsLock: @@ -750,9 +750,9 @@ CKeyState::isIgnoredKey(KeyID key, KeyModifierMask) const } KeyButton -CKeyState::getButton(KeyID id, SInt32 group) const +KeyState::getButton(KeyID id, SInt32 group) const { - const CKeyMap::KeyItemList* items = + const synergy::KeyMap::KeyItemList* items = m_keyMap.findCompatibleKey(id, group, 0, 0); if (items == NULL) { return 0; @@ -763,7 +763,7 @@ CKeyState::getButton(KeyID id, SInt32 group) const } void -CKeyState::addAliasEntries() +KeyState::addAliasEntries() { for (SInt32 g = 0, n = m_keyMap.getNumGroups(); g < n; ++g) { // if we can't shift any kKeyTab key in a particular group but we can @@ -787,7 +787,7 @@ CKeyState::addAliasEntries() } void -CKeyState::addKeypadEntries() +KeyState::addKeypadEntries() { // map every numpad key to its equivalent non-numpad key if it's not // on the keyboard. @@ -801,7 +801,7 @@ CKeyState::addKeypadEntries() } void -CKeyState::addCombinationEntries() +KeyState::addCombinationEntries() { for (SInt32 g = 0, n = m_keyMap.getNumGroups(); g < n; ++g) { // add dead and compose key composition sequences @@ -822,7 +822,7 @@ CKeyState::addCombinationEntries() } void -CKeyState::fakeKeys(const Keystrokes& keys, UInt32 count) +KeyState::fakeKeys(const Keystrokes& keys, UInt32 count) { // do nothing if no keys or no repeats if (count == 0 || keys.empty()) { @@ -859,12 +859,12 @@ CKeyState::fakeKeys(const Keystrokes& keys, UInt32 count) } void -CKeyState::updateModifierKeyState(KeyButton button, +KeyState::updateModifierKeyState(KeyButton button, const ModifierToKeys& oldModifiers, const ModifierToKeys& newModifiers) { // get the pressed modifier buttons before and after - CKeyMap::ButtonToKeyMap oldKeys, newKeys; + synergy::KeyMap::ButtonToKeyMap oldKeys, newKeys; for (ModifierToKeys::const_iterator i = oldModifiers.begin(); i != oldModifiers.end(); ++i) { oldKeys.insert(std::make_pair(i->second.m_button, &i->second)); @@ -875,7 +875,7 @@ CKeyState::updateModifierKeyState(KeyButton button, } // get the modifier buttons that were pressed or released - CKeyMap::ButtonToKeyMap pressed, released; + synergy::KeyMap::ButtonToKeyMap pressed, released; std::set_difference(oldKeys.begin(), oldKeys.end(), newKeys.begin(), newKeys.end(), std::inserter(released, released.end()), @@ -886,14 +886,14 @@ CKeyState::updateModifierKeyState(KeyButton button, ButtonToKeyLess()); // update state - for (CKeyMap::ButtonToKeyMap::const_iterator i = released.begin(); + for (synergy::KeyMap::ButtonToKeyMap::const_iterator i = released.begin(); i != released.end(); ++i) { if (i->first != button) { m_keys[i->first] = 0; m_syntheticKeys[i->first] = 0; } } - for (CKeyMap::ButtonToKeyMap::const_iterator i = pressed.begin(); + for (synergy::KeyMap::ButtonToKeyMap::const_iterator i = pressed.begin(); i != pressed.end(); ++i) { if (i->first != button) { m_keys[i->first] = 1; @@ -904,10 +904,10 @@ CKeyState::updateModifierKeyState(KeyButton button, } // -// CKeyState::CAddActiveModifierContext +// KeyState::AddActiveModifierContext // -CKeyState::CAddActiveModifierContext::CAddActiveModifierContext( +KeyState::AddActiveModifierContext::AddActiveModifierContext( SInt32 group, KeyModifierMask mask, ModifierToKeys& activeModifiers) : m_activeGroup(group), diff --git a/src/lib/synergy/KeyState.h b/src/lib/synergy/KeyState.h index 7092bdb6..8b549063 100644 --- a/src/lib/synergy/KeyState.h +++ b/src/lib/synergy/KeyState.h @@ -26,11 +26,11 @@ This class provides key state services. Subclasses must implement a few platform specific methods. */ -class CKeyState : public IKeyState { +class KeyState : public IKeyState { public: - CKeyState(IEventQueue* events); - CKeyState(IEventQueue* events, CKeyMap& keyMap); - virtual ~CKeyState(); + KeyState(IEventQueue* events); + KeyState(IEventQueue* events, synergy::KeyMap& keyMap); + virtual ~KeyState(); //! @name manipulators //@{ @@ -84,7 +84,7 @@ public: SInt32 getKeyState(KeyButton keyButton) { return m_keys[keyButton]; } protected: - typedef CKeyMap::Keystroke Keystroke; + typedef synergy::KeyMap::Keystroke Keystroke; //! @name protected manipulators //@{ @@ -93,7 +93,7 @@ protected: /*! Fills \p keyMap with the current keyboard map. */ - virtual void getKeyMap(CKeyMap& keyMap) = 0; + virtual void getKeyMap(synergy::KeyMap& keyMap) = 0; //! Fake a key event /*! @@ -136,12 +136,12 @@ protected: //@} private: - typedef CKeyMap::Keystrokes Keystrokes; - typedef CKeyMap::ModifierToKeys ModifierToKeys; + typedef synergy::KeyMap::Keystrokes Keystrokes; + typedef synergy::KeyMap::ModifierToKeys ModifierToKeys; public: - struct CAddActiveModifierContext { + struct AddActiveModifierContext { public: - CAddActiveModifierContext(SInt32 group, KeyModifierMask mask, + AddActiveModifierContext(SInt32 group, KeyModifierMask mask, ModifierToKeys& activeModifiers); public: @@ -151,23 +151,23 @@ public: private: // not implemented - CAddActiveModifierContext(const CAddActiveModifierContext&); - CAddActiveModifierContext& operator=(const CAddActiveModifierContext&); + AddActiveModifierContext(const AddActiveModifierContext&); + AddActiveModifierContext& operator=(const AddActiveModifierContext&); }; private: class ButtonToKeyLess { public: - bool operator()(const CKeyMap::ButtonToKeyMap::value_type& a, - const CKeyMap::ButtonToKeyMap::value_type b) const + bool operator()(const synergy::KeyMap::ButtonToKeyMap::value_type& a, + const synergy::KeyMap::ButtonToKeyMap::value_type b) const { return (a.first < b.first); } }; // not implemented - CKeyState(const CKeyState&); - CKeyState& operator=(const CKeyState&); + KeyState(const KeyState&); + KeyState& operator=(const KeyState&); // called by all ctors. void init(); @@ -193,14 +193,14 @@ private: // active modifiers collection callback static void addActiveModifierCB(KeyID id, SInt32 group, - CKeyMap::KeyItem& keyItem, void* vcontext); + synergy::KeyMap::KeyItem& keyItem, void* vcontext); private: // must be declared before m_keyMap. used when this class owns the key map. - CKeyMap* m_keyMapPtr; + synergy::KeyMap* m_keyMapPtr; // the keyboard map - CKeyMap& m_keyMap; + synergy::KeyMap& m_keyMap; // current modifier state KeyModifierMask m_mask; diff --git a/src/lib/synergy/PacketStreamFilter.cpp b/src/lib/synergy/PacketStreamFilter.cpp index cb7e4d6d..2ce6ac21 100644 --- a/src/lib/synergy/PacketStreamFilter.cpp +++ b/src/lib/synergy/PacketStreamFilter.cpp @@ -25,11 +25,11 @@ #include // -// CPacketStreamFilter +// PacketStreamFilter // -CPacketStreamFilter::CPacketStreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream) : - CStreamFilter(events, stream, adoptStream), +PacketStreamFilter::PacketStreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream) : + StreamFilter(events, stream, adoptStream), m_size(0), m_inputShutdown(false), m_events(events) @@ -37,28 +37,28 @@ CPacketStreamFilter::CPacketStreamFilter(IEventQueue* events, synergy::IStream* // do nothing } -CPacketStreamFilter::~CPacketStreamFilter() +PacketStreamFilter::~PacketStreamFilter() { // do nothing } void -CPacketStreamFilter::close() +PacketStreamFilter::close() { - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_size = 0; m_buffer.pop(m_buffer.getSize()); - CStreamFilter::close(); + StreamFilter::close(); } UInt32 -CPacketStreamFilter::read(void* buffer, UInt32 n) +PacketStreamFilter::read(void* buffer, UInt32 n) { if (n == 0) { return 0; } - CLock lock(&m_mutex); + Lock lock(&m_mutex); // if not enough data yet then give up if (!isReadyNoLock()) { @@ -82,7 +82,7 @@ CPacketStreamFilter::read(void* buffer, UInt32 n) readPacketSize(); if (m_inputShutdown && m_size == 0) { - m_events->addEvent(CEvent(m_events->forIStream().inputShutdown(), + m_events->addEvent(Event(m_events->forIStream().inputShutdown(), getEventTarget(), NULL)); } @@ -90,7 +90,7 @@ CPacketStreamFilter::read(void* buffer, UInt32 n) } void -CPacketStreamFilter::write(const void* buffer, UInt32 count) +PacketStreamFilter::write(const void* buffer, UInt32 count) { // write the length of the payload UInt8 length[4]; @@ -105,36 +105,36 @@ CPacketStreamFilter::write(const void* buffer, UInt32 count) } void -CPacketStreamFilter::shutdownInput() +PacketStreamFilter::shutdownInput() { - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_size = 0; m_buffer.pop(m_buffer.getSize()); - CStreamFilter::shutdownInput(); + StreamFilter::shutdownInput(); } bool -CPacketStreamFilter::isReady() const +PacketStreamFilter::isReady() const { - CLock lock(&m_mutex); + Lock lock(&m_mutex); return isReadyNoLock(); } UInt32 -CPacketStreamFilter::getSize() const +PacketStreamFilter::getSize() const { - CLock lock(&m_mutex); + Lock lock(&m_mutex); return isReadyNoLock() ? m_size : 0; } bool -CPacketStreamFilter::isReadyNoLock() const +PacketStreamFilter::isReadyNoLock() const { return (m_size != 0 && m_buffer.getSize() >= m_size); } void -CPacketStreamFilter::readPacketSize() +PacketStreamFilter::readPacketSize() { // note -- m_mutex must be locked on entry @@ -150,7 +150,7 @@ CPacketStreamFilter::readPacketSize() } bool -CPacketStreamFilter::readMore() +PacketStreamFilter::readMore() { // note if we have whole packet bool wasReady = isReadyNoLock(); @@ -176,17 +176,17 @@ CPacketStreamFilter::readMore() } void -CPacketStreamFilter::filterEvent(const CEvent& event) +PacketStreamFilter::filterEvent(const Event& event) { if (event.getType() == m_events->forIStream().inputReady()) { - CLock lock(&m_mutex); + Lock lock(&m_mutex); if (!readMore()) { return; } } else if (event.getType() == m_events->forIStream().inputShutdown()) { // discard this if we have buffered data - CLock lock(&m_mutex); + Lock lock(&m_mutex); m_inputShutdown = true; if (m_size != 0) { return; @@ -194,5 +194,5 @@ CPacketStreamFilter::filterEvent(const CEvent& event) } // pass event - CStreamFilter::filterEvent(event); + StreamFilter::filterEvent(event); } diff --git a/src/lib/synergy/PacketStreamFilter.h b/src/lib/synergy/PacketStreamFilter.h index f27f1188..681a39e9 100644 --- a/src/lib/synergy/PacketStreamFilter.h +++ b/src/lib/synergy/PacketStreamFilter.h @@ -28,10 +28,10 @@ class IEventQueue; /*! Filters a stream to read and write packets. */ -class CPacketStreamFilter : public CStreamFilter { +class PacketStreamFilter : public StreamFilter { public: - CPacketStreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream = true); - ~CPacketStreamFilter(); + PacketStreamFilter(IEventQueue* events, synergy::IStream* stream, bool adoptStream = true); + ~PacketStreamFilter(); // IStream overrides virtual void close(); @@ -42,8 +42,8 @@ public: virtual UInt32 getSize() const; protected: - // CStreamFilter overrides - virtual void filterEvent(const CEvent&); + // StreamFilter overrides + virtual void filterEvent(const Event&); private: bool isReadyNoLock() const; @@ -51,9 +51,9 @@ private: bool readMore(); private: - CMutex m_mutex; + Mutex m_mutex; UInt32 m_size; - CStreamBuffer m_buffer; + StreamBuffer m_buffer; bool m_inputShutdown; IEventQueue* m_events; }; diff --git a/src/lib/synergy/PlatformScreen.cpp b/src/lib/synergy/PlatformScreen.cpp index f95336b7..deed1729 100644 --- a/src/lib/synergy/PlatformScreen.cpp +++ b/src/lib/synergy/PlatformScreen.cpp @@ -20,103 +20,103 @@ #include "synergy/App.h" #include "synergy/ArgsBase.h" -CPlatformScreen::CPlatformScreen(IEventQueue* events) : +PlatformScreen::PlatformScreen(IEventQueue* events) : IPlatformScreen(events), m_draggingStarted(false), m_fakeDraggingStarted(false) { } -CPlatformScreen::~CPlatformScreen() +PlatformScreen::~PlatformScreen() { // do nothing } void -CPlatformScreen::updateKeyMap() +PlatformScreen::updateKeyMap() { getKeyState()->updateKeyMap(); } void -CPlatformScreen::updateKeyState() +PlatformScreen::updateKeyState() { getKeyState()->updateKeyState(); updateButtons(); } void -CPlatformScreen::setHalfDuplexMask(KeyModifierMask mask) +PlatformScreen::setHalfDuplexMask(KeyModifierMask mask) { getKeyState()->setHalfDuplexMask(mask); } void -CPlatformScreen::fakeKeyDown(KeyID id, KeyModifierMask mask, +PlatformScreen::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button) { getKeyState()->fakeKeyDown(id, mask, button); } bool -CPlatformScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask, +PlatformScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) { return getKeyState()->fakeKeyRepeat(id, mask, count, button); } bool -CPlatformScreen::fakeKeyUp(KeyButton button) +PlatformScreen::fakeKeyUp(KeyButton button) { return getKeyState()->fakeKeyUp(button); } void -CPlatformScreen::fakeAllKeysUp() +PlatformScreen::fakeAllKeysUp() { getKeyState()->fakeAllKeysUp(); } bool -CPlatformScreen::fakeCtrlAltDel() +PlatformScreen::fakeCtrlAltDel() { return getKeyState()->fakeCtrlAltDel(); } bool -CPlatformScreen::isKeyDown(KeyButton button) const +PlatformScreen::isKeyDown(KeyButton button) const { return getKeyState()->isKeyDown(button); } KeyModifierMask -CPlatformScreen::getActiveModifiers() const +PlatformScreen::getActiveModifiers() const { return getKeyState()->getActiveModifiers(); } KeyModifierMask -CPlatformScreen::pollActiveModifiers() const +PlatformScreen::pollActiveModifiers() const { return getKeyState()->pollActiveModifiers(); } SInt32 -CPlatformScreen::pollActiveGroup() const +PlatformScreen::pollActiveGroup() const { return getKeyState()->pollActiveGroup(); } void -CPlatformScreen::pollPressedKeys(KeyButtonSet& pressedKeys) const +PlatformScreen::pollPressedKeys(KeyButtonSet& pressedKeys) const { getKeyState()->pollPressedKeys(pressedKeys); } bool -CPlatformScreen::isDraggingStarted() +PlatformScreen::isDraggingStarted() { - if (CApp::instance().argsBase().m_enableDragDrop) { + if (App::instance().argsBase().m_enableDragDrop) { return m_draggingStarted; } return false; diff --git a/src/lib/synergy/PlatformScreen.h b/src/lib/synergy/PlatformScreen.h index 60804ce5..ecf7338c 100644 --- a/src/lib/synergy/PlatformScreen.h +++ b/src/lib/synergy/PlatformScreen.h @@ -28,10 +28,10 @@ This screen implementation is the superclass of all other screen implementations. It implements a handful of methods and requires subclasses to implement the rest. */ -class CPlatformScreen : public IPlatformScreen { +class PlatformScreen : public IPlatformScreen { public: - CPlatformScreen(IEventQueue* events); - virtual ~CPlatformScreen(); + PlatformScreen(IEventQueue* events); + virtual ~PlatformScreen(); // IScreen overrides virtual void* getEventTarget() const = 0; @@ -80,7 +80,7 @@ public: virtual void setDraggingStarted(bool started) { m_draggingStarted = started; } virtual bool isDraggingStarted(); virtual bool isFakeDraggingStarted() { return m_fakeDraggingStarted; } - virtual CString& getDraggingFilename() { return m_draggingFilename; } + virtual String& getDraggingFilename() { return m_draggingFilename; } virtual void clearDraggingFilename() { } // IPlatformScreen overrides @@ -94,12 +94,12 @@ public: virtual void closeScreensaver() = 0; virtual void screensaver(bool activate) = 0; virtual void resetOptions() = 0; - virtual void setOptions(const COptionsList& options) = 0; + virtual void setOptions(const OptionsList& options) = 0; virtual void setSequenceNumber(UInt32) = 0; virtual bool isPrimary() const = 0; - virtual void fakeDraggingFiles(CDragFileList fileList) { throw std::runtime_error("fakeDraggingFiles not implemented"); } - virtual const CString& + virtual void fakeDraggingFiles(DragFileList fileList) { throw std::runtime_error("fakeDraggingFiles not implemented"); } + virtual const String& getDropTarget() const { throw std::runtime_error("getDropTarget not implemented"); } protected: @@ -118,10 +118,10 @@ protected: virtual IKeyState* getKeyState() const = 0; // IPlatformScreen overrides - virtual void handleSystemEvent(const CEvent& event, void*) = 0; + virtual void handleSystemEvent(const Event& event, void*) = 0; protected: - CString m_draggingFilename; + String m_draggingFilename; bool m_draggingStarted; bool m_fakeDraggingStarted; }; diff --git a/src/lib/synergy/PortableTaskBarReceiver.cpp b/src/lib/synergy/PortableTaskBarReceiver.cpp index 9d797029..f218df7f 100644 --- a/src/lib/synergy/PortableTaskBarReceiver.cpp +++ b/src/lib/synergy/PortableTaskBarReceiver.cpp @@ -24,23 +24,23 @@ #include "common/Version.h" // -// CPortableTaskBarReceiver +// PortableTaskBarReceiver // -CPortableTaskBarReceiver::CPortableTaskBarReceiver(IEventQueue* events) : +PortableTaskBarReceiver::PortableTaskBarReceiver(IEventQueue* events) : m_state(kNotRunning), m_events(events) { // do nothing } -CPortableTaskBarReceiver::~CPortableTaskBarReceiver() +PortableTaskBarReceiver::~PortableTaskBarReceiver() { // do nothing } void -CPortableTaskBarReceiver::updateStatus(INode* node, const CString& errorMsg) +PortableTaskBarReceiver::updateStatus(INode* node, const String& errorMsg) { { // update our status @@ -65,44 +65,44 @@ CPortableTaskBarReceiver::updateStatus(INode* node, const CString& errorMsg) ARCH->updateReceiver(this); } -CPortableTaskBarReceiver::EState -CPortableTaskBarReceiver::getStatus() const +PortableTaskBarReceiver::EState +PortableTaskBarReceiver::getStatus() const { return m_state; } -const CString& -CPortableTaskBarReceiver::getErrorMessage() const +const String& +PortableTaskBarReceiver::getErrorMessage() const { return m_errorMessage; } void -CPortableTaskBarReceiver::quit() +PortableTaskBarReceiver::quit() { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } void -CPortableTaskBarReceiver::onStatusChanged(INode*) +PortableTaskBarReceiver::onStatusChanged(INode*) { // do nothing } void -CPortableTaskBarReceiver::lock() const +PortableTaskBarReceiver::lock() const { // do nothing } void -CPortableTaskBarReceiver::unlock() const +PortableTaskBarReceiver::unlock() const { // do nothing } std::string -CPortableTaskBarReceiver::getToolTip() const +PortableTaskBarReceiver::getToolTip() const { switch (m_state) { case kNotRunning: diff --git a/src/lib/synergy/PortableTaskBarReceiver.h b/src/lib/synergy/PortableTaskBarReceiver.h index b40c22d3..57726fe2 100644 --- a/src/lib/synergy/PortableTaskBarReceiver.h +++ b/src/lib/synergy/PortableTaskBarReceiver.h @@ -29,10 +29,10 @@ class IEventQueue; //! Implementation of IArchTaskBarReceiver for the synergy server -class CPortableTaskBarReceiver : public IArchTaskBarReceiver { +class PortableTaskBarReceiver : public IArchTaskBarReceiver { public: - CPortableTaskBarReceiver(IEventQueue* events); - virtual ~CPortableTaskBarReceiver(); + PortableTaskBarReceiver(IEventQueue* events); + virtual ~PortableTaskBarReceiver(); //! @name manipulators //@{ @@ -41,7 +41,7 @@ public: /*! Determine the status and query required information from the server. */ - void updateStatus(INode*, const CString& errorMsg); + void updateStatus(INode*, const String& errorMsg); //@} @@ -55,7 +55,7 @@ public: virtual std::string getToolTip() const; protected: - typedef std::vector CClients; + typedef std::vector Clients; enum EState { kNotRunning, kNotWorking, @@ -68,7 +68,7 @@ protected: EState getStatus() const; //! Get error message - const CString& getErrorMessage() const; + const String& getErrorMessage() const; //! Quit app /*! @@ -85,12 +85,12 @@ protected: private: EState m_state; - CString m_errorMessage; + String m_errorMessage; - CString m_server; - CClients m_clients; + String m_server; + Clients m_clients; IEventQueue* m_events; }; -IArchTaskBarReceiver* createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events); +IArchTaskBarReceiver* createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events); diff --git a/src/lib/synergy/ProtocolUtil.cpp b/src/lib/synergy/ProtocolUtil.cpp index b4b84cac..b0a88867 100644 --- a/src/lib/synergy/ProtocolUtil.cpp +++ b/src/lib/synergy/ProtocolUtil.cpp @@ -25,11 +25,11 @@ #include // -// CProtocolUtil +// ProtocolUtil // void -CProtocolUtil::writef(synergy::IStream* stream, const char* fmt, ...) +ProtocolUtil::writef(synergy::IStream* stream, const char* fmt, ...) { assert(stream != NULL); assert(fmt != NULL); @@ -45,7 +45,7 @@ CProtocolUtil::writef(synergy::IStream* stream, const char* fmt, ...) } bool -CProtocolUtil::readf(synergy::IStream* stream, const char* fmt, ...) +ProtocolUtil::readf(synergy::IStream* stream, const char* fmt, ...) { assert(stream != NULL); assert(fmt != NULL); @@ -66,7 +66,7 @@ CProtocolUtil::readf(synergy::IStream* stream, const char* fmt, ...) } void -CProtocolUtil::vwritef(synergy::IStream* stream, +ProtocolUtil::vwritef(synergy::IStream* stream, const char* fmt, UInt32 size, va_list args) { assert(stream != NULL); @@ -95,7 +95,7 @@ CProtocolUtil::vwritef(synergy::IStream* stream, } void -CProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args) +ProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args) { assert(stream != NULL); assert(fmt != NULL); @@ -237,7 +237,7 @@ CProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args) } // save the data - CString* dst = va_arg(args, CString*); + String* dst = va_arg(args, String*); dst->assign((const char*)sBuffer, len); // release the buffer @@ -276,7 +276,7 @@ CProtocolUtil::vreadf(synergy::IStream* stream, const char* fmt, va_list args) } UInt32 -CProtocolUtil::getLength(const char* fmt, va_list args) +ProtocolUtil::getLength(const char* fmt, va_list args) { UInt32 n = 0; while (*fmt) { @@ -309,7 +309,7 @@ CProtocolUtil::getLength(const char* fmt, va_list args) case 's': assert(len == 0); - len = (UInt32)(va_arg(args, CString*))->size() + 4; + len = (UInt32)(va_arg(args, String*))->size() + 4; (void)va_arg(args, UInt8*); break; @@ -342,7 +342,7 @@ CProtocolUtil::getLength(const char* fmt, va_list args) } void -CProtocolUtil::writef(void* buffer, const char* fmt, va_list args) +ProtocolUtil::writef(void* buffer, const char* fmt, va_list args) { UInt8* dst = reinterpret_cast(buffer); @@ -443,7 +443,7 @@ CProtocolUtil::writef(void* buffer, const char* fmt, va_list args) case 's': { assert(len == 0); - const CString* src = va_arg(args, CString*); + const String* src = va_arg(args, String*); const UInt32 len = (src != NULL) ? (UInt32)src->size() : 0; *dst++ = static_cast((len >> 24) & 0xff); *dst++ = static_cast((len >> 16) & 0xff); @@ -489,7 +489,7 @@ CProtocolUtil::writef(void* buffer, const char* fmt, va_list args) } UInt32 -CProtocolUtil::eatLength(const char** pfmt) +ProtocolUtil::eatLength(const char** pfmt) { const char* fmt = *pfmt; UInt32 n = 0; @@ -514,7 +514,7 @@ CProtocolUtil::eatLength(const char** pfmt) } void -CProtocolUtil::read(synergy::IStream* stream, void* vbuffer, UInt32 count) +ProtocolUtil::read(synergy::IStream* stream, void* vbuffer, UInt32 count) { assert(stream != NULL); assert(vbuffer != NULL); @@ -541,8 +541,8 @@ CProtocolUtil::read(synergy::IStream* stream, void* vbuffer, UInt32 count) // XIOReadMismatch // -CString +String XIOReadMismatch::getWhat() const throw() { - return format("XIOReadMismatch", "CProtocolUtil::readf() mismatch"); + return format("XIOReadMismatch", "ProtocolUtil::readf() mismatch"); } diff --git a/src/lib/synergy/ProtocolUtil.h b/src/lib/synergy/ProtocolUtil.h index d991ae38..fed1ea9d 100644 --- a/src/lib/synergy/ProtocolUtil.h +++ b/src/lib/synergy/ProtocolUtil.h @@ -30,7 +30,7 @@ namespace synergy { class IStream; } This class provides various functions for implementing the synergy protocol. */ -class CProtocolUtil { +class ProtocolUtil { public: //! Write formatted data /*! @@ -47,7 +47,7 @@ public: - \%1I -- converts std::vector* to 1 byte integers - \%2I -- converts std::vector* to 2 byte integers in NBO - \%4I -- converts std::vector* to 4 byte integers in NBO - - \%s -- converts CString* to stream of bytes + - \%s -- converts String* to stream of bytes - \%S -- converts integer N and const UInt8* to stream of N bytes */ static void writef(synergy::IStream*, @@ -67,7 +67,7 @@ public: - \%1I -- reads 1 byte integers; arg is std::vector* - \%2I -- reads NBO 2 byte integers; arg is std::vector* - \%4I -- reads NBO 4 byte integers; arg is std::vector* - - \%s -- reads bytes; argument must be a CString*, \b not a char* + - \%s -- reads bytes; argument must be a String*, \b not a char* */ static bool readf(synergy::IStream*, const char* fmt, ...); @@ -86,11 +86,11 @@ private: //! Mismatched read exception /*! -Thrown by CProtocolUtil::readf() when the data being read does not +Thrown by ProtocolUtil::readf() when the data being read does not match the format. */ class XIOReadMismatch : public XIO { public: // XBase overrides - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); }; diff --git a/src/lib/synergy/Screen.cpp b/src/lib/synergy/Screen.cpp index 8284fc8b..3e7e5bf2 100644 --- a/src/lib/synergy/Screen.cpp +++ b/src/lib/synergy/Screen.cpp @@ -25,10 +25,10 @@ #include "base/TMethodEventJob.h" // -// CScreen +// Screen // -CScreen::CScreen(IPlatformScreen* platformScreen, IEventQueue* events) : +Screen::Screen(IPlatformScreen* platformScreen, IEventQueue* events) : m_screen(platformScreen), m_isPrimary(platformScreen->isPrimary()), m_enabled(false), @@ -47,7 +47,7 @@ CScreen::CScreen(IPlatformScreen* platformScreen, IEventQueue* events) : LOG((CLOG_DEBUG "opened display")); } -CScreen::~CScreen() +Screen::~Screen() { if (m_mock) { return; @@ -63,7 +63,7 @@ CScreen::~CScreen() } void -CScreen::enable() +Screen::enable() { assert(!m_enabled); @@ -82,7 +82,7 @@ CScreen::enable() } void -CScreen::disable() +Screen::disable() { assert(m_enabled); @@ -105,7 +105,7 @@ CScreen::disable() } void -CScreen::enter(KeyModifierMask toggleMask) +Screen::enter(KeyModifierMask toggleMask) { assert(m_entered == false); LOG((CLOG_INFO "entering screen")); @@ -123,7 +123,7 @@ CScreen::enter(KeyModifierMask toggleMask) } bool -CScreen::leave() +Screen::leave() { assert(m_entered == true); LOG((CLOG_INFO "leaving screen")); @@ -148,33 +148,33 @@ CScreen::leave() } void -CScreen::reconfigure(UInt32 activeSides) +Screen::reconfigure(UInt32 activeSides) { assert(m_isPrimary); m_screen->reconfigure(activeSides); } void -CScreen::warpCursor(SInt32 x, SInt32 y) +Screen::warpCursor(SInt32 x, SInt32 y) { assert(m_isPrimary); m_screen->warpCursor(x, y); } void -CScreen::setClipboard(ClipboardID id, const IClipboard* clipboard) +Screen::setClipboard(ClipboardID id, const IClipboard* clipboard) { m_screen->setClipboard(id, clipboard); } void -CScreen::grabClipboard(ClipboardID id) +Screen::grabClipboard(ClipboardID id) { m_screen->setClipboard(id, NULL); } void -CScreen::screensaver(bool activate) +Screen::screensaver(bool activate) { if (!m_isPrimary) { // activate/deactivation screen saver iff synchronization enabled @@ -185,7 +185,7 @@ CScreen::screensaver(bool activate) } void -CScreen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button) +Screen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button) { // check for ctrl+alt+del emulation if (id == kKeyDelete && @@ -200,7 +200,7 @@ CScreen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button) } void -CScreen::keyRepeat(KeyID id, +Screen::keyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button) { assert(!m_isPrimary); @@ -208,46 +208,46 @@ CScreen::keyRepeat(KeyID id, } void -CScreen::keyUp(KeyID, KeyModifierMask, KeyButton button) +Screen::keyUp(KeyID, KeyModifierMask, KeyButton button) { m_screen->fakeKeyUp(button); } void -CScreen::mouseDown(ButtonID button) +Screen::mouseDown(ButtonID button) { m_screen->fakeMouseButton(button, true); } void -CScreen::mouseUp(ButtonID button) +Screen::mouseUp(ButtonID button) { m_screen->fakeMouseButton(button, false); } void -CScreen::mouseMove(SInt32 x, SInt32 y) +Screen::mouseMove(SInt32 x, SInt32 y) { assert(!m_isPrimary); m_screen->fakeMouseMove(x, y); } void -CScreen::mouseRelativeMove(SInt32 dx, SInt32 dy) +Screen::mouseRelativeMove(SInt32 dx, SInt32 dy) { assert(!m_isPrimary); m_screen->fakeMouseRelativeMove(dx, dy); } void -CScreen::mouseWheel(SInt32 xDelta, SInt32 yDelta) +Screen::mouseWheel(SInt32 xDelta, SInt32 yDelta) { assert(!m_isPrimary); m_screen->fakeMouseWheel(xDelta, yDelta); } void -CScreen::resetOptions() +Screen::resetOptions() { // reset options m_halfDuplex = 0; @@ -266,7 +266,7 @@ CScreen::resetOptions() } void -CScreen::setOptions(const COptionsList& options) +Screen::setOptions(const OptionsList& options) { // update options bool oldScreenSaverSync = m_screenSaverSync; @@ -322,25 +322,25 @@ CScreen::setOptions(const COptionsList& options) } void -CScreen::setSequenceNumber(UInt32 seqNum) +Screen::setSequenceNumber(UInt32 seqNum) { m_screen->setSequenceNumber(seqNum); } UInt32 -CScreen::registerHotKey(KeyID key, KeyModifierMask mask) +Screen::registerHotKey(KeyID key, KeyModifierMask mask) { return m_screen->registerHotKey(key, mask); } void -CScreen::unregisterHotKey(UInt32 id) +Screen::unregisterHotKey(UInt32 id) { m_screen->unregisterHotKey(id); } void -CScreen::fakeInputBegin() +Screen::fakeInputBegin() { assert(!m_fakeInput); @@ -349,7 +349,7 @@ CScreen::fakeInputBegin() } void -CScreen::fakeInputEnd() +Screen::fakeInputEnd() { assert(m_fakeInput); @@ -358,13 +358,13 @@ CScreen::fakeInputEnd() } bool -CScreen::isOnScreen() const +Screen::isOnScreen() const { return m_entered; } bool -CScreen::isLockedToScreen() const +Screen::isLockedToScreen() const { // check for pressed mouse buttons // HACK: commented out as it breaks new drag drop feature @@ -388,7 +388,7 @@ CScreen::isLockedToScreen() const } SInt32 -CScreen::getJumpZoneSize() const +Screen::getJumpZoneSize() const { if (!m_isPrimary) { return 0; @@ -399,107 +399,107 @@ CScreen::getJumpZoneSize() const } void -CScreen::getCursorCenter(SInt32& x, SInt32& y) const +Screen::getCursorCenter(SInt32& x, SInt32& y) const { m_screen->getCursorCenter(x, y); } KeyModifierMask -CScreen::getActiveModifiers() const +Screen::getActiveModifiers() const { return m_screen->getActiveModifiers(); } KeyModifierMask -CScreen::pollActiveModifiers() const +Screen::pollActiveModifiers() const { return m_screen->pollActiveModifiers(); } bool -CScreen::isDraggingStarted() const +Screen::isDraggingStarted() const { return m_screen->isDraggingStarted(); } bool -CScreen::isFakeDraggingStarted() const +Screen::isFakeDraggingStarted() const { return m_screen->isFakeDraggingStarted(); } void -CScreen::setDraggingStarted(bool started) +Screen::setDraggingStarted(bool started) { m_screen->setDraggingStarted(started); } void -CScreen::startDraggingFiles(CDragFileList& fileList) +Screen::startDraggingFiles(DragFileList& fileList) { m_screen->fakeDraggingFiles(fileList); } void -CScreen::setEnableDragDrop(bool enabled) +Screen::setEnableDragDrop(bool enabled) { m_enableDragDrop = enabled; } -CString& -CScreen::getDraggingFilename() const +String& +Screen::getDraggingFilename() const { return m_screen->getDraggingFilename(); } void -CScreen::clearDraggingFilename() +Screen::clearDraggingFilename() { m_screen->clearDraggingFilename(); } -const CString& -CScreen::getDropTarget() const +const String& +Screen::getDropTarget() const { return m_screen->getDropTarget(); } void* -CScreen::getEventTarget() const +Screen::getEventTarget() const { return m_screen; } bool -CScreen::getClipboard(ClipboardID id, IClipboard* clipboard) const +Screen::getClipboard(ClipboardID id, IClipboard* clipboard) const { return m_screen->getClipboard(id, clipboard); } void -CScreen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const +Screen::getShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h) const { m_screen->getShape(x, y, w, h); } void -CScreen::getCursorPos(SInt32& x, SInt32& y) const +Screen::getCursorPos(SInt32& x, SInt32& y) const { m_screen->getCursorPos(x, y); } void -CScreen::enablePrimary() +Screen::enablePrimary() { // get notified of screen saver activation/deactivation m_screen->openScreensaver(true); // claim screen changed size - m_events->addEvent(CEvent(m_events->forIScreen().shapeChanged(), getEventTarget())); + m_events->addEvent(Event(m_events->forIScreen().shapeChanged(), getEventTarget())); } void -CScreen::enableSecondary() +Screen::enableSecondary() { // assume primary has all clipboards for (ClipboardID id = 0; id < kClipboardEnd; ++id) { @@ -513,33 +513,33 @@ CScreen::enableSecondary() } void -CScreen::disablePrimary() +Screen::disablePrimary() { // done with screen saver m_screen->closeScreensaver(); } void -CScreen::disableSecondary() +Screen::disableSecondary() { // done with screen saver m_screen->closeScreensaver(); } void -CScreen::enterPrimary() +Screen::enterPrimary() { // do nothing } void -CScreen::enterSecondary(KeyModifierMask) +Screen::enterSecondary(KeyModifierMask) { // do nothing } void -CScreen::leavePrimary() +Screen::leavePrimary() { // we don't track keys while on the primary screen so update our // idea of them now. this is particularly to update the state of @@ -548,7 +548,7 @@ CScreen::leavePrimary() } void -CScreen::leaveSecondary() +Screen::leaveSecondary() { // release any keys we think are still down m_screen->fakeAllKeysUp(); diff --git a/src/lib/synergy/Screen.h b/src/lib/synergy/Screen.h index c34ddf70..38fdd0e9 100644 --- a/src/lib/synergy/Screen.h +++ b/src/lib/synergy/Screen.h @@ -35,13 +35,13 @@ class IEventQueue; This is a platform independent screen. It can work as either a primary or secondary screen. */ -class CScreen : public IScreen { +class Screen : public IScreen { public: - CScreen(IPlatformScreen* platformScreen, IEventQueue* events); - virtual ~CScreen(); + Screen(IPlatformScreen* platformScreen, IEventQueue* events); + virtual ~Screen(); #ifdef TEST_ENV - CScreen() : m_mock(true) { } + Screen() : m_mock(true) { } #endif //! @name manipulators @@ -183,7 +183,7 @@ public: Set options to given values. Ignores unknown options and doesn't modify options that aren't given in \c options. */ - virtual void setOptions(const COptionsList& options); + virtual void setOptions(const OptionsList& options); //! Set clipboard sequence number /*! @@ -223,7 +223,7 @@ public: void setDraggingStarted(bool started); //! Fake a files dragging operation - void startDraggingFiles(CDragFileList& fileList); + void startDraggingFiles(DragFileList& fileList); void setEnableDragDrop(bool enabled); //@} @@ -281,13 +281,13 @@ public: bool isFakeDraggingStarted() const; //! Get the filename of the file being dragged - CString& getDraggingFilename() const; + String& getDraggingFilename() const; //! Clear the filename of the file that was dragged void clearDraggingFilename(); //! Get the drop target directory - const CString& getDropTarget() const; + const String& getDropTarget() const; //@} diff --git a/src/lib/synergy/ServerApp.cpp b/src/lib/synergy/ServerApp.cpp index dce8500c..323c75e9 100644 --- a/src/lib/synergy/ServerApp.cpp +++ b/src/lib/synergy/ServerApp.cpp @@ -61,11 +61,11 @@ #include // -// CServerApp +// ServerApp // -CServerApp::CServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) : - CApp(events, createTaskBarReceiver, new CServerArgs()), +ServerApp::ServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver) : + App(events, createTaskBarReceiver, new ServerArgs()), m_server(NULL), m_serverState(kUninitialized), m_serverScreen(NULL), @@ -76,14 +76,14 @@ CServerApp::CServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTask { } -CServerApp::~CServerApp() +ServerApp::~ServerApp() { } void -CServerApp::parseArgs(int argc, const char* const* argv) +ServerApp::parseArgs(int argc, const char* const* argv) { - CArgParser argParser(this); + ArgParser argParser(this); bool result = argParser.parseServerArgs(args(), argc, argv); if (!result || args().m_shouldExit) { @@ -92,7 +92,7 @@ CServerApp::parseArgs(int argc, const char* const* argv) else { if (!args().m_synergyAddress.empty()) { try { - *m_synergyAddress = CNetworkAddress(args().m_synergyAddress, + *m_synergyAddress = NetworkAddress(args().m_synergyAddress, kDefaultPort); m_synergyAddress->resolve(); } @@ -106,7 +106,7 @@ CServerApp::parseArgs(int argc, const char* const* argv) } void -CServerApp::help() +ServerApp::help() { // window api args (windows/x-windows/carbon) #if WINAPI_XWINDOWS @@ -159,15 +159,15 @@ CServerApp::help() } void -CServerApp::reloadSignalHandler(CArch::ESignal, void*) +ServerApp::reloadSignalHandler(Arch::ESignal, void*) { - IEventQueue* events = CApp::instance().getEvents(); - events->addEvent(CEvent(events->forCServerApp().reloadConfig(), + IEventQueue* events = App::instance().getEvents(); + events->addEvent(Event(events->forServerApp().reloadConfig(), events->getSystemTarget())); } void -CServerApp::reloadConfig(const CEvent&, void*) +ServerApp::reloadConfig(const Event&, void*) { LOG((CLOG_DEBUG "reload configuration")); if (loadConfig(args().m_configFile)) { @@ -179,7 +179,7 @@ CServerApp::reloadConfig(const CEvent&, void*) } void -CServerApp::loadConfig() +ServerApp::loadConfig() { bool loaded = false; @@ -191,7 +191,7 @@ CServerApp::loadConfig() // load the default configuration if no explicit file given else { // get the user's home directory - CString path = ARCH->getUserDirectory(); + String path = ARCH->getUserDirectory(); if (!path.empty()) { // complete path path = ARCH->concatPath(path, USR_CONFIG_NAME); @@ -222,7 +222,7 @@ CServerApp::loadConfig() } bool -CServerApp::loadConfig(const CString& pathname) +ServerApp::loadConfig(const String& pathname) { try { // load configuration @@ -249,7 +249,7 @@ CServerApp::loadConfig(const CString& pathname) } void -CServerApp::forceReconnect(const CEvent&, void*) +ServerApp::forceReconnect(const Event&, void*) { if (m_server != NULL) { m_server->disconnect(); @@ -257,10 +257,10 @@ CServerApp::forceReconnect(const CEvent&, void*) } void -CServerApp::handleClientConnected(const CEvent&, void* vlistener) +ServerApp::handleClientConnected(const Event&, void* vlistener) { - CClientListener* listener = reinterpret_cast(vlistener); - CClientProxy* client = listener->getNextClient(); + ClientListener* listener = reinterpret_cast(vlistener); + ClientProxy* client = listener->getNextClient(); if (client != NULL) { m_server->adoptClient(client); updateStatus(); @@ -268,13 +268,13 @@ CServerApp::handleClientConnected(const CEvent&, void* vlistener) } void -CServerApp::handleClientsDisconnected(const CEvent&, void*) +ServerApp::handleClientsDisconnected(const Event&, void*) { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } void -CServerApp::closeServer(CServer* server) +ServerApp::closeServer(Server* server) { if (server == NULL) { return; @@ -285,39 +285,39 @@ CServerApp::closeServer(CServer* server) // wait for clients to disconnect for up to timeout seconds double timeout = 3.0; - CEventQueueTimer* timer = m_events->newOneShotTimer(timeout, NULL); - m_events->adoptHandler(CEvent::kTimer, timer, - new TMethodEventJob(this, &CServerApp::handleClientsDisconnected)); - m_events->adoptHandler(m_events->forCServer().disconnected(), server, - new TMethodEventJob(this, &CServerApp::handleClientsDisconnected)); + EventQueueTimer* timer = m_events->newOneShotTimer(timeout, NULL); + m_events->adoptHandler(Event::kTimer, timer, + new TMethodEventJob(this, &ServerApp::handleClientsDisconnected)); + m_events->adoptHandler(m_events->forServer().disconnected(), server, + new TMethodEventJob(this, &ServerApp::handleClientsDisconnected)); m_events->loop(); - m_events->removeHandler(CEvent::kTimer, timer); + m_events->removeHandler(Event::kTimer, timer); m_events->deleteTimer(timer); - m_events->removeHandler(m_events->forCServer().disconnected(), server); + m_events->removeHandler(m_events->forServer().disconnected(), server); // done with server delete server; } void -CServerApp::stopRetryTimer() +ServerApp::stopRetryTimer() { if (m_timer != NULL) { m_events->deleteTimer(m_timer); - m_events->removeHandler(CEvent::kTimer, NULL); + m_events->removeHandler(Event::kTimer, NULL); m_timer = NULL; } } void -CServerApp::updateStatus() +ServerApp::updateStatus() { updateStatus(""); } -void CServerApp::updateStatus( const CString& msg ) +void ServerApp::updateStatus( const String& msg ) { if (m_taskBarReceiver) { @@ -326,16 +326,16 @@ void CServerApp::updateStatus( const CString& msg ) } void -CServerApp::closeClientListener(CClientListener* listen) +ServerApp::closeClientListener(ClientListener* listen) { if (listen != NULL) { - m_events->removeHandler(m_events->forCClientListener().connected(), listen); + m_events->removeHandler(m_events->forClientListener().connected(), listen); delete listen; } } void -CServerApp::stopServer() +ServerApp::stopServer() { if (m_serverState == kStarted) { closeClientListener(m_listener); @@ -353,13 +353,13 @@ CServerApp::stopServer() } void -CServerApp::closePrimaryClient(CPrimaryClient* primaryClient) +ServerApp::closePrimaryClient(PrimaryClient* primaryClient) { delete primaryClient; } void -CServerApp::closeServerScreen(CScreen* screen) +ServerApp::closeServerScreen(Screen* screen) { if (screen != NULL) { m_events->removeHandler(m_events->forIScreen().error(), @@ -372,7 +372,7 @@ CServerApp::closeServerScreen(CScreen* screen) } } -void CServerApp::cleanupServer() +void ServerApp::cleanupServer() { stopServer(); if (m_serverState == kInitialized) { @@ -393,7 +393,7 @@ void CServerApp::cleanupServer() } void -CServerApp::retryHandler(const CEvent&, void*) +ServerApp::retryHandler(const Event&, void*) { // discard old timer assert(m_timer != NULL); @@ -411,7 +411,7 @@ CServerApp::retryHandler(const CEvent&, void*) LOG((CLOG_DEBUG1 "retry server initialization")); m_serverState = kUninitialized; if (!initServer()) { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } break; @@ -419,12 +419,12 @@ CServerApp::retryHandler(const CEvent&, void*) LOG((CLOG_DEBUG1 "retry server initialization")); m_serverState = kUninitialized; if (!initServer()) { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } else if (m_serverState == kInitialized) { LOG((CLOG_DEBUG1 "starting server")); if (!startServer()) { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } } break; @@ -433,13 +433,13 @@ CServerApp::retryHandler(const CEvent&, void*) LOG((CLOG_DEBUG1 "retry starting server")); m_serverState = kInitialized; if (!startServer()) { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } break; } } -bool CServerApp::initServer() +bool ServerApp::initServer() { // skip if already initialized or initializing if (m_serverState != kUninitialized) { @@ -447,10 +447,10 @@ bool CServerApp::initServer() } double retryTime; - CScreen* serverScreen = NULL; - CPrimaryClient* primaryClient = NULL; + Screen* serverScreen = NULL; + PrimaryClient* primaryClient = NULL; try { - CString name = args().m_config->getCanonicalName(args().m_name); + String name = args().m_config->getCanonicalName(args().m_name); serverScreen = openServerScreen(); primaryClient = openPrimaryClient(name, serverScreen); m_serverScreen = serverScreen; @@ -463,7 +463,7 @@ bool CServerApp::initServer() LOG((CLOG_WARN "primary screen unavailable: %s", e.what())); closePrimaryClient(primaryClient); closeServerScreen(serverScreen); - updateStatus(CString("primary screen unavailable: ") + e.what()); + updateStatus(String("primary screen unavailable: ") + e.what()); retryTime = e.getRetryTime(); } catch (XScreenOpenFailure& e) { @@ -484,8 +484,8 @@ bool CServerApp::initServer() assert(m_timer == NULL); LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime)); m_timer = m_events->newOneShotTimer(retryTime, NULL); - m_events->adoptHandler(CEvent::kTimer, m_timer, - new TMethodEventJob(this, &CServerApp::retryHandler)); + m_events->adoptHandler(Event::kTimer, m_timer, + new TMethodEventJob(this, &ServerApp::retryHandler)); m_serverState = kInitializing; return true; } @@ -495,27 +495,27 @@ bool CServerApp::initServer() } } -CScreen* CServerApp::openServerScreen() +Screen* ServerApp::openServerScreen() { - CScreen* screen = createScreen(); + Screen* screen = createScreen(); screen->setEnableDragDrop(argsBase().m_enableDragDrop); m_events->adoptHandler(m_events->forIScreen().error(), screen->getEventTarget(), - new TMethodEventJob( - this, &CServerApp::handleScreenError)); + new TMethodEventJob( + this, &ServerApp::handleScreenError)); m_events->adoptHandler(m_events->forIScreen().suspend(), screen->getEventTarget(), - new TMethodEventJob( - this, &CServerApp::handleSuspend)); + new TMethodEventJob( + this, &ServerApp::handleSuspend)); m_events->adoptHandler(m_events->forIScreen().resume(), screen->getEventTarget(), - new TMethodEventJob( - this, &CServerApp::handleResume)); + new TMethodEventJob( + this, &ServerApp::handleResume)); return screen; } bool -CServerApp::startServer() +ServerApp::startServer() { // skip if already started or starting if (m_serverState == kStarting || m_serverState == kStarted) { @@ -537,7 +537,7 @@ CServerApp::startServer() } double retryTime; - CClientListener* listener = NULL; + ClientListener* listener = NULL; try { listener = openClientListener(args().m_config->getSynergyAddress()); m_server = openServer(*args().m_config, m_primaryClient); @@ -551,7 +551,7 @@ CServerApp::startServer() catch (XSocketAddressInUse& e) { LOG((CLOG_WARN "cannot listen for clients: %s", e.what())); closeClientListener(listener); - updateStatus(CString("cannot listen for clients: ") + e.what()); + updateStatus(String("cannot listen for clients: ") + e.what()); retryTime = 10.0; } catch (XBase& e) { @@ -565,8 +565,8 @@ CServerApp::startServer() assert(m_timer == NULL); LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime)); m_timer = m_events->newOneShotTimer(retryTime, NULL); - m_events->adoptHandler(CEvent::kTimer, m_timer, - new TMethodEventJob(this, &CServerApp::retryHandler)); + m_events->adoptHandler(Event::kTimer, m_timer, + new TMethodEventJob(this, &ServerApp::retryHandler)); m_serverState = kStarting; return true; } @@ -576,37 +576,37 @@ CServerApp::startServer() } } -CScreen* -CServerApp::createScreen() +Screen* +ServerApp::createScreen() { #if WINAPI_MSWINDOWS - return new CScreen(new CMSWindowsScreen( + return new Screen(new CMSWindowsScreen( true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events); #elif WINAPI_XWINDOWS - return new CScreen(new CXWindowsScreen( + return new Screen(new CXWindowsScreen( args().m_display, true, args().m_disableXInitThreads, 0, m_events), m_events); #elif WINAPI_CARBON - return new CScreen(new COSXScreen(m_events, true), m_events); + return new Screen(new OSXScreen(m_events, true), m_events); #endif } -CPrimaryClient* -CServerApp::openPrimaryClient(const CString& name, CScreen* screen) +PrimaryClient* +ServerApp::openPrimaryClient(const String& name, Screen* screen) { LOG((CLOG_DEBUG1 "creating primary screen")); - return new CPrimaryClient(name, screen); + return new PrimaryClient(name, screen); } void -CServerApp::handleScreenError(const CEvent&, void*) +ServerApp::handleScreenError(const Event&, void*) { LOG((CLOG_CRIT "error on screen")); - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } void -CServerApp::handleSuspend(const CEvent&, void*) +ServerApp::handleSuspend(const Event&, void*) { if (!m_suspended) { LOG((CLOG_INFO "suspend")); @@ -616,7 +616,7 @@ CServerApp::handleSuspend(const CEvent&, void*) } void -CServerApp::handleResume(const CEvent&, void*) +ServerApp::handleResume(const Event&, void*) { if (m_suspended) { LOG((CLOG_INFO "resume")); @@ -625,10 +625,10 @@ CServerApp::handleResume(const CEvent&, void*) } } -CClientListener* -CServerApp::openClientListener(const CNetworkAddress& address) +ClientListener* +ServerApp::openClientListener(const NetworkAddress& address) { - CClientListener* listen = new CClientListener( + ClientListener* listen = new ClientListener( address, new CTCPSocketFactory(m_events, getSocketMultiplexer()), NULL, @@ -636,25 +636,25 @@ CServerApp::openClientListener(const CNetworkAddress& address) m_events); m_events->adoptHandler( - m_events->forCClientListener().connected(), listen, - new TMethodEventJob( - this, &CServerApp::handleClientConnected, listen)); + m_events->forClientListener().connected(), listen, + new TMethodEventJob( + this, &ServerApp::handleClientConnected, listen)); return listen; } -CServer* -CServerApp::openServer(CConfig& config, CPrimaryClient* primaryClient) +Server* +ServerApp::openServer(Config& config, PrimaryClient* primaryClient) { - CServer* server = new CServer(config, primaryClient, m_serverScreen, m_events, args().m_enableDragDrop); + Server* server = new Server(config, primaryClient, m_serverScreen, m_events, args().m_enableDragDrop); try { m_events->adoptHandler( - m_events->forCServer().disconnected(), server, - new TMethodEventJob(this, &CServerApp::handleNoClients)); + m_events->forServer().disconnected(), server, + new TMethodEventJob(this, &ServerApp::handleNoClients)); m_events->adoptHandler( - m_events->forCServer().screenSwitched(), server, - new TMethodEventJob(this, &CServerApp::handleScreenSwitched)); + m_events->forServer().screenSwitched(), server, + new TMethodEventJob(this, &ServerApp::handleScreenSwitched)); } catch (std::bad_alloc &ba) { delete server; @@ -665,22 +665,22 @@ CServerApp::openServer(CConfig& config, CPrimaryClient* primaryClient) } void -CServerApp::handleNoClients(const CEvent&, void*) +ServerApp::handleNoClients(const Event&, void*) { updateStatus(); } void -CServerApp::handleScreenSwitched(const CEvent& e, void*) +ServerApp::handleScreenSwitched(const Event& e, void*) { } int -CServerApp::mainLoop() +ServerApp::mainLoop() { // create socket multiplexer. this must happen after daemonization // on unix because threads evaporate across a fork(). - CSocketMultiplexer multiplexer; + SocketMultiplexer multiplexer; setSocketMultiplexer(&multiplexer); // if configuration has no screens then add this system @@ -696,11 +696,11 @@ CServerApp::mainLoop() args().m_config->setSynergyAddress(*m_synergyAddress); } else if (!args().m_config->getSynergyAddress().isValid()) { - args().m_config->setSynergyAddress(CNetworkAddress(kDefaultPort)); + args().m_config->setSynergyAddress(NetworkAddress(kDefaultPort)); } // canonicalize the primary screen name - CString primaryName = args().m_config->getCanonicalName(args().m_name); + String primaryName = args().m_config->getCanonicalName(args().m_name); if (primaryName.empty()) { LOG((CLOG_CRIT "unknown screen name `%s'", args().m_name.c_str())); return kExitFailed; @@ -719,22 +719,22 @@ CServerApp::mainLoop() ARCH->plugin().init(m_serverScreen->getEventTarget(), m_events); // handle hangup signal by reloading the server's configuration - ARCH->setSignalHandler(CArch::kHANGUP, &reloadSignalHandler, NULL); - m_events->adoptHandler(m_events->forCServerApp().reloadConfig(), + ARCH->setSignalHandler(Arch::kHANGUP, &reloadSignalHandler, NULL); + m_events->adoptHandler(m_events->forServerApp().reloadConfig(), m_events->getSystemTarget(), - new TMethodEventJob(this, &CServerApp::reloadConfig)); + new TMethodEventJob(this, &ServerApp::reloadConfig)); // handle force reconnect event by disconnecting clients. they'll // reconnect automatically. - m_events->adoptHandler(m_events->forCServerApp().forceReconnect(), + m_events->adoptHandler(m_events->forServerApp().forceReconnect(), m_events->getSystemTarget(), - new TMethodEventJob(this, &CServerApp::forceReconnect)); + new TMethodEventJob(this, &ServerApp::forceReconnect)); // to work around the sticky meta keys problem, we'll give users // the option to reset the state of synergys - m_events->adoptHandler(m_events->forCServerApp().resetServer(), + m_events->adoptHandler(m_events->forServerApp().resetServer(), m_events->getSystemTarget(), - new TMethodEventJob(this, &CServerApp::resetServer)); + new TMethodEventJob(this, &ServerApp::resetServer)); // run event loop. if startServer() failed we're supposed to retry // later. the timer installed by startServer() will take care of @@ -743,13 +743,13 @@ CServerApp::mainLoop() #if defined(MAC_OS_X_VERSION_10_7) - CThread thread( - new TMethodJob( - this, &CServerApp::runEventsLoop, + Thread thread( + new TMethodJob( + this, &ServerApp::runEventsLoop, NULL)); // wait until carbon loop is ready - COSXScreen* screen = dynamic_cast( + OSXScreen* screen = dynamic_cast( m_serverScreen->getPlatformScreen()); screen->waitForCarbonLoop(); @@ -762,9 +762,9 @@ CServerApp::mainLoop() // close down LOG((CLOG_DEBUG1 "stopping server")); - m_events->removeHandler(m_events->forCServerApp().forceReconnect(), + m_events->removeHandler(m_events->forServerApp().forceReconnect(), m_events->getSystemTarget()); - m_events->removeHandler(m_events->forCServerApp().reloadConfig(), + m_events->removeHandler(m_events->forServerApp().reloadConfig(), m_events->getSystemTarget()); cleanupServer(); updateStatus(); @@ -777,7 +777,7 @@ CServerApp::mainLoop() return kExitSuccess; } -void CServerApp::resetServer(const CEvent&, void*) +void ServerApp::resetServer(const Event&, void*) { LOG((CLOG_DEBUG1 "resetting server")); stopServer(); @@ -786,11 +786,11 @@ void CServerApp::resetServer(const CEvent&, void*) } int -CServerApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup) +ServerApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup) { // general initialization - m_synergyAddress = new CNetworkAddress; - args().m_config = new CConfig(m_events); + m_synergyAddress = new NetworkAddress; + args().m_config = new Config(m_events); args().m_pname = ARCH->getBasename(argv[0]); // install caller's output filter @@ -813,11 +813,11 @@ CServerApp::runInner(int argc, char** argv, ILogOutputter* outputter, StartupFun } int daemonMainLoopStatic(int argc, const char** argv) { - return CServerApp::instance().daemonMainLoop(argc, argv); + return ServerApp::instance().daemonMainLoop(argc, argv); } int -CServerApp::standardStartup(int argc, char** argv) +ServerApp::standardStartup(int argc, char** argv) { initApp(argc, argv); @@ -831,7 +831,7 @@ CServerApp::standardStartup(int argc, char** argv) } int -CServerApp::foregroundStartup(int argc, char** argv) +ServerApp::foregroundStartup(int argc, char** argv) { initApp(argc, argv); @@ -840,7 +840,7 @@ CServerApp::foregroundStartup(int argc, char** argv) } const char* -CServerApp::daemonName() const +ServerApp::daemonName() const { #if SYSAPI_WIN32 return "Synergy Server"; @@ -850,7 +850,7 @@ CServerApp::daemonName() const } const char* -CServerApp::daemonInfo() const +ServerApp::daemonInfo() const { #if SYSAPI_WIN32 return "Shares this computers mouse and keyboard with other computers."; @@ -860,7 +860,7 @@ CServerApp::daemonInfo() const } void -CServerApp::startNode() +ServerApp::startNode() { // start the server. if this return false then we've failed and // we shouldn't retry. diff --git a/src/lib/synergy/ServerApp.h b/src/lib/synergy/ServerApp.h index 83020ad7..5ccac6a0 100644 --- a/src/lib/synergy/ServerApp.h +++ b/src/lib/synergy/ServerApp.h @@ -39,18 +39,18 @@ enum EServerState { kStarted }; -class CServer; -class CScreen; -class CClientListener; -class CEventQueueTimer; +class Server; +class Screen; +class ClientListener; +class EventQueueTimer; class ILogOutputter; class IEventQueue; -class CServerArgs; +class ServerArgs; -class CServerApp : public CApp { +class ServerApp : public App { public: - CServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver); - virtual ~CServerApp(); + ServerApp(IEventQueue* events, CreateTaskBarReceiverFunc createTaskBarReceiver); + virtual ~ServerApp(); // Parse server specific command line arguments. void parseArgs(int argc, const char* const* argv); @@ -59,41 +59,41 @@ public: void help(); // Returns arguments that are common and for server. - CServerArgs& args() const { return (CServerArgs&)argsBase(); } + ServerArgs& args() const { return (ServerArgs&)argsBase(); } const char* daemonName() const; const char* daemonInfo() const; // TODO: Document these functions. - static void reloadSignalHandler(CArch::ESignal, void*); + static void reloadSignalHandler(Arch::ESignal, void*); - void reloadConfig(const CEvent&, void*); + void reloadConfig(const Event&, void*); void loadConfig(); - bool loadConfig(const CString& pathname); - void forceReconnect(const CEvent&, void*); - void resetServer(const CEvent&, void*); - void handleClientConnected(const CEvent&, void* vlistener); - void handleClientsDisconnected(const CEvent&, void*); - void closeServer(CServer* server); + bool loadConfig(const String& pathname); + void forceReconnect(const Event&, void*); + void resetServer(const Event&, void*); + void handleClientConnected(const Event&, void* vlistener); + void handleClientsDisconnected(const Event&, void*); + void closeServer(Server* server); void stopRetryTimer(); void updateStatus(); - void updateStatus(const CString& msg); - void closeClientListener(CClientListener* listen); + void updateStatus(const String& msg); + void closeClientListener(ClientListener* listen); void stopServer(); - void closePrimaryClient(CPrimaryClient* primaryClient); - void closeServerScreen(CScreen* screen); + void closePrimaryClient(PrimaryClient* primaryClient); + void closeServerScreen(Screen* screen); void cleanupServer(); bool initServer(); - void retryHandler(const CEvent&, void*); - CScreen* openServerScreen(); - CScreen* createScreen(); - CPrimaryClient* openPrimaryClient(const CString& name, CScreen* screen); - void handleScreenError(const CEvent&, void*); - void handleSuspend(const CEvent&, void*); - void handleResume(const CEvent&, void*); - CClientListener* openClientListener(const CNetworkAddress& address); - CServer* openServer(CConfig& config, CPrimaryClient* primaryClient); - void handleNoClients(const CEvent&, void*); + void retryHandler(const Event&, void*); + Screen* openServerScreen(); + Screen* createScreen(); + PrimaryClient* openPrimaryClient(const String& name, Screen* screen); + void handleScreenError(const Event&, void*); + void handleSuspend(const Event&, void*); + void handleResume(const Event&, void*); + ClientListener* openClientListener(const NetworkAddress& address); + Server* openServer(Config& config, PrimaryClient* primaryClient); + void handleNoClients(const Event&, void*); bool startServer(); int mainLoop(); int runInner(int argc, char** argv, ILogOutputter* outputter, StartupFunc startup); @@ -101,20 +101,20 @@ public: int foregroundStartup(int argc, char** argv); void startNode(); - static CServerApp& instance() { return (CServerApp&)CApp::instance(); } + static ServerApp& instance() { return (ServerApp&)App::instance(); } - CServer* getServerPtr() { return m_server; } + Server* getServerPtr() { return m_server; } - CServer* m_server; + Server* m_server; EServerState m_serverState; - CScreen* m_serverScreen; - CPrimaryClient* m_primaryClient; - CClientListener* m_listener; - CEventQueueTimer* m_timer; - CNetworkAddress* m_synergyAddress; + Screen* m_serverScreen; + PrimaryClient* m_primaryClient; + ClientListener* m_listener; + EventQueueTimer* m_timer; + NetworkAddress* m_synergyAddress; private: - void handleScreenSwitched(const CEvent&, void* data); + void handleScreenSwitched(const Event&, void* data); }; // configuration file name diff --git a/src/lib/synergy/ServerArgs.cpp b/src/lib/synergy/ServerArgs.cpp index fb0d48f3..eddf9c7c 100644 --- a/src/lib/synergy/ServerArgs.cpp +++ b/src/lib/synergy/ServerArgs.cpp @@ -17,7 +17,7 @@ #include "synergy/ServerArgs.h" -CServerArgs::CServerArgs() : +ServerArgs::ServerArgs() : m_configFile(), m_config(NULL) { diff --git a/src/lib/synergy/ServerArgs.h b/src/lib/synergy/ServerArgs.h index d516209a..457ca6db 100644 --- a/src/lib/synergy/ServerArgs.h +++ b/src/lib/synergy/ServerArgs.h @@ -19,14 +19,14 @@ #include "synergy/ArgsBase.h" -class CNetworkAddress; -class CConfig; +class NetworkAddress; +class Config; -class CServerArgs : public CArgsBase { +class ServerArgs : public ArgsBase { public: - CServerArgs(); + ServerArgs(); public: - CString m_configFile; - CConfig* m_config; + String m_configFile; + Config* m_config; }; diff --git a/src/lib/synergy/ServerTaskBarReceiver.cpp b/src/lib/synergy/ServerTaskBarReceiver.cpp index 16f95a30..e042e6d9 100644 --- a/src/lib/synergy/ServerTaskBarReceiver.cpp +++ b/src/lib/synergy/ServerTaskBarReceiver.cpp @@ -25,23 +25,23 @@ #include "common/Version.h" // -// CServerTaskBarReceiver +// ServerTaskBarReceiver // -CServerTaskBarReceiver::CServerTaskBarReceiver(IEventQueue* events) : +ServerTaskBarReceiver::ServerTaskBarReceiver(IEventQueue* events) : m_state(kNotRunning), m_events(events) { // do nothing } -CServerTaskBarReceiver::~CServerTaskBarReceiver() +ServerTaskBarReceiver::~ServerTaskBarReceiver() { // do nothing } void -CServerTaskBarReceiver::updateStatus(CServer* server, const CString& errorMsg) +ServerTaskBarReceiver::updateStatus(Server* server, const String& errorMsg) { { // update our status @@ -73,50 +73,50 @@ CServerTaskBarReceiver::updateStatus(CServer* server, const CString& errorMsg) ARCH->updateReceiver(this); } -CServerTaskBarReceiver::EState -CServerTaskBarReceiver::getStatus() const +ServerTaskBarReceiver::EState +ServerTaskBarReceiver::getStatus() const { return m_state; } -const CString& -CServerTaskBarReceiver::getErrorMessage() const +const String& +ServerTaskBarReceiver::getErrorMessage() const { return m_errorMessage; } -const CServerTaskBarReceiver::CClients& -CServerTaskBarReceiver::getClients() const +const ServerTaskBarReceiver::Clients& +ServerTaskBarReceiver::getClients() const { return m_clients; } void -CServerTaskBarReceiver::quit() +ServerTaskBarReceiver::quit() { - m_events->addEvent(CEvent(CEvent::kQuit)); + m_events->addEvent(Event(Event::kQuit)); } void -CServerTaskBarReceiver::onStatusChanged(CServer*) +ServerTaskBarReceiver::onStatusChanged(Server*) { // do nothing } void -CServerTaskBarReceiver::lock() const +ServerTaskBarReceiver::lock() const { // do nothing } void -CServerTaskBarReceiver::unlock() const +ServerTaskBarReceiver::unlock() const { // do nothing } std::string -CServerTaskBarReceiver::getToolTip() const +ServerTaskBarReceiver::getToolTip() const { switch (m_state) { case kNotRunning: diff --git a/src/lib/synergy/ServerTaskBarReceiver.h b/src/lib/synergy/ServerTaskBarReceiver.h index d80c56d8..b8208257 100644 --- a/src/lib/synergy/ServerTaskBarReceiver.h +++ b/src/lib/synergy/ServerTaskBarReceiver.h @@ -29,10 +29,10 @@ class IEventQueue; //! Implementation of IArchTaskBarReceiver for the synergy server -class CServerTaskBarReceiver : public IArchTaskBarReceiver { +class ServerTaskBarReceiver : public IArchTaskBarReceiver { public: - CServerTaskBarReceiver(IEventQueue* events); - virtual ~CServerTaskBarReceiver(); + ServerTaskBarReceiver(IEventQueue* events); + virtual ~ServerTaskBarReceiver(); //! @name manipulators //@{ @@ -41,9 +41,9 @@ public: /*! Determine the status and query required information from the server. */ - void updateStatus(CServer*, const CString& errorMsg); + void updateStatus(Server*, const String& errorMsg); - void updateStatus(INode* n, const CString& errorMsg) { updateStatus((CServer*)n, errorMsg); } + void updateStatus(INode* n, const String& errorMsg) { updateStatus((Server*)n, errorMsg); } //@} @@ -57,7 +57,7 @@ public: virtual std::string getToolTip() const; protected: - typedef std::vector CClients; + typedef std::vector Clients; enum EState { kNotRunning, kNotWorking, @@ -70,10 +70,10 @@ protected: EState getStatus() const; //! Get error message - const CString& getErrorMessage() const; + const String& getErrorMessage() const; //! Get connected clients - const CClients& getClients() const; + const Clients& getClients() const; //! Quit app /*! @@ -86,13 +86,13 @@ protected: Called when status changes. The default implementation does nothing. */ - virtual void onStatusChanged(CServer* server); + virtual void onStatusChanged(Server* server); private: EState m_state; - CString m_errorMessage; - CClients m_clients; + String m_errorMessage; + Clients m_clients; IEventQueue* m_events; }; -IArchTaskBarReceiver* createTaskBarReceiver(const CBufferedLogOutputter* logBuffer, IEventQueue* events); +IArchTaskBarReceiver* createTaskBarReceiver(const BufferedLogOutputter* logBuffer, IEventQueue* events); diff --git a/src/lib/synergy/ToolApp.cpp b/src/lib/synergy/ToolApp.cpp index 03035c61..e0e2cb57 100644 --- a/src/lib/synergy/ToolApp.cpp +++ b/src/lib/synergy/ToolApp.cpp @@ -37,7 +37,7 @@ enum { }; UInt32 -CToolApp::run(int argc, char** argv) +ToolApp::run(int argc, char** argv) { if (argc <= 1) { std::cerr << "no args" << std::endl; diff --git a/src/lib/synergy/ToolApp.h b/src/lib/synergy/ToolApp.h index ebca6798..4cb429cc 100644 --- a/src/lib/synergy/ToolApp.h +++ b/src/lib/synergy/ToolApp.h @@ -21,7 +21,7 @@ #include "synergy/ToolArgs.h" #include "common/basic_types.h" -class CToolApp : public CMinimalApp +class ToolApp : public MinimalApp { public: UInt32 run(int argc, char** argv); diff --git a/src/lib/synergy/XScreen.cpp b/src/lib/synergy/XScreen.cpp index e62991f3..c39579c3 100644 --- a/src/lib/synergy/XScreen.cpp +++ b/src/lib/synergy/XScreen.cpp @@ -22,7 +22,7 @@ // XScreenOpenFailure // -CString +String XScreenOpenFailure::getWhat() const throw() { return format("XScreenOpenFailure", "unable to open screen"); @@ -33,7 +33,7 @@ XScreenOpenFailure::getWhat() const throw() // XScreenXInputFailure // -CString +String XScreenXInputFailure::getWhat() const throw() { return ""; @@ -61,7 +61,7 @@ XScreenUnavailable::getRetryTime() const return m_timeUntilRetry; } -CString +String XScreenUnavailable::getWhat() const throw() { return format("XScreenUnavailable", "unable to open screen"); diff --git a/src/lib/synergy/XScreen.h b/src/lib/synergy/XScreen.h index 780a98cb..5070547a 100644 --- a/src/lib/synergy/XScreen.h +++ b/src/lib/synergy/XScreen.h @@ -61,7 +61,7 @@ public: //@} protected: - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: double m_timeUntilRetry; diff --git a/src/lib/synergy/XSynergy.cpp b/src/lib/synergy/XSynergy.cpp index 06ff6b06..e8d7fd7f 100644 --- a/src/lib/synergy/XSynergy.cpp +++ b/src/lib/synergy/XSynergy.cpp @@ -23,7 +23,7 @@ // XBadClient // -CString +String XBadClient::getWhat() const throw() { return "XBadClient"; @@ -53,7 +53,7 @@ XIncompatibleClient::getMinor() const throw() return m_minor; } -CString +String XIncompatibleClient::getWhat() const throw() { return format("XIncompatibleClient", "incompatible client %{1}.%{2}", @@ -66,19 +66,19 @@ XIncompatibleClient::getWhat() const throw() // XDuplicateClient // -XDuplicateClient::XDuplicateClient(const CString& name) : +XDuplicateClient::XDuplicateClient(const String& name) : m_name(name) { // do nothing } -const CString& +const String& XDuplicateClient::getName() const throw() { return m_name; } -CString +String XDuplicateClient::getWhat() const throw() { return format("XDuplicateClient", "duplicate client %{1}", m_name.c_str()); @@ -89,19 +89,19 @@ XDuplicateClient::getWhat() const throw() // XUnknownClient // -XUnknownClient::XUnknownClient(const CString& name) : +XUnknownClient::XUnknownClient(const String& name) : m_name(name) { // do nothing } -const CString& +const String& XUnknownClient::getName() const throw() { return m_name; } -CString +String XUnknownClient::getWhat() const throw() { return format("XUnknownClient", "unknown client %{1}", m_name.c_str()); @@ -124,7 +124,7 @@ XExitApp::getCode() const throw() return m_code; } -CString +String XExitApp::getWhat() const throw() { return format( diff --git a/src/lib/synergy/XSynergy.h b/src/lib/synergy/XSynergy.h index e288b53d..60add6cc 100644 --- a/src/lib/synergy/XSynergy.h +++ b/src/lib/synergy/XSynergy.h @@ -48,7 +48,7 @@ public: //@} protected: - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: int m_major; @@ -62,23 +62,23 @@ a client that is already connected. */ class XDuplicateClient : public XSynergy { public: - XDuplicateClient(const CString& name); + XDuplicateClient(const String& name); virtual ~XDuplicateClient() _NOEXCEPT { } //! @name accessors //@{ //! Get client's name - virtual const CString& + virtual const String& getName() const throw(); //@} protected: - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: - CString m_name; + String m_name; }; //! Client not in map exception @@ -88,23 +88,23 @@ unknown to the server. */ class XUnknownClient : public XSynergy { public: - XUnknownClient(const CString& name); + XUnknownClient(const String& name); virtual ~XUnknownClient() _NOEXCEPT { } //! @name accessors //@{ //! Get the client's name - virtual const CString& + virtual const String& getName() const throw(); //@} protected: - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: - CString m_name; + String m_name; }; //! Generic exit eception @@ -122,7 +122,7 @@ public: int getCode() const throw(); protected: - virtual CString getWhat() const throw(); + virtual String getWhat() const throw(); private: int m_code; diff --git a/src/lib/synergy/option_types.h b/src/lib/synergy/option_types.h index c385e1eb..ffabadc2 100644 --- a/src/lib/synergy/option_types.h +++ b/src/lib/synergy/option_types.h @@ -34,7 +34,7 @@ Type to hold an option value. typedef SInt32 OptionValue; // for now, options are just pairs of integers -typedef std::vector COptionsList; +typedef std::vector OptionsList; // macro for packing 4 character strings into 4 byte integers #define OPTION_CODE(_s) \ diff --git a/src/lib/synergy/protocol_types.h b/src/lib/synergy/protocol_types.h index 415d5e7f..7fd4de45 100644 --- a/src/lib/synergy/protocol_types.h +++ b/src/lib/synergy/protocol_types.h @@ -307,7 +307,7 @@ extern const char* kMsgEBad; /*! This class contains information about a screen. */ -class CClientInfo { +class ClientInfo { public: //! Screen position /*! diff --git a/src/lib/synergy/unix/AppUtilUnix.cpp b/src/lib/synergy/unix/AppUtilUnix.cpp index 786dbef2..c2738323 100644 --- a/src/lib/synergy/unix/AppUtilUnix.cpp +++ b/src/lib/synergy/unix/AppUtilUnix.cpp @@ -19,28 +19,28 @@ #include "synergy/unix/AppUtilUnix.h" #include "synergy/ArgsBase.h" -CAppUtilUnix::CAppUtilUnix(IEventQueue* events) +AppUtilUnix::AppUtilUnix(IEventQueue* events) { } -CAppUtilUnix::~CAppUtilUnix() +AppUtilUnix::~AppUtilUnix() { } int standardStartupStatic(int argc, char** argv) { - return CAppUtil::instance().app().standardStartup(argc, argv); + return AppUtil::instance().app().standardStartup(argc, argv); } int -CAppUtilUnix::run(int argc, char** argv) +AppUtilUnix::run(int argc, char** argv) { return app().runInner(argc, argv, NULL, &standardStartupStatic); } void -CAppUtilUnix::startNode() +AppUtilUnix::startNode() { app().startNode(); } diff --git a/src/lib/synergy/unix/AppUtilUnix.h b/src/lib/synergy/unix/AppUtilUnix.h index 4b0bb8e3..5e02f7dc 100644 --- a/src/lib/synergy/unix/AppUtilUnix.h +++ b/src/lib/synergy/unix/AppUtilUnix.h @@ -20,14 +20,14 @@ #include "synergy/AppUtil.h" -#define ARCH_APP_UTIL CAppUtilUnix +#define ARCH_APP_UTIL AppUtilUnix class IEventQueue; -class CAppUtilUnix : public CAppUtil { +class AppUtilUnix : public AppUtil { public: - CAppUtilUnix(IEventQueue* events); - virtual ~CAppUtilUnix(); + AppUtilUnix(IEventQueue* events); + virtual ~AppUtilUnix(); int run(int argc, char** argv); void startNode(); diff --git a/src/lib/synergy/win32/AppUtilWindows.cpp b/src/lib/synergy/win32/AppUtilWindows.cpp index 2230f128..7b8d1250 100644 --- a/src/lib/synergy/win32/AppUtilWindows.cpp +++ b/src/lib/synergy/win32/AppUtilWindows.cpp @@ -36,7 +36,7 @@ #include #include -CAppUtilWindows::CAppUtilWindows(IEventQueue* events) : +AppUtilWindows::AppUtilWindows(IEventQueue* events) : m_events(events), m_exitMode(kExitModeNormal) { @@ -46,15 +46,15 @@ CAppUtilWindows::CAppUtilWindows(IEventQueue* events) : } } -CAppUtilWindows::~CAppUtilWindows() +AppUtilWindows::~AppUtilWindows() { } -BOOL WINAPI CAppUtilWindows::consoleHandler(DWORD) +BOOL WINAPI AppUtilWindows::consoleHandler(DWORD) { LOG((CLOG_INFO "got shutdown signal")); - IEventQueue* events = CAppUtil::instance().app().getEvents(); - events->addEvent(CEvent(CEvent::kQuit)); + IEventQueue* events = AppUtil::instance().app().getEvents(); + events->addEvent(Event(Event::kQuit)); return TRUE; } @@ -62,11 +62,11 @@ static int mainLoopStatic() { - return CAppUtil::instance().app().mainLoop(); + return AppUtil::instance().app().mainLoop(); } int -CAppUtilWindows::daemonNTMainLoop(int argc, const char** argv) +AppUtilWindows::daemonNTMainLoop(int argc, const char** argv) { app().initApp(argc, argv); debugServiceWait(); @@ -74,16 +74,16 @@ CAppUtilWindows::daemonNTMainLoop(int argc, const char** argv) // NB: what the hell does this do?! app().argsBase().m_backend = false; - return CArchMiscWindows::runDaemon(mainLoopStatic); + return ArchMiscWindows::runDaemon(mainLoopStatic); } void -CAppUtilWindows::exitApp(int code) +AppUtilWindows::exitApp(int code) { switch (m_exitMode) { case kExitModeDaemon: - CArchMiscWindows::daemonFailed(code); + ArchMiscWindows::daemonFailed(code); break; default: @@ -93,13 +93,13 @@ CAppUtilWindows::exitApp(int code) int daemonNTMainLoopStatic(int argc, const char** argv) { - return CAppUtilWindows::instance().daemonNTMainLoop(argc, argv); + return AppUtilWindows::instance().daemonNTMainLoop(argc, argv); } int -CAppUtilWindows::daemonNTStartup(int, char**) +AppUtilWindows::daemonNTStartup(int, char**) { - CSystemLogger sysLogger(app().daemonName(), false); + SystemLogger sysLogger(app().daemonName(), false); m_exitMode = kExitModeDaemon; return ARCH->daemonize(app().daemonName(), daemonNTMainLoopStatic); } @@ -108,18 +108,18 @@ static int daemonNTStartupStatic(int argc, char** argv) { - return CAppUtilWindows::instance().daemonNTStartup(argc, argv); + return AppUtilWindows::instance().daemonNTStartup(argc, argv); } static int foregroundStartupStatic(int argc, char** argv) { - return CAppUtil::instance().app().foregroundStartup(argc, argv); + return AppUtil::instance().app().foregroundStartup(argc, argv); } void -CAppUtilWindows::beforeAppExit() +AppUtilWindows::beforeAppExit() { // this can be handy for debugging, since the application is launched in // a new console window, and will normally close on exit (making it so @@ -131,25 +131,25 @@ CAppUtilWindows::beforeAppExit() } int -CAppUtilWindows::run(int argc, char** argv) -{ - OSVERSIONINFO osvi; - ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osvi); - +AppUtilWindows::run(int argc, char** argv) +{ + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osvi); + if (osvi.dwMajorVersion < 5 || (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion < 1)) { throw std::runtime_error("synergy only supports windows xp and above."); } // record window instance for tray icon, etc - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); - CMSWindowsScreen::init(CArchMiscWindows::instanceWin32()); - CThread::getCurrentThread().setPriority(-14); + CMSWindowsScreen::init(ArchMiscWindows::instanceWin32()); + Thread::getCurrentThread().setPriority(-14); StartupFunc startup; - if (CArchMiscWindows::wasLaunchedAsService()) { + if (ArchMiscWindows::wasLaunchedAsService()) { startup = &daemonNTStartupStatic; } else { startup = &foregroundStartupStatic; @@ -159,14 +159,14 @@ CAppUtilWindows::run(int argc, char** argv) return app().runInner(argc, argv, NULL, startup); } -CAppUtilWindows& -CAppUtilWindows::instance() +AppUtilWindows& +AppUtilWindows::instance() { - return (CAppUtilWindows&)CAppUtil::instance(); + return (AppUtilWindows&)AppUtil::instance(); } void -CAppUtilWindows::debugServiceWait() +AppUtilWindows::debugServiceWait() { if (app().argsBase().m_debugServiceWait) { @@ -183,7 +183,7 @@ CAppUtilWindows::debugServiceWait() } void -CAppUtilWindows::startNode() +AppUtilWindows::startNode() { app().startNode(); } diff --git a/src/lib/synergy/win32/AppUtilWindows.h b/src/lib/synergy/win32/AppUtilWindows.h index c51a09a6..74b4c041 100644 --- a/src/lib/synergy/win32/AppUtilWindows.h +++ b/src/lib/synergy/win32/AppUtilWindows.h @@ -24,7 +24,7 @@ #define WIN32_LEAN_AND_MEAN #include "Windows.h" -#define ARCH_APP_UTIL CAppUtilWindows +#define ARCH_APP_UTIL AppUtilWindows class IEventQueue; @@ -33,10 +33,10 @@ enum AppExitMode { kExitModeDaemon }; -class CAppUtilWindows : public CAppUtil { +class AppUtilWindows : public AppUtil { public: - CAppUtilWindows(IEventQueue* events); - virtual ~CAppUtilWindows(); + AppUtilWindows(IEventQueue* events); + virtual ~AppUtilWindows(); int daemonNTStartup(int, char**); @@ -50,7 +50,7 @@ public: void beforeAppExit(); - static CAppUtilWindows& instance(); + static AppUtilWindows& instance(); void startNode(); @@ -58,5 +58,5 @@ private: AppExitMode m_exitMode; IEventQueue* m_events; - static BOOL WINAPI consoleHandler(DWORD CEvent); + static BOOL WINAPI consoleHandler(DWORD Event); }; diff --git a/src/lib/synwinhk/synwinhk.cpp b/src/lib/synwinhk/synwinhk.cpp index 70840085..97c5ca26 100644 --- a/src/lib/synwinhk/synwinhk.cpp +++ b/src/lib/synwinhk/synwinhk.cpp @@ -554,7 +554,7 @@ doMouseHookHandler(WPARAM wParam, SInt32 x, SInt32 y, SInt32 data) // outside of the screen. jeez. naturally we end up getting // fake motion in the other direction to get the position back // on the screen, which plays havoc with switch on double tap. - // CServer deals with that. we'll clamp positions onto the + // Server deals with that. we'll clamp positions onto the // screen. also, if we discard events for positions outside // of the screen then the mouse appears to get a bit jerky // near the edge. we can either accept that or pass the bogus diff --git a/src/test/global/TestEventQueue.cpp b/src/test/global/TestEventQueue.cpp index 91a615fa..46e0f5fc 100644 --- a/src/test/global/TestEventQueue.cpp +++ b/src/test/global/TestEventQueue.cpp @@ -23,31 +23,31 @@ #include "common/stdexcept.h" void -CTestEventQueue::raiseQuitEvent() +TestEventQueue::raiseQuitEvent() { - addEvent(CEvent(CEvent::kQuit)); + addEvent(Event(Event::kQuit)); } void -CTestEventQueue::initQuitTimeout(double timeout) +TestEventQueue::initQuitTimeout(double timeout) { assert(m_quitTimeoutTimer == nullptr); m_quitTimeoutTimer = newOneShotTimer(timeout, NULL); - adoptHandler(CEvent::kTimer, m_quitTimeoutTimer, - new TMethodEventJob( - this, &CTestEventQueue::handleQuitTimeout)); + adoptHandler(Event::kTimer, m_quitTimeoutTimer, + new TMethodEventJob( + this, &TestEventQueue::handleQuitTimeout)); } void -CTestEventQueue::cleanupQuitTimeout() +TestEventQueue::cleanupQuitTimeout() { - removeHandler(CEvent::kTimer, m_quitTimeoutTimer); + removeHandler(Event::kTimer, m_quitTimeoutTimer); delete m_quitTimeoutTimer; m_quitTimeoutTimer = nullptr; } void -CTestEventQueue::handleQuitTimeout(const CEvent&, void* vclient) +TestEventQueue::handleQuitTimeout(const Event&, void* vclient) { throw std::runtime_error("test event queue timeout"); } diff --git a/src/test/global/TestEventQueue.h b/src/test/global/TestEventQueue.h index fffd55fb..965d08e1 100644 --- a/src/test/global/TestEventQueue.h +++ b/src/test/global/TestEventQueue.h @@ -19,13 +19,13 @@ #include "base/EventQueue.h" -class CEventQueueTimer; +class EventQueueTimer; -class CTestEventQueue : public CEventQueue { +class TestEventQueue : public EventQueue { public: - CTestEventQueue() : m_quitTimeoutTimer(nullptr) { } + TestEventQueue() : m_quitTimeoutTimer(nullptr) { } - void handleQuitTimeout(const CEvent&, void* vclient); + void handleQuitTimeout(const Event&, void* vclient); void raiseQuitEvent(); void initQuitTimeout(double timeout); void cleanupQuitTimeout(); @@ -34,5 +34,5 @@ private: void timeoutThread(void*); private: - CEventQueueTimer* m_quitTimeoutTimer; + EventQueueTimer* m_quitTimeoutTimer; }; diff --git a/src/test/integtests/Main.cpp b/src/test/integtests/Main.cpp index afb17106..d58ec275 100644 --- a/src/test/integtests/Main.cpp +++ b/src/test/integtests/Main.cpp @@ -39,13 +39,13 @@ main(int argc, char **argv) { #if SYSAPI_WIN32 // record window instance for tray icon, etc - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CLog log; + Log log; log.setFilter(kDEBUG2); string lockFile; diff --git a/src/test/integtests/arch/ArchInternetTests.cpp b/src/test/integtests/arch/ArchInternetTests.cpp index 5addc7c7..4841a232 100644 --- a/src/test/integtests/arch/ArchInternetTests.cpp +++ b/src/test/integtests/arch/ArchInternetTests.cpp @@ -25,13 +25,13 @@ TEST(ArchInternetTests, get) { ARCH_INTERNET internet; - CString result = internet.get(TEST_URL); + String result = internet.get(TEST_URL); ASSERT_EQ("Hello world!", result); } TEST(ArchInternetTests, urlEncode) { ARCH_INTERNET internet; - CString result = internet.urlEncode("hello=+&world"); + String result = internet.urlEncode("hello=+&world"); ASSERT_EQ("hello%3D%2B%26world", result); } diff --git a/src/test/integtests/ipc/IpcTests.cpp b/src/test/integtests/ipc/IpcTests.cpp index 5b85d6f7..43526e10 100644 --- a/src/test/integtests/ipc/IpcTests.cpp +++ b/src/test/integtests/ipc/IpcTests.cpp @@ -41,109 +41,109 @@ #define TEST_IPC_PORT 24802 -class CIpcTests : public ::testing::Test +class IpcTests : public ::testing::Test { public: - CIpcTests(); - virtual ~CIpcTests(); + IpcTests(); + virtual ~IpcTests(); - void connectToServer_handleMessageReceived(const CEvent&, void*); - void sendMessageToServer_serverHandleMessageReceived(const CEvent&, void*); - void sendMessageToClient_serverHandleClientConnected(const CEvent&, void*); - void sendMessageToClient_clientHandleMessageReceived(const CEvent&, void*); + void connectToServer_handleMessageReceived(const Event&, void*); + void sendMessageToServer_serverHandleMessageReceived(const Event&, void*); + void sendMessageToClient_serverHandleClientConnected(const Event&, void*); + void sendMessageToClient_clientHandleMessageReceived(const Event&, void*); public: - CSocketMultiplexer m_multiplexer; + SocketMultiplexer m_multiplexer; bool m_connectToServer_helloMessageReceived; bool m_connectToServer_hasClientNode; - CIpcServer* m_connectToServer_server; - CString m_sendMessageToServer_receivedString; - CString m_sendMessageToClient_receivedString; - CIpcClient* m_sendMessageToServer_client; - CIpcServer* m_sendMessageToClient_server; - CTestEventQueue m_events; + IpcServer* m_connectToServer_server; + String m_sendMessageToServer_receivedString; + String m_sendMessageToClient_receivedString; + IpcClient* m_sendMessageToServer_client; + IpcServer* m_sendMessageToClient_server; + TestEventQueue m_events; }; -TEST_F(CIpcTests, connectToServer) +TEST_F(IpcTests, connectToServer) { - CSocketMultiplexer socketMultiplexer; - CIpcServer server(&m_events, &socketMultiplexer, TEST_IPC_PORT); + SocketMultiplexer socketMultiplexer; + IpcServer server(&m_events, &socketMultiplexer, TEST_IPC_PORT); server.listen(); m_connectToServer_server = &server; m_events.adoptHandler( - m_events.forCIpcServer().messageReceived(), &server, - new TMethodEventJob( - this, &CIpcTests::connectToServer_handleMessageReceived)); + m_events.forIpcServer().messageReceived(), &server, + new TMethodEventJob( + this, &IpcTests::connectToServer_handleMessageReceived)); - CIpcClient client(&m_events, &socketMultiplexer, TEST_IPC_PORT); + IpcClient client(&m_events, &socketMultiplexer, TEST_IPC_PORT); client.connect(); m_events.initQuitTimeout(5); m_events.loop(); - m_events.removeHandler(m_events.forCIpcServer().messageReceived(), &server); + m_events.removeHandler(m_events.forIpcServer().messageReceived(), &server); m_events.cleanupQuitTimeout(); EXPECT_EQ(true, m_connectToServer_helloMessageReceived); EXPECT_EQ(true, m_connectToServer_hasClientNode); } -TEST_F(CIpcTests, sendMessageToServer) +TEST_F(IpcTests, sendMessageToServer) { - CSocketMultiplexer socketMultiplexer; - CIpcServer server(&m_events, &socketMultiplexer, TEST_IPC_PORT); + SocketMultiplexer socketMultiplexer; + IpcServer server(&m_events, &socketMultiplexer, TEST_IPC_PORT); server.listen(); // event handler sends "test" command to server. m_events.adoptHandler( - m_events.forCIpcServer().messageReceived(), &server, - new TMethodEventJob( - this, &CIpcTests::sendMessageToServer_serverHandleMessageReceived)); + m_events.forIpcServer().messageReceived(), &server, + new TMethodEventJob( + this, &IpcTests::sendMessageToServer_serverHandleMessageReceived)); - CIpcClient client(&m_events, &socketMultiplexer, TEST_IPC_PORT); + IpcClient client(&m_events, &socketMultiplexer, TEST_IPC_PORT); client.connect(); m_sendMessageToServer_client = &client; m_events.initQuitTimeout(5); m_events.loop(); - m_events.removeHandler(m_events.forCIpcServer().messageReceived(), &server); + m_events.removeHandler(m_events.forIpcServer().messageReceived(), &server); m_events.cleanupQuitTimeout(); EXPECT_EQ("test", m_sendMessageToServer_receivedString); } -TEST_F(CIpcTests, sendMessageToClient) +TEST_F(IpcTests, sendMessageToClient) { - CSocketMultiplexer socketMultiplexer; - CIpcServer server(&m_events, &socketMultiplexer, TEST_IPC_PORT); + SocketMultiplexer socketMultiplexer; + IpcServer server(&m_events, &socketMultiplexer, TEST_IPC_PORT); server.listen(); m_sendMessageToClient_server = &server; // event handler sends "test" log line to client. m_events.adoptHandler( - m_events.forCIpcServer().messageReceived(), &server, - new TMethodEventJob( - this, &CIpcTests::sendMessageToClient_serverHandleClientConnected)); + m_events.forIpcServer().messageReceived(), &server, + new TMethodEventJob( + this, &IpcTests::sendMessageToClient_serverHandleClientConnected)); - CIpcClient client(&m_events, &socketMultiplexer, TEST_IPC_PORT); + IpcClient client(&m_events, &socketMultiplexer, TEST_IPC_PORT); client.connect(); m_events.adoptHandler( - m_events.forCIpcClient().messageReceived(), &client, - new TMethodEventJob( - this, &CIpcTests::sendMessageToClient_clientHandleMessageReceived)); + m_events.forIpcClient().messageReceived(), &client, + new TMethodEventJob( + this, &IpcTests::sendMessageToClient_clientHandleMessageReceived)); m_events.initQuitTimeout(5); m_events.loop(); - m_events.removeHandler(m_events.forCIpcServer().messageReceived(), &server); - m_events.removeHandler(m_events.forCIpcClient().messageReceived(), &client); + m_events.removeHandler(m_events.forIpcServer().messageReceived(), &server); + m_events.removeHandler(m_events.forIpcClient().messageReceived(), &client); m_events.cleanupQuitTimeout(); EXPECT_EQ("test", m_sendMessageToClient_receivedString); } -CIpcTests::CIpcTests() : +IpcTests::IpcTests() : m_connectToServer_helloMessageReceived(false), m_connectToServer_hasClientNode(false), m_connectToServer_server(nullptr), @@ -152,14 +152,14 @@ m_sendMessageToServer_client(nullptr) { } -CIpcTests::~CIpcTests() +IpcTests::~IpcTests() { } void -CIpcTests::connectToServer_handleMessageReceived(const CEvent& e, void*) +IpcTests::connectToServer_handleMessageReceived(const Event& e, void*) { - CIpcMessage* m = static_cast(e.getDataObject()); + IpcMessage* m = static_cast(e.getDataObject()); if (m->type() == kIpcHello) { m_connectToServer_hasClientNode = m_connectToServer_server->hasClients(kIpcClientNode); @@ -169,16 +169,16 @@ CIpcTests::connectToServer_handleMessageReceived(const CEvent& e, void*) } void -CIpcTests::sendMessageToServer_serverHandleMessageReceived(const CEvent& e, void*) +IpcTests::sendMessageToServer_serverHandleMessageReceived(const Event& e, void*) { - CIpcMessage* m = static_cast(e.getDataObject()); + IpcMessage* m = static_cast(e.getDataObject()); if (m->type() == kIpcHello) { LOG((CLOG_DEBUG "client said hello, sending test to server")); - CIpcCommandMessage m("test", true); + IpcCommandMessage m("test", true); m_sendMessageToServer_client->send(m); } else if (m->type() == kIpcCommand) { - CIpcCommandMessage* cm = static_cast(m); + IpcCommandMessage* cm = static_cast(m); LOG((CLOG_DEBUG "got ipc command message, %d", cm->command().c_str())); m_sendMessageToServer_receivedString = cm->command(); m_events.raiseQuitEvent(); @@ -186,22 +186,22 @@ CIpcTests::sendMessageToServer_serverHandleMessageReceived(const CEvent& e, void } void -CIpcTests::sendMessageToClient_serverHandleClientConnected(const CEvent& e, void*) +IpcTests::sendMessageToClient_serverHandleClientConnected(const Event& e, void*) { - CIpcMessage* m = static_cast(e.getDataObject()); + IpcMessage* m = static_cast(e.getDataObject()); if (m->type() == kIpcHello) { LOG((CLOG_DEBUG "client said hello, sending test to client")); - CIpcLogLineMessage m("test"); + IpcLogLineMessage m("test"); m_sendMessageToClient_server->send(m, kIpcClientNode); } } void -CIpcTests::sendMessageToClient_clientHandleMessageReceived(const CEvent& e, void*) +IpcTests::sendMessageToClient_clientHandleMessageReceived(const Event& e, void*) { - CIpcMessage* m = static_cast(e.getDataObject()); + IpcMessage* m = static_cast(e.getDataObject()); if (m->type() == kIpcLogLine) { - CIpcLogLineMessage* llm = static_cast(m); + IpcLogLineMessage* llm = static_cast(m); LOG((CLOG_DEBUG "got ipc log message, %d", llm->logLine().c_str())); m_sendMessageToClient_receivedString = llm->logLine(); m_events.raiseQuitEvent(); diff --git a/src/test/integtests/net/NetworkTests.cpp b/src/test/integtests/net/NetworkTests.cpp index 214082ba..ea36e646 100644 --- a/src/test/integtests/net/NetworkTests.cpp +++ b/src/test/integtests/net/NetworkTests.cpp @@ -61,7 +61,7 @@ const size_t kMockFileSize = 1024 * 1024 * 10; // 10MB void getScreenShape(SInt32& x, SInt32& y, SInt32& w, SInt32& h); void getCursorPos(SInt32& x, SInt32& y); -CString intToString(size_t i); +String intToString(size_t i); UInt8* newMockData(size_t size); void createFile(fstream& file, const char* filename, size_t size); @@ -85,20 +85,20 @@ public: void sendMockData(void* eventTarget); - void sendToClient_mockData_handleClientConnected(const CEvent&, void* vlistener); - void sendToClient_mockData_fileRecieveCompleted(const CEvent&, void*); + void sendToClient_mockData_handleClientConnected(const Event&, void* vlistener); + void sendToClient_mockData_fileRecieveCompleted(const Event&, void*); - void sendToClient_mockFile_handleClientConnected(const CEvent&, void* vlistener); - void sendToClient_mockFile_fileRecieveCompleted(const CEvent& event, void*); + void sendToClient_mockFile_handleClientConnected(const Event&, void* vlistener); + void sendToClient_mockFile_fileRecieveCompleted(const Event& event, void*); - void sendToServer_mockData_handleClientConnected(const CEvent&, void* vlistener); - void sendToServer_mockData_fileRecieveCompleted(const CEvent& event, void*); + void sendToServer_mockData_handleClientConnected(const Event&, void* vlistener); + void sendToServer_mockData_fileRecieveCompleted(const Event& event, void*); - void sendToServer_mockFile_handleClientConnected(const CEvent&, void* vlistener); - void sendToServer_mockFile_fileRecieveCompleted(const CEvent& event, void*); + void sendToServer_mockFile_handleClientConnected(const Event&, void* vlistener); + void sendToServer_mockFile_fileRecieveCompleted(const Event& event, void*); public: - CTestEventQueue m_events; + TestEventQueue m_events; UInt8* m_mockData; size_t m_mockDataSize; fstream m_mockFile; @@ -108,41 +108,41 @@ public: TEST_F(NetworkTests, sendToClient_mockData) { // server and client - CNetworkAddress serverAddress(TEST_HOST, TEST_PORT); - CCryptoOptions cryptoOptions; + NetworkAddress serverAddress(TEST_HOST, TEST_PORT); + CryptoOptions cryptoOptions; serverAddress.resolve(); // server - CSocketMultiplexer serverSocketMultiplexer; + SocketMultiplexer serverSocketMultiplexer; CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer); - CClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); - NiceMock serverScreen; - NiceMock primaryClient; - NiceMock serverConfig; - NiceMock serverInputFilter; + ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + NiceMock serverScreen; + NiceMock primaryClient; + NiceMock serverConfig; + NiceMock serverInputFilter; m_events.adoptHandler( - m_events.forCClientListener().connected(), &listener, + m_events.forClientListener().connected(), &listener, new TMethodEventJob( this, &NetworkTests::sendToClient_mockData_handleClientConnected, &listener)); ON_CALL(serverConfig, isScreen(_)).WillByDefault(Return(true)); ON_CALL(serverConfig, getInputFilter()).WillByDefault(Return(&serverInputFilter)); - CServer server(serverConfig, &primaryClient, &serverScreen, &m_events, true); + Server server(serverConfig, &primaryClient, &serverScreen, &m_events, true); server.m_mock = true; listener.setServer(&server); // client - NiceMock clientScreen; - CSocketMultiplexer clientSocketMultiplexer; + NiceMock clientScreen; + SocketMultiplexer clientSocketMultiplexer; CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer); ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - CClient client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); m_events.adoptHandler( m_events.forIScreen().fileRecieveCompleted(), &client, @@ -153,7 +153,7 @@ TEST_F(NetworkTests, sendToClient_mockData) m_events.initQuitTimeout(10); m_events.loop(); - m_events.removeHandler(m_events.forCClientListener().connected(), &listener); + m_events.removeHandler(m_events.forClientListener().connected(), &listener); m_events.removeHandler(m_events.forIScreen().fileRecieveCompleted(), &client); m_events.cleanupQuitTimeout(); } @@ -161,41 +161,41 @@ TEST_F(NetworkTests, sendToClient_mockData) TEST_F(NetworkTests, sendToClient_mockFile) { // server and client - CNetworkAddress serverAddress(TEST_HOST, TEST_PORT); - CCryptoOptions cryptoOptions; + NetworkAddress serverAddress(TEST_HOST, TEST_PORT); + CryptoOptions cryptoOptions; serverAddress.resolve(); // server - CSocketMultiplexer serverSocketMultiplexer; + SocketMultiplexer serverSocketMultiplexer; CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer); - CClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); - NiceMock serverScreen; - NiceMock primaryClient; - NiceMock serverConfig; - NiceMock serverInputFilter; + ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + NiceMock serverScreen; + NiceMock primaryClient; + NiceMock serverConfig; + NiceMock serverInputFilter; m_events.adoptHandler( - m_events.forCClientListener().connected(), &listener, + m_events.forClientListener().connected(), &listener, new TMethodEventJob( this, &NetworkTests::sendToClient_mockFile_handleClientConnected, &listener)); ON_CALL(serverConfig, isScreen(_)).WillByDefault(Return(true)); ON_CALL(serverConfig, getInputFilter()).WillByDefault(Return(&serverInputFilter)); - CServer server(serverConfig, &primaryClient, &serverScreen, &m_events, true); + Server server(serverConfig, &primaryClient, &serverScreen, &m_events, true); server.m_mock = true; listener.setServer(&server); // client - NiceMock clientScreen; - CSocketMultiplexer clientSocketMultiplexer; + NiceMock clientScreen; + SocketMultiplexer clientSocketMultiplexer; CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer); ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - CClient client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); m_events.adoptHandler( m_events.forIScreen().fileRecieveCompleted(), &client, @@ -206,7 +206,7 @@ TEST_F(NetworkTests, sendToClient_mockFile) m_events.initQuitTimeout(10); m_events.loop(); - m_events.removeHandler(m_events.forCClientListener().connected(), &listener); + m_events.removeHandler(m_events.forClientListener().connected(), &listener); m_events.removeHandler(m_events.forIScreen().fileRecieveCompleted(), &client); m_events.cleanupQuitTimeout(); } @@ -214,39 +214,39 @@ TEST_F(NetworkTests, sendToClient_mockFile) TEST_F(NetworkTests, sendToServer_mockData) { // server and client - CNetworkAddress serverAddress(TEST_HOST, TEST_PORT); - CCryptoOptions cryptoOptions; + NetworkAddress serverAddress(TEST_HOST, TEST_PORT); + CryptoOptions cryptoOptions; serverAddress.resolve(); // server - CSocketMultiplexer serverSocketMultiplexer; + SocketMultiplexer serverSocketMultiplexer; CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer); - CClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); - NiceMock serverScreen; - NiceMock primaryClient; - NiceMock serverConfig; - NiceMock serverInputFilter; + ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + NiceMock serverScreen; + NiceMock primaryClient; + NiceMock serverConfig; + NiceMock serverInputFilter; ON_CALL(serverConfig, isScreen(_)).WillByDefault(Return(true)); ON_CALL(serverConfig, getInputFilter()).WillByDefault(Return(&serverInputFilter)); - CServer server(serverConfig, &primaryClient, &serverScreen, &m_events, true); + Server server(serverConfig, &primaryClient, &serverScreen, &m_events, true); server.m_mock = true; listener.setServer(&server); // client - NiceMock clientScreen; - CSocketMultiplexer clientSocketMultiplexer; + NiceMock clientScreen; + SocketMultiplexer clientSocketMultiplexer; CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer); ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - CClient client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); m_events.adoptHandler( - m_events.forCClientListener().connected(), &listener, + m_events.forClientListener().connected(), &listener, new TMethodEventJob( this, &NetworkTests::sendToServer_mockData_handleClientConnected, &client)); @@ -259,7 +259,7 @@ TEST_F(NetworkTests, sendToServer_mockData) m_events.initQuitTimeout(10); m_events.loop(); - m_events.removeHandler(m_events.forCClientListener().connected(), &listener); + m_events.removeHandler(m_events.forClientListener().connected(), &listener); m_events.removeHandler(m_events.forIScreen().fileRecieveCompleted(), &server); m_events.cleanupQuitTimeout(); } @@ -267,39 +267,39 @@ TEST_F(NetworkTests, sendToServer_mockData) TEST_F(NetworkTests, sendToServer_mockFile) { // server and client - CNetworkAddress serverAddress(TEST_HOST, TEST_PORT); - CCryptoOptions cryptoOptions; + NetworkAddress serverAddress(TEST_HOST, TEST_PORT); + CryptoOptions cryptoOptions; serverAddress.resolve(); // server - CSocketMultiplexer serverSocketMultiplexer; + SocketMultiplexer serverSocketMultiplexer; CTCPSocketFactory* serverSocketFactory = new CTCPSocketFactory(&m_events, &serverSocketMultiplexer); - CClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); - NiceMock serverScreen; - NiceMock primaryClient; - NiceMock serverConfig; - NiceMock serverInputFilter; + ClientListener listener(serverAddress, serverSocketFactory, NULL, cryptoOptions, &m_events); + NiceMock serverScreen; + NiceMock primaryClient; + NiceMock serverConfig; + NiceMock serverInputFilter; ON_CALL(serverConfig, isScreen(_)).WillByDefault(Return(true)); ON_CALL(serverConfig, getInputFilter()).WillByDefault(Return(&serverInputFilter)); - CServer server(serverConfig, &primaryClient, &serverScreen, &m_events, true); + Server server(serverConfig, &primaryClient, &serverScreen, &m_events, true); server.m_mock = true; listener.setServer(&server); // client - NiceMock clientScreen; - CSocketMultiplexer clientSocketMultiplexer; + NiceMock clientScreen; + SocketMultiplexer clientSocketMultiplexer; CTCPSocketFactory* clientSocketFactory = new CTCPSocketFactory(&m_events, &clientSocketMultiplexer); ON_CALL(clientScreen, getShape(_, _, _, _)).WillByDefault(Invoke(getScreenShape)); ON_CALL(clientScreen, getCursorPos(_, _)).WillByDefault(Invoke(getCursorPos)); - CClient client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); + Client client(&m_events, "stub", serverAddress, clientSocketFactory, NULL, &clientScreen, cryptoOptions, true); m_events.adoptHandler( - m_events.forCClientListener().connected(), &listener, + m_events.forClientListener().connected(), &listener, new TMethodEventJob( this, &NetworkTests::sendToServer_mockFile_handleClientConnected, &client)); @@ -312,23 +312,23 @@ TEST_F(NetworkTests, sendToServer_mockFile) m_events.initQuitTimeout(10); m_events.loop(); - m_events.removeHandler(m_events.forCClientListener().connected(), &listener); + m_events.removeHandler(m_events.forClientListener().connected(), &listener); m_events.removeHandler(m_events.forIScreen().fileRecieveCompleted(), &server); m_events.cleanupQuitTimeout(); } void -NetworkTests::sendToClient_mockData_handleClientConnected(const CEvent&, void* vlistener) +NetworkTests::sendToClient_mockData_handleClientConnected(const Event&, void* vlistener) { - CClientListener* listener = reinterpret_cast(vlistener); - CServer* server = listener->getServer(); + ClientListener* listener = reinterpret_cast(vlistener); + Server* server = listener->getServer(); - CClientProxy* client = listener->getNextClient(); + ClientProxy* client = listener->getNextClient(); if (client == NULL) { throw runtime_error("client is null"); } - CBaseClientProxy* bcp = reinterpret_cast(client); + BaseClientProxy* bcp = reinterpret_cast(client); server->adoptClient(bcp); server->setActive(bcp); @@ -336,26 +336,26 @@ NetworkTests::sendToClient_mockData_handleClientConnected(const CEvent&, void* v } void -NetworkTests::sendToClient_mockData_fileRecieveCompleted(const CEvent& event, void*) +NetworkTests::sendToClient_mockData_fileRecieveCompleted(const Event& event, void*) { - CClient* client = reinterpret_cast(event.getTarget()); + Client* client = reinterpret_cast(event.getTarget()); EXPECT_TRUE(client->isReceivedFileSizeValid()); m_events.raiseQuitEvent(); } void -NetworkTests::sendToClient_mockFile_handleClientConnected(const CEvent&, void* vlistener) +NetworkTests::sendToClient_mockFile_handleClientConnected(const Event&, void* vlistener) { - CClientListener* listener = reinterpret_cast(vlistener); - CServer* server = listener->getServer(); + ClientListener* listener = reinterpret_cast(vlistener); + Server* server = listener->getServer(); - CClientProxy* client = listener->getNextClient(); + ClientProxy* client = listener->getNextClient(); if (client == NULL) { throw runtime_error("client is null"); } - CBaseClientProxy* bcp = reinterpret_cast(client); + BaseClientProxy* bcp = reinterpret_cast(client); server->adoptClient(bcp); server->setActive(bcp); @@ -363,41 +363,41 @@ NetworkTests::sendToClient_mockFile_handleClientConnected(const CEvent&, void* v } void -NetworkTests::sendToClient_mockFile_fileRecieveCompleted(const CEvent& event, void*) +NetworkTests::sendToClient_mockFile_fileRecieveCompleted(const Event& event, void*) { - CClient* client = reinterpret_cast(event.getTarget()); + Client* client = reinterpret_cast(event.getTarget()); EXPECT_TRUE(client->isReceivedFileSizeValid()); m_events.raiseQuitEvent(); } void -NetworkTests::sendToServer_mockData_handleClientConnected(const CEvent&, void* vclient) +NetworkTests::sendToServer_mockData_handleClientConnected(const Event&, void* vclient) { - CClient* client = reinterpret_cast(vclient); + Client* client = reinterpret_cast(vclient); sendMockData(client); } void -NetworkTests::sendToServer_mockData_fileRecieveCompleted(const CEvent& event, void*) +NetworkTests::sendToServer_mockData_fileRecieveCompleted(const Event& event, void*) { - CServer* server = reinterpret_cast(event.getTarget()); + Server* server = reinterpret_cast(event.getTarget()); EXPECT_TRUE(server->isReceivedFileSizeValid()); m_events.raiseQuitEvent(); } void -NetworkTests::sendToServer_mockFile_handleClientConnected(const CEvent&, void* vclient) +NetworkTests::sendToServer_mockFile_handleClientConnected(const Event&, void* vclient) { - CClient* client = reinterpret_cast(vclient); + Client* client = reinterpret_cast(vclient); client->sendFileToServer(kMockFilename); } void -NetworkTests::sendToServer_mockFile_fileRecieveCompleted(const CEvent& event, void*) +NetworkTests::sendToServer_mockFile_fileRecieveCompleted(const Event& event, void*) { - CServer* server = reinterpret_cast(event.getTarget()); + Server* server = reinterpret_cast(event.getTarget()); EXPECT_TRUE(server->isReceivedFileSizeValid()); m_events.raiseQuitEvent(); @@ -407,15 +407,15 @@ void NetworkTests::sendMockData(void* eventTarget) { // send first message (file size) - CString size = intToString(kMockDataSize); + String size = intToString(kMockDataSize); size_t sizeLength = size.size(); - CFileChunker::CFileChunk* sizeMessage = new CFileChunker::CFileChunk(sizeLength + 2); + FileChunker::FileChunk* sizeMessage = new FileChunker::FileChunk(sizeLength + 2); char* chunkData = sizeMessage->m_chunk; chunkData[0] = kFileStart; memcpy(&chunkData[1], size.c_str(), sizeLength); chunkData[sizeLength + 1] = '\0'; - m_events.addEvent(CEvent(m_events.forIScreen().fileChunkSending(), eventTarget, sizeMessage)); + m_events.addEvent(Event(m_events.forIScreen().fileChunkSending(), eventTarget, sizeMessage)); // send chunk messages with incrementing chunk size size_t lastSize = 0; @@ -429,13 +429,13 @@ NetworkTests::sendMockData(void* eventTarget) } // first byte is the chunk mark, last is \0 - CFileChunker::CFileChunk* fileChunk = new CFileChunker::CFileChunk(chunkSize + 2); + FileChunker::FileChunk* fileChunk = new FileChunker::FileChunk(chunkSize + 2); char* chunkData = fileChunk->m_chunk; chunkData[0] = kFileChunk; memcpy(&chunkData[1], &m_mockData[sentLength], chunkSize); chunkData[chunkSize + 1] = '\0'; - m_events.addEvent(CEvent(m_events.forIScreen().fileChunkSending(), eventTarget, fileChunk)); + m_events.addEvent(Event(m_events.forIScreen().fileChunkSending(), eventTarget, fileChunk)); sentLength += chunkSize; lastSize = chunkSize; @@ -447,12 +447,12 @@ NetworkTests::sendMockData(void* eventTarget) } // send last message - CFileChunker::CFileChunk* transferFinished = new CFileChunker::CFileChunk(2); + FileChunker::FileChunk* transferFinished = new FileChunker::FileChunk(2); chunkData = transferFinished->m_chunk; chunkData[0] = kFileEnd; chunkData[1] = '\0'; - m_events.addEvent(CEvent(m_events.forIScreen().fileChunkSending(), eventTarget, transferFinished)); + m_events.addEvent(Event(m_events.forIScreen().fileChunkSending(), eventTarget, transferFinished)); } UInt8* @@ -519,7 +519,7 @@ getCursorPos(SInt32& x, SInt32& y) y = 0; } -CString +String intToString(size_t i) { stringstream ss; diff --git a/src/test/integtests/platform/MSWindowsClipboardTests.cpp b/src/test/integtests/platform/MSWindowsClipboardTests.cpp index 97ff0e39..3707e2a1 100644 --- a/src/test/integtests/platform/MSWindowsClipboardTests.cpp +++ b/src/test/integtests/platform/MSWindowsClipboardTests.cpp @@ -89,7 +89,7 @@ TEST_F(CMSWindowsClipboardTests, add_newValue_valueWasStored) clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } @@ -113,7 +113,7 @@ TEST_F(CMSWindowsClipboardTests, add_replaceValue_valueWasReplaced) clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.add(IClipboard::kText, "maxivista sucks"); // haha, just kidding. - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("maxivista sucks", actual); } @@ -154,7 +154,7 @@ TEST_F(CMSWindowsClipboardTests, close_isOpen_noErrors) CMSWindowsClipboard::Time actual = clipboard.getTime(); - // this behavior is different to that of CClipboard which only + // this behavior is different to that of Clipboard which only // returns the value passed into open(t) after empty() is called. EXPECT_EQ(1, actual); }*/ @@ -201,7 +201,7 @@ TEST_F(CMSWindowsClipboardTests, get_withNoFormats_returnsEmpty) clipboard.open(0); clipboard.empty(); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("", actual); } @@ -213,7 +213,7 @@ TEST_F(CMSWindowsClipboardTests, get_withFormatAdded_returnsExpected) clipboard.empty(); clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } diff --git a/src/test/integtests/platform/MSWindowsKeyStateTests.cpp b/src/test/integtests/platform/MSWindowsKeyStateTests.cpp index c238dbc8..4e6d2c4d 100644 --- a/src/test/integtests/platform/MSWindowsKeyStateTests.cpp +++ b/src/test/integtests/platform/MSWindowsKeyStateTests.cpp @@ -70,9 +70,9 @@ private: TEST_F(CMSWindowsKeyStateTests, disable_eventQueueNotUsed) { - NiceMock eventQueue; + NiceMock eventQueue; CMSWindowsDesks* desks = newDesks(&eventQueue); - CMockKeyMap keyMap; + MockKeyMap keyMap; CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap); EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(0); @@ -83,9 +83,9 @@ TEST_F(CMSWindowsKeyStateTests, disable_eventQueueNotUsed) TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_noRepeatAndButtonIsZero_resultIsTrue) { - NiceMock eventQueue; + NiceMock eventQueue; CMSWindowsDesks* desks = newDesks(&eventQueue); - CMockKeyMap keyMap; + MockKeyMap keyMap; CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap); keyState.setLastDown(1); @@ -97,9 +97,9 @@ TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_noRepeatAndButtonIsZero_resultIsT TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_pressFalse_lastDownIsZero) { - NiceMock eventQueue; + NiceMock eventQueue; CMSWindowsDesks* desks = newDesks(&eventQueue); - CMockKeyMap keyMap; + MockKeyMap keyMap; CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap); keyState.setLastDown(1); @@ -111,9 +111,9 @@ TEST_F(CMSWindowsKeyStateTests, testAutoRepeat_pressFalse_lastDownIsZero) TEST_F(CMSWindowsKeyStateTests, saveModifiers_noModifiers_savedModifiers0) { - NiceMock eventQueue; + NiceMock eventQueue; CMSWindowsDesks* desks = newDesks(&eventQueue); - CMockKeyMap keyMap; + MockKeyMap keyMap; CMSWindowsKeyState keyState(desks, getEventTarget(), &eventQueue, keyMap); keyState.saveModifiers(); diff --git a/src/test/integtests/platform/OSXClipboardTests.cpp b/src/test/integtests/platform/OSXClipboardTests.cpp index d2a4b4a7..63e56f54 100644 --- a/src/test/integtests/platform/OSXClipboardTests.cpp +++ b/src/test/integtests/platform/OSXClipboardTests.cpp @@ -21,9 +21,9 @@ #include "test/global/gtest.h" #include -TEST(COSXClipboardTests, empty_openCalled_returnsTrue) +TEST(OSXClipboardTests, empty_openCalled_returnsTrue) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); bool actual = clipboard.empty(); @@ -31,62 +31,62 @@ TEST(COSXClipboardTests, empty_openCalled_returnsTrue) EXPECT_EQ(true, actual); } -TEST(COSXClipboardTests, empty_singleFormat_hasReturnsFalse) +TEST(OSXClipboardTests, empty_singleFormat_hasReturnsFalse) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); - clipboard.add(COSXClipboard::kText, "synergy rocks!"); + clipboard.add(OSXClipboard::kText, "synergy rocks!"); clipboard.empty(); - bool actual = clipboard.has(COSXClipboard::kText); + bool actual = clipboard.has(OSXClipboard::kText); EXPECT_EQ(false, actual); } -TEST(COSXClipboardTests, add_newValue_valueWasStored) +TEST(OSXClipboardTests, add_newValue_valueWasStored) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } -TEST(COSXClipboardTests, add_replaceValue_valueWasReplaced) +TEST(OSXClipboardTests, add_replaceValue_valueWasReplaced) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.add(IClipboard::kText, "maxivista sucks"); // haha, just kidding. - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("maxivista sucks", actual); } -TEST(COSXClipboardTests, open_timeIsZero_returnsTrue) +TEST(OSXClipboardTests, open_timeIsZero_returnsTrue) { - COSXClipboard clipboard; + OSXClipboard clipboard; bool actual = clipboard.open(0); EXPECT_EQ(true, actual); } -TEST(COSXClipboardTests, open_timeIsOne_returnsTrue) +TEST(OSXClipboardTests, open_timeIsOne_returnsTrue) { - COSXClipboard clipboard; + OSXClipboard clipboard; bool actual = clipboard.open(1); EXPECT_EQ(true, actual); } -TEST(COSXClipboardTests, close_isOpen_noErrors) +TEST(OSXClipboardTests, close_isOpen_noErrors) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.close(); @@ -94,32 +94,32 @@ TEST(COSXClipboardTests, close_isOpen_noErrors) // can't assert anything } -TEST(COSXClipboardTests, getTime_openWithNoEmpty_returnsOne) +TEST(OSXClipboardTests, getTime_openWithNoEmpty_returnsOne) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(1); - COSXClipboard::Time actual = clipboard.getTime(); + OSXClipboard::Time actual = clipboard.getTime(); - // this behavior is different to that of CClipboard which only + // this behavior is different to that of Clipboard which only // returns the value passed into open(t) after empty() is called. EXPECT_EQ((UInt32)1, actual); } -TEST(COSXClipboardTests, getTime_openAndEmpty_returnsOne) +TEST(OSXClipboardTests, getTime_openAndEmpty_returnsOne) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(1); clipboard.empty(); - COSXClipboard::Time actual = clipboard.getTime(); + OSXClipboard::Time actual = clipboard.getTime(); EXPECT_EQ((UInt32)1, actual); } -TEST(COSXClipboardTests, has_withFormatAdded_returnsTrue) +TEST(OSXClipboardTests, has_withFormatAdded_returnsTrue) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.empty(); clipboard.add(IClipboard::kText, "synergy rocks!"); @@ -129,9 +129,9 @@ TEST(COSXClipboardTests, has_withFormatAdded_returnsTrue) EXPECT_EQ(true, actual); } -TEST(COSXClipboardTests, has_withNoFormats_returnsFalse) +TEST(OSXClipboardTests, has_withNoFormats_returnsFalse) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.empty(); @@ -140,25 +140,25 @@ TEST(COSXClipboardTests, has_withNoFormats_returnsFalse) EXPECT_EQ(false, actual); } -TEST(COSXClipboardTests, get_withNoFormats_returnsEmpty) +TEST(OSXClipboardTests, get_withNoFormats_returnsEmpty) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.empty(); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("", actual); } -TEST(COSXClipboardTests, get_withFormatAdded_returnsExpected) +TEST(OSXClipboardTests, get_withFormatAdded_returnsExpected) { - COSXClipboard clipboard; + OSXClipboard clipboard; clipboard.open(0); clipboard.empty(); clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } diff --git a/src/test/integtests/platform/OSXKeyStateTests.cpp b/src/test/integtests/platform/OSXKeyStateTests.cpp index f1a02ad1..bbaf2cd8 100644 --- a/src/test/integtests/platform/OSXKeyStateTests.cpp +++ b/src/test/integtests/platform/OSXKeyStateTests.cpp @@ -30,19 +30,19 @@ #define A_CHAR_ID 0x00000061 #define A_CHAR_BUTTON 001 -class COSXKeyStateTests : public ::testing::Test { +class OSXKeyStateTests : public ::testing::Test { public: - static bool isKeyPressed(const COSXKeyState& keyState, KeyButton button); + static bool isKeyPressed(const OSXKeyState& keyState, KeyButton button); }; // fakeAndPoll_shift seems to always fail on osx10.6 #if __MAC_OS_X_VERSION_MIN_REQUIRED > 1060 -TEST_F(COSXKeyStateTests, fakeAndPoll_shift) +TEST_F(OSXKeyStateTests, fakeAndPoll_shift) { - CKeyMap keyMap; - CMockEventQueue eventQueue; - COSXKeyState keyState(&eventQueue, keyMap); + synergy::KeyMap keyMap; + MockEventQueue eventQueue; + OSXKeyState keyState(&eventQueue, keyMap); keyState.updateKeyMap(); keyState.fakeKeyDown(SHIFT_ID_L, 0, 1); @@ -58,11 +58,11 @@ TEST_F(COSXKeyStateTests, fakeAndPoll_shift) EXPECT_TRUE(!isKeyPressed(keyState, SHIFT_BUTTON)); } -TEST_F(COSXKeyStateTests, fakeAndPoll_charKey) +TEST_F(OSXKeyStateTests, fakeAndPoll_charKey) { - CKeyMap keyMap; - CMockEventQueue eventQueue; - COSXKeyState keyState(&eventQueue, keyMap); + synergy::KeyMap keyMap; + MockEventQueue eventQueue; + OSXKeyState keyState(&eventQueue, keyMap); keyState.updateKeyMap(); keyState.fakeKeyDown(A_CHAR_ID, 0, 1); @@ -77,11 +77,11 @@ TEST_F(COSXKeyStateTests, fakeAndPoll_charKey) keyState.fakeKeyUp(2); } -TEST_F(COSXKeyStateTests, fakeAndPoll_charKeyAndModifier) +TEST_F(OSXKeyStateTests, fakeAndPoll_charKeyAndModifier) { - CKeyMap keyMap; - CMockEventQueue eventQueue; - COSXKeyState keyState(&eventQueue, keyMap); + synergy::KeyMap keyMap; + MockEventQueue eventQueue; + OSXKeyState keyState(&eventQueue, keyMap); keyState.updateKeyMap(); keyState.fakeKeyDown(A_CHAR_ID, KeyModifierShift, 1); @@ -97,7 +97,7 @@ TEST_F(COSXKeyStateTests, fakeAndPoll_charKeyAndModifier) } bool -COSXKeyStateTests::isKeyPressed(const COSXKeyState& keyState, KeyButton button) +OSXKeyStateTests::isKeyPressed(const OSXKeyState& keyState, KeyButton button) { // HACK: allow os to realize key state changes. ARCH->sleep(.2); diff --git a/src/test/integtests/platform/OSXScreenTests.cpp b/src/test/integtests/platform/OSXScreenTests.cpp index f0c82b3c..5f57759a 100644 --- a/src/test/integtests/platform/OSXScreenTests.cpp +++ b/src/test/integtests/platform/OSXScreenTests.cpp @@ -23,10 +23,10 @@ // disabling these tests - the return value of CGCursorIsVisible is unreliable. /* -TEST(COSXScreenTests, hideCursor_notPrimary) +TEST(OSXScreenTests, hideCursor_notPrimary) { - CEventQueue queue; - COSXScreen screen(true, false); + EventQueue queue; + OSXScreen screen(true, false); screen.hideCursor(); @@ -36,10 +36,10 @@ TEST(COSXScreenTests, hideCursor_notPrimary) ARCH->sleep(.1f); } -TEST(COSXScreenTests, showCursor_notPrimary) +TEST(OSXScreenTests, showCursor_notPrimary) { - CEventQueue queue; - COSXScreen screen(false, false); + EventQueue queue; + OSXScreen screen(false, false); screen.showCursor(); diff --git a/src/test/integtests/platform/XWindowsClipboardTests.cpp b/src/test/integtests/platform/XWindowsClipboardTests.cpp index 3bb9d273..513313eb 100644 --- a/src/test/integtests/platform/XWindowsClipboardTests.cpp +++ b/src/test/integtests/platform/XWindowsClipboardTests.cpp @@ -91,7 +91,7 @@ TEST_F(CXWindowsClipboardTests, add_newValue_valueWasStored) clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } @@ -102,7 +102,7 @@ TEST_F(CXWindowsClipboardTests, add_replaceValue_valueWasReplaced) clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.add(IClipboard::kText, "maxivista sucks"); // haha, just kidding. - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("maxivista sucks", actual); } @@ -139,7 +139,7 @@ TEST_F(CXWindowsClipboardTests, get_withNoFormats_returnsEmpty) { CXWindowsClipboard clipboard = createClipboard(); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("", actual); } @@ -149,7 +149,7 @@ TEST_F(CXWindowsClipboardTests, get_withFormatAdded_returnsExpected) CXWindowsClipboard clipboard = createClipboard(); clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } diff --git a/src/test/integtests/platform/XWindowsKeyStateTests.cpp b/src/test/integtests/platform/XWindowsKeyStateTests.cpp index a99140ce..607bab77 100644 --- a/src/test/integtests/platform/XWindowsKeyStateTests.cpp +++ b/src/test/integtests/platform/XWindowsKeyStateTests.cpp @@ -74,8 +74,8 @@ protected: TEST_F(CXWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -86,8 +86,8 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_pollAndSet_groupIsZero) TEST_F(CXWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -98,8 +98,8 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_poll_groupIsNotSet) TEST_F(CXWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -110,8 +110,8 @@ TEST_F(CXWindowsKeyStateTests, setActiveGroup_customGroup_groupWasSet) TEST_F(CXWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -122,8 +122,8 @@ TEST_F(CXWindowsKeyStateTests, mapModifiersFromX_zeroState_zeroMask) TEST_F(CXWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -135,8 +135,8 @@ TEST_F(CXWindowsKeyStateTests, mapModifiersToX_zeroMask_resultIsTrue) TEST_F(CXWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -147,8 +147,8 @@ TEST_F(CXWindowsKeyStateTests, fakeCtrlAltDel_default_returnsFalse) TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -160,8 +160,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_defaultState_returnsZero) #if 0 // TODO: fix, causes sigsegv TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCorrect) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -193,8 +193,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveModifiers_shiftKeyDownThenUp_masksAreCo TEST_F(CXWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -205,8 +205,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_defaultState_returnsZero) TEST_F(CXWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); @@ -220,8 +220,8 @@ TEST_F(CXWindowsKeyStateTests, pollActiveGroup_positiveGroup_returnsGroup) TEST_F(CXWindowsKeyStateTests, pollActiveGroup_xkb_areEqual) { #if HAVE_XKB_EXTENSION - CMockKeyMap keyMap; - CMockEventQueue eventQueue; + MockKeyMap keyMap; + MockEventQueue eventQueue; CXWindowsKeyState keyState( m_display, true, &eventQueue, keyMap); diff --git a/src/test/integtests/platform/XWindowsScreenSaverTests.cpp b/src/test/integtests/platform/XWindowsScreenSaverTests.cpp index caa9beb6..6059de5e 100644 --- a/src/test/integtests/platform/XWindowsScreenSaverTests.cpp +++ b/src/test/integtests/platform/XWindowsScreenSaverTests.cpp @@ -32,7 +32,7 @@ TEST(CXWindowsScreenSaverTests, activate_defaultScreen_todo) { Display* display = XOpenDisplay(":0.0"); Window window = DefaultRootWindow(display); - CMockEventQueue eventQueue; + MockEventQueue eventQueue; EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(1); CXWindowsScreenSaver screenSaver( display, window, NULL, &eventQueue); diff --git a/src/test/integtests/platform/XWindowsScreenTests.cpp b/src/test/integtests/platform/XWindowsScreenTests.cpp index d77d816f..f12f2b5d 100644 --- a/src/test/integtests/platform/XWindowsScreenTests.cpp +++ b/src/test/integtests/platform/XWindowsScreenTests.cpp @@ -25,7 +25,7 @@ using ::testing::_; TEST(CXWindowsScreenTests, fakeMouseMove_nonPrimary_getCursorPosValuesCorrect) { - CMockEventQueue eventQueue; + MockEventQueue eventQueue; EXPECT_CALL(eventQueue, adoptHandler(_, _, _)).Times(2); EXPECT_CALL(eventQueue, adoptBuffer(_)).Times(2); EXPECT_CALL(eventQueue, removeHandler(_, _)).Times(2); diff --git a/src/test/mock/client/MockClient.h b/src/test/mock/client/MockClient.h index d60b0883..f185ec10 100644 --- a/src/test/mock/client/MockClient.h +++ b/src/test/mock/client/MockClient.h @@ -26,12 +26,12 @@ class IEventQueue; -class CMockClient : public CClient +class MockClient : public Client { public: - CMockClient() : CClient() { } + MockClient() : Client() { } MOCK_METHOD2(mouseMove, void(SInt32, SInt32)); - MOCK_METHOD1(setOptions, void(const COptionsList&)); + MOCK_METHOD1(setOptions, void(const OptionsList&)); MOCK_METHOD0(handshakeComplete, void()); MOCK_METHOD1(setDecryptIv, void(const UInt8*)); }; diff --git a/src/test/mock/io/MockCryptoStream.h b/src/test/mock/io/MockCryptoStream.h index 3d36c626..405fb69d 100644 --- a/src/test/mock/io/MockCryptoStream.h +++ b/src/test/mock/io/MockCryptoStream.h @@ -22,11 +22,11 @@ #include "test/global/gmock.h" -class CMockCryptoStream : public CCryptoStream +class MockCryptoStream : public CryptoStream { public: - CMockCryptoStream(IEventQueue* eventQueue, IStream* stream) : - CCryptoStream(eventQueue, stream, CCryptoOptions("gcm", "stub"), false) { } + MockCryptoStream(IEventQueue* eventQueue, IStream* stream) : + CryptoStream(eventQueue, stream, CryptoOptions("gcm", "stub"), false) { } MOCK_METHOD2(read, UInt32(void*, UInt32)); MOCK_METHOD2(write, void(const void*, UInt32)); }; diff --git a/src/test/mock/io/MockStream.h b/src/test/mock/io/MockStream.h index 05155766..075fcd4b 100644 --- a/src/test/mock/io/MockStream.h +++ b/src/test/mock/io/MockStream.h @@ -24,20 +24,20 @@ class IEventQueue; -class CMockStream : public synergy::IStream +class MockStream : public synergy::IStream { public: - CMockStream() { } + MockStream() { } MOCK_METHOD0(close, void()); MOCK_METHOD2(read, UInt32(void*, UInt32)); MOCK_METHOD2(write, void(const void*, UInt32)); MOCK_METHOD0(flush, void()); MOCK_METHOD0(shutdownInput, void()); MOCK_METHOD0(shutdownOutput, void()); - MOCK_METHOD0(getInputReadyEvent, CEvent::Type()); - MOCK_METHOD0(getOutputErrorEvent, CEvent::Type()); - MOCK_METHOD0(getInputShutdownEvent, CEvent::Type()); - MOCK_METHOD0(getOutputShutdownEvent, CEvent::Type()); + MOCK_METHOD0(getInputReadyEvent, Event::Type()); + MOCK_METHOD0(getOutputErrorEvent, Event::Type()); + MOCK_METHOD0(getInputShutdownEvent, Event::Type()); + MOCK_METHOD0(getOutputShutdownEvent, Event::Type()); MOCK_CONST_METHOD0(getEventTarget, void*()); MOCK_CONST_METHOD0(isReady, bool()); MOCK_CONST_METHOD0(getSize, UInt32()); diff --git a/src/test/mock/server/MockConfig.h b/src/test/mock/server/MockConfig.h index f3f3d9ae..fd78d4cd 100644 --- a/src/test/mock/server/MockConfig.h +++ b/src/test/mock/server/MockConfig.h @@ -23,10 +23,10 @@ #include "test/global/gmock.h" -class CMockConfig : public CConfig +class MockConfig : public Config { public: - CMockConfig() : CConfig() { } - MOCK_METHOD0(getInputFilter, CInputFilter*()); - MOCK_CONST_METHOD1(isScreen, bool(const CString&)); + MockConfig() : Config() { } + MOCK_METHOD0(getInputFilter, InputFilter*()); + MOCK_CONST_METHOD1(isScreen, bool(const String&)); }; diff --git a/src/test/mock/server/MockInputFilter.h b/src/test/mock/server/MockInputFilter.h index a2b137bd..f5da93b6 100644 --- a/src/test/mock/server/MockInputFilter.h +++ b/src/test/mock/server/MockInputFilter.h @@ -23,8 +23,8 @@ #include "test/global/gmock.h" -class CMockInputFilter : public CInputFilter +class MockInputFilter : public InputFilter { public: - MOCK_METHOD1(setPrimaryClient, void(CPrimaryClient*)); + MOCK_METHOD1(setPrimaryClient, void(PrimaryClient*)); }; diff --git a/src/test/mock/server/MockPrimaryClient.h b/src/test/mock/server/MockPrimaryClient.h index 04882d71..256cf09e 100644 --- a/src/test/mock/server/MockPrimaryClient.h +++ b/src/test/mock/server/MockPrimaryClient.h @@ -24,7 +24,7 @@ #include "test/global/gmock.h" -class CMockPrimaryClient : public CPrimaryClient +class MockPrimaryClient : public PrimaryClient { public: MOCK_CONST_METHOD0(getEventTarget, void*()); @@ -32,7 +32,7 @@ public: MOCK_CONST_METHOD2(setJumpCursorPos, void(SInt32, SInt32)); MOCK_METHOD1(reconfigure, void(UInt32)); MOCK_METHOD0(resetOptions, void()); - MOCK_METHOD1(setOptions, void(const COptionsList&)); + MOCK_METHOD1(setOptions, void(const OptionsList&)); MOCK_METHOD0(enable, void()); MOCK_METHOD0(disable, void()); MOCK_METHOD2(registerHotKey, UInt32(KeyID, KeyModifierMask)); diff --git a/src/test/mock/server/MockServer.h b/src/test/mock/server/MockServer.h index 20efa088..73172f94 100644 --- a/src/test/mock/server/MockServer.h +++ b/src/test/mock/server/MockServer.h @@ -25,8 +25,8 @@ class IEventQueue; -class CMockServer : public CServer +class MockServer : public Server { public: - CMockServer() : CServer() { } + MockServer() : Server() { } }; diff --git a/src/test/mock/synergy/MockApp.h b/src/test/mock/synergy/MockApp.h index da71258f..d3e1402a 100644 --- a/src/test/mock/synergy/MockApp.h +++ b/src/test/mock/synergy/MockApp.h @@ -23,14 +23,14 @@ #include "test/global/gmock.h" -class CMockApp : public CApp +class MockApp : public App { public: - CMockApp() : CApp(NULL, NULL, NULL) { } + MockApp() : App(NULL, NULL, NULL) { } MOCK_METHOD0(help, void()); MOCK_METHOD0(loadConfig, void()); - MOCK_METHOD1(loadConfig, bool(const CString&)); + MOCK_METHOD1(loadConfig, bool(const String&)); MOCK_CONST_METHOD0(daemonInfo, const char*()); MOCK_CONST_METHOD0(daemonName, const char*()); MOCK_METHOD2(parseArgs, void(int, const char* const*)); @@ -40,5 +40,5 @@ public: MOCK_METHOD0(startNode, void()); MOCK_METHOD0(mainLoop, int()); MOCK_METHOD2(foregroundStartup, int(int, char**)); - MOCK_METHOD0(createScreen, CScreen*()); + MOCK_METHOD0(createScreen, Screen*()); }; diff --git a/src/test/mock/synergy/MockArgParser.h b/src/test/mock/synergy/MockArgParser.h index 05224a0a..79036d9d 100644 --- a/src/test/mock/synergy/MockArgParser.h +++ b/src/test/mock/synergy/MockArgParser.h @@ -23,10 +23,10 @@ #include "test/global/gmock.h" -class CMockArgParser : public CArgParser +class MockArgParser : public ArgParser { public: - CMockArgParser() : CArgParser(NULL) { } + MockArgParser() : ArgParser(NULL) { } MOCK_METHOD3(parseGenericArgs, bool(int, const char* const*, int&)); MOCK_METHOD0(checkUnexpectedArgs, bool()); diff --git a/src/test/mock/synergy/MockEventQueue.h b/src/test/mock/synergy/MockEventQueue.h index 64405c7d..a02530f6 100644 --- a/src/test/mock/synergy/MockEventQueue.h +++ b/src/test/mock/synergy/MockEventQueue.h @@ -22,42 +22,42 @@ #include "test/global/gmock.h" -class CMockEventQueue : public IEventQueue +class MockEventQueue : public IEventQueue { public: MOCK_METHOD0(loop, void()); - MOCK_METHOD2(newOneShotTimer, CEventQueueTimer*(double, void*)); - MOCK_METHOD2(newTimer, CEventQueueTimer*(double, void*)); - MOCK_METHOD2(getEvent, bool(CEvent&, double)); + MOCK_METHOD2(newOneShotTimer, EventQueueTimer*(double, void*)); + MOCK_METHOD2(newTimer, EventQueueTimer*(double, void*)); + MOCK_METHOD2(getEvent, bool(Event&, double)); MOCK_METHOD1(adoptBuffer, void(IEventQueueBuffer*)); - MOCK_METHOD2(registerTypeOnce, CEvent::Type(CEvent::Type&, const char*)); + MOCK_METHOD2(registerTypeOnce, Event::Type(Event::Type&, const char*)); MOCK_METHOD1(removeHandlers, void(void*)); - MOCK_METHOD1(registerType, CEvent::Type(const char*)); + MOCK_METHOD1(registerType, Event::Type(const char*)); MOCK_CONST_METHOD0(isEmpty, bool()); - MOCK_METHOD3(adoptHandler, void(CEvent::Type, void*, IEventJob*)); - MOCK_METHOD1(getTypeName, const char*(CEvent::Type)); - MOCK_METHOD1(addEvent, void(const CEvent&)); - MOCK_METHOD2(removeHandler, void(CEvent::Type, void*)); - MOCK_METHOD1(dispatchEvent, bool(const CEvent&)); - MOCK_CONST_METHOD2(getHandler, IEventJob*(CEvent::Type, void*)); - MOCK_METHOD1(deleteTimer, void(CEventQueueTimer*)); - MOCK_CONST_METHOD1(getRegisteredType, CEvent::Type(const CString&)); + MOCK_METHOD3(adoptHandler, void(Event::Type, void*, IEventJob*)); + MOCK_METHOD1(getTypeName, const char*(Event::Type)); + MOCK_METHOD1(addEvent, void(const Event&)); + MOCK_METHOD2(removeHandler, void(Event::Type, void*)); + MOCK_METHOD1(dispatchEvent, bool(const Event&)); + MOCK_CONST_METHOD2(getHandler, IEventJob*(Event::Type, void*)); + MOCK_METHOD1(deleteTimer, void(EventQueueTimer*)); + MOCK_CONST_METHOD1(getRegisteredType, Event::Type(const String&)); MOCK_METHOD0(getSystemTarget, void*()); - MOCK_METHOD0(forCClient, CClientEvents&()); + MOCK_METHOD0(forClient, ClientEvents&()); MOCK_METHOD0(forIStream, IStreamEvents&()); - MOCK_METHOD0(forCIpcClient, CIpcClientEvents&()); - MOCK_METHOD0(forCIpcClientProxy, CIpcClientProxyEvents&()); - MOCK_METHOD0(forCIpcServer, CIpcServerEvents&()); - MOCK_METHOD0(forCIpcServerProxy, CIpcServerProxyEvents&()); + MOCK_METHOD0(forIpcClient, IpcClientEvents&()); + MOCK_METHOD0(forIpcClientProxy, IpcClientProxyEvents&()); + MOCK_METHOD0(forIpcServer, IpcServerEvents&()); + MOCK_METHOD0(forIpcServerProxy, IpcServerProxyEvents&()); MOCK_METHOD0(forIDataSocket, IDataSocketEvents&()); MOCK_METHOD0(forIListenSocket, IListenSocketEvents&()); MOCK_METHOD0(forISocket, ISocketEvents&()); - MOCK_METHOD0(forCOSXScreen, COSXScreenEvents&()); - MOCK_METHOD0(forCClientListener, CClientListenerEvents&()); - MOCK_METHOD0(forCClientProxy, CClientProxyEvents&()); - MOCK_METHOD0(forCClientProxyUnknown, CClientProxyUnknownEvents&()); - MOCK_METHOD0(forCServer, CServerEvents&()); - MOCK_METHOD0(forCServerApp, CServerAppEvents&()); + MOCK_METHOD0(forOSXScreen, OSXScreenEvents&()); + MOCK_METHOD0(forClientListener, ClientListenerEvents&()); + MOCK_METHOD0(forClientProxy, ClientProxyEvents&()); + MOCK_METHOD0(forClientProxyUnknown, ClientProxyUnknownEvents&()); + MOCK_METHOD0(forServer, ServerEvents&()); + MOCK_METHOD0(forServerApp, ServerAppEvents&()); MOCK_METHOD0(forIKeyState, IKeyStateEvents&()); MOCK_METHOD0(forIPrimaryScreen, IPrimaryScreenEvents&()); MOCK_METHOD0(forIScreen, IScreenEvents&()); diff --git a/src/test/mock/synergy/MockKeyMap.h b/src/test/mock/synergy/MockKeyMap.h index c162b20e..df499b6a 100644 --- a/src/test/mock/synergy/MockKeyMap.h +++ b/src/test/mock/synergy/MockKeyMap.h @@ -22,15 +22,15 @@ #include "test/global/gmock.h" -class CMockKeyMap : public CKeyMap +class MockKeyMap : public synergy::KeyMap { public: - MOCK_METHOD1(swap, void(CKeyMap&)); + MOCK_METHOD1(swap, void(KeyMap&)); MOCK_METHOD0(finish, void()); MOCK_METHOD2(foreachKey, void(ForeachKeyCallback, void*)); MOCK_METHOD1(addHalfDuplexModifier, void(KeyID)); MOCK_CONST_METHOD2(isHalfDuplex, bool(KeyID, KeyButton)); - MOCK_CONST_METHOD7(mapKey, const CKeyMap::KeyItem*( + MOCK_CONST_METHOD7(mapKey, const KeyMap::KeyItem*( Keystrokes&, KeyID, SInt32, ModifierToKeys&, KeyModifierMask&, KeyModifierMask, bool)); }; diff --git a/src/test/mock/synergy/MockScreen.h b/src/test/mock/synergy/MockScreen.h index 7c986db3..87b131bc 100644 --- a/src/test/mock/synergy/MockScreen.h +++ b/src/test/mock/synergy/MockScreen.h @@ -23,14 +23,14 @@ #include "test/global/gmock.h" -class CMockScreen : public CScreen +class MockScreen : public Screen { public: - CMockScreen() : CScreen() { } + MockScreen() : Screen() { } MOCK_METHOD0(disable, void()); MOCK_CONST_METHOD4(getShape, void(SInt32&, SInt32&, SInt32&, SInt32&)); MOCK_CONST_METHOD2(getCursorPos, void(SInt32&, SInt32&)); MOCK_METHOD0(resetOptions, void()); - MOCK_METHOD1(setOptions, void(const COptionsList&)); + MOCK_METHOD1(setOptions, void(const OptionsList&)); MOCK_METHOD0(enable, void()); }; diff --git a/src/test/unittests/Main.cpp b/src/test/unittests/Main.cpp index a26a9edb..ca59df46 100644 --- a/src/test/unittests/Main.cpp +++ b/src/test/unittests/Main.cpp @@ -30,13 +30,13 @@ main(int argc, char **argv) { #if SYSAPI_WIN32 // HACK: shouldn't be needed, but logging fails without this. - CArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); + ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif - CArch arch; + Arch arch; arch.init(); - CLog log; + Log log; log.setFilter(kDEBUG4); testing::InitGoogleTest(&argc, argv); diff --git a/src/test/unittests/base/StringTests.cpp b/src/test/unittests/base/StringTests.cpp index e2fbc0ec..30beccb7 100644 --- a/src/test/unittests/base/StringTests.cpp +++ b/src/test/unittests/base/StringTests.cpp @@ -21,35 +21,35 @@ using namespace synergy; -TEST(CStringTests, format) +TEST(StringTests, format) { const char* format = "%%%{1}=%{2}"; const char* arg1 = "answer"; const char* arg2 = "42"; - CString result = string::format(format, arg1, arg2); + String result = string::format(format, arg1, arg2); EXPECT_EQ("%answer=42", result); } -TEST(CStringTests, findReplaceAll) +TEST(StringTests, findReplaceAll) { - CString subject = "foobar"; - CString find = "bar"; - CString replace = "baz"; + String subject = "foobar"; + String find = "bar"; + String replace = "baz"; string::findReplaceAll(subject, find, replace); EXPECT_EQ("foobaz", subject); } -TEST(CStringTests, sprintf) +TEST(StringTests, sprintf) { const char* format = "%s=%d"; const char* arg1 = "answer"; int arg2 = 42; - CString result = string::sprintf(format, arg1, arg2); + String result = string::sprintf(format, arg1, arg2); EXPECT_EQ("answer=42", result); } diff --git a/src/test/unittests/client/ServerProxyTests.cpp b/src/test/unittests/client/ServerProxyTests.cpp index 8d3e4d41..74087ec9 100644 --- a/src/test/unittests/client/ServerProxyTests.cpp +++ b/src/test/unittests/client/ServerProxyTests.cpp @@ -40,17 +40,17 @@ UInt32 mouseMove_mockRead(void* buffer, UInt32 n); const UInt8 g_readCryptoIv_bufferLen = 20; UInt8 g_readCryptoIv_buffer[g_readCryptoIv_bufferLen]; UInt32 g_readCryptoIv_bufferIndex; -CString g_readCryptoIv_result; +String g_readCryptoIv_result; UInt32 readCryptoIv_mockRead(void* buffer, UInt32 n); void readCryptoIv_setDecryptIv(const UInt8*); -TEST(CServerProxyTests, mouseMove) +TEST(ServerProxyTests, mouseMove) { g_mouseMove_bufferIndex = 0; - NiceMock eventQueue; - NiceMock stream; - NiceMock client; + NiceMock eventQueue; + NiceMock stream; + NiceMock client; IStreamEvents streamEvents; streamEvents.setEvents(&eventQueue); @@ -62,17 +62,17 @@ TEST(CServerProxyTests, mouseMove) const char data[] = "DSOP\0\0\0\0DMMV\0\1\0\2"; memcpy(g_mouseMove_buffer, data, g_mouseMove_bufferLen); - CServerProxy serverProxy(&client, &stream, &eventQueue); + ServerProxy serverProxy(&client, &stream, &eventQueue); serverProxy.handleDataForTest(); } -TEST(CServerProxyTests, readCryptoIv) +TEST(ServerProxyTests, readCryptoIv) { g_readCryptoIv_bufferIndex = 0; - NiceMock eventQueue; - NiceMock client; - NiceMock stream; + NiceMock eventQueue; + NiceMock client; + NiceMock stream; IStreamEvents streamEvents; streamEvents.setEvents(&eventQueue); @@ -83,7 +83,7 @@ TEST(CServerProxyTests, readCryptoIv) const char data[] = "DSOP\0\0\0\0DCIV\0\0\0\4mock"; memcpy(g_readCryptoIv_buffer, data, g_readCryptoIv_bufferLen); - CServerProxy serverProxy(&client, &stream, &eventQueue); + ServerProxy serverProxy(&client, &stream, &eventQueue); serverProxy.handleDataForTest(); EXPECT_EQ("mock", g_readCryptoIv_result); diff --git a/src/test/unittests/server/ClientProxyTests.cpp b/src/test/unittests/server/ClientProxyTests.cpp index 87b00ec3..68f3db1d 100644 --- a/src/test/unittests/server/ClientProxyTests.cpp +++ b/src/test/unittests/server/ClientProxyTests.cpp @@ -36,20 +36,20 @@ UInt32 g_cryptoIvWrite_readBufferIndex; void cryptoIv_mockWrite(const void* in, UInt32 n); UInt8 cryptoIv_mockRead(void* out, UInt32 n); -TEST(CClientProxyTests, cryptoIvWrite) +TEST(ClientProxyTests, cryptoIvWrite) { g_cryptoIvWrite_writeBufferIndex = 0; g_cryptoIvWrite_readBufferIndex = 0; - NiceMock eventQueue; - NiceMock innerStream; - NiceMock server; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + NiceMock server; + CryptoOptions options("cfb", "mock"); IStreamEvents streamEvents; streamEvents.setEvents(&eventQueue); - CCryptoStream* serverStream = new CCryptoStream(&eventQueue, &innerStream, options, false); - CCryptoStream* clientStream = new CCryptoStream(&eventQueue, &innerStream, options, false); + CryptoStream* serverStream = new CryptoStream(&eventQueue, &innerStream, options, false); + CryptoStream* clientStream = new CryptoStream(&eventQueue, &innerStream, options, false); byte iv[CRYPTO_IV_SIZE]; serverStream->newIv(iv); @@ -60,7 +60,7 @@ TEST(CClientProxyTests, cryptoIvWrite) ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(cryptoIv_mockWrite)); ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(cryptoIv_mockRead)); - CClientProxy1_4 clientProxy("stub", serverStream, &server, &eventQueue); + ClientProxy1_4 clientProxy("stub", serverStream, &server, &eventQueue); UInt8 buffer[100]; clientStream->read(buffer, 4); diff --git a/src/test/unittests/synergy/ArgParserTests.cpp b/src/test/unittests/synergy/ArgParserTests.cpp index 42808d8c..5592c10e 100644 --- a/src/test/unittests/synergy/ArgParserTests.cpp +++ b/src/test/unittests/synergy/ArgParserTests.cpp @@ -20,109 +20,109 @@ #include "test/global/gtest.h" -TEST(CArgParserTests, isArg_abbreviationsArg_returnTrue) +TEST(ArgParserTests, isArg_abbreviationsArg_returnTrue) { int i = 1; const int argc = 2; const char* argv[argc] = { "stub", "-t" }; - bool result = CArgParser::isArg(i, argc, argv, "-t", NULL); + bool result = ArgParser::isArg(i, argc, argv, "-t", NULL); EXPECT_EQ(true, result); } -TEST(CArgParserTests, isArg_fullArg_returnTrue) +TEST(ArgParserTests, isArg_fullArg_returnTrue) { int i = 1; const int argc = 2; const char* argv[argc] = { "stub", "--test" }; - bool result = CArgParser::isArg(i, argc, argv, NULL, "--test"); + bool result = ArgParser::isArg(i, argc, argv, NULL, "--test"); EXPECT_EQ(true, result); } -TEST(CArgParserTests, isArg_missingArgs_returnFalse) +TEST(ArgParserTests, isArg_missingArgs_returnFalse) { int i = 1; const int argc = 2; const char* argv[argc] = { "stub", "-t" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); - bool result = CArgParser::isArg(i, argc, argv, "-t", NULL, 1); + bool result = ArgParser::isArg(i, argc, argv, "-t", NULL, 1); EXPECT_FALSE(result); EXPECT_EQ(true, argsBase.m_shouldExit); } -TEST(CArgParserTests, searchDoubleQuotes_doubleQuotedArg_returnTrue) +TEST(ArgParserTests, searchDoubleQuotes_doubleQuotedArg_returnTrue) { - CString command("\"stub\""); + String command("\"stub\""); size_t left = 0; size_t right = 0; - bool result = CArgParser::searchDoubleQuotes(command, left, right); + bool result = ArgParser::searchDoubleQuotes(command, left, right); EXPECT_EQ(true, result); EXPECT_EQ(0, left); EXPECT_EQ(5, right); } -TEST(CArgParserTests, searchDoubleQuotes_noDoubleQuotedArg_returnfalse) +TEST(ArgParserTests, searchDoubleQuotes_noDoubleQuotedArg_returnfalse) { - CString command("stub"); + String command("stub"); size_t left = 0; size_t right = 0; - bool result = CArgParser::searchDoubleQuotes(command, left, right); + bool result = ArgParser::searchDoubleQuotes(command, left, right); EXPECT_FALSE(result); EXPECT_EQ(0, left); EXPECT_EQ(0, right); } -TEST(CArgParserTests, searchDoubleQuotes_oneDoubleQuoteArg_returnfalse) +TEST(ArgParserTests, searchDoubleQuotes_oneDoubleQuoteArg_returnfalse) { - CString command("\"stub"); + String command("\"stub"); size_t left = 0; size_t right = 0; - bool result = CArgParser::searchDoubleQuotes(command, left, right); + bool result = ArgParser::searchDoubleQuotes(command, left, right); EXPECT_FALSE(result); EXPECT_EQ(0, left); EXPECT_EQ(0, right); } -TEST(CArgParserTests, splitCommandString_oneArg_returnArgv) +TEST(ArgParserTests, splitCommandString_oneArg_returnArgv) { - CString command("stub"); - std::vector argv; + String command("stub"); + std::vector argv; - CArgParser::splitCommandString(command, argv); + ArgParser::splitCommandString(command, argv); EXPECT_EQ(1, argv.size()); EXPECT_EQ("stub", argv.at(0)); } -TEST(CArgParserTests, splitCommandString_twoArgs_returnArgv) +TEST(ArgParserTests, splitCommandString_twoArgs_returnArgv) { - CString command("stub1 stub2"); - std::vector argv; + String command("stub1 stub2"); + std::vector argv; - CArgParser::splitCommandString(command, argv); + ArgParser::splitCommandString(command, argv); EXPECT_EQ(2, argv.size()); EXPECT_EQ("stub1", argv.at(0)); EXPECT_EQ("stub2", argv.at(1)); } -TEST(CArgParserTests, splitCommandString_doubleQuotedArgs_returnArgv) +TEST(ArgParserTests, splitCommandString_doubleQuotedArgs_returnArgv) { - CString command("\"stub1\" stub2 \"stub3\""); - std::vector argv; + String command("\"stub1\" stub2 \"stub3\""); + std::vector argv; - CArgParser::splitCommandString(command, argv); + ArgParser::splitCommandString(command, argv); EXPECT_EQ(3, argv.size()); EXPECT_EQ("stub1", argv.at(0)); @@ -130,12 +130,12 @@ TEST(CArgParserTests, splitCommandString_doubleQuotedArgs_returnArgv) EXPECT_EQ("stub3", argv.at(2)); } -TEST(CArgParserTests, splitCommandString_spaceDoubleQuotedArgs_returnArgv) +TEST(ArgParserTests, splitCommandString_spaceDoubleQuotedArgs_returnArgv) { - CString command("\"stub1\" stub2 \"stub3 space\""); - std::vector argv; + String command("\"stub1\" stub2 \"stub3 space\""); + std::vector argv; - CArgParser::splitCommandString(command, argv); + ArgParser::splitCommandString(command, argv); EXPECT_EQ(3, argv.size()); EXPECT_EQ("stub1", argv.at(0)); @@ -143,17 +143,17 @@ TEST(CArgParserTests, splitCommandString_spaceDoubleQuotedArgs_returnArgv) EXPECT_EQ("stub3 space", argv.at(2)); } -TEST(CArgParserTests, getArgv_stringArray_return2DArray) +TEST(ArgParserTests, getArgv_stringArray_return2DArray) { - std::vector argArray; + std::vector argArray; argArray.push_back("stub1"); argArray.push_back("stub2"); argArray.push_back("stub3 space"); - const char** argv = CArgParser::getArgv(argArray); + const char** argv = ArgParser::getArgv(argArray); - CString row1(argv[0]); - CString row2(argv[1]); - CString row3(argv[2]); + String row1(argv[0]); + String row2(argv[1]); + String row3(argv[2]); EXPECT_EQ("stub1", row1); EXPECT_EQ("stub2", row2); @@ -162,45 +162,45 @@ TEST(CArgParserTests, getArgv_stringArray_return2DArray) delete[] argv; } -TEST(CArgParserTests, assembleCommand_stringArray_returnCommand) +TEST(ArgParserTests, assembleCommand_stringArray_returnCommand) { - std::vector argArray; + std::vector argArray; argArray.push_back("stub1"); argArray.push_back("stub2"); - CString command = CArgParser::assembleCommand(argArray); + String command = ArgParser::assembleCommand(argArray); EXPECT_EQ("stub1 stub2", command); } -TEST(CArgParserTests, assembleCommand_ignoreSecondArg_returnCommand) +TEST(ArgParserTests, assembleCommand_ignoreSecondArg_returnCommand) { - std::vector argArray; + std::vector argArray; argArray.push_back("stub1"); argArray.push_back("stub2"); - CString command = CArgParser::assembleCommand(argArray, "stub2"); + String command = ArgParser::assembleCommand(argArray, "stub2"); EXPECT_EQ("stub1", command); } -TEST(CArgParserTests, assembleCommand_ignoreSecondArgWithOneParameter_returnCommand) +TEST(ArgParserTests, assembleCommand_ignoreSecondArgWithOneParameter_returnCommand) { - std::vector argArray; + std::vector argArray; argArray.push_back("stub1"); argArray.push_back("stub2"); argArray.push_back("stub3"); argArray.push_back("stub4"); - CString command = CArgParser::assembleCommand(argArray, "stub2", 1); + String command = ArgParser::assembleCommand(argArray, "stub2", 1); EXPECT_EQ("stub1 stub4", command); } -TEST(CArgParserTests, assembleCommand_stringArrayWithSpace_returnCommand) +TEST(ArgParserTests, assembleCommand_stringArrayWithSpace_returnCommand) { - std::vector argArray; + std::vector argArray; argArray.push_back("stub1 space"); argArray.push_back("stub2"); argArray.push_back("stub3 space"); - CString command = CArgParser::assembleCommand(argArray); + String command = ArgParser::assembleCommand(argArray); EXPECT_EQ("\"stub1 space\" stub2 \"stub3 space\"", command); } diff --git a/src/test/unittests/synergy/ClientArgsParsingTests.cpp b/src/test/unittests/synergy/ClientArgsParsingTests.cpp index 1cc1e67b..e4a7fde7 100644 --- a/src/test/unittests/synergy/ClientArgsParsingTests.cpp +++ b/src/test/unittests/synergy/ClientArgsParsingTests.cpp @@ -37,12 +37,12 @@ client_stubCheckUnexpectedArgs() return false; } -TEST(CClientArgsParsingTests, parseClientArgs_yScrollArg_setYScroll) +TEST(ClientArgsParsingTests, parseClientArgs_yScrollArg_setYScroll) { - NiceMock argParser; + NiceMock argParser; ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(client_stubParseGenericArgs)); ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(client_stubCheckUnexpectedArgs)); - CClientArgs clientArgs; + ClientArgs clientArgs; const int argc = 3; const char* kYScrollCmd[argc] = { "stub", "--yscroll", "1" }; @@ -51,12 +51,12 @@ TEST(CClientArgsParsingTests, parseClientArgs_yScrollArg_setYScroll) EXPECT_EQ(1, clientArgs.m_yscroll); } -TEST(CClientArgsParsingTests, parseClientArgs_addressArg_setSynergyAddress) +TEST(ClientArgsParsingTests, parseClientArgs_addressArg_setSynergyAddress) { - NiceMock argParser; + NiceMock argParser; ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(client_stubParseGenericArgs)); ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(client_stubCheckUnexpectedArgs)); - CClientArgs clientArgs; + ClientArgs clientArgs; const int argc = 2; const char* kAddressCmd[argc] = { "stub", "mock_address" }; @@ -66,12 +66,12 @@ TEST(CClientArgsParsingTests, parseClientArgs_addressArg_setSynergyAddress) EXPECT_EQ(true, result); } -TEST(CClientArgsParsingTests, parseClientArgs_noAddressArg_returnFalse) +TEST(ClientArgsParsingTests, parseClientArgs_noAddressArg_returnFalse) { - NiceMock argParser; + NiceMock argParser; ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(client_stubParseGenericArgs)); ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(client_stubCheckUnexpectedArgs)); - CClientArgs clientArgs; + ClientArgs clientArgs; const int argc = 1; const char* kNoAddressCmd[argc] = { "stub" }; @@ -80,12 +80,12 @@ TEST(CClientArgsParsingTests, parseClientArgs_noAddressArg_returnFalse) EXPECT_FALSE(result); } -TEST(CClientArgsParsingTests, parseClientArgs_unrecognizedArg_returnFalse) +TEST(ClientArgsParsingTests, parseClientArgs_unrecognizedArg_returnFalse) { - NiceMock argParser; + NiceMock argParser; ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(client_stubParseGenericArgs)); ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(client_stubCheckUnexpectedArgs)); - CClientArgs clientArgs; + ClientArgs clientArgs; const int argc = 3; const char* kUnrecognizedCmd[argc] = { "stub", "mock_arg", "mock_address"}; diff --git a/src/test/unittests/synergy/ClipboardTests.cpp b/src/test/unittests/synergy/ClipboardTests.cpp index 400dcdac..15f32fdb 100644 --- a/src/test/unittests/synergy/ClipboardTests.cpp +++ b/src/test/unittests/synergy/ClipboardTests.cpp @@ -20,9 +20,9 @@ #include "test/global/gtest.h" -TEST(CClipboardTests, empty_openCalled_returnsTrue) +TEST(ClipboardTests, empty_openCalled_returnsTrue) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); bool actual = clipboard.empty(); @@ -30,62 +30,62 @@ TEST(CClipboardTests, empty_openCalled_returnsTrue) EXPECT_EQ(true, actual); } -TEST(CClipboardTests, empty_singleFormat_hasReturnsFalse) +TEST(ClipboardTests, empty_singleFormat_hasReturnsFalse) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); - clipboard.add(CClipboard::kText, "synergy rocks!"); + clipboard.add(Clipboard::kText, "synergy rocks!"); clipboard.empty(); - bool actual = clipboard.has(CClipboard::kText); + bool actual = clipboard.has(Clipboard::kText); EXPECT_FALSE(actual); } -TEST(CClipboardTests, add_newValue_valueWasStored) +TEST(ClipboardTests, add_newValue_valueWasStored) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } -TEST(CClipboardTests, add_replaceValue_valueWasReplaced) +TEST(ClipboardTests, add_replaceValue_valueWasReplaced) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.add(IClipboard::kText, "maxivista sucks"); // haha, just kidding. - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("maxivista sucks", actual); } -TEST(CClipboardTests, open_timeIsZero_returnsTrue) +TEST(ClipboardTests, open_timeIsZero_returnsTrue) { - CClipboard clipboard; + Clipboard clipboard; bool actual = clipboard.open(0); EXPECT_EQ(true, actual); } -TEST(CClipboardTests, open_timeIsOne_returnsTrue) +TEST(ClipboardTests, open_timeIsOne_returnsTrue) { - CClipboard clipboard; + Clipboard clipboard; bool actual = clipboard.open(1); EXPECT_EQ(true, actual); } -TEST(CClipboardTests, close_isOpen_noErrors) +TEST(ClipboardTests, close_isOpen_noErrors) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.close(); @@ -93,30 +93,30 @@ TEST(CClipboardTests, close_isOpen_noErrors) // can't assert anything } -TEST(CClipboardTests, getTime_openWithNoEmpty_returnsZero) +TEST(ClipboardTests, getTime_openWithNoEmpty_returnsZero) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(1); - CClipboard::Time actual = clipboard.getTime(); + Clipboard::Time actual = clipboard.getTime(); EXPECT_EQ(0, actual); } -TEST(CClipboardTests, getTime_openAndEmpty_returnsOne) +TEST(ClipboardTests, getTime_openAndEmpty_returnsOne) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(1); clipboard.empty(); - CClipboard::Time actual = clipboard.getTime(); + Clipboard::Time actual = clipboard.getTime(); EXPECT_EQ(1, actual); } -TEST(CClipboardTests, has_withFormatAdded_returnsTrue) +TEST(ClipboardTests, has_withFormatAdded_returnsTrue) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); @@ -125,9 +125,9 @@ TEST(CClipboardTests, has_withFormatAdded_returnsTrue) EXPECT_EQ(true, actual); } -TEST(CClipboardTests, has_withNoFormats_returnsFalse) +TEST(ClipboardTests, has_withNoFormats_returnsFalse) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); bool actual = clipboard.has(IClipboard::kText); @@ -135,59 +135,59 @@ TEST(CClipboardTests, has_withNoFormats_returnsFalse) EXPECT_FALSE(actual); } -TEST(CClipboardTests, get_withNoFormats_returnsEmpty) +TEST(ClipboardTests, get_withNoFormats_returnsEmpty) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("", actual); } -TEST(CClipboardTests, get_withFormatAdded_returnsExpected) +TEST(ClipboardTests, get_withFormatAdded_returnsExpected) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } -TEST(CClipboardTests, marshall_addNotCalled_firstCharIsZero) +TEST(ClipboardTests, marshall_addNotCalled_firstCharIsZero) { - CClipboard clipboard; + Clipboard clipboard; - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); // seems to return "\0\0\0\0" but EXPECT_EQ can't assert this, // so instead, just assert that first char is '\0'. EXPECT_EQ(0, (int)actual[0]); } -TEST(CClipboardTests, marshall_withTextAdded_typeCharIsText) +TEST(ClipboardTests, marshall_withTextAdded_typeCharIsText) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.close(); - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); // string contains other data, but 8th char should be kText. EXPECT_EQ(IClipboard::kText, (int)actual[7]); } -TEST(CClipboardTests, marshall_withTextAdded_lastSizeCharIs14) +TEST(ClipboardTests, marshall_withTextAdded_lastSizeCharIs14) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); // 14 chars clipboard.close(); - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); EXPECT_EQ(14, (int)actual[11]); } @@ -195,22 +195,22 @@ TEST(CClipboardTests, marshall_withTextAdded_lastSizeCharIs14) // TODO: there's some integer -> char encoding going on here. i find it // hard to believe that the clipboard is the only thing doing this. maybe // we should refactor this stuff out of the clipboard. -TEST(CClipboardTests, marshall_withTextSize285_sizeCharsValid) +TEST(ClipboardTests, marshall_withTextSize285_sizeCharsValid) { // 285 chars - CString data; + String data; data.append("Synergy is Free and Open Source Software that lets you "); data.append("easily share your mouse and keyboard between multiple "); data.append("computers, where each computer has it's own display. No "); data.append("special hardware is required, all you need is a local area "); data.append("network. Synergy is supported on Windows, Mac OS X and Linux."); - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, data); clipboard.close(); - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); // 4 asserts here, but that's ok because we're really just asserting 1 // thing. the 32-bit size value is split into 4 chars. if the size is 285 @@ -225,28 +225,28 @@ TEST(CClipboardTests, marshall_withTextSize285_sizeCharsValid) EXPECT_EQ(29, actual[11]); // 285 - 256 = 29 } -TEST(CClipboardTests, marshall_withHtmlAdded_typeCharIsHtml) +TEST(ClipboardTests, marshall_withHtmlAdded_typeCharIsHtml) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kHTML, "html sucks"); clipboard.close(); - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); // string contains other data, but 8th char should be kHTML. EXPECT_EQ(IClipboard::kHTML, (int)actual[7]); } -TEST(CClipboardTests, marshall_withHtmlAndText_has2Formats) +TEST(ClipboardTests, marshall_withHtmlAndText_has2Formats) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks"); clipboard.add(IClipboard::kHTML, "html sucks"); clipboard.close(); - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); // the number of formats is stored inside the first 4 chars. // the writeUInt32 function right-aligns numbers in 4 chars, @@ -256,24 +256,24 @@ TEST(CClipboardTests, marshall_withHtmlAndText_has2Formats) EXPECT_EQ(2, (int)actual[3]); } -TEST(CClipboardTests, marshall_withTextAdded_endsWithAdded) +TEST(ClipboardTests, marshall_withTextAdded_endsWithAdded) { - CClipboard clipboard; + Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.close(); - CString actual = clipboard.marshall(); + String actual = clipboard.marshall(); // string contains other data, but should end in the string we added. EXPECT_EQ("synergy rocks!", actual.substr(12)); } -TEST(CClipboardTests, unmarshall_emptyData_hasTextIsFalse) +TEST(ClipboardTests, unmarshall_emptyData_hasTextIsFalse) { - CClipboard clipboard; + Clipboard clipboard; - CString data; + String data; data += (char)0; data += (char)0; data += (char)0; @@ -286,19 +286,19 @@ TEST(CClipboardTests, unmarshall_emptyData_hasTextIsFalse) EXPECT_FALSE(actual); } -TEST(CClipboardTests, unmarshall_withTextSize285_getTextIsValid) +TEST(ClipboardTests, unmarshall_withTextSize285_getTextIsValid) { - CClipboard clipboard; + Clipboard clipboard; // 285 chars - CString text; + String text; text.append("Synergy is Free and Open Source Software that lets you "); text.append("easily share your mouse and keyboard between multiple "); text.append("computers, where each computer has it's own display. No "); text.append("special hardware is required, all you need is a local area "); text.append("network. Synergy is supported on Windows, Mac OS X and Linux."); - CString data; + String data; data += (char)0; data += (char)0; data += (char)0; @@ -316,14 +316,14 @@ TEST(CClipboardTests, unmarshall_withTextSize285_getTextIsValid) clipboard.unmarshall(data, 0); clipboard.open(0); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ(text, actual); } -TEST(CClipboardTests, unmarshall_withTextAndHtml_getTextIsValid) +TEST(ClipboardTests, unmarshall_withTextAndHtml_getTextIsValid) { - CClipboard clipboard; - CString data; + Clipboard clipboard; + String data; data += (char)0; data += (char)0; data += (char)0; @@ -350,14 +350,14 @@ TEST(CClipboardTests, unmarshall_withTextAndHtml_getTextIsValid) clipboard.unmarshall(data, 0); clipboard.open(0); - CString actual = clipboard.get(IClipboard::kText); + String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); } -TEST(CClipboardTests, unmarshall_withTextAndHtml_getHtmlIsValid) +TEST(ClipboardTests, unmarshall_withTextAndHtml_getHtmlIsValid) { - CClipboard clipboard; - CString data; + Clipboard clipboard; + String data; data += (char)0; data += (char)0; data += (char)0; @@ -384,21 +384,21 @@ TEST(CClipboardTests, unmarshall_withTextAndHtml_getHtmlIsValid) clipboard.unmarshall(data, 0); clipboard.open(0); - CString actual = clipboard.get(IClipboard::kHTML); + String actual = clipboard.get(IClipboard::kHTML); EXPECT_EQ("html sucks", actual); } -TEST(CClipboardTests, copy_withSingleText_clipboardsAreEqual) +TEST(ClipboardTests, copy_withSingleText_clipboardsAreEqual) { - CClipboard clipboard1; + Clipboard clipboard1; clipboard1.open(0); - clipboard1.add(CClipboard::kText, "synergy rocks!"); + clipboard1.add(Clipboard::kText, "synergy rocks!"); clipboard1.close(); - CClipboard clipboard2; - CClipboard::copy(&clipboard2, &clipboard1); + Clipboard clipboard2; + Clipboard::copy(&clipboard2, &clipboard1); clipboard2.open(0); - CString actual = clipboard2.get(CClipboard::kText); + String actual = clipboard2.get(Clipboard::kText); EXPECT_EQ("synergy rocks!", actual); } diff --git a/src/test/unittests/synergy/CryptoStreamTests.cpp b/src/test/unittests/synergy/CryptoStreamTests.cpp index 4aecc082..00f0dd18 100644 --- a/src/test/unittests/synergy/CryptoStreamTests.cpp +++ b/src/test/unittests/synergy/CryptoStreamTests.cpp @@ -60,7 +60,7 @@ UInt8 readWriteIvChangeTrigger_mockRead(void* out, UInt32 n); UInt8 g_newIvDoesNotChangeIv_buffer[1]; void newIvDoesNotChangeIv_mockWrite(const void* in, UInt32 n); -TEST(CCryptoStreamTests, write) +TEST(CryptoStreamTests, write) { const UInt32 size = 4; UInt8* buffer = new UInt8[size]; @@ -69,13 +69,13 @@ TEST(CCryptoStreamTests, write) buffer[2] = 'D'; buffer[3] = 'N'; - NiceMock eventQueue; - NiceMock innerStream; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + CryptoOptions options("cfb", "mock"); ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(write_mockWrite)); - CCryptoStream cs(&eventQueue, &innerStream, options, false); + CryptoStream cs(&eventQueue, &innerStream, options, false); cs.setEncryptIv(kIv); cs.write(buffer, size); @@ -85,15 +85,15 @@ TEST(CCryptoStreamTests, write) EXPECT_EQ(220, g_write_buffer[3]); } -TEST(CCryptoStreamTests, read) +TEST(CryptoStreamTests, read) { - NiceMock eventQueue; - NiceMock innerStream; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + CryptoOptions options("cfb", "mock"); ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(read_mockRead)); - CCryptoStream cs(&eventQueue, &innerStream, options, false); + CryptoStream cs(&eventQueue, &innerStream, options, false); cs.setEncryptIv(kIv); cs.setDecryptIv(kIv); @@ -112,18 +112,18 @@ TEST(CCryptoStreamTests, read) EXPECT_EQ('N', buffer[3]); } -TEST(CCryptoStreamTests, write4Read1) +TEST(CryptoStreamTests, write4Read1) { g_write4Read1_bufferIndex = 0; - NiceMock eventQueue; - NiceMock innerStream; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + CryptoOptions options("cfb", "mock"); ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(write4Read1_mockWrite)); ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(write4Read1_mockRead)); - CCryptoStream cs1(&eventQueue, &innerStream, options, false); + CryptoStream cs1(&eventQueue, &innerStream, options, false); cs1.setEncryptIv(kIv); cs1.write("a", 1); @@ -131,7 +131,7 @@ TEST(CCryptoStreamTests, write4Read1) cs1.write("c", 1); cs1.write("d", 1); - CCryptoStream cs2(&eventQueue, &innerStream, options, false); + CryptoStream cs2(&eventQueue, &innerStream, options, false); cs2.setDecryptIv(kIv); UInt8 buffer[4]; @@ -143,18 +143,18 @@ TEST(CCryptoStreamTests, write4Read1) EXPECT_EQ('d', buffer[3]); } -TEST(CCryptoStreamTests, write1Read4) +TEST(CryptoStreamTests, write1Read4) { g_write1Read4_bufferIndex = 0; - NiceMock eventQueue; - NiceMock innerStream; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + CryptoOptions options("cfb", "mock"); ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(write1Read4_mockWrite)); ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(write1Read4_mockRead)); - CCryptoStream cs1(&eventQueue, &innerStream, options, false); + CryptoStream cs1(&eventQueue, &innerStream, options, false); cs1.setEncryptIv(kIv); UInt8 bufferIn[4]; @@ -164,7 +164,7 @@ TEST(CCryptoStreamTests, write1Read4) bufferIn[3] = 'd'; cs1.write(bufferIn, 4); - CCryptoStream cs2(&eventQueue, &innerStream, options, false); + CryptoStream cs2(&eventQueue, &innerStream, options, false); cs2.setDecryptIv(kIv); UInt8 bufferOut[4]; @@ -179,14 +179,14 @@ TEST(CCryptoStreamTests, write1Read4) EXPECT_EQ('d', bufferOut[3]); } -TEST(CCryptoStreamTests, readWriteIvChanged) +TEST(CryptoStreamTests, readWriteIvChanged) { g_readWriteIvChangeTrigger_writeBufferIndex = 0; g_readWriteIvChangeTrigger_readBufferIndex = 0; - NiceMock eventQueue; - NiceMock innerStream; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + CryptoOptions options("cfb", "mock"); ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(readWriteIvChanged_mockWrite)); ON_CALL(innerStream, read(_, _)).WillByDefault(Invoke(readWriteIvChanged_mockRead)); @@ -195,7 +195,7 @@ TEST(CCryptoStreamTests, readWriteIvChanged) const byte iv1[] = "aaaaaaaaaaaaaaaa"; const byte iv2[] = "bbbbbbbbbbbbbbbb"; - CCryptoStream cs1(&eventQueue, &innerStream, options, false); + CryptoStream cs1(&eventQueue, &innerStream, options, false); cs1.setEncryptIv(iv1); UInt8 bufferIn[4]; @@ -205,7 +205,7 @@ TEST(CCryptoStreamTests, readWriteIvChanged) bufferIn[3] = 'd'; cs1.write(bufferIn, 4); - CCryptoStream cs2(&eventQueue, &innerStream, options, false); + CryptoStream cs2(&eventQueue, &innerStream, options, false); cs1.setDecryptIv(iv2); UInt8 bufferOut[4]; @@ -234,35 +234,35 @@ TEST(CCryptoStreamTests, readWriteIvChanged) EXPECT_EQ('d', bufferOut[3]); } -TEST(CCryptoStreamTests, createKey) +TEST(CryptoStreamTests, createKey) { byte hash1[16]; - CCryptoStream::createKey(hash1, "MockLongPassword", 16, 16); + CryptoStream::createKey(hash1, "MockLongPassword", 16, 16); EXPECT_EQ(hash1[0], 149); EXPECT_EQ(hash1[15], 235); byte hash2[32]; - CCryptoStream::createKey(hash2, "MockLongPassword", 32, 16); + CryptoStream::createKey(hash2, "MockLongPassword", 32, 16); EXPECT_EQ(hash2[0], 149); EXPECT_EQ(hash2[15], 235); EXPECT_EQ(hash2[31], 7); byte hash3[32]; - CCryptoStream::createKey(hash3, "7accbf2f86a9191da0947107d4fe7054", 32, 16); + CryptoStream::createKey(hash3, "7accbf2f86a9191da0947107d4fe7054", 32, 16); EXPECT_EQ(hash3[0], 120); EXPECT_EQ(hash3[15], 11); EXPECT_EQ(hash3[31], 233); } -TEST(CCryptoStreamTests, newIvDoesNotChangeIv) +TEST(CryptoStreamTests, newIvDoesNotChangeIv) { - NiceMock eventQueue; - NiceMock innerStream; - CCryptoOptions options("cfb", "mock"); + NiceMock eventQueue; + NiceMock innerStream; + CryptoOptions options("cfb", "mock"); ON_CALL(innerStream, write(_, _)).WillByDefault(Invoke(newIvDoesNotChangeIv_mockWrite)); - CCryptoStream cs1(&eventQueue, &innerStream, options, false); + CryptoStream cs1(&eventQueue, &innerStream, options, false); cs1.write("a", 1); EXPECT_EQ(175, g_newIvDoesNotChangeIv_buffer[0]); diff --git a/src/test/unittests/synergy/GenericArgsParsingTests.cpp b/src/test/unittests/synergy/GenericArgsParsingTests.cpp index 4d3f585b..0091a768 100644 --- a/src/test/unittests/synergy/GenericArgsParsingTests.cpp +++ b/src/test/unittests/synergy/GenericArgsParsingTests.cpp @@ -41,68 +41,68 @@ showMockVersion() g_versionShowed = true; } -TEST(CGenericArgsParsingTests, parseGenericArgs_logLevelCmd_setLogLevel) +TEST(GenericArgsParsingTests, parseGenericArgs_logLevelCmd_setLogLevel) { int i = 1; const int argc = 3; const char* kLogLevelCmd[argc] = { "stub", "--debug", "DEBUG" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kLogLevelCmd, i); - CString logFilter(argsBase.m_logFilter); + String logFilter(argsBase.m_logFilter); EXPECT_EQ("DEBUG", logFilter); EXPECT_EQ(2, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_logFileCmd_saveLogFilename) +TEST(GenericArgsParsingTests, parseGenericArgs_logFileCmd_saveLogFilename) { int i = 1; const int argc = 3; const char* kLogFileCmd[argc] = { "stub", "--log", "mock_filename" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kLogFileCmd, i); - CString logFile(argsBase.m_logFile); + String logFile(argsBase.m_logFile); EXPECT_EQ("mock_filename", logFile); EXPECT_EQ(2, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_logFileCmdWithSpace_saveLogFilename) +TEST(GenericArgsParsingTests, parseGenericArgs_logFileCmdWithSpace_saveLogFilename) { int i = 1; const int argc = 3; const char* kLogFileCmdWithSpace[argc] = { "stub", "--log", "mo ck_filename" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kLogFileCmdWithSpace, i); - CString logFile(argsBase.m_logFile); + String logFile(argsBase.m_logFile); EXPECT_EQ("mo ck_filename", logFile); EXPECT_EQ(2, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_noDeamonCmd_daemonFalse) +TEST(GenericArgsParsingTests, parseGenericArgs_noDeamonCmd_daemonFalse) { int i = 1; const int argc = 2; const char* kNoDeamonCmd[argc] = { "stub", "-f" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kNoDeamonCmd, i); @@ -111,14 +111,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_noDeamonCmd_daemonFalse) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_deamonCmd_daemonTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_deamonCmd_daemonTrue) { int i = 1; const int argc = 2; const char* kDeamonCmd[argc] = { "stub", "--daemon" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kDeamonCmd, i); @@ -127,14 +127,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_deamonCmd_daemonTrue) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_nameCmd_saveName) +TEST(GenericArgsParsingTests, parseGenericArgs_nameCmd_saveName) { int i = 1; const int argc = 3; const char* kNameCmd[argc] = { "stub", "--name", "mock" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kNameCmd, i); @@ -143,14 +143,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_nameCmd_saveName) EXPECT_EQ(2, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_noRestartCmd_restartFalse) +TEST(GenericArgsParsingTests, parseGenericArgs_noRestartCmd_restartFalse) { int i = 1; const int argc = 2; const char* kNoRestartCmd[argc] = { "stub", "--no-restart" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kNoRestartCmd, i); @@ -159,14 +159,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_noRestartCmd_restartFalse) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_restartCmd_restartTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_restartCmd_restartTrue) { int i = 1; const int argc = 2; const char* kRestartCmd[argc] = { "stub", "--restart" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kRestartCmd, i); @@ -175,14 +175,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_restartCmd_restartTrue) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_backendCmd_backendTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_backendCmd_backendTrue) { int i = 1; const int argc = 2; const char* kBackendCmd[argc] = { "stub", "-z" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kBackendCmd, i); @@ -191,14 +191,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_backendCmd_backendTrue) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_noHookCmd_noHookTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_noHookCmd_noHookTrue) { int i = 1; const int argc = 2; const char* kNoHookCmd[argc] = { "stub", "--no-hooks" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kNoHookCmd, i); @@ -207,16 +207,16 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_noHookCmd_noHookTrue) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_helpCmd_showHelp) +TEST(GenericArgsParsingTests, parseGenericArgs_helpCmd_showHelp) { g_helpShowed = false; int i = 1; const int argc = 2; const char* kHelpCmd[argc] = { "stub", "--help" }; - NiceMock app; - CArgParser argParser(&app); - CArgsBase argsBase; + NiceMock app; + ArgParser argParser(&app); + ArgsBase argsBase; argParser.setArgsBase(argsBase); ON_CALL(app, help()).WillByDefault(Invoke(showMockHelp)); @@ -227,16 +227,16 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_helpCmd_showHelp) } -TEST(CGenericArgsParsingTests, parseGenericArgs_versionCmd_showVersion) +TEST(GenericArgsParsingTests, parseGenericArgs_versionCmd_showVersion) { g_versionShowed = false; int i = 1; const int argc = 2; const char* kVersionCmd[argc] = { "stub", "--version" }; - NiceMock app; - CArgParser argParser(&app); - CArgsBase argsBase; + NiceMock app; + ArgParser argParser(&app); + ArgsBase argsBase; argParser.setArgsBase(argsBase); ON_CALL(app, version()).WillByDefault(Invoke(showMockVersion)); @@ -246,14 +246,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_versionCmd_showVersion) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_noTrayCmd_disableTrayTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_noTrayCmd_disableTrayTrue) { int i = 1; const int argc = 2; const char* kNoTrayCmd[argc] = { "stub", "--no-tray" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kNoTrayCmd, i); @@ -262,14 +262,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_noTrayCmd_disableTrayTrue) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_ipcCmd_enableIpcTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_ipcCmd_enableIpcTrue) { int i = 1; const int argc = 2; const char* kIpcCmd[argc] = { "stub", "--ipc" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kIpcCmd, i); @@ -278,14 +278,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_ipcCmd_enableIpcTrue) EXPECT_EQ(1, i); } -TEST(CGenericArgsParsingTests, parseGenericArgs_cryptoPassCmd_savePassword) +TEST(GenericArgsParsingTests, parseGenericArgs_cryptoPassCmd_savePassword) { int i = 1; const int argc = 3; const char* kCryptoPassCmd[argc] = { "stub", "--crypto-pass", "mock_password" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kCryptoPassCmd, i); @@ -296,14 +296,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_cryptoPassCmd_savePassword) } #ifndef WINAPI_XWINDOWS -TEST(CGenericArgsParsingTests, parseGenericArgs_dragDropCmdOnNonLinux_enableDragDropTrue) +TEST(GenericArgsParsingTests, parseGenericArgs_dragDropCmdOnNonLinux_enableDragDropTrue) { int i = 1; const int argc = 2; const char* kDragDropCmd[argc] = { "stub", "--enable-drag-drop" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kDragDropCmd, i); @@ -314,14 +314,14 @@ TEST(CGenericArgsParsingTests, parseGenericArgs_dragDropCmdOnNonLinux_enableDrag #endif #ifdef WINAPI_XWINDOWS -TEST(CGenericArgsParsingTests, parseGenericArgs_dragDropCmdOnLinux_enableDragDropFalse) +TEST(GenericArgsParsingTests, parseGenericArgs_dragDropCmdOnLinux_enableDragDropFalse) { int i = 1; const int argc = 2; const char* kDragDropCmd[argc] = { "stub", "--enable-drag-drop" }; - CArgParser argParser(NULL); - CArgsBase argsBase; + ArgParser argParser(NULL); + ArgsBase argsBase; argParser.setArgsBase(argsBase); argParser.parseGenericArgs(argc, kDragDropCmd, i); diff --git a/src/test/unittests/synergy/KeyStateTests.cpp b/src/test/unittests/synergy/KeyStateTests.cpp index 509ed61b..1e251848 100644 --- a/src/test/unittests/synergy/KeyStateTests.cpp +++ b/src/test/unittests/synergy/KeyStateTests.cpp @@ -31,44 +31,44 @@ using ::testing::Return; using ::testing::ReturnRef; using ::testing::SaveArg; -TEST(CKeyStateTests, onKey_aKeyDown_keyStateOne) +TEST(KeyStateTests, onKey_aKeyDown_keyStateOne) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); keyState.onKey(1, true, KeyModifierAlt); EXPECT_EQ(1, keyState.getKeyState(1)); } -TEST(CKeyStateTests, onKey_aKeyUp_keyStateZero) +TEST(KeyStateTests, onKey_aKeyUp_keyStateZero) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); keyState.onKey(1, false, KeyModifierAlt); EXPECT_EQ(0, keyState.getKeyState(1)); } -TEST(CKeyStateTests, onKey_invalidKey_keyStateZero) +TEST(KeyStateTests, onKey_invalidKey_keyStateZero) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); keyState.onKey(0, true, KeyModifierAlt); EXPECT_EQ(0, keyState.getKeyState(0)); } -TEST(CKeyStateTests, sendKeyEvent_halfDuplexAndRepeat_addEventNotCalled) +TEST(KeyStateTests, sendKeyEvent_halfDuplexAndRepeat_addEventNotCalled) { - NiceMock keyMap; - NiceMock eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + NiceMock eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); ON_CALL(keyMap, isHalfDuplex(_, _)).WillByDefault(Return(true)); @@ -77,11 +77,11 @@ TEST(CKeyStateTests, sendKeyEvent_halfDuplexAndRepeat_addEventNotCalled) keyState.sendKeyEvent(NULL, false, true, kKeyCapsLock, 0, 0, 0); } -TEST(CKeyStateTests, sendKeyEvent_halfDuplex_addEventCalledTwice) +TEST(KeyStateTests, sendKeyEvent_halfDuplex_addEventCalledTwice) { - NiceMock keyMap; - NiceMock eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + NiceMock eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); IKeyStateEvents keyStateEvents; keyStateEvents.setEvents(&eventQueue); @@ -93,11 +93,11 @@ TEST(CKeyStateTests, sendKeyEvent_halfDuplex_addEventCalledTwice) keyState.sendKeyEvent(NULL, false, false, kKeyCapsLock, 0, 0, 0); } -TEST(CKeyStateTests, sendKeyEvent_keyRepeat_addEventCalledOnce) +TEST(KeyStateTests, sendKeyEvent_keyRepeat_addEventCalledOnce) { - NiceMock keyMap; - NiceMock eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + NiceMock eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); IKeyStateEvents keyStateEvents; keyStateEvents.setEvents(&eventQueue); @@ -108,11 +108,11 @@ TEST(CKeyStateTests, sendKeyEvent_keyRepeat_addEventCalledOnce) keyState.sendKeyEvent(NULL, false, true, 1, 0, 0, 0); } -TEST(CKeyStateTests, sendKeyEvent_keyDown_addEventCalledOnce) +TEST(KeyStateTests, sendKeyEvent_keyDown_addEventCalledOnce) { - NiceMock keyMap; - NiceMock eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + NiceMock eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); IKeyStateEvents keyStateEvents; keyStateEvents.setEvents(&eventQueue); @@ -123,11 +123,11 @@ TEST(CKeyStateTests, sendKeyEvent_keyDown_addEventCalledOnce) keyState.sendKeyEvent(NULL, true, false, 1, 0, 0, 0); } -TEST(CKeyStateTests, sendKeyEvent_keyUp_addEventCalledOnce) +TEST(KeyStateTests, sendKeyEvent_keyUp_addEventCalledOnce) { - NiceMock keyMap; - NiceMock eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + NiceMock eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); IKeyStateEvents keyStateEvents; keyStateEvents.setEvents(&eventQueue); @@ -138,11 +138,11 @@ TEST(CKeyStateTests, sendKeyEvent_keyUp_addEventCalledOnce) keyState.sendKeyEvent(NULL, false, false, 1, 0, 0, 0); } -TEST(CKeyStateTests, updateKeyMap_mockKeyMap_keyMapGotMock) +TEST(KeyStateTests, updateKeyMap_mockKeyMap_keyMapGotMock) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // key map member gets a new key map via swap() EXPECT_CALL(keyMap, swap(_)); @@ -150,11 +150,11 @@ TEST(CKeyStateTests, updateKeyMap_mockKeyMap_keyMapGotMock) keyState.updateKeyMap(); } -TEST(CKeyStateTests, updateKeyState_pollInsertsSingleKey_keyIsDown) +TEST(KeyStateTests, updateKeyState_pollInsertsSingleKey_keyIsDown) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); ON_CALL(keyState, pollPressedKeys(_)).WillByDefault(Invoke(stubPollPressedKeys)); keyState.updateKeyState(); @@ -163,11 +163,11 @@ TEST(CKeyStateTests, updateKeyState_pollInsertsSingleKey_keyIsDown) ASSERT_TRUE(actual); } -TEST(CKeyStateTests, updateKeyState_pollDoesNothing_keyNotSet) +TEST(KeyStateTests, updateKeyState_pollDoesNothing_keyNotSet) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); keyState.updateKeyState(); @@ -175,11 +175,11 @@ TEST(CKeyStateTests, updateKeyState_pollDoesNothing_keyNotSet) ASSERT_FALSE(actual); } -TEST(CKeyStateTests, updateKeyState_activeModifiers_maskSet) +TEST(KeyStateTests, updateKeyState_activeModifiers_maskSet) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); ON_CALL(keyState, pollActiveModifiers()).WillByDefault(Return(KeyModifierAlt)); keyState.updateKeyState(); @@ -188,11 +188,11 @@ TEST(CKeyStateTests, updateKeyState_activeModifiers_maskSet) ASSERT_EQ(KeyModifierAlt, actual); } -TEST(CKeyStateTests, updateKeyState_activeModifiers_maskNotSet) +TEST(KeyStateTests, updateKeyState_activeModifiers_maskNotSet) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); keyState.updateKeyState(); @@ -200,11 +200,11 @@ TEST(CKeyStateTests, updateKeyState_activeModifiers_maskNotSet) ASSERT_EQ(0, actual); } -TEST(CKeyStateTests, updateKeyState_activeModifiers_keyMapGotModifers) +TEST(KeyStateTests, updateKeyState_activeModifiers_keyMapGotModifers) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); ON_CALL(keyState, pollActiveModifiers()).WillByDefault(Return(1)); ON_CALL(keyMap, foreachKey(_, _)).WillByDefault(Invoke(assertMaskIsOne)); @@ -214,44 +214,44 @@ TEST(CKeyStateTests, updateKeyState_activeModifiers_keyMapGotModifers) keyState.updateKeyState(); } -TEST(CKeyStateTests, setHalfDuplexMask_capsLock_halfDuplexCapsLockAdded) +TEST(KeyStateTests, setHalfDuplexMask_capsLock_halfDuplexCapsLockAdded) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); EXPECT_CALL(keyMap, addHalfDuplexModifier(kKeyCapsLock)); keyState.setHalfDuplexMask(KeyModifierCapsLock); } -TEST(CKeyStateTests, setHalfDuplexMask_numLock_halfDuplexNumLockAdded) +TEST(KeyStateTests, setHalfDuplexMask_numLock_halfDuplexNumLockAdded) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); EXPECT_CALL(keyMap, addHalfDuplexModifier(kKeyNumLock)); keyState.setHalfDuplexMask(KeyModifierNumLock); } -TEST(CKeyStateTests, setHalfDuplexMask_scrollLock_halfDuplexScollLockAdded) +TEST(KeyStateTests, setHalfDuplexMask_scrollLock_halfDuplexScollLockAdded) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); EXPECT_CALL(keyMap, addHalfDuplexModifier(kKeyScrollLock)); keyState.setHalfDuplexMask(KeyModifierScrollLock); } -TEST(CKeyStateTests, fakeKeyDown_serverKeyAlreadyDown_fakeKeyCalledTwice) +TEST(KeyStateTests, fakeKeyDown_serverKeyAlreadyDown_fakeKeyCalledTwice) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); s_stubKeyItem.m_client = 0; s_stubKeyItem.m_button = 1; ON_CALL(keyMap, mapKey(_, _, _, _, _, _, _)).WillByDefault(Invoke(stubMapKey)); @@ -265,22 +265,22 @@ TEST(CKeyStateTests, fakeKeyDown_serverKeyAlreadyDown_fakeKeyCalledTwice) keyState.fakeKeyDown(1, 0, 0); } -TEST(CKeyStateTests, fakeKeyDown_isIgnoredKey_fakeKeyNotCalled) +TEST(KeyStateTests, fakeKeyDown_isIgnoredKey_fakeKeyNotCalled) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); EXPECT_CALL(keyState, fakeKey(_)).Times(0); keyState.fakeKeyDown(kKeyCapsLock, 0, 0); } -TEST(CKeyStateTests, fakeKeyDown_mapReturnsKeystrokes_fakeKeyCalled) +TEST(KeyStateTests, fakeKeyDown_mapReturnsKeystrokes_fakeKeyCalled) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); s_stubKeyItem.m_button = 0; s_stubKeyItem.m_client = 0; ON_CALL(keyMap, mapKey(_, _, _, _, _, _, _)).WillByDefault(Invoke(stubMapKey)); @@ -290,32 +290,32 @@ TEST(CKeyStateTests, fakeKeyDown_mapReturnsKeystrokes_fakeKeyCalled) keyState.fakeKeyDown(1, 0, 0); } -TEST(CKeyStateTests, fakeKeyRepeat_invalidKey_returnsFalse) +TEST(KeyStateTests, fakeKeyRepeat_invalidKey_returnsFalse) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); bool actual = keyState.fakeKeyRepeat(0, 0, 0, 0); ASSERT_FALSE(actual); } -TEST(CKeyStateTests, fakeKeyRepeat_nullKey_returnsFalse) +TEST(KeyStateTests, fakeKeyRepeat_nullKey_returnsFalse) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // set the key to down (we need to make mapKey return a valid key to do this). - CKeyMap::KeyItem keyItem; + synergy::KeyMap::KeyItem keyItem; keyItem.m_client = 0; keyItem.m_button = 1; ON_CALL(keyMap, mapKey(_, _, _, _, _, _, _)).WillByDefault(Return(&keyItem)); keyState.fakeKeyDown(1, 0, 0); // change mapKey to return NULL so that fakeKeyRepeat exits early. - CKeyMap::KeyItem* nullKeyItem = NULL; + synergy::KeyMap::KeyItem* nullKeyItem = NULL; ON_CALL(keyMap, mapKey(_, _, _, _, _, _, _)).WillByDefault(Return(nullKeyItem)); bool actual = keyState.fakeKeyRepeat(1, 0, 0, 0); @@ -323,14 +323,14 @@ TEST(CKeyStateTests, fakeKeyRepeat_nullKey_returnsFalse) ASSERT_FALSE(actual); } -TEST(CKeyStateTests, fakeKeyRepeat_invalidButton_returnsFalse) +TEST(KeyStateTests, fakeKeyRepeat_invalidButton_returnsFalse) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // set the key to down (we need to make mapKey return a valid key to do this). - CKeyMap::KeyItem keyItem; + synergy::KeyMap::KeyItem keyItem; keyItem.m_client = 0; keyItem.m_button = 1; // set to 1 to make fakeKeyDown work. ON_CALL(keyMap, mapKey(_, _, _, _, _, _, _)).WillByDefault(Return(&keyItem)); @@ -345,13 +345,13 @@ TEST(CKeyStateTests, fakeKeyRepeat_invalidButton_returnsFalse) ASSERT_FALSE(actual); } -TEST(CKeyStateTests, fakeKeyRepeat_validKey_returnsTrue) +TEST(KeyStateTests, fakeKeyRepeat_validKey_returnsTrue) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); s_stubKeyItem.m_client = 0; - s_stubKeystroke.m_type = CKeyMap::Keystroke::kButton; + s_stubKeystroke.m_type = synergy::KeyMap::Keystroke::kButton; s_stubKeystroke.m_data.m_button.m_button = 2; // set the button to 1 for fakeKeyDown call @@ -368,22 +368,22 @@ TEST(CKeyStateTests, fakeKeyRepeat_validKey_returnsTrue) ASSERT_TRUE(actual); } -TEST(CKeyStateTests, fakeKeyUp_buttonNotDown_returnsFalse) +TEST(KeyStateTests, fakeKeyUp_buttonNotDown_returnsFalse) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); bool actual = keyState.fakeKeyUp(0); ASSERT_FALSE(actual); } -TEST(CKeyStateTests, fakeKeyUp_buttonAlreadyDown_returnsTrue) +TEST(KeyStateTests, fakeKeyUp_buttonAlreadyDown_returnsTrue) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // press alt down so we get full coverage. ON_CALL(keyState, pollActiveModifiers()).WillByDefault(Return(KeyModifierAlt)); @@ -400,11 +400,11 @@ TEST(CKeyStateTests, fakeKeyUp_buttonAlreadyDown_returnsTrue) ASSERT_TRUE(actual); } -TEST(CKeyStateTests, fakeAllKeysUp_keysWereDown_keysAreUp) +TEST(KeyStateTests, fakeAllKeysUp_keysWereDown_keysAreUp) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // press button 1 down. s_stubKeyItem.m_button = 1; @@ -418,11 +418,11 @@ TEST(CKeyStateTests, fakeAllKeysUp_keysWereDown_keysAreUp) ASSERT_FALSE(actual); } -TEST(CKeyStateTests, isKeyDown_keyDown_returnsTrue) +TEST(KeyStateTests, isKeyDown_keyDown_returnsTrue) { - NiceMock keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + NiceMock keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // press button 1 down. s_stubKeyItem.m_button = 1; @@ -435,11 +435,11 @@ TEST(CKeyStateTests, isKeyDown_keyDown_returnsTrue) ASSERT_TRUE(actual); } -TEST(CKeyStateTests, isKeyDown_noKeysDown_returnsFalse) +TEST(KeyStateTests, isKeyDown_noKeysDown_returnsFalse) { - CMockKeyMap keyMap; - CMockEventQueue eventQueue; - CKeyStateImpl keyState(eventQueue, keyMap); + MockKeyMap keyMap; + MockEventQueue eventQueue; + KeyStateImpl keyState(eventQueue, keyMap); // method under test bool actual = keyState.isKeyDown(1); @@ -456,13 +456,13 @@ stubPollPressedKeys(IKeyState::KeyButtonSet& pressedKeys) void assertMaskIsOne(ForeachKeyCallback cb, void* userData) { - ASSERT_EQ(1, ((CKeyState::CAddActiveModifierContext*)userData)->m_mask); + ASSERT_EQ(1, ((KeyState::AddActiveModifierContext*)userData)->m_mask); } -const CKeyMap::KeyItem* +const synergy::KeyMap::KeyItem* stubMapKey( - CKeyMap::Keystrokes& keys, KeyID id, SInt32 group, - CKeyMap::ModifierToKeys& activeModifiers, + synergy::KeyMap::Keystrokes& keys, KeyID id, SInt32 group, + synergy::KeyMap::ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredMask, bool isAutoRepeat) diff --git a/src/test/unittests/synergy/KeyStateTests.h b/src/test/unittests/synergy/KeyStateTests.h index 31d26f71..ea36d0a2 100644 --- a/src/test/unittests/synergy/KeyStateTests.h +++ b/src/test/unittests/synergy/KeyStateTests.h @@ -22,38 +22,38 @@ #include "test/global/gmock.h" -class CMockKeyMap; -class CMockEventQueue; +class MockKeyMap; +class MockEventQueue; // NOTE: do not mock methods that are not pure virtual. this mock exists only -// to provide an implementation of the CKeyState abstract class. -class CMockKeyState : public CKeyState +// to provide an implementation of the KeyState abstract class. +class MockKeyState : public KeyState { public: - CMockKeyState(const CMockEventQueue& eventQueue) : - CKeyState((IEventQueue*)&eventQueue) + MockKeyState(const MockEventQueue& eventQueue) : + KeyState((IEventQueue*)&eventQueue) { } - CMockKeyState(const CMockEventQueue& eventQueue, const CMockKeyMap& keyMap) : - CKeyState((IEventQueue*)&eventQueue, (CKeyMap&)keyMap) + MockKeyState(const MockEventQueue& eventQueue, const MockKeyMap& keyMap) : + KeyState((IEventQueue*)&eventQueue, (synergy::KeyMap&)keyMap) { } MOCK_CONST_METHOD0(pollActiveGroup, SInt32()); MOCK_CONST_METHOD0(pollActiveModifiers, KeyModifierMask()); MOCK_METHOD0(fakeCtrlAltDel, bool()); - MOCK_METHOD1(getKeyMap, void(CKeyMap&)); + MOCK_METHOD1(getKeyMap, void(synergy::KeyMap&)); MOCK_METHOD1(fakeKey, void(const Keystroke&)); MOCK_CONST_METHOD1(pollPressedKeys, void(KeyButtonSet&)); }; -typedef ::testing::NiceMock CKeyStateImpl; +typedef ::testing::NiceMock KeyStateImpl; typedef UInt32 KeyID; typedef void (*ForeachKeyCallback)( - KeyID, SInt32 group, CKeyMap::KeyItem&, void* userData); + KeyID, SInt32 group, synergy::KeyMap::KeyItem&, void* userData); void stubPollPressedKeys(IKeyState::KeyButtonSet& pressedKeys); @@ -61,13 +61,13 @@ stubPollPressedKeys(IKeyState::KeyButtonSet& pressedKeys); void assertMaskIsOne(ForeachKeyCallback cb, void* userData); -const CKeyMap::KeyItem* +const synergy::KeyMap::KeyItem* stubMapKey( - CKeyMap::Keystrokes& keys, KeyID id, SInt32 group, - CKeyMap::ModifierToKeys& activeModifiers, + synergy::KeyMap::Keystrokes& keys, KeyID id, SInt32 group, + synergy::KeyMap::ModifierToKeys& activeModifiers, KeyModifierMask& currentState, KeyModifierMask desiredMask, bool isAutoRepeat); -CKeyMap::Keystroke s_stubKeystroke(1, false, false); -CKeyMap::KeyItem s_stubKeyItem; +synergy::KeyMap::Keystroke s_stubKeystroke(1, false, false); +synergy::KeyMap::KeyItem s_stubKeyItem; diff --git a/src/test/unittests/synergy/ServerArgsParsingTests.cpp b/src/test/unittests/synergy/ServerArgsParsingTests.cpp index 5e57733b..e2ed2bf3 100644 --- a/src/test/unittests/synergy/ServerArgsParsingTests.cpp +++ b/src/test/unittests/synergy/ServerArgsParsingTests.cpp @@ -37,12 +37,12 @@ server_stubCheckUnexpectedArgs() return false; } -TEST(CServerArgsParsingTests, parseServerArgs_addressArg_setSynergyAddress) +TEST(ServerArgsParsingTests, parseServerArgs_addressArg_setSynergyAddress) { - NiceMock argParser; + NiceMock argParser; ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(server_stubParseGenericArgs)); ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(server_stubCheckUnexpectedArgs)); - CServerArgs serverArgs; + ServerArgs serverArgs; const int argc = 3; const char* kAddressCmd[argc] = { "stub", "--address", "mock_address" }; @@ -51,12 +51,12 @@ TEST(CServerArgsParsingTests, parseServerArgs_addressArg_setSynergyAddress) EXPECT_EQ("mock_address", serverArgs.m_synergyAddress); } -TEST(CServerArgsParsingTests, parseServerArgs_configArg_setConfigFile) +TEST(ServerArgsParsingTests, parseServerArgs_configArg_setConfigFile) { - NiceMock argParser; + NiceMock argParser; ON_CALL(argParser, parseGenericArgs(_, _, _)).WillByDefault(Invoke(server_stubParseGenericArgs)); ON_CALL(argParser, checkUnexpectedArgs()).WillByDefault(Invoke(server_stubCheckUnexpectedArgs)); - CServerArgs serverArgs; + ServerArgs serverArgs; const int argc = 3; const char* kConfigCmd[argc] = { "stub", "--config", "mock_configFile" };