diff options
author | Fishbone <fishbone@miranda-ng.org> | 2013-06-02 16:19:21 +0000 |
---|---|---|
committer | Fishbone <fishbone@miranda-ng.org> | 2013-06-02 16:19:21 +0000 |
commit | ab7e0b08fa8c31cf1d468ab4b3c660e2b1836811 (patch) | |
tree | 52977603ea0f431adff16573d3d5b46a95843c7f /protocols/WhatsApp/src/WhatsAPI++/ByteArray.h | |
parent | 8320783f99419db1e40346fdb292c19ee008948b (diff) |
Added WhatsApp-protocol
git-svn-id: http://svn.miranda-ng.org/main/trunk@4861 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/ByteArray.h')
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/ByteArray.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/ByteArray.h b/protocols/WhatsApp/src/WhatsAPI++/ByteArray.h new file mode 100644 index 0000000000..57ac503020 --- /dev/null +++ b/protocols/WhatsApp/src/WhatsAPI++/ByteArray.h @@ -0,0 +1,55 @@ +/*
+ * ByteArray.h
+ *
+ * Created on: 26/06/2012
+ * Author: Antonio
+ */
+
+
+
+#ifndef BYTEARRAY_H_
+#define BYTEARRAY_H_
+
+#include <vector>
+#include <string>
+
+class ByteArrayOutputStream {
+protected:
+ std::vector<unsigned char>* buf;
+ size_t position;
+
+public:
+ ByteArrayOutputStream(int size = 32);
+ std::vector<unsigned char>* toByteArray();
+ std::vector<unsigned char>* getBuffer();
+ size_t getPosition();
+ void setPosition(size_t count);
+ void write(int i);
+ void write(unsigned char* c, size_t length);
+ void write(const std::string& s);
+ void print();
+ void setLength(size_t length);
+ size_t getLength();
+ size_t getCapacity();
+
+ virtual ~ByteArrayOutputStream();
+};
+
+class ByteArrayInputStream {
+protected:
+ std::vector<unsigned char>* buf;
+ size_t pos;
+ size_t mark;
+ size_t count;
+
+public:
+ ByteArrayInputStream(std::vector<unsigned char>* buf, size_t off, size_t length );
+ ByteArrayInputStream(std::vector<unsigned char>* buf);
+ int read();
+ int read(std::vector<unsigned char>& b, size_t off, size_t length);
+ void print();
+
+ virtual ~ByteArrayInputStream();
+};
+
+#endif /* BYTEARRAY_H_ */
|