mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-26 12:41:35 +03:00
d2135af0d9
CServer to the primary screen when the configuration changes so it can make necessary adjustments (the win32 primary screen must tell the hook dll about the new jump zones). changed includes of some std c++ library files to go through our own include files. these wrap the include with stuff to keep vc++ quiet when compiling at warning level 4, which is what it does now. it also works around missing <istream> and <ostream> on g++2.96. added missing std:: where necessary. g++ doesn't really support namespaces so it lets references without the namespace slip through. added workaround or fix. not sure if istringstream::str(string) should reset eofbit. it does on g++ but does not on vc++. added clear() after str() so it works either way. added low-level keyboard hook to win32. if available (it's only available on NT SP3 and up) it allows us to catch and handle alt+tab, alt+esc, ctrl+esc, and windows key hot keys. i think that leaves only ctrl+alt+del and accessibility functions uncaught on those systems.
102 lines
2.4 KiB
C++
102 lines
2.4 KiB
C++
#ifndef CHTTPSERVER_H
|
|
#define CHTTPSERVER_H
|
|
|
|
#include "BasicTypes.h"
|
|
#include "CString.h"
|
|
#include "stdvector.h"
|
|
|
|
class CServer;
|
|
class CConfig;
|
|
class CHTTPRequest;
|
|
class CHTTPReply;
|
|
class ISocket;
|
|
|
|
class CHTTPServer {
|
|
public:
|
|
CHTTPServer(CServer*);
|
|
virtual ~CHTTPServer();
|
|
|
|
// manipulators
|
|
|
|
// synchronously process an HTTP request on the given socket
|
|
void processRequest(ISocket*);
|
|
|
|
// accessors
|
|
|
|
protected:
|
|
virtual void doProcessRequest(CHTTPRequest&, CHTTPReply&);
|
|
|
|
virtual void doProcessGetEditMap(CHTTPRequest&, CHTTPReply&);
|
|
virtual void doProcessPostEditMap(CHTTPRequest&, CHTTPReply&);
|
|
|
|
static bool parseXY(const CString&, SInt32& x, SInt32& y);
|
|
|
|
class CScreenArray {
|
|
public:
|
|
CScreenArray();
|
|
~CScreenArray();
|
|
|
|
// resize the array. this also clears all the elements.
|
|
void resize(SInt32 w, SInt32 h);
|
|
|
|
// insert/remove a row/column. all elements in a new row/column
|
|
// are unset.
|
|
void insertRow(SInt32 insertedBeforeRow);
|
|
void insertColumn(SInt32 insertedBeforeColumn);
|
|
void eraseRow(SInt32 row);
|
|
void eraseColumn(SInt32 column);
|
|
|
|
// rotate rows or columns
|
|
void rotateRows(SInt32 rowsDown);
|
|
void rotateColumns(SInt32 columnsDown);
|
|
|
|
// remove/set a screen name. setting an empty name is the
|
|
// same as removing a name. names are not checked for
|
|
// validity.
|
|
void remove(SInt32 x, SInt32 y);
|
|
void set(SInt32 x, SInt32 y, const CString&);
|
|
|
|
// convert a CConfig to a CScreenArray. returns true iff
|
|
// all connections are symmetric and therefore exactly
|
|
// representable by a CScreenArray.
|
|
bool convertFrom(const CConfig&);
|
|
|
|
// accessors
|
|
|
|
// get the array size
|
|
SInt32 getWidth() const { return m_w; }
|
|
SInt32 getHeight() const { return m_h; }
|
|
|
|
// returns true iff the cell has a 4-connected neighbor
|
|
bool isAllowed(SInt32 x, SInt32 y) const;
|
|
|
|
// returns true iff the cell has a (non-empty) name
|
|
bool isSet(SInt32 x, SInt32 y) const;
|
|
|
|
// get a screen name
|
|
CString get(SInt32 x, SInt32 y) const;
|
|
|
|
// find a screen by name. returns true iff found.
|
|
bool find(const CString&, SInt32& x, SInt32& y) const;
|
|
|
|
// return true iff the overall array is valid. that means
|
|
// just zero or one screen or all screens are 4-connected
|
|
// to other screens.
|
|
bool isValid() const;
|
|
|
|
// convert this to a CConfig
|
|
void convertTo(CConfig&) const;
|
|
|
|
private:
|
|
typedef std::vector<CString> CNames;
|
|
|
|
SInt32 m_w, m_h;
|
|
CNames m_screens;
|
|
};
|
|
|
|
private:
|
|
CServer* m_server;
|
|
};
|
|
|
|
#endif
|