voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
byteArray.hpp
1 #ifndef BLUB_CORE_BYTEARRAY_HPP
2 #define BLUB_CORE_BYTEARRAY_HPP
3 
4 #include "blub/core/globals.hpp"
5 #include "blub/serialization/access.hpp"
6 #include "blub/serialization/nameValuePair.hpp"
7 
8 #include <boost/serialization/base_object.hpp>
9 #include <boost/serialization/vector.hpp>
10 
11 #include <vector>
12 
13 
14 namespace blub
15 {
16 
17 class byteArray : public std::vector<char>
18 {
19 public:
20  typedef std::vector<char> t_base;
21 
22  byteArray()
23  {
24  ;
25  }
26  byteArray(const uint32& size)
27  : t_base(size, 0)
28  {;}
29 
30  byteArray(const byteArray &array);
31  byteArray(const char *array, uint32 size);
32  byteArray(const string &str);
33 
40  byteArray mid(const uint32& index, const int32& length = -1) const;
41  uint32 size() const
42  {
43  return static_cast<uint32>(t_base::size());
44  }
45 
46  byteArray& operator +=(const byteArray& other);
47 
48 private:
49  BLUB_SERIALIZATION_ACCESS
50 
51  template <class formatType>
52  void serialize(formatType & ar, const uint32& version)
53  {
54  (void)version;
55 
56  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(t_base);
57  }
58 
59 };
60 
61 }
62 
63 #endif // BLUB_CORE_BYTEARRAY_HPP
Definition: byteArray.hpp:17
Definition: deadlineTimer.hpp:10
byteArray mid(const uint32 &index, const int32 &length=-1) const
mid gets an copy from a specified index for a length
Definition: byteArray.cpp:30
Definition: array.hpp:18