libnative-utilities/include/array/GrowableByteArray.hpp

52 lines
1.1 KiB
C++
Raw Permalink Normal View History

2024-08-15 18:40:30 +08:00
#ifndef GROWABLEBYTEARRAY_HPP
#define GROWABLEBYTEARRAY_HPP
#include "include/array/GrowableArray.hpp"
class GrowableByteArray{
public:
GrowableByteArray(unsigned int initSize=minmum_capacity);
unsigned char* getArrayData();
unsigned int capacity();
const unsigned int& length=arrlen;
const unsigned int& element_size=elementSize;
void put(const unsigned char e);
void set(unsigned index, const unsigned char e);
void copyFrom(const unsigned char* data, unsigned int count);
void copyFrom(const unsigned char* data, unsigned int index, unsigned int count);
void copyFrom(const unsigned char* data, unsigned int index, unsigned int bufferOffset, unsigned int count);
unsigned char get(unsigned int index);
void remove(unsigned int index);
void gc();
void clear();
~GrowableByteArray();
private:
GrowableArray* array;
unsigned int arrlen;
unsigned int elementSize;
static const unsigned int minmum_capacity;
};
#endif // GROWABLEBYTEARRAY_HPP