sources/network/bytestream.h

changeset 11
cffa2777d917
parent 9
e7a09ceb4505
child 13
09dcaeaa216b
--- a/sources/network/bytestream.h	Fri Dec 12 00:55:51 2014 +0200
+++ b/sources/network/bytestream.h	Fri Dec 12 01:37:04 2014 +0200
@@ -44,6 +44,7 @@
 	Bytestream (unsigned long length = 0x800);
 	Bytestream (const unsigned char* data, unsigned long length);
 	Bytestream (const Vector<unsigned char>& bytes);
+	Bytestream (const Bytestream& other);
 	~Bytestream();
 
 	inline METHOD allocated_size() const -> unsigned long;
@@ -62,6 +63,7 @@
 	       METHOD resize (unsigned long length) -> void;
 	inline METHOD rewind() -> void;
 	inline METHOD seek (unsigned long pos) -> void;
+	inline METHOD to_vector() const -> Vector<unsigned char>;
 	       METHOD write (const unsigned char* val, unsigned int length) -> void;
 	       METHOD write_buffer (const Bytestream& other) -> void;
 	       METHOD write_buffer (const Vector<unsigned char>& other) -> void;
@@ -75,6 +77,7 @@
 
 	inline METHOD operator[] (unsigned long idx) -> unsigned char&;
 	inline METHOD operator[] (unsigned long idx) const -> unsigned char;
+	       METHOD operator= (const Bytestream& other) -> Bytestream&;
 
 private:
 	unsigned char* m_data;
@@ -174,3 +177,11 @@
 {
 	return m_data;
 }
+
+// -------------------------------------------------------------------------------------------------
+//
+inline METHOD
+Bytestream::to_vector() const -> Vector<unsigned char>
+{
+	return Vector<unsigned char> (m_data, m_writtenLength);
+}

mercurial