From 47ada94baa424e56d2ded256fddc91e6aa4d3090 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Tue, 3 Dec 2013 03:05:47 +0100 Subject: initial import --- helpers.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 helpers.h (limited to 'helpers.h') diff --git a/helpers.h b/helpers.h new file mode 100644 index 0000000..962026c --- /dev/null +++ b/helpers.h @@ -0,0 +1,35 @@ +#ifndef HELPERS_H +#define HELPERS_H + +#include +#include +#include "gatouuid.h" + +template +inline T read_le(const uchar *src) +{ + return qFromLittleEndian(src); +} + +template +inline T read_le(const char *src) +{ + return qFromLittleEndian(reinterpret_cast(src)); +} + +template +void write_le(T src, uchar *dst) +{ + qToLittleEndian(src, dst); +} + +template +void write_le(T src, char *dst) +{ + qToLittleEndian(src, reinterpret_cast(dst)); +} + +GatoUUID bytearray_to_gatouuid(const QByteArray &ba); +QByteArray gatouuid_to_bytearray(const GatoUUID &uuid, bool use_uuid16, bool use_uuid32); + +#endif // HELPERS_H -- cgit v1.2.3