Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/shared/Communication.h

Issue 10845030: Marshal all libadblockplus calls to the engine process (Closed)
Patch Set: Created May 31, 2013, 2:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« src/engine/main.cpp ('K') | « src/plugin/PluginUserSettings.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef COMMUNICATION_H 1 #ifndef COMMUNICATION_H
2 #define COMMUNICATION_H 2 #define COMMUNICATION_H
3 3
4 #include <memory> 4 #include <memory>
5 #include <sstream> 5 #include <sstream>
6 #include <stdexcept> 6 #include <stdexcept>
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include <Windows.h> 10 #include <Windows.h>
11 11
12 namespace Communication 12 namespace Communication
13 { 13 {
14 extern const std::wstring pipeName; 14 extern const std::wstring pipeName;
15 const int bufferSize = 1024; 15 const int bufferSize = 1024;
16 16
17 enum ValueType {TYPE_STRING, TYPE_WSTRING, TYPE_INT64, TYPE_INT32, TYPE_BOOL}; 17 enum ValueType {TYPE_STRING, TYPE_WSTRING, TYPE_INT64, TYPE_INT32, TYPE_BOOL};
18 18
19 class InputBuffer 19 class InputBuffer
20 { 20 {
21 public: 21 public:
22 InputBuffer(const std::string& data) : buffer(data) {} 22 InputBuffer(const std::string& data) : buffer(data), hasType(false) {}
23 InputBuffer& operator>>(std::string& value) { return ReadString(value, TYPE_ STRING); } 23 InputBuffer& operator>>(std::string& value) { return ReadString(value, TYPE_ STRING); }
24 InputBuffer& operator>>(std::wstring& value) { return ReadString(value, TYPE _WSTRING); } 24 InputBuffer& operator>>(std::wstring& value) { return ReadString(value, TYPE _WSTRING); }
25 InputBuffer& operator>>(int64_t& value) { return Read(value, TYPE_INT64); } 25 InputBuffer& operator>>(int64_t& value) { return Read(value, TYPE_INT64); }
26 InputBuffer& operator>>(int32_t& value) { return Read(value, TYPE_INT32); } 26 InputBuffer& operator>>(int32_t& value) { return Read(value, TYPE_INT32); }
27 InputBuffer& operator>>(bool& value) { return Read(value, TYPE_BOOL); } 27 InputBuffer& operator>>(bool& value) { return Read(value, TYPE_BOOL); }
28 private: 28 private:
29 std::istringstream buffer; 29 std::istringstream buffer;
30 int32_t currentType; 30 int32_t currentType;
31 bool hasType; 31 bool hasType;
32 32
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 InputBuffer ReadMessage(); 148 InputBuffer ReadMessage();
149 void WriteMessage(OutputBuffer& message); 149 void WriteMessage(OutputBuffer& message);
150 150
151 protected: 151 protected:
152 HANDLE pipe; 152 HANDLE pipe;
153 }; 153 };
154 } 154 }
155 155
156 #endif 156 #endif
OLDNEW
« src/engine/main.cpp ('K') | « src/plugin/PluginUserSettings.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld