summaryrefslogtreecommitdiffstats
path: root/common/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/commands.cpp')
-rw-r--r--common/commands.cpp18
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
28namespace Commands 28namespace Commands
29{ 29{
30 30
31void write(QIODevice *device, int commandId)
32{
33 write(device, commandId, 0, 0);
34}
35
36void 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
31void write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb) 49void write(QIODevice *device, int commandId, flatbuffers::FlatBufferBuilder &fbb)
32{ 50{
33 const int dataSize = fbb.GetSize(); 51 const int dataSize = fbb.GetSize();