MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / toBase64Encoding

Method toBase64Encoding

JUCE/modules/juce_core/memory/juce_MemoryBlock.cpp:353–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351static const char base64EncodingTable[] = ".ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+";
352
353String MemoryBlock::toBase64Encoding() const
354{
355 auto numChars = ((size << 3) + 5) / 6;
356
357 String destString ((unsigned int) size); // store the length, followed by a '.', and then the data.
358 auto initialLen = destString.length();
359 destString.preallocateBytes ((size_t) initialLen * sizeof (String::CharPointerType::CharType) + 2 + numChars);
360
361 auto d = destString.getCharPointer();
362 d += initialLen;
363 d.write ('.');
364
365 for (size_t i = 0; i < numChars; ++i)
366 d.write ((juce_wchar) (uint8) base64EncodingTable[getBitRange (i * 6, 6)]);
367
368 d.writeNull();
369 return destString;
370}
371
372static const char base64DecodingTable[] =
373{

Callers 12

generateRandomUniqueFunction · 0.80
imageToBase64Function · 0.80
crashHandlerMethod · 0.80
createTreeMethod · 0.80
exportPanelMethod · 0.80
appendStateFromMethod · 0.80
parseMidiChunkMethod · 0.80
saveMethod · 0.80
savePluginStateFunction · 0.80
toStringMethod · 0.80
copyToXmlAttributesMethod · 0.80
createNodeXmlFunction · 0.80

Calls 4

preallocateBytesMethod · 0.80
lengthMethod · 0.45
writeMethod · 0.45
writeNullMethod · 0.45

Tested by

no test coverage detected