12345678910111213141516171819202122232425262728293031323334 |
- #ifndef __DATABLOCK_H
- #define __DATABLOCK_H
- #include <stdio.h>
- #include <cstdint>
- #include "datastring.h"
- #include "idisposable.h"
- class datablock:public datastring,public idisposable
- {
- public:
- datablock(int len); // Makes a garbage string of len bytes. Allocates capacity to len+1.
- datablock(const char *input); // Makes a deep copy of input.
- datablock(const char *input,int len); // Makes a deep copy of input.
- datablock(datastring input); // Makes a deep copy of input.
- ~datablock();
- int capacity; // The total number of bytes in data[].
- void dispose(); // "delete this"; Used by idisposable base class.
- datablock *clone(); // Makes a shallow copy by incrementing usage.
- void initialize(int len);
- void clear(); // Deallocate data[] and set capacity,length to 0.
- datablock &operator=(datastring input);
- datablock &operator=(const char *input);
- datablock &operator+=(datastring input);
- datablock &operator+=(const char *input);
- datablock &operator=(int64_t input);
- datablock &operator+=(int64_t input);
- datablock &operator+=(datablock &input);
- bool append(const char *input,int len);
- int compare(datastring &item);
- int compare(datablock &item);
- bool alter(datastring &item,int offset); // Alters the data block starting at offset.
- };
- #endif
|