本文整理汇总了C++中MemoryBlock::copyTo方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBlock::copyTo方法的具体用法?C++ MemoryBlock::copyTo怎么用?C++ MemoryBlock::copyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBlock
的用法示例。
在下文中一共展示了MemoryBlock::copyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
Uuid& Uuid::operator= (const String& uuidString)
{
MemoryBlock mb;
mb.loadFromHexString (uuidString);
mb.ensureSize (sizeof (uuid), true);
mb.copyTo (uuid, 0, sizeof (uuid));
return *this;
}
示例2: storeProgram
void DexedAudioProcessorEditor::storeProgram() {
String currentName = normalizeSysexName((const char *) processor->data+145);
char destSysex[4096];
File *externalFile = NULL;
memcpy(&destSysex, processor->sysex, 4096);
bool activeCartridgeFound = processor->activeFileCartridge.exists();
while (true) {
String msg;
if ( externalFile == NULL ) {
if ( activeCartridgeFound )
msg = "Store program to current (" + processor->activeFileCartridge.getFileName() + ") / new cartridge";
else
msg = "Store program to current / new cartridge";
} else {
msg = "Store program to " + externalFile->getFileName();
}
AlertWindow dialog("Store Program", msg, AlertWindow::NoIcon, this);
dialog.addTextEditor("Name", currentName, String("Name"), false);
// TODO: fix the name length to 10
StringArray programs;
extractProgramNames((char *) &destSysex, programs);
dialog.addComboBox("Dest", programs, "Program Destination");
if ( externalFile == NULL ) {
StringArray saveAction;
saveAction.add("Store program to DAW plugin song state");
saveAction.add("Store program and create a new copy of the .syx cartridge");
if ( activeCartridgeFound )
saveAction.add("Store program and overwrite current .syx cartridge");
dialog.addComboBox("SaveAction", saveAction, "Store Action");
}
dialog.addButton("OK", 0, KeyPress(KeyPress::returnKey));
dialog.addButton("CANCEL", 1, KeyPress(KeyPress::escapeKey));
dialog.addButton("EXTERNAL FILE", 2, KeyPress());
int response = dialog.runModalLoop();
if ( response == 2 ) {
FileChooser fc("Destination Sysex", processor->dexedCartDir, "*.syx;*.SYX;*.*", 1);
if ( fc.browseForFileToOpen() ) {
if ( externalFile != NULL )
delete externalFile;
MemoryBlock block;
externalFile = new File(fc.getResults().getReference(0));
if ( externalFile->loadFileAsData(block) ) {
block.copyTo(destSysex, 6, 4096);
continue;
}
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "Read error", "Unable to read file");
}
}
if ( response == 0 ) {
TextEditor *name = dialog.getTextEditor("Name");
ComboBox *dest = dialog.getComboBoxComponent("Dest");
int programNum = dest->getSelectedItemIndex();
String programName(name->getText());
if ( programName.length() > 10 ) {
int toStrip = programName.length() - 10;
programName = programName.dropLastCharacters(toStrip);
}
if ( externalFile == NULL ) {
packProgram((uint8_t *) processor->sysex, (uint8_t *) processor->data, programNum, programName);
processor->programNames.set(programNum, programName);
rebuildProgramCombobox();
processor->setCurrentProgram(programNum);
processor->updateHostDisplay();
int action = dialog.getComboBoxComponent("SaveAction")->getSelectedItemIndex();
if ( action > 0 ) {
File destination = processor->activeFileCartridge;
if ( ! destination.exists() ) {
FileChooser fc("Destination Sysex", processor->dexedCartDir, "*.syx", 1);
if ( ! fc.browseForFileToSave(true) )
break;
destination = fc.getResult();
}
char sysexFile[4104];
exportSysexCart((char *) &sysexFile, (char *) &processor->sysex, 0);
if ( ! destination.replaceWithData(sysexFile, 4104) ) {
AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, "Write error", "Unable to write file");
}
processor->activeFileCartridge = destination;
}
} else {
packProgram((uint8_t *) &destSysex, (uint8_t *) processor->data, programNum, programName);
char sysexFile[4104];
exportSysexCart((char *) &sysexFile, (char *) &destSysex, 0);
//.........这里部分代码省略.........