12345678910111213141516171819202122232425262728293031 |
- #ifndef BUFFER_H
- #define BUFFER_H
- class Buffer {
- int length;
- int capacity;
- char* buffer;
- public:
- Buffer(int initialSize);
- Buffer(const Buffer& other);
- Buffer(Buffer&& other);
- ~Buffer();
- Buffer& operator=(Buffer other);
- Buffer& add(const void* data, int size);
- template<typename T>
- Buffer& add(const T& t) {
- add(&t, sizeof(T));
- return *this;
- }
- int getLength() const;
- operator const char*() const;
- private:
- void swap(Buffer& other);
- };
- #endif
|