本文整理汇总了C++中juce::MemoryBlock类的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBlock类的具体用法?C++ MemoryBlock怎么用?C++ MemoryBlock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MemoryBlock类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyXmlToBinary
void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData)
{
const String xmlString (xml.createDocument (String::empty, true, false));
const size_t stringLength = xmlString.getNumBytesAsUTF8();
destData.setSize (stringLength + 9);
uint32* const d = static_cast<uint32*> (destData.getData());
d[0] = ByteOrder::swapIfBigEndian ((const uint32) magicXmlNumber);
d[1] = ByteOrder::swapIfBigEndian ((const uint32) stringLength);
xmlString.copyToUTF8 ((CharPointer_UTF8::CharType*) (d + 2), stringLength + 1);
}
示例2: copyXmlToBinary
void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData)
{
{
MemoryOutputStream out (destData, false);
out.writeInt (magicXmlNumber);
out.writeInt (0);
xml.writeToStream (out, String::empty, true, false);
out.writeByte (0);
}
// go back and write the string length..
static_cast<uint32*> (destData.getData())[1]
= ByteOrder::swapIfBigEndian ((uint32) destData.getSize() - 9);
}
示例3: jojo_bang
void jojo_bang (t_jojo *x)
{
const ScopedLock myLock (x->lock_);
post ("Public / %s", x->public_.toString().toRawUTF8());
post ("Private / %s", x->private_.toString().toRawUTF8());
String myText (CharPointer_UTF8 ("P\xc3\xa9p\xc3\xa9 p\xc3\xa8te en ao\xc3\xbbt!"));
post ("%s", myText.toRawUTF8());
const juce::MemoryBlock blockBegin (myText.toRawUTF8(), myText.getNumBytesAsUTF8() + 1);
BigInteger bitArray;
bitArray.loadFromMemoryBlock (blockBegin);
x->public_.applyToValue (bitArray); /* Encrypt with the public key. */
post ("%s", bitArray.toString (16).toRawUTF8());
x->private_.applyToValue (bitArray); /* Then decrypt with the private key. */
const juce::MemoryBlock blockEnd (bitArray.toMemoryBlock());
post ("%s", blockEnd.toString().toRawUTF8());
}