diff options
Diffstat (limited to 'common/commands.cpp')
-rw-r--r-- | common/commands.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/commands.cpp b/common/commands.cpp index abed8b9..ecbbfdb 100644 --- a/common/commands.cpp +++ b/common/commands.cpp | |||
@@ -28,6 +28,24 @@ namespace Akonadi2 | |||
28 | namespace Commands | 28 | namespace Commands |
29 | { | 29 | { |
30 | 30 | ||
31 | void write(QIODevice *device, int commandId) | ||
32 | { | ||
33 | write(device, commandId, 0, 0); | ||
34 | } | ||
35 | |||
36 | void write(QIODevice *device, int commandId, const char *buffer, uint size) | ||
37 | { | ||
38 | if (size > 0 && !buffer) { | ||
39 | size = 0; | ||
40 | } | ||
41 | |||
42 | device->write((const char*)&commandId, sizeof(int)); | ||
43 | device->write((const char*)&size, sizeof(uint)); | ||
44 | if (buffer) { | ||
45 | device->write(buffer, size); | ||
46 | } | ||
47 | } | ||
48 | |||
31 | void write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb) | 49 | void write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb) |
32 | { | 50 | { |
33 | const int dataSize = fbb.GetSize(); | 51 | const int dataSize = fbb.GetSize(); |