Index: src/shared/Communication.h |
=================================================================== |
--- a/src/shared/Communication.h |
+++ b/src/shared/Communication.h |
@@ -9,24 +9,36 @@ |
#include <vector> |
#include <Windows.h> |
namespace Communication |
{ |
extern const std::wstring pipeName; |
const int bufferSize = 1024; |
- enum {TYPE_STRING, TYPE_WSTRING, TYPE_INT64, TYPE_INT32, TYPE_BOOL}; |
- typedef int32_t ValueType; |
+ enum ProcType : uint32_t { |
Felix Dahlke
2013/06/04 06:47:32
I can't find anything about this, but I think you
Wladimir Palant
2013/06/04 09:26:13
It is a standard feature, see http://en.wikipedia.
Felix Dahlke
2013/06/04 11:55:21
Didn't know it's a new standard feature, in this c
|
+ PROC_MATCHES, |
+ PROC_GET_ELEMHIDE_SELECTORS, |
+ PROC_AVAILABLE_SUBSCRIPTIONS, |
+ PROC_LISTED_SUBSCRIPTIONS, |
+ PROC_SET_SUBSCRIPTION, |
+ PROC_UPDATE_ALL_SUBSCRIPTIONS, |
+ PROC_GET_EXCEPTION_DOMAINS, |
+ PROC_ADD_FILTER, |
+ }; |
+ enum ValueType : uint32_t { |
+ TYPE_PROC, TYPE_STRING, TYPE_WSTRING, TYPE_INT64, TYPE_INT32, TYPE_BOOL |
+ }; |
typedef uint32_t SizeType; |
class InputBuffer |
{ |
public: |
InputBuffer(const std::string& data) : buffer(data), hasType(false) {} |
+ InputBuffer& operator>>(ProcType& value) { return Read(value, TYPE_PROC); } |
InputBuffer& operator>>(std::string& value) { return ReadString(value, TYPE_STRING); } |
InputBuffer& operator>>(std::wstring& value) { return ReadString(value, TYPE_WSTRING); } |
InputBuffer& operator>>(int64_t& value) { return Read(value, TYPE_INT64); } |
InputBuffer& operator>>(int32_t& value) { return Read(value, TYPE_INT32); } |
InputBuffer& operator>>(bool& value) { return Read(value, TYPE_BOOL); } |
private: |
std::istringstream buffer; |
ValueType currentType; |
@@ -88,16 +100,17 @@ namespace Communication |
// Explicit copy constructor to allow returning OutputBuffer by value |
OutputBuffer(const OutputBuffer& copy) : buffer(copy.buffer.str()) {} |
std::string Get() |
{ |
return buffer.str(); |
} |
+ OutputBuffer& operator<<(ProcType value) { return Write(value, TYPE_PROC); } |
OutputBuffer& operator<<(const std::string& value) { return WriteString(value, TYPE_STRING); } |
OutputBuffer& operator<<(const std::wstring& value) { return WriteString(value, TYPE_WSTRING); } |
OutputBuffer& operator<<(int64_t value) { return Write(value, TYPE_INT64); } |
OutputBuffer& operator<<(int32_t value) { return Write(value, TYPE_INT32); } |
OutputBuffer& operator<<(bool value) { return Write(value, TYPE_BOOL); } |
private: |
std::ostringstream buffer; |