45 bool initialiseToZero =
false);
55 MemoryBlock (
const void* dataToInitialiseFrom,
size_t sizeInBytes);
75 bool operator== (
const MemoryBlock& other)
const noexcept;
80 bool operator!= (
const MemoryBlock& other)
const noexcept;
83 bool matches (
const void* data,
size_t dataSize)
const noexcept;
98 const void*
getData() const noexcept {
return data; }
103 template <
typename Type>
104 char& operator[] (
const Type offset)
noexcept {
return data [offset]; }
107 template <
typename Type>
108 const char& operator[] (
const Type offset)
const noexcept {
return data [offset]; }
111 char*
begin() noexcept {
return data; }
114 const char*
begin() const noexcept {
return data; }
127 size_t getSize() const noexcept {
return size; }
141 void setSize (
size_t newSize,
142 bool initialiseNewSpaceToZero =
false);
153 void ensureSize (
size_t minimumSize,
154 bool initialiseNewSpaceToZero =
false);
163 void fillWith (uint8 valueToUse)
noexcept;
168 void append (
const void* data,
size_t numBytes);
173 void replaceAll (
const void* data,
size_t numBytes);
180 void insert (
const void* dataToInsert,
size_t numBytesToInsert,
size_t insertPosition);
189 void removeSection (
size_t startByte,
size_t numBytesToRemove);
199 void copyFrom (
const void* srcData,
200 int destinationOffset,
201 size_t numBytes)
noexcept;
210 void copyTo (
void* destData,
212 size_t numBytes)
const noexcept;
232 void loadFromHexString (
StringRef sourceHexString);
236 void setBitRange (
size_t bitRangeStart,
238 int binaryNumberToApply)
noexcept;
241 int getBitRange (
size_t bitRangeStart,
242 size_t numBitsToRead)
const noexcept;
256 String toBase64Encoding()
const;
269 bool fromBase64Encoding (
StringRef encodedString);
273 [[deprecated (
"Use the replaceAll method instead, which will also replace the data when numBytes == 0.")]]
274 void replaceWith (
const void* srcData,
size_t numBytes)
277 replaceAll (srcData, numBytes);
283 using HeapBlockType = HeapBlock<char, true>;
287 JUCE_LEAK_DETECTOR (MemoryBlock)