Indentation changes.
This commit is contained in:
parent
3ca72b35f3
commit
ea6b347b18
|
@ -4,13 +4,13 @@
|
||||||
#include "IJob.h"
|
#include "IJob.h"
|
||||||
|
|
||||||
class CFunctionJob : public IJob {
|
class CFunctionJob : public IJob {
|
||||||
public:
|
public:
|
||||||
CFunctionJob(void (*func)(void*), void* arg = NULL);
|
CFunctionJob(void (*func)(void*), void* arg = NULL);
|
||||||
|
|
||||||
// IJob overrides
|
// IJob overrides
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void (*m_func)(void*);
|
void (*m_func)(void*);
|
||||||
void* m_arg;
|
void* m_arg;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
class CLog {
|
class CLog {
|
||||||
public:
|
public:
|
||||||
typedef void (*Outputter)(const char*);
|
typedef void (*Outputter)(const char*);
|
||||||
|
|
||||||
static void print(const char*, ...);
|
static void print(const char*, ...);
|
||||||
static void printt(const char* file, int line, const char*, ...);
|
static void printt(const char* file, int line, const char*, ...);
|
||||||
static void setOutputter(Outputter);
|
static void setOutputter(Outputter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void output(int priority, char* msg);
|
static void output(int priority, char* msg);
|
||||||
static char* vsprint(int pad, char*, int len, const char*, va_list);
|
static char* vsprint(int pad, char*, int len, const char*, va_list);
|
||||||
static int nprint(const char*, va_list);
|
static int nprint(const char*, va_list);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Outputter s_outputter;
|
static Outputter s_outputter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ static PTimeGetTime s_tgt = NULL;
|
||||||
//
|
//
|
||||||
|
|
||||||
class CStopwatchInit {
|
class CStopwatchInit {
|
||||||
public:
|
public:
|
||||||
CStopwatchInit();
|
CStopwatchInit();
|
||||||
~CStopwatchInit();
|
~CStopwatchInit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class CStopwatch {
|
class CStopwatch {
|
||||||
public:
|
public:
|
||||||
// the default constructor does an implicit reset() or setTrigger().
|
// the default constructor does an implicit reset() or setTrigger().
|
||||||
// if triggered == false then the clock starts ticking.
|
// if triggered == false then the clock starts ticking.
|
||||||
CStopwatch(bool triggered = false);
|
CStopwatch(bool triggered = false);
|
||||||
|
@ -45,10 +45,10 @@ class CStopwatch {
|
||||||
double getTime() const;
|
double getTime() const;
|
||||||
operator double() const;
|
operator double() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double getClock() const;
|
double getClock() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_mark;
|
double m_mark;
|
||||||
bool m_triggered;
|
bool m_triggered;
|
||||||
bool m_stopped;
|
bool m_stopped;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#define _CS(_x) _x
|
#define _CS(_x) _x
|
||||||
|
|
||||||
class CString : public std::string {
|
class CString : public std::string {
|
||||||
public:
|
public:
|
||||||
typedef char _e;
|
typedef char _e;
|
||||||
typedef _e CharT;
|
typedef _e CharT;
|
||||||
typedef std::allocator<_e> _a;
|
typedef std::allocator<_e> _a;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
class IInterface {
|
class IInterface {
|
||||||
public:
|
public:
|
||||||
virtual ~IInterface() { }
|
virtual ~IInterface() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "IInterface.h"
|
#include "IInterface.h"
|
||||||
|
|
||||||
class IJob : public IInterface {
|
class IJob : public IInterface {
|
||||||
public:
|
public:
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class TMethodJob : public IJob {
|
class TMethodJob : public IJob {
|
||||||
public:
|
public:
|
||||||
TMethodJob(T* object, void (T::*method)(void*), void* arg = NULL);
|
TMethodJob(T* object, void (T::*method)(void*), void* arg = NULL);
|
||||||
|
|
||||||
// IJob overrides
|
// IJob overrides
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T* m_object;
|
T* m_object;
|
||||||
void (T::*m_method)(void*);
|
void (T::*m_method)(void*);
|
||||||
void* m_arg;
|
void* m_arg;
|
||||||
|
|
10
base/XBase.h
10
base/XBase.h
|
@ -5,7 +5,7 @@
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
class XBase : public std::exception {
|
class XBase : public std::exception {
|
||||||
public:
|
public:
|
||||||
XBase();
|
XBase();
|
||||||
XBase(const CString& msg);
|
XBase(const CString& msg);
|
||||||
virtual ~XBase();
|
virtual ~XBase();
|
||||||
|
@ -13,7 +13,7 @@ class XBase : public std::exception {
|
||||||
// std::exception overrides
|
// std::exception overrides
|
||||||
virtual const char* what() const;
|
virtual const char* what() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// returns a human readable string describing the exception
|
// returns a human readable string describing the exception
|
||||||
virtual CString getWhat() const throw() = 0;
|
virtual CString getWhat() const throw() = 0;
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ class XBase : public std::exception {
|
||||||
virtual CString format(const char* id,
|
virtual CString format(const char* id,
|
||||||
const char* defaultFormat, ...) const throw();
|
const char* defaultFormat, ...) const throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable CString m_what;
|
mutable CString m_what;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MXErrno {
|
class MXErrno {
|
||||||
public:
|
public:
|
||||||
MXErrno();
|
MXErrno();
|
||||||
MXErrno(int);
|
MXErrno(int);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class MXErrno {
|
||||||
int getErrno() const;
|
int getErrno() const;
|
||||||
const char* getErrstr() const;
|
const char* getErrstr() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_errno;
|
int m_errno;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class IOutputStream;
|
||||||
class ISecondaryScreen;
|
class ISecondaryScreen;
|
||||||
|
|
||||||
class CClient {
|
class CClient {
|
||||||
public:
|
public:
|
||||||
CClient(const CString& clientName);
|
CClient(const CString& clientName);
|
||||||
~CClient();
|
~CClient();
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class CClient {
|
||||||
// accessors
|
// accessors
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void runSession(void*);
|
void runSession(void*);
|
||||||
|
|
||||||
// open/close the primary screen
|
// open/close the primary screen
|
||||||
|
@ -49,7 +49,7 @@ class CClient {
|
||||||
void onMouseMove();
|
void onMouseMove();
|
||||||
void onMouseWheel();
|
void onMouseWheel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex m_mutex;
|
CMutex m_mutex;
|
||||||
CString m_name;
|
CString m_name;
|
||||||
IInputStream* m_input;
|
IInputStream* m_input;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "ISecondaryScreen.h"
|
#include "ISecondaryScreen.h"
|
||||||
|
|
||||||
class CMSWindowsSecondaryScreen : public CMSWindowsScreen, public ISecondaryScreen {
|
class CMSWindowsSecondaryScreen : public CMSWindowsScreen, public ISecondaryScreen {
|
||||||
public:
|
public:
|
||||||
CMSWindowsSecondaryScreen();
|
CMSWindowsSecondaryScreen();
|
||||||
virtual ~CMSWindowsSecondaryScreen();
|
virtual ~CMSWindowsSecondaryScreen();
|
||||||
|
|
||||||
|
@ -29,17 +29,17 @@ class CMSWindowsSecondaryScreen : public CMSWindowsScreen, public ISecondaryScre
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(IClipboard*) const;
|
virtual void getClipboard(IClipboard*) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CMSWindowsScreen overrides
|
// CMSWindowsScreen overrides
|
||||||
virtual bool onPreTranslate(MSG*);
|
virtual bool onPreTranslate(MSG*);
|
||||||
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
||||||
virtual void onOpenDisplay();
|
virtual void onOpenDisplay();
|
||||||
virtual void onCloseDisplay();
|
virtual void onCloseDisplay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UINT mapKey(KeyID, KeyModifierMask) const;
|
UINT mapKey(KeyID, KeyModifierMask) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CClient* m_client;
|
CClient* m_client;
|
||||||
HWND m_window;
|
HWND m_window;
|
||||||
HWND m_nextClipboardWindow;
|
HWND m_nextClipboardWindow;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CXWindowsSecondaryScreen : public CXWindowsScreen, public ISecondaryScreen {
|
class CXWindowsSecondaryScreen : public CXWindowsScreen, public ISecondaryScreen {
|
||||||
public:
|
public:
|
||||||
CXWindowsSecondaryScreen();
|
CXWindowsSecondaryScreen();
|
||||||
virtual ~CXWindowsSecondaryScreen();
|
virtual ~CXWindowsSecondaryScreen();
|
||||||
|
|
||||||
|
@ -30,13 +30,13 @@ class CXWindowsSecondaryScreen : public CXWindowsScreen, public ISecondaryScreen
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CXWindowsScreen overrides
|
// CXWindowsScreen overrides
|
||||||
virtual void onOpenDisplay();
|
virtual void onOpenDisplay();
|
||||||
virtual void onCloseDisplay();
|
virtual void onCloseDisplay();
|
||||||
virtual long getEventMask(Window) const;
|
virtual long getEventMask(Window) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct KeyCodeMask {
|
struct KeyCodeMask {
|
||||||
public:
|
public:
|
||||||
KeyCode keycode;
|
KeyCode keycode;
|
||||||
|
@ -64,7 +64,7 @@ class CXWindowsSecondaryScreen : public CXWindowsScreen, public ISecondaryScreen
|
||||||
void updateModifierMap(Display* display);
|
void updateModifierMap(Display* display);
|
||||||
static bool isToggleKeysym(KeySym);
|
static bool isToggleKeysym(KeySym);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CClient* m_client;
|
CClient* m_client;
|
||||||
Window m_window;
|
Window m_window;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CMutex;
|
||||||
class IJob;
|
class IJob;
|
||||||
|
|
||||||
class CBufferedInputStream : public IInputStream {
|
class CBufferedInputStream : public IInputStream {
|
||||||
public:
|
public:
|
||||||
CBufferedInputStream(CMutex*, IJob* adoptedCloseCB);
|
CBufferedInputStream(CMutex*, IJob* adoptedCloseCB);
|
||||||
~CBufferedInputStream();
|
~CBufferedInputStream();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class CBufferedInputStream : public IInputStream {
|
||||||
virtual UInt32 read(void*, UInt32 count);
|
virtual UInt32 read(void*, UInt32 count);
|
||||||
virtual UInt32 getSize() const;
|
virtual UInt32 getSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex* m_mutex;
|
CMutex* m_mutex;
|
||||||
CCondVar<bool> m_empty;
|
CCondVar<bool> m_empty;
|
||||||
IJob* m_closeCB;
|
IJob* m_closeCB;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CMutex;
|
||||||
class IJob;
|
class IJob;
|
||||||
|
|
||||||
class CBufferedOutputStream : public IOutputStream {
|
class CBufferedOutputStream : public IOutputStream {
|
||||||
public:
|
public:
|
||||||
CBufferedOutputStream(CMutex*, IJob* adoptedCloseCB);
|
CBufferedOutputStream(CMutex*, IJob* adoptedCloseCB);
|
||||||
~CBufferedOutputStream();
|
~CBufferedOutputStream();
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ class CBufferedOutputStream : public IOutputStream {
|
||||||
virtual UInt32 write(const void*, UInt32 count);
|
virtual UInt32 write(const void*, UInt32 count);
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInt32 getSizeWithLock() const;
|
UInt32 getSizeWithLock() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex* m_mutex;
|
CMutex* m_mutex;
|
||||||
IJob* m_closeCB;
|
IJob* m_closeCB;
|
||||||
CStreamBuffer m_buffer;
|
CStreamBuffer m_buffer;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "IInputStream.h"
|
#include "IInputStream.h"
|
||||||
|
|
||||||
class CInputStreamFilter : public IInputStream {
|
class CInputStreamFilter : public IInputStream {
|
||||||
public:
|
public:
|
||||||
CInputStreamFilter(IInputStream*, bool adoptStream = true);
|
CInputStreamFilter(IInputStream*, bool adoptStream = true);
|
||||||
~CInputStreamFilter();
|
~CInputStreamFilter();
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ class CInputStreamFilter : public IInputStream {
|
||||||
virtual UInt32 read(void*, UInt32 maxCount) = 0;
|
virtual UInt32 read(void*, UInt32 maxCount) = 0;
|
||||||
virtual UInt32 getSize() const = 0;
|
virtual UInt32 getSize() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IInputStream* getStream() const;
|
IInputStream* getStream() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IInputStream* m_stream;
|
IInputStream* m_stream;
|
||||||
bool m_adopted;
|
bool m_adopted;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "IOutputStream.h"
|
#include "IOutputStream.h"
|
||||||
|
|
||||||
class COutputStreamFilter : public IOutputStream {
|
class COutputStreamFilter : public IOutputStream {
|
||||||
public:
|
public:
|
||||||
COutputStreamFilter(IOutputStream*, bool adoptStream = true);
|
COutputStreamFilter(IOutputStream*, bool adoptStream = true);
|
||||||
~COutputStreamFilter();
|
~COutputStreamFilter();
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ class COutputStreamFilter : public IOutputStream {
|
||||||
virtual UInt32 write(const void*, UInt32 count) = 0;
|
virtual UInt32 write(const void*, UInt32 count) = 0;
|
||||||
virtual void flush() = 0;
|
virtual void flush() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IOutputStream* getStream() const;
|
IOutputStream* getStream() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IOutputStream* m_stream;
|
IOutputStream* m_stream;
|
||||||
bool m_adopted;
|
bool m_adopted;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CStreamBuffer {
|
class CStreamBuffer {
|
||||||
public:
|
public:
|
||||||
CStreamBuffer();
|
CStreamBuffer();
|
||||||
~CStreamBuffer();
|
~CStreamBuffer();
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class CStreamBuffer {
|
||||||
// return the number of bytes in the buffer
|
// return the number of bytes in the buffer
|
||||||
UInt32 getSize() const;
|
UInt32 getSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const UInt32 kChunkSize;
|
static const UInt32 kChunkSize;
|
||||||
|
|
||||||
typedef std::vector<UInt8> Chunk;
|
typedef std::vector<UInt8> Chunk;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "XIO.h"
|
#include "XIO.h"
|
||||||
|
|
||||||
class IInputStream : public IInterface {
|
class IInputStream : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// close the stream
|
// close the stream
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "XIO.h"
|
#include "XIO.h"
|
||||||
|
|
||||||
class IOutputStream : public IInterface {
|
class IOutputStream : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// close the stream
|
// close the stream
|
||||||
|
|
8
io/XIO.h
8
io/XIO.h
|
@ -7,25 +7,25 @@
|
||||||
class XIO : public XBase { };
|
class XIO : public XBase { };
|
||||||
|
|
||||||
class XIOErrno : public XIO, public MXErrno {
|
class XIOErrno : public XIO, public MXErrno {
|
||||||
public:
|
public:
|
||||||
XIOErrno();
|
XIOErrno();
|
||||||
XIOErrno(int);
|
XIOErrno(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
class XIOClose: public XIOErrno {
|
class XIOClose: public XIOErrno {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
class XIOClosed : public XIO {
|
class XIOClosed : public XIO {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
class XIOEndOfStream : public XIO {
|
class XIOEndOfStream : public XIO {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
class CStopwatch;
|
class CStopwatch;
|
||||||
|
|
||||||
class CCondVarBase {
|
class CCondVarBase {
|
||||||
public:
|
public:
|
||||||
// mutex must be supplied. all condition variables have an
|
// mutex must be supplied. all condition variables have an
|
||||||
// associated mutex. the copy c'tor uses the same mutex as the
|
// associated mutex. the copy c'tor uses the same mutex as the
|
||||||
// argument and is otherwise like the default c'tor.
|
// argument and is otherwise like the default c'tor.
|
||||||
|
@ -45,7 +45,7 @@ class CCondVarBase {
|
||||||
// get the mutex passed to the c'tor
|
// get the mutex passed to the c'tor
|
||||||
CMutex* getMutex() const;
|
CMutex* getMutex() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void fini();
|
void fini();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class CCondVarBase {
|
||||||
CCondVarBase(const CCondVarBase&);
|
CCondVarBase(const CCondVarBase&);
|
||||||
CCondVarBase& operator=(const CCondVarBase&);
|
CCondVarBase& operator=(const CCondVarBase&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex* m_mutex;
|
CMutex* m_mutex;
|
||||||
void* m_cond;
|
void* m_cond;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class CCondVarBase {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class CCondVar : public CCondVarBase {
|
class CCondVar : public CCondVarBase {
|
||||||
public:
|
public:
|
||||||
CCondVar(CMutex* mutex, const T&);
|
CCondVar(CMutex* mutex, const T&);
|
||||||
CCondVar(const CCondVar&);
|
CCondVar(const CCondVar&);
|
||||||
~CCondVar();
|
~CCondVar();
|
||||||
|
@ -85,7 +85,7 @@ class CCondVar : public CCondVarBase {
|
||||||
// calling this method.
|
// calling this method.
|
||||||
operator const T&() const;
|
operator const T&() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T m_data;
|
T m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,17 @@ class CMutex;
|
||||||
class CCondVarBase;
|
class CCondVarBase;
|
||||||
|
|
||||||
class CLock {
|
class CLock {
|
||||||
public:
|
public:
|
||||||
CLock(const CMutex* mutex);
|
CLock(const CMutex* mutex);
|
||||||
CLock(const CCondVarBase* cv);
|
CLock(const CCondVarBase* cv);
|
||||||
~CLock();
|
~CLock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// not implemented
|
// not implemented
|
||||||
CLock(const CLock&);
|
CLock(const CLock&);
|
||||||
CLock& operator=(const CLock&);
|
CLock& operator=(const CLock&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const CMutex* m_mutex;
|
const CMutex* m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
// recursive mutex class
|
// recursive mutex class
|
||||||
class CMutex {
|
class CMutex {
|
||||||
public:
|
public:
|
||||||
// copy c'tor is equivalent to default c'tor. it's here to
|
// copy c'tor is equivalent to default c'tor. it's here to
|
||||||
// allow copying of objects that have mutexes.
|
// allow copying of objects that have mutexes.
|
||||||
CMutex();
|
CMutex();
|
||||||
|
@ -23,11 +23,11 @@ class CMutex {
|
||||||
void lock() const;
|
void lock() const;
|
||||||
void unlock() const;
|
void unlock() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void fini();
|
void fini();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class CCondVarBase;
|
friend class CCondVarBase;
|
||||||
void* m_mutex;
|
void* m_mutex;
|
||||||
};
|
};
|
||||||
|
|
10
mt/CThread.h
10
mt/CThread.h
|
@ -8,7 +8,7 @@ class CThreadRep;
|
||||||
|
|
||||||
// note -- do not derive from this class
|
// note -- do not derive from this class
|
||||||
class CThread {
|
class CThread {
|
||||||
public:
|
public:
|
||||||
// create and start a new thread executing the job.
|
// create and start a new thread executing the job.
|
||||||
// the user data can be retrieved with getUserData().
|
// the user data can be retrieved with getUserData().
|
||||||
CThread(IJob* adopted, void* userData = 0);
|
CThread(IJob* adopted, void* userData = 0);
|
||||||
|
@ -115,20 +115,20 @@ class CThread {
|
||||||
bool operator==(const CThread&) const;
|
bool operator==(const CThread&) const;
|
||||||
bool operator!=(const CThread&) const;
|
bool operator!=(const CThread&) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CThread(CThreadRep*);
|
CThread(CThreadRep*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CThreadRep* m_rep;
|
CThreadRep* m_rep;
|
||||||
};
|
};
|
||||||
|
|
||||||
// disables cancellation in the c'tor and enables it in the d'tor.
|
// disables cancellation in the c'tor and enables it in the d'tor.
|
||||||
class CThreadMaskCancel {
|
class CThreadMaskCancel {
|
||||||
public:
|
public:
|
||||||
CThreadMaskCancel() : m_old(CThread::enableCancel(false)) { }
|
CThreadMaskCancel() : m_old(CThread::enableCancel(false)) { }
|
||||||
~CThreadMaskCancel() { CThread::enableCancel(m_old); }
|
~CThreadMaskCancel() { CThread::enableCancel(m_old); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_old;
|
bool m_old;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CMutex;
|
||||||
class IJob;
|
class IJob;
|
||||||
|
|
||||||
class CThreadRep {
|
class CThreadRep {
|
||||||
public:
|
public:
|
||||||
CThreadRep(IJob*, void* userData);
|
CThreadRep(IJob*, void* userData);
|
||||||
|
|
||||||
// manipulators
|
// manipulators
|
||||||
|
@ -67,10 +67,10 @@ class CThreadRep {
|
||||||
// rep has been ref()'d.
|
// rep has been ref()'d.
|
||||||
static CThreadRep* getCurrentThreadRep();
|
static CThreadRep* getCurrentThreadRep();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~CThreadRep();
|
virtual ~CThreadRep();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// internal constructor
|
// internal constructor
|
||||||
CThreadRep();
|
CThreadRep();
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ class CThreadRep {
|
||||||
CThreadRep(const CThreadRep&);
|
CThreadRep(const CThreadRep&);
|
||||||
CThreadRep& operator=(const CThreadRep&);
|
CThreadRep& operator=(const CThreadRep&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static CMutex* s_mutex;
|
static CMutex* s_mutex;
|
||||||
static CThreadRep* s_head;
|
static CThreadRep* s_head;
|
||||||
|
|
||||||
|
@ -127,18 +127,18 @@ class CThreadRep {
|
||||||
//
|
//
|
||||||
|
|
||||||
class CThreadPtr {
|
class CThreadPtr {
|
||||||
public:
|
public:
|
||||||
CThreadPtr(CThreadRep* rep) : m_rep(rep) { }
|
CThreadPtr(CThreadRep* rep) : m_rep(rep) { }
|
||||||
~CThreadPtr() { m_rep->unref(); }
|
~CThreadPtr() { m_rep->unref(); }
|
||||||
|
|
||||||
CThreadRep* operator->() const { return m_rep; }
|
CThreadRep* operator->() const { return m_rep; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// not implemented
|
// not implemented
|
||||||
CThreadPtr(const CThreadPtr&);
|
CThreadPtr(const CThreadPtr&);
|
||||||
CThreadPtr& operator=(const CThreadPtr&);
|
CThreadPtr& operator=(const CThreadPtr&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CThreadRep* m_rep;
|
CThreadRep* m_rep;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,18 @@
|
||||||
class CThread;
|
class CThread;
|
||||||
|
|
||||||
class CTimerThread {
|
class CTimerThread {
|
||||||
public:
|
public:
|
||||||
CTimerThread(double timeout);
|
CTimerThread(double timeout);
|
||||||
~CTimerThread();
|
~CTimerThread();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void timer(void*);
|
void timer(void*);
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
CTimerThread(const CTimerThread&);
|
CTimerThread(const CTimerThread&);
|
||||||
CTimerThread& operator=(const CTimerThread&);
|
CTimerThread& operator=(const CTimerThread&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_timeout;
|
double m_timeout;
|
||||||
CThread* m_callingThread;
|
CThread* m_callingThread;
|
||||||
CThread* m_timingThread;
|
CThread* m_timingThread;
|
||||||
|
|
|
@ -10,11 +10,11 @@ class XThread { };
|
||||||
// must not throw this type but must rethrow it if caught (by
|
// must not throw this type but must rethrow it if caught (by
|
||||||
// XThreadExit, XThread, or ...).
|
// XThreadExit, XThread, or ...).
|
||||||
class XThreadExit : public XThread {
|
class XThreadExit : public XThread {
|
||||||
public:
|
public:
|
||||||
XThreadExit(void* result) : m_result(result) { }
|
XThreadExit(void* result) : m_result(result) { }
|
||||||
~XThreadExit() { }
|
~XThreadExit() { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void* m_result;
|
void* m_result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ typedef int ssize_t;
|
||||||
// FIXME -- must handle htonl and ilk when defined as macros
|
// FIXME -- must handle htonl and ilk when defined as macros
|
||||||
|
|
||||||
class CNetwork {
|
class CNetwork {
|
||||||
public:
|
public:
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if defined(CONFIG_PLATFORM_WIN32)
|
||||||
typedef SOCKET Socket;
|
typedef SOCKET Socket;
|
||||||
typedef struct sockaddr Address;
|
typedef struct sockaddr Address;
|
||||||
|
@ -129,7 +129,7 @@ class CNetwork {
|
||||||
static int (PASCAL FAR *gethosterror)(void);
|
static int (PASCAL FAR *gethosterror)(void);
|
||||||
|
|
||||||
#if defined(CONFIG_PLATFORM_WIN32)
|
#if defined(CONFIG_PLATFORM_WIN32)
|
||||||
private:
|
private:
|
||||||
static void init2(HMODULE);
|
static void init2(HMODULE);
|
||||||
static int PASCAL FAR poll2(PollEntry[], int nfds, int timeout);
|
static int PASCAL FAR poll2(PollEntry[], int nfds, int timeout);
|
||||||
static ssize_t PASCAL FAR read2(Socket s, void FAR * buf, size_t len);
|
static ssize_t PASCAL FAR read2(Socket s, void FAR * buf, size_t len);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class CString;
|
class CString;
|
||||||
|
|
||||||
class CNetworkAddress {
|
class CNetworkAddress {
|
||||||
public:
|
public:
|
||||||
CNetworkAddress(UInt16 port);
|
CNetworkAddress(UInt16 port);
|
||||||
CNetworkAddress(const CString& hostname, UInt16 port);
|
CNetworkAddress(const CString& hostname, UInt16 port);
|
||||||
~CNetworkAddress();
|
~CNetworkAddress();
|
||||||
|
@ -20,7 +20,7 @@ class CNetworkAddress {
|
||||||
const CNetwork::Address* getAddress() const;
|
const CNetwork::Address* getAddress() const;
|
||||||
CNetwork::AddressLength getAddressLength() const;
|
CNetwork::AddressLength getAddressLength() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CNetwork::Address m_address;
|
CNetwork::Address m_address;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CMutex;
|
||||||
class IJob;
|
class IJob;
|
||||||
|
|
||||||
class CSocketInputStream : public IInputStream {
|
class CSocketInputStream : public IInputStream {
|
||||||
public:
|
public:
|
||||||
CSocketInputStream(CMutex*, IJob* adoptedCloseCB);
|
CSocketInputStream(CMutex*, IJob* adoptedCloseCB);
|
||||||
~CSocketInputStream();
|
~CSocketInputStream();
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class CSocketInputStream : public IInputStream {
|
||||||
virtual UInt32 read(void*, UInt32 count);
|
virtual UInt32 read(void*, UInt32 count);
|
||||||
virtual UInt32 getSize() const;
|
virtual UInt32 getSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex* m_mutex;
|
CMutex* m_mutex;
|
||||||
CCondVar<bool> m_empty;
|
CCondVar<bool> m_empty;
|
||||||
IJob* m_closeCB;
|
IJob* m_closeCB;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class CMutex;
|
||||||
class IJob;
|
class IJob;
|
||||||
|
|
||||||
class CSocketOutputStream : public IOutputStream {
|
class CSocketOutputStream : public IOutputStream {
|
||||||
public:
|
public:
|
||||||
CSocketOutputStream(CMutex*, IJob* adoptedCloseCB);
|
CSocketOutputStream(CMutex*, IJob* adoptedCloseCB);
|
||||||
~CSocketOutputStream();
|
~CSocketOutputStream();
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ class CSocketOutputStream : public IOutputStream {
|
||||||
virtual UInt32 write(const void*, UInt32 count);
|
virtual UInt32 write(const void*, UInt32 count);
|
||||||
virtual void flush();
|
virtual void flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInt32 getSizeWithLock() const;
|
UInt32 getSizeWithLock() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex* m_mutex;
|
CMutex* m_mutex;
|
||||||
IJob* m_closeCB;
|
IJob* m_closeCB;
|
||||||
CSocketStreamBuffer m_buffer;
|
CSocketStreamBuffer m_buffer;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CSocketStreamBuffer {
|
class CSocketStreamBuffer {
|
||||||
public:
|
public:
|
||||||
CSocketStreamBuffer();
|
CSocketStreamBuffer();
|
||||||
~CSocketStreamBuffer();
|
~CSocketStreamBuffer();
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class CSocketStreamBuffer {
|
||||||
// return the number of bytes in the buffer
|
// return the number of bytes in the buffer
|
||||||
UInt32 getSize() const;
|
UInt32 getSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const UInt32 kChunkSize;
|
static const UInt32 kChunkSize;
|
||||||
|
|
||||||
typedef std::vector<UInt8> Chunk;
|
typedef std::vector<UInt8> Chunk;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "CNetwork.h"
|
#include "CNetwork.h"
|
||||||
|
|
||||||
class CTCPListenSocket : public IListenSocket {
|
class CTCPListenSocket : public IListenSocket {
|
||||||
public:
|
public:
|
||||||
CTCPListenSocket();
|
CTCPListenSocket();
|
||||||
~CTCPListenSocket();
|
~CTCPListenSocket();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class CTCPListenSocket : public IListenSocket {
|
||||||
virtual ISocket* accept();
|
virtual ISocket* accept();
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CNetwork::Socket m_fd;
|
CNetwork::Socket m_fd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CBufferedInputStream;
|
||||||
class CBufferedOutputStream;
|
class CBufferedOutputStream;
|
||||||
|
|
||||||
class CTCPSocket : public ISocket {
|
class CTCPSocket : public ISocket {
|
||||||
public:
|
public:
|
||||||
CTCPSocket();
|
CTCPSocket();
|
||||||
CTCPSocket(CNetwork::Socket);
|
CTCPSocket(CNetwork::Socket);
|
||||||
~CTCPSocket();
|
~CTCPSocket();
|
||||||
|
@ -29,14 +29,14 @@ class CTCPSocket : public ISocket {
|
||||||
virtual IInputStream* getInputStream();
|
virtual IInputStream* getInputStream();
|
||||||
virtual IOutputStream* getOutputStream();
|
virtual IOutputStream* getOutputStream();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void ioThread(void*);
|
void ioThread(void*);
|
||||||
void ioService();
|
void ioService();
|
||||||
void closeInput(void*);
|
void closeInput(void*);
|
||||||
void closeOutput(void*);
|
void closeOutput(void*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { kClosed = 0, kRead = 1, kWrite = 2, kReadWrite = 3 };
|
enum { kClosed = 0, kRead = 1, kWrite = 2, kReadWrite = 3 };
|
||||||
|
|
||||||
CNetwork::Socket m_fd;
|
CNetwork::Socket m_fd;
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CNetworkAddress;
|
||||||
class ISocket;
|
class ISocket;
|
||||||
|
|
||||||
class IListenSocket : public IInterface {
|
class IListenSocket : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// bind the socket to a particular address
|
// bind the socket to a particular address
|
||||||
|
|
|
@ -11,7 +11,7 @@ class IInputStream;
|
||||||
class IOutputStream;
|
class IOutputStream;
|
||||||
|
|
||||||
class ISocket : public IInterface {
|
class ISocket : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// bind the socket to a particular address
|
// bind the socket to a particular address
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
class XNetwork : public XBase { };
|
class XNetwork : public XBase { };
|
||||||
|
|
||||||
class XNetworkUnavailable : public XNetwork {
|
class XNetworkUnavailable : public XNetwork {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
class XNetworkFailed : public XNetwork {
|
class XNetworkFailed : public XNetwork {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
class XNetworkVersion : public XNetwork {
|
class XNetworkVersion : public XNetwork {
|
||||||
public:
|
public:
|
||||||
XNetworkVersion(int major, int minor) throw();
|
XNetworkVersion(int major, int minor) throw();
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
|
@ -28,24 +28,24 @@ class XNetworkVersion : public XNetwork {
|
||||||
int getMajor() const throw();
|
int getMajor() const throw();
|
||||||
int getMinor() const throw();
|
int getMinor() const throw();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_major;
|
int m_major;
|
||||||
int m_minor;
|
int m_minor;
|
||||||
};
|
};
|
||||||
|
|
||||||
class XNetworkFunctionUnavailable : public XNetwork {
|
class XNetworkFunctionUnavailable : public XNetwork {
|
||||||
public:
|
public:
|
||||||
XNetworkFunctionUnavailable(const char* name) throw();
|
XNetworkFunctionUnavailable(const char* name) throw();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CString m_name;
|
CString m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class XSocket : public XBase { };
|
class XSocket : public XBase { };
|
||||||
|
|
||||||
class XSocketAddress : public XSocket {
|
class XSocketAddress : public XSocket {
|
||||||
public:
|
public:
|
||||||
enum Error { kUnknown, kNotFound, kNoAddress, kBadPort };
|
enum Error { kUnknown, kNotFound, kNoAddress, kBadPort };
|
||||||
|
|
||||||
XSocketAddress(Error, const CString& hostname, SInt16 port) throw();
|
XSocketAddress(Error, const CString& hostname, SInt16 port) throw();
|
||||||
|
@ -19,24 +19,24 @@ class XSocketAddress : public XSocket {
|
||||||
virtual CString getHostname() const throw();
|
virtual CString getHostname() const throw();
|
||||||
virtual SInt16 getPort() const throw();
|
virtual SInt16 getPort() const throw();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Error m_error;
|
Error m_error;
|
||||||
CString m_hostname;
|
CString m_hostname;
|
||||||
SInt16 m_port;
|
SInt16 m_port;
|
||||||
};
|
};
|
||||||
|
|
||||||
class XSocketErrno : public XSocket, public MXErrno {
|
class XSocketErrno : public XSocket, public MXErrno {
|
||||||
public:
|
public:
|
||||||
XSocketErrno();
|
XSocketErrno();
|
||||||
XSocketErrno(int);
|
XSocketErrno(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
class XSocketBind : public XSocketErrno {
|
class XSocketBind : public XSocketErrno {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
@ -44,13 +44,13 @@ class XSocketBind : public XSocketErrno {
|
||||||
class XSocketAddressInUse : public XSocketBind { };
|
class XSocketAddressInUse : public XSocketBind { };
|
||||||
|
|
||||||
class XSocketConnect : public XSocketErrno {
|
class XSocketConnect : public XSocketErrno {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
class XSocketCreate : public XSocketErrno {
|
class XSocketCreate : public XSocketErrno {
|
||||||
protected:
|
protected:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "IPrimaryScreen.h"
|
#include "IPrimaryScreen.h"
|
||||||
|
|
||||||
class CMSWindowsPrimaryScreen : public CMSWindowsScreen, public IPrimaryScreen {
|
class CMSWindowsPrimaryScreen : public CMSWindowsScreen, public IPrimaryScreen {
|
||||||
public:
|
public:
|
||||||
typedef bool (CMSWindowsPrimaryScreen::*HookMethod)(int, WPARAM, LPARAM);
|
typedef bool (CMSWindowsPrimaryScreen::*HookMethod)(int, WPARAM, LPARAM);
|
||||||
|
|
||||||
CMSWindowsPrimaryScreen();
|
CMSWindowsPrimaryScreen();
|
||||||
|
@ -27,14 +27,14 @@ class CMSWindowsPrimaryScreen : public CMSWindowsScreen, public IPrimaryScreen {
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(IClipboard*) const;
|
virtual void getClipboard(IClipboard*) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CMSWindowsScreen overrides
|
// CMSWindowsScreen overrides
|
||||||
virtual bool onPreTranslate(MSG*);
|
virtual bool onPreTranslate(MSG*);
|
||||||
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
virtual LRESULT onEvent(HWND, UINT, WPARAM, LPARAM);
|
||||||
virtual void onOpenDisplay();
|
virtual void onOpenDisplay();
|
||||||
virtual void onCloseDisplay();
|
virtual void onCloseDisplay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void doEnter();
|
void doEnter();
|
||||||
|
|
||||||
void nextMark();
|
void nextMark();
|
||||||
|
@ -43,7 +43,7 @@ class CMSWindowsPrimaryScreen : public CMSWindowsScreen, public IPrimaryScreen {
|
||||||
KeyModifierMask* maskOut) const;
|
KeyModifierMask* maskOut) const;
|
||||||
ButtonID mapButton(WPARAM button) const;
|
ButtonID mapButton(WPARAM button) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CServer* m_server;
|
CServer* m_server;
|
||||||
bool m_active;
|
bool m_active;
|
||||||
HWND m_window;
|
HWND m_window;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
class CScreenMap {
|
class CScreenMap {
|
||||||
public:
|
public:
|
||||||
enum EDirection { kLeft, kRight, kTop, kBottom,
|
enum EDirection { kLeft, kRight, kTop, kBottom,
|
||||||
kFirstDirection = kLeft, kLastDirection = kBottom };
|
kFirstDirection = kLeft, kLastDirection = kBottom };
|
||||||
enum EDirectionMask { kLeftMask = 1, kRightMask = 2,
|
enum EDirectionMask { kLeftMask = 1, kRightMask = 2,
|
||||||
|
@ -38,7 +38,7 @@ class CScreenMap {
|
||||||
// get the name of a direction (for debugging)
|
// get the name of a direction (for debugging)
|
||||||
static const char* dirName(EDirection);
|
static const char* dirName(EDirection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CCell {
|
class CCell {
|
||||||
public:
|
public:
|
||||||
CString m_neighbor[kLastDirection - kFirstDirection + 1];
|
CString m_neighbor[kLastDirection - kFirstDirection + 1];
|
||||||
|
|
|
@ -19,7 +19,7 @@ class ISecurityFactory;
|
||||||
class IPrimaryScreen;
|
class IPrimaryScreen;
|
||||||
|
|
||||||
class CServer {
|
class CServer {
|
||||||
public:
|
public:
|
||||||
CServer();
|
CServer();
|
||||||
~CServer();
|
~CServer();
|
||||||
|
|
||||||
|
@ -64,10 +64,10 @@ class CServer {
|
||||||
// get the sides of the primary screen that have neighbors
|
// get the sides of the primary screen that have neighbors
|
||||||
UInt32 getActivePrimarySides() const;
|
UInt32 getActivePrimarySides() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool onCommandKey(KeyID, KeyModifierMask, bool down);
|
bool onCommandKey(KeyID, KeyModifierMask, bool down);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CCleanupNote {
|
class CCleanupNote {
|
||||||
public:
|
public:
|
||||||
CCleanupNote(CServer*);
|
CCleanupNote(CServer*);
|
||||||
|
@ -155,7 +155,7 @@ class CServer {
|
||||||
CScreenInfo* addConnection(const CString& name, IServerProtocol*);
|
CScreenInfo* addConnection(const CString& name, IServerProtocol*);
|
||||||
void removeConnection(const CString& name);
|
void removeConnection(const CString& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::list<CThread*> CThreadList;
|
typedef std::list<CThread*> CThreadList;
|
||||||
typedef std::map<CString, CScreenInfo*> CScreenList;
|
typedef std::map<CString, CScreenInfo*> CScreenList;
|
||||||
class CClipboardInfo {
|
class CClipboardInfo {
|
||||||
|
|
|
@ -9,7 +9,7 @@ class IInputStream;
|
||||||
class IOutputStream;
|
class IOutputStream;
|
||||||
|
|
||||||
class CServerProtocol : public IServerProtocol {
|
class CServerProtocol : public IServerProtocol {
|
||||||
public:
|
public:
|
||||||
CServerProtocol(CServer*, const CString& clientName,
|
CServerProtocol(CServer*, const CString& clientName,
|
||||||
IInputStream*, IOutputStream*);
|
IInputStream*, IOutputStream*);
|
||||||
~CServerProtocol();
|
~CServerProtocol();
|
||||||
|
@ -44,13 +44,13 @@ class CServerProtocol : public IServerProtocol {
|
||||||
virtual void sendMouseMove(SInt32 xAbs, SInt32 yAbs) = 0;
|
virtual void sendMouseMove(SInt32 xAbs, SInt32 yAbs) = 0;
|
||||||
virtual void sendMouseWheel(SInt32 delta) = 0;
|
virtual void sendMouseWheel(SInt32 delta) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//IServerProtocol overrides
|
//IServerProtocol overrides
|
||||||
virtual void recvInfo() = 0;
|
virtual void recvInfo() = 0;
|
||||||
virtual void recvClipboard() = 0;
|
virtual void recvClipboard() = 0;
|
||||||
virtual void recvGrabClipboard() = 0;
|
virtual void recvGrabClipboard() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CServer* m_server;
|
CServer* m_server;
|
||||||
CString m_client;
|
CString m_client;
|
||||||
IInputStream* m_input;
|
IInputStream* m_input;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "CServerProtocol.h"
|
#include "CServerProtocol.h"
|
||||||
|
|
||||||
class CServerProtocol1_0 : public CServerProtocol {
|
class CServerProtocol1_0 : public CServerProtocol {
|
||||||
public:
|
public:
|
||||||
CServerProtocol1_0(CServer*, const CString&, IInputStream*, IOutputStream*);
|
CServerProtocol1_0(CServer*, const CString&, IInputStream*, IOutputStream*);
|
||||||
~CServerProtocol1_0();
|
~CServerProtocol1_0();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class CServerProtocol1_0 : public CServerProtocol {
|
||||||
virtual void sendMouseMove(SInt32 xAbs, SInt32 yAbs);
|
virtual void sendMouseMove(SInt32 xAbs, SInt32 yAbs);
|
||||||
virtual void sendMouseWheel(SInt32 delta);
|
virtual void sendMouseWheel(SInt32 delta);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// IServerProtocol overrides
|
// IServerProtocol overrides
|
||||||
virtual void recvInfo();
|
virtual void recvInfo();
|
||||||
virtual void recvClipboard();
|
virtual void recvClipboard();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "IPrimaryScreen.h"
|
#include "IPrimaryScreen.h"
|
||||||
|
|
||||||
class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
|
class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
|
||||||
public:
|
public:
|
||||||
CXWindowsPrimaryScreen();
|
CXWindowsPrimaryScreen();
|
||||||
virtual ~CXWindowsPrimaryScreen();
|
virtual ~CXWindowsPrimaryScreen();
|
||||||
|
|
||||||
|
@ -25,13 +25,13 @@ class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
|
||||||
virtual SInt32 getJumpZoneSize() const;
|
virtual SInt32 getJumpZoneSize() const;
|
||||||
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
virtual void getClipboard(ClipboardID, IClipboard*) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CXWindowsScreen overrides
|
// CXWindowsScreen overrides
|
||||||
virtual void onOpenDisplay();
|
virtual void onOpenDisplay();
|
||||||
virtual void onCloseDisplay();
|
virtual void onCloseDisplay();
|
||||||
virtual long getEventMask(Window) const;
|
virtual long getEventMask(Window) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void selectEvents(Display*, Window) const;
|
void selectEvents(Display*, Window) const;
|
||||||
void warpCursorNoLock(Display*,
|
void warpCursorNoLock(Display*,
|
||||||
SInt32 xAbsolute, SInt32 yAbsolute);
|
SInt32 xAbsolute, SInt32 yAbsolute);
|
||||||
|
@ -40,7 +40,7 @@ class CXWindowsPrimaryScreen : public CXWindowsScreen, public IPrimaryScreen {
|
||||||
KeyID mapKey(XKeyEvent*) const;
|
KeyID mapKey(XKeyEvent*) const;
|
||||||
ButtonID mapButton(unsigned int button) const;
|
ButtonID mapButton(unsigned int button) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CServer* m_server;
|
CServer* m_server;
|
||||||
bool m_active;
|
bool m_active;
|
||||||
Window m_window;
|
Window m_window;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "CString.h"
|
#include "CString.h"
|
||||||
|
|
||||||
class CClipboard : public IClipboard {
|
class CClipboard : public IClipboard {
|
||||||
public:
|
public:
|
||||||
CClipboard();
|
CClipboard();
|
||||||
virtual ~CClipboard();
|
virtual ~CClipboard();
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ class CClipboard : public IClipboard {
|
||||||
static void copy(IClipboard* dst, const IClipboard* src);
|
static void copy(IClipboard* dst, const IClipboard* src);
|
||||||
static void copy(IClipboard* dst, const IClipboard* src, Time);
|
static void copy(IClipboard* dst, const IClipboard* src, Time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInt32 readUInt32(const char*) const;
|
UInt32 readUInt32(const char*) const;
|
||||||
void writeUInt32(CString*, UInt32) const;
|
void writeUInt32(CString*, UInt32) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Time m_time;
|
Time m_time;
|
||||||
bool m_added[kNumFormats];
|
bool m_added[kNumFormats];
|
||||||
CString m_data[kNumFormats];
|
CString m_data[kNumFormats];
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "CMutex.h"
|
#include "CMutex.h"
|
||||||
|
|
||||||
class CInputPacketStream : public CInputStreamFilter {
|
class CInputPacketStream : public CInputStreamFilter {
|
||||||
public:
|
public:
|
||||||
CInputPacketStream(IInputStream*, bool adoptStream = true);
|
CInputPacketStream(IInputStream*, bool adoptStream = true);
|
||||||
~CInputPacketStream();
|
~CInputPacketStream();
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ class CInputPacketStream : public CInputStreamFilter {
|
||||||
virtual UInt32 read(void*, UInt32 maxCount);
|
virtual UInt32 read(void*, UInt32 maxCount);
|
||||||
virtual UInt32 getSize() const;
|
virtual UInt32 getSize() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInt32 getSizeNoLock() const;
|
UInt32 getSizeNoLock() const;
|
||||||
bool hasFullMessage() const;
|
bool hasFullMessage() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMutex m_mutex;
|
CMutex m_mutex;
|
||||||
mutable UInt32 m_size;
|
mutable UInt32 m_size;
|
||||||
mutable CBufferedInputStream m_buffer;
|
mutable CBufferedInputStream m_buffer;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
class CMSWindowsClipboard : public IClipboard {
|
class CMSWindowsClipboard : public IClipboard {
|
||||||
public:
|
public:
|
||||||
CMSWindowsClipboard(HWND window);
|
CMSWindowsClipboard(HWND window);
|
||||||
virtual ~CMSWindowsClipboard();
|
virtual ~CMSWindowsClipboard();
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@ class CMSWindowsClipboard : public IClipboard {
|
||||||
virtual bool has(EFormat) const;
|
virtual bool has(EFormat) const;
|
||||||
virtual CString get(EFormat) const;
|
virtual CString get(EFormat) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UINT convertFormatToWin32(EFormat) const;
|
UINT convertFormatToWin32(EFormat) const;
|
||||||
HANDLE convertTextToWin32(const CString& data) const;
|
HANDLE convertTextToWin32(const CString& data) const;
|
||||||
CString convertTextFromWin32(HANDLE) const;
|
CString convertTextFromWin32(HANDLE) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HWND m_window;
|
HWND m_window;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class CString;
|
||||||
class CThread;
|
class CThread;
|
||||||
|
|
||||||
class CMSWindowsScreen {
|
class CMSWindowsScreen {
|
||||||
public:
|
public:
|
||||||
CMSWindowsScreen();
|
CMSWindowsScreen();
|
||||||
virtual ~CMSWindowsScreen();
|
virtual ~CMSWindowsScreen();
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class CMSWindowsScreen {
|
||||||
|
|
||||||
static void init(HINSTANCE);
|
static void init(HINSTANCE);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// runs an event loop and returns when WM_QUIT is received
|
// runs an event loop and returns when WM_QUIT is received
|
||||||
void doRun();
|
void doRun();
|
||||||
|
|
||||||
|
@ -62,10 +62,10 @@ class CMSWindowsScreen {
|
||||||
// called by closeDisplay() to
|
// called by closeDisplay() to
|
||||||
virtual void onCloseDisplay() = 0;
|
virtual void onCloseDisplay() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
|
static LRESULT CALLBACK wndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static HINSTANCE s_instance;
|
static HINSTANCE s_instance;
|
||||||
ATOM m_class;
|
ATOM m_class;
|
||||||
HICON m_icon;
|
HICON m_icon;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "COutputStreamFilter.h"
|
#include "COutputStreamFilter.h"
|
||||||
|
|
||||||
class COutputPacketStream : public COutputStreamFilter {
|
class COutputPacketStream : public COutputStreamFilter {
|
||||||
public:
|
public:
|
||||||
COutputPacketStream(IOutputStream*, bool adoptStream = true);
|
COutputPacketStream(IOutputStream*, bool adoptStream = true);
|
||||||
~COutputPacketStream();
|
~COutputPacketStream();
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class IInputStream;
|
||||||
class IOutputStream;
|
class IOutputStream;
|
||||||
|
|
||||||
class CProtocolUtil {
|
class CProtocolUtil {
|
||||||
public:
|
public:
|
||||||
// write formatted binary data to a stream. fmt consists of
|
// write formatted binary data to a stream. fmt consists of
|
||||||
// regular characters and format specifiers. format specifiers
|
// regular characters and format specifiers. format specifiers
|
||||||
// begin with %. all characters not part of a format specifier
|
// begin with %. all characters not part of a format specifier
|
||||||
|
@ -37,7 +37,7 @@ class CProtocolUtil {
|
||||||
static void readf(IInputStream*,
|
static void readf(IInputStream*,
|
||||||
const char* fmt, ...);
|
const char* fmt, ...);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static UInt32 getLength(const char* fmt, va_list);
|
static UInt32 getLength(const char* fmt, va_list);
|
||||||
static void writef(void*, const char* fmt, va_list);
|
static void writef(void*, const char* fmt, va_list);
|
||||||
static UInt32 eatLength(const char** fmt);
|
static UInt32 eatLength(const char** fmt);
|
||||||
|
@ -45,7 +45,7 @@ class CProtocolUtil {
|
||||||
};
|
};
|
||||||
|
|
||||||
class XIOReadMismatch : public XIO {
|
class XIOReadMismatch : public XIO {
|
||||||
public:
|
public:
|
||||||
// XBase overrides
|
// XBase overrides
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "ISocketFactory.h"
|
#include "ISocketFactory.h"
|
||||||
|
|
||||||
class CTCPSocketFactory : public ISocketFactory {
|
class CTCPSocketFactory : public ISocketFactory {
|
||||||
public:
|
public:
|
||||||
CTCPSocketFactory();
|
CTCPSocketFactory();
|
||||||
virtual ~CTCPSocketFactory();
|
virtual ~CTCPSocketFactory();
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "IClipboard.h"
|
#include "IClipboard.h"
|
||||||
|
|
||||||
class CXWindowsClipboard : public IClipboard {
|
class CXWindowsClipboard : public IClipboard {
|
||||||
public:
|
public:
|
||||||
CXWindowsClipboard();
|
CXWindowsClipboard();
|
||||||
virtual ~CXWindowsClipboard();
|
virtual ~CXWindowsClipboard();
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
class CString;
|
class CString;
|
||||||
|
|
||||||
class CXWindowsScreen {
|
class CXWindowsScreen {
|
||||||
public:
|
public:
|
||||||
CXWindowsScreen();
|
CXWindowsScreen();
|
||||||
virtual ~CXWindowsScreen();
|
virtual ~CXWindowsScreen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class CDisplayLock {
|
class CDisplayLock {
|
||||||
public:
|
public:
|
||||||
CDisplayLock(const CXWindowsScreen*);
|
CDisplayLock(const CXWindowsScreen*);
|
||||||
|
@ -104,7 +104,7 @@ class CXWindowsScreen {
|
||||||
// get the X event mask required by the subclass for the given window
|
// get the X event mask required by the subclass for the given window
|
||||||
virtual long getEventMask(Window) const = 0;
|
virtual long getEventMask(Window) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CPropertyNotifyInfo {
|
struct CPropertyNotifyInfo {
|
||||||
public:
|
public:
|
||||||
Window m_window;
|
Window m_window;
|
||||||
|
@ -147,7 +147,7 @@ class CXWindowsScreen {
|
||||||
bool wasOwnedAtTime(ClipboardID, Window, Time) const;
|
bool wasOwnedAtTime(ClipboardID, Window, Time) const;
|
||||||
Time getCurrentTimeNoLock(Window) const;
|
Time getCurrentTimeNoLock(Window) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CClipboardInfo {
|
class CClipboardInfo {
|
||||||
public:
|
public:
|
||||||
CClipboardInfo();
|
CClipboardInfo();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
class CString;
|
class CString;
|
||||||
|
|
||||||
class IClipboard : public IInterface {
|
class IClipboard : public IInterface {
|
||||||
public:
|
public:
|
||||||
// timestamp type. timestamps are in milliseconds from some
|
// timestamp type. timestamps are in milliseconds from some
|
||||||
// arbitrary starting time. timestamps will wrap around to 0
|
// arbitrary starting time. timestamps will wrap around to 0
|
||||||
// after about 49 3/4 days.
|
// after about 49 3/4 days.
|
||||||
|
|
|
@ -9,7 +9,7 @@ class CServer;
|
||||||
class IClipboard;
|
class IClipboard;
|
||||||
|
|
||||||
class IPrimaryScreen : public IInterface {
|
class IPrimaryScreen : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// enter the screen's message loop. this returns when it detects
|
// enter the screen's message loop. this returns when it detects
|
||||||
|
|
|
@ -11,7 +11,7 @@ class CClient;
|
||||||
class IClipboard;
|
class IClipboard;
|
||||||
|
|
||||||
class ISecondaryScreen : public IInterface {
|
class ISecondaryScreen : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// enter the screen's message loop. this returns when it detects
|
// enter the screen's message loop. this returns when it detects
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
class IClipboard;
|
class IClipboard;
|
||||||
|
|
||||||
class IServerProtocol : public IInterface {
|
class IServerProtocol : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// process messages from the client and insert the appropriate
|
// process messages from the client and insert the appropriate
|
||||||
|
@ -39,7 +39,7 @@ class IServerProtocol : public IInterface {
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
virtual void recvInfo() = 0;
|
virtual void recvInfo() = 0;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ISocket;
|
||||||
class IListenSocket;
|
class IListenSocket;
|
||||||
|
|
||||||
class ISocketFactory : public IInterface {
|
class ISocketFactory : public IInterface {
|
||||||
public:
|
public:
|
||||||
// manipulators
|
// manipulators
|
||||||
|
|
||||||
// accessors
|
// accessors
|
||||||
|
|
|
@ -7,13 +7,13 @@ class XSynergy : public XBase { };
|
||||||
|
|
||||||
// client is misbehaving
|
// client is misbehaving
|
||||||
class XBadClient : public XSynergy {
|
class XBadClient : public XSynergy {
|
||||||
protected:
|
protected:
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
};
|
};
|
||||||
|
|
||||||
// client has incompatible version
|
// client has incompatible version
|
||||||
class XIncompatibleClient : public XSynergy {
|
class XIncompatibleClient : public XSynergy {
|
||||||
public:
|
public:
|
||||||
XIncompatibleClient(int major, int minor);
|
XIncompatibleClient(int major, int minor);
|
||||||
|
|
||||||
// manipulators
|
// manipulators
|
||||||
|
@ -23,10 +23,10 @@ class XIncompatibleClient : public XSynergy {
|
||||||
int getMajor() const throw();
|
int getMajor() const throw();
|
||||||
int getMinor() const throw();
|
int getMinor() const throw();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CString getWhat() const throw();
|
virtual CString getWhat() const throw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_major;
|
int m_major;
|
||||||
int m_minor;
|
int m_minor;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue