46 jassert (other.data !=
nullptr);
48 memcpy (data, other.data, size);
55 jassert (((
ssize_t) sizeInBytes) >= 0);
77 memcpy (data, other.data, size);
84 : data (std::move (other.data)),
91 data = std::move (other.data);
99 return matches (other.data, other.size);
109 return size == dataSize
130 zeromem (data + size,
newSize - size);
156 std::swap (size, other.size);
157 data.swapWith (other.data);
163 memset (data, (
int) value, size);
197 setSize (size + numBytes,
false);
226 auto* d =
static_cast<const char*
> (
src);
235 if ((
size_t) offset + num > size)
236 num = size - (
size_t) offset;
239 memcpy (data + offset, d, num);
244 auto* d =
static_cast<char*
> (
dst);
248 zeromem (d, (
size_t) -offset);
254 if ((
size_t) offset + num > size)
262 memcpy (d, data + offset, num);
279 while (
numBits > 0 && (
size_t)
byte < size)
301 while (
numBits > 0 && (
size_t)
byte < size)
335 auto c =
t.getAndAdvance();
337 if (c >=
'0' && c <=
'9') {
byte |= c -
'0';
break; }
338 if (c >=
'a' && c <=
'z') {
byte |= c - (
'a' - 10);
break; }
339 if (c >=
'A' && c <=
'Z') {
byte |= c - (
'A' - 10);
break; }
343 setSize (
static_cast<size_t> (dest - data));
349 *dest++ = (
char)
byte;
354static const char base64EncodingTable[] =
".ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+";
358 auto numChars = ((size << 3) + 5) / 6;
368 for (
size_t i = 0; i <
numChars; ++i)
375static const char base64DecodingTable[] =
377 63, 0, 0, 0, 0, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 0, 0, 0, 0, 0, 0, 0,
378 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
379 0, 0, 0, 0, 0, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52
405 if (isPositiveAndBelow (c, numElementsInArray (base64DecodingTable)))
407 setBitRange ((
size_t) pos, 6, base64DecodingTable[c]);
static CharPointerType1 find(CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
void malloc(SizeType newNumElements, size_t elementSize=sizeof(ElementType))
void allocate(SizeType newNumElements, bool initialiseToZero)
void realloc(SizeType newNumElements, size_t elementSize=sizeof(ElementType))
void copyFrom(const void *srcData, int destinationOffset, size_t numBytes) noexcept
bool fromBase64Encoding(StringRef encodedString)
String toBase64Encoding() const
bool matches(const void *data, size_t dataSize) const noexcept
void append(const void *data, size_t numBytes)
void replaceAll(const void *data, size_t numBytes)
void copyTo(void *destData, int sourceOffset, size_t numBytes) const noexcept
void insert(const void *dataToInsert, size_t numBytesToInsert, size_t insertPosition)
void swapWith(MemoryBlock &other) noexcept
int getBitRange(size_t bitRangeStart, size_t numBitsToRead) const noexcept
void loadFromHexString(StringRef sourceHexString)
void removeSection(size_t startByte, size_t numBytesToRemove)
MemoryBlock & operator=(const MemoryBlock &)
void fillWith(uint8 valueToUse) noexcept
bool operator!=(const MemoryBlock &other) const noexcept
void setSize(size_t newSize, bool initialiseNewSpaceToZero=false)
void ensureSize(size_t minimumSize, bool initialiseNewSpaceToZero=false)
void setBitRange(size_t bitRangeStart, size_t numBits, int binaryNumberToApply) noexcept
bool operator==(const MemoryBlock &other) const noexcept
String::CharPointerType text
static String fromUTF8(const char *utf8buffer, int bufferSizeBytes=-1)
int getIntValue() const noexcept