Beispiel #1
0
void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock& destData)
{
    const String xmlString (xml.createDocument (String::empty, true, false));
    const int stringLength = xmlString.getNumBytesAsUTF8();

    destData.setSize ((size_t) stringLength + 10);

    char* const d = static_cast<char*> (destData.getData());
    *(uint32*) d = ByteOrder::swapIfBigEndian ((const uint32) magicXmlNumber);
    *(uint32*) (d + 4) = ByteOrder::swapIfBigEndian ((const uint32) stringLength);

    xmlString.copyToUTF8 (d + 8, stringLength + 1);
}
Beispiel #2
0
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);
}