| Index: src/shared/Communication.h |
| =================================================================== |
| --- a/src/shared/Communication.h |
| +++ b/src/shared/Communication.h |
| @@ -36,12 +36,15 @@ |
| { |
| public: |
| InputBuffer(const std::string& data) : buffer(data), hasType(false) {} |
| + InputBuffer(const InputBuffer& copy) { hasType = copy.hasType; buffer = std::istringstream(copy.buffer.str()); currentType = copy.currentType; } |
| 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); } |
| + ValueType GetType(); |
| + bool IsEmpty() { return buffer.eof(); } |
|
Wladimir Palant
2013/07/22 06:43:11
This is just wrong :-(
eof() doesn't mean that the
Oleksandr
2013/07/22 09:53:31
I guess the name was just wrong. Should've been Is
|
| private: |
| std::istringstream buffer; |
| ValueType currentType; |
| @@ -80,6 +83,7 @@ |
| buffer.read(reinterpret_cast<char*>(&value), sizeof(T)); |
| if (buffer.fail()) |
| throw new std::runtime_error("Unexpected end of input buffer"); |
| + hasType = false; |
| } |
| }; |