本文整理汇总了C++中MemoryBlock::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBlock::getData方法的具体用法?C++ MemoryBlock::getData怎么用?C++ MemoryBlock::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBlock
的用法示例。
在下文中一共展示了MemoryBlock::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructResponseMask
void CtrlrMIDITransaction::constructResponseMask()
{
MemoryBlock responseMask;
MemoryBlock prefix = getFormulaAsMemoryBlock(getProperty(Ids::transRespFormulaPrefix));
MemoryBlock data((int)getProperty(Ids::transRespDataLen), true);
MemoryBlock suffix = getFormulaAsMemoryBlock(getProperty(Ids::transRespFormulaSuffix));
MemoryBlock name = getNameAsMemoryBlock();
if (data.getSize() < name.getSize())
{
TRANS("["+getName()+"] CtrlrMIDITransaction::constructResponseMask data block will not fit name");
}
if (prefix.getSize() > 0)
{
responseMask.append (prefix.getData(), prefix.getSize());
}
if (data.getSize() > 0)
{
responseMask.append (data.getData(), data.getSize());
}
if (suffix.getSize() > 0)
{
responseMask.append (suffix.getData(), suffix.getSize());
}
setResponseMask (responseMask);
}
示例2: constructConfirmation
void CtrlrMIDITransaction::constructConfirmation()
{
MemoryBlock request;
MemoryBlock prefix = getFormulaAsMemoryBlock(getProperty(Ids::transConfFormulaPrefix));
MemoryBlock data = getConfirmationDataAsMemoryBlock();
MemoryBlock suffix = getFormulaAsMemoryBlock(getProperty(Ids::transConfFormulaSuffix));
if (prefix.getSize() > 0)
{
request.append (prefix.getData(), prefix.getSize());
}
if (data.getSize() > 0)
{
request.append (data.getData(), data.getSize());
}
if (suffix.getSize() > 0)
{
request.append (suffix.getData(), suffix.getSize());
}
setRequest (request);
}
示例3: constructRequest
void CtrlrMIDITransaction::constructRequest()
{
MemoryBlock request;
MemoryBlock prefix = getFormulaAsMemoryBlock(getProperty(Ids::transReqFormulaPrefix));
MemoryBlock data = getRequestDataAsMemoryBlock();
MemoryBlock suffix = getFormulaAsMemoryBlock(getProperty(Ids::transReqFormulaSuffix));
MemoryBlock name = getNameAsMemoryBlock();
if (data.getSize() < name.getSize())
{
TRANS("["+getName()+"] CtrlrMIDITransaction::constructRequest data block will not fit name");
}
if (prefix.getSize() > 0)
{
request.append (prefix.getData(), prefix.getSize());
}
if (data.getSize() > 0)
{
request.append (data.getData(), data.getSize());
}
if (suffix.getSize() > 0)
{
request.append (suffix.getData(), suffix.getSize());
}
setRequest (request);
}
示例4: readNextLine
String InputStream::readNextLine()
{
MemoryBlock buffer (256);
char* data = static_cast<char*> (buffer.getData());
size_t i = 0;
while ((data[i] = readByte()) != 0)
{
if (data[i] == '\n')
break;
if (data[i] == '\r')
{
const int64 lastPos = getPosition();
if (readByte() != '\n')
setPosition (lastPos);
break;
}
if (++i >= buffer.getSize())
{
buffer.setSize (buffer.getSize() + 512);
data = static_cast<char*> (buffer.getData());
}
}
return String::fromUTF8 (data, (int) i);
}
示例5:
void CtrlrLuaAudioConverter::convertInt16 (MemoryBlock &sourceData, AudioSampleBuffer &destination, const int numSamples, const int numChannels, const bool interleaved)
{
if (interleaved)
{
AudioData::ConverterInstance < AudioData::Pointer <AudioData::Int16,
AudioData::NativeEndian,
AudioData::Interleaved,
AudioData::Const>,
AudioData::Pointer <AudioData::Float32,
AudioData::NativeEndian,
AudioData::Interleaved,
AudioData::NonConst>
> converter;
for (int ch=0; ch<numChannels; ch++)
{
converter.convertSamples ((void *)destination.getReadPointer(ch), sourceData.getData(), numSamples);
}
}
else
{
AudioData::ConverterInstance < AudioData::Pointer <AudioData::Int16,
AudioData::NativeEndian,
AudioData::NonInterleaved,
AudioData::Const>,
AudioData::Pointer <AudioData::Float32,
AudioData::NativeEndian,
AudioData::Interleaved,
AudioData::NonConst>
> converter;
for (int ch=0; ch<numChannels; ch++)
{
converter.convertSamples ((void *)destination.getReadPointer(ch), ch, sourceData.getData(), ch, numSamples);
}
}
}
示例6: sendMessage
//==============================================================================
bool InterprocessConnection::sendMessage (const MemoryBlock& message)
{
uint32 messageHeader[2] = { ByteOrder::swapIfBigEndian (magicMessageHeader),
ByteOrder::swapIfBigEndian ((uint32) message.getSize()) };
MemoryBlock messageData (sizeof (messageHeader) + message.getSize());
messageData.copyFrom (messageHeader, 0, sizeof (messageHeader));
messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize());
return writeData (messageData.getData(), (int) messageData.getSize()) == (int) messageData.getSize();
}
示例7: getValue
static String getValue (const String& regValuePath, const String& defaultValue, DWORD wow64Flags)
{
MemoryBlock buffer;
switch (getBinaryValue (regValuePath, buffer, wow64Flags))
{
case REG_SZ: return static_cast <const WCHAR*> (buffer.getData());
case REG_DWORD: return String ((int) *reinterpret_cast<const DWORD*> (buffer.getData()));
default: break;
}
return defaultValue;
}
示例8: createFromHexData
const MidiMessage createFromHexData (const String &hexData)
{
MemoryBlock bl;
bl.loadFromHexString(hexData);
return (MidiMessage ((uint8*)bl.getData(), (int)bl.getSize()));
}
示例9:
BEAST_API OutputStream& BEAST_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data)
{
if (data.getSize() > 0)
stream.write (data.getData(), data.getSize());
return stream;
}
示例10: getDefaultResources
const Result CtrlrWindows::getDefaultResources(MemoryBlock& dataToWrite)
{
#ifdef DEBUG_INSTANCE
File temp("c:\\devel\\debug_small.bpanelz");
MemoryBlock data;
{
ScopedPointer <FileInputStream> fis (temp.createInputStream());
fis->readIntoMemoryBlock (data);
}
ValueTree t = ValueTree::readFromGZIPData(data.getData(), data.getSize());
if (t.isValid())
{
ValueTree r = t.getChildWithName (Ids::resourceExportList);
if (r.isValid())
{
MemoryOutputStream mos (dataToWrite, false);
{
GZIPCompressorOutputStream gzipOutputStream (&mos);
r.writeToStream(gzipOutputStream);
gzipOutputStream.flush();
}
return (Result::ok());
}
}
else
{
return (Result::fail("Windows Native: getDefaultResources got data but couldn't parse it as a compressed ValueTree"));
}
#endif
return (readResource (nullptr, MAKEINTRESOURCE(CTRLR_INTERNAL_RESOURCES_RESID), RT_RCDATA, dataToWrite));
}
示例11:
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryBlock& data)
{
if (data.getSize() > 0)
stream.write (data.getData(), (int) data.getSize());
return stream;
}
示例12: key
static std::uint32_t getBinaryValue (const String& regValuePath, MemoryBlock& result, DWORD wow64Flags)
{
const RegistryKeyWrapper key (regValuePath, false, wow64Flags);
if (key.key != 0)
{
for (unsigned long bufferSize = 1024; ; bufferSize *= 2)
{
result.setSize (bufferSize, false);
DWORD type = REG_NONE;
const LONG err = RegQueryValueEx (key.key, key.wideCharValueName, 0, &type,
(LPBYTE) result.getData(), &bufferSize);
if (err == ERROR_SUCCESS)
{
result.setSize (bufferSize, false);
return type;
}
if (err != ERROR_MORE_DATA)
break;
}
}
return REG_NONE;
}
示例13: save_fxbp
static void save_fxbp(SoundPlugin *plugin, wchar_t *wfilename, bool is_fxb){
Data *data = (Data*)plugin->data;
AudioPluginInstance *instance = data->audio_instance;
MemoryBlock memoryBlock;
bool result = VSTPluginFormat::saveToFXBFile(instance, memoryBlock, is_fxb);
if (result==false){
GFX_Message(NULL, "Unable to create FXB/FXP data for this plugin");
return;
}
String filename(wfilename);
File file(filename);
Result result2 = file.create();
if (result2.failed()){
GFX_Message(NULL, "Unable to create file %s (%s)", STRING_get_chars(wfilename), result2.getErrorMessage().toRawUTF8());
return;
}
bool result3 = file.replaceWithData(memoryBlock.getData(), memoryBlock.getSize());
if (result3==false){
GFX_Message(NULL, "Unable to write data to file %s (disk full?)", STRING_get_chars(wfilename));
return;
}
printf("\n\n\n ***************** result: %d\n\n\n\n",result);
}
示例14: handleSaveCommand
void HostFilterComponent::handleSaveCommand(bool saveToExistingFileAndDontPrompt)
{
File tmp = currentSessionFile;
bool userConfirmed = true;
if (!saveToExistingFileAndDontPrompt || !tmp.exists())
{
FileChooser myChooser (T("Save Session..."),
currentSessionFile.exists() ? tmp : Config::getInstance ()->lastSessionDirectory,
JOST_SESSION_WILDCARD,
JOST_USE_NATIVE_FILE_CHOOSER);
if (myChooser.browseForFileToSave (true))
tmp = myChooser.getResult().withFileExtension (JOST_SESSION_EXTENSION);
else
userConfirmed = false;
}
if (userConfirmed && (tmp != File::nonexistent))
{
MemoryBlock fileData;
getFilter ()->getStateInformation (fileData);
if (tmp.replaceWithData (fileData.getData (), fileData.getSize()))
{
Config::getInstance()->addRecentSession (tmp);
setCurrentSessionFile(tmp);
Config::getInstance()->lastSessionFile = tmp;
}
}
}
示例15: load
void OnlineUnlockStatus::load()
{
MemoryBlock mb;
mb.fromBase64Encoding (getState());
if (mb.getSize() > 0)
status = ValueTree::readFromGZIPData (mb.getData(), mb.getSize());
else
status = ValueTree (stateTagName);
StringArray localMachineNums (getLocalMachineIDs());
if (machineNumberAllowed (StringArray ("1234"), localMachineNums))
status.removeProperty (unlockedProp, nullptr);
KeyFileUtils::KeyFileData data;
data = KeyFileUtils::getDataFromKeyFile (KeyFileUtils::getXmlFromKeyFile (status[keyfileDataProp], getPublicKey()));
if (data.keyFileExpires)
{
if (! doesProductIDMatch (data.appID))
status.removeProperty (expiryTimeProp, nullptr);
if (! machineNumberAllowed (data.machineNumbers, localMachineNums))
status.removeProperty (expiryTimeProp, nullptr);
}
else
{
if (! doesProductIDMatch (data.appID))
status.removeProperty (unlockedProp, nullptr);
if (! machineNumberAllowed (data.machineNumbers, localMachineNums))
status.removeProperty (unlockedProp, nullptr);
}
}