本文整理汇总了C++中OwnedArray类的典型用法代码示例。如果您正苦于以下问题:C++ OwnedArray类的具体用法?C++ OwnedArray怎么用?C++ OwnedArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OwnedArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemDropped
void ProjectTreeViewBase::itemDropped (const DragAndDropTarget::SourceDetails& dragSourceDetails, int insertIndex)
{
OwnedArray <Project::Item> selectedNodes;
getAllSelectedNodesInTree (dragSourceDetails.sourceComponent, selectedNodes);
if (selectedNodes.size() > 0)
{
TreeView* tree = getOwnerView();
ScopedPointer <XmlElement> oldOpenness (tree->getOpennessState (false));
moveSelectedItemsTo (selectedNodes, insertIndex);
if (oldOpenness != nullptr)
tree->restoreOpennessState (*oldOpenness, false);
}
}
示例2: reorderChildren
void reorderChildren (const OwnedArray<ValueTree>& newOrder, UndoManager* undoManager)
{
jassert (newOrder.size() == children.size());
for (int i = 0; i < children.size(); ++i)
{
SharedObject* const child = newOrder.getUnchecked(i)->object;
if (children.getObjectPointerUnchecked (i) != child)
{
const int oldIndex = children.indexOf (child);
jassert (oldIndex >= 0);
moveChild (oldIndex, i, undoManager);
}
}
}
示例3: createDeviceTypesIfNeeded
//==============================================================================
void AudioDeviceManager::createDeviceTypesIfNeeded()
{
if (availableDeviceTypes.size() == 0)
{
OwnedArray<AudioIODeviceType> types;
createAudioDeviceTypes (types);
for (int i = 0; i < types.size(); ++i)
addAudioDeviceType (types.getUnchecked(i));
types.clear (false);
if (AudioIODeviceType* first = availableDeviceTypes.getFirst())
currentDeviceType = first->getTypeName();
}
}
示例4: createFileCreationOptionComboBox
static void createFileCreationOptionComboBox (Component& setupComp,
OwnedArray<Component>& itemsCreated,
const char** fileOptions)
{
ComboBox* c = new ComboBox();
itemsCreated.add (c);
setupComp.addChildAndSetID (c, "filesToCreate");
c->addItemList (StringArray (fileOptions), 1);
c->setSelectedId (1, false);
Label* l = new Label (String::empty, "Files to Auto-Generate:");
l->attachToComponent (c, true);
itemsCreated.add (l);
c->setBounds ("parent.width / 2 + 160, 10, parent.width - 10, top + 22");
}
示例5: addToDeleteList
void ThreadPool::addToDeleteList (OwnedArray<ThreadPoolJob>& deletionList, ThreadPoolJob* const job) const
{
job->shouldStop = true;
job->pool = nullptr;
if (job->shouldBeDeleted)
deletionList.add (job);
}
示例6: run
void run()
{
OwnedArray<ImageItem> images;
bool res = smugmug->getImages(images, ur->getAlbumId());
smugmug->lock.enter();
if (res)
{
for (int i = ur->getNumImages() - 1; i >= 0; i--)
{
for (int j = 0; j < images.size(); j++)
{
if (ur->getImageFile(i).getFileName() == images[j]->filename)
{
ur->getImageFileInfo(i).status = UploadFile::Duplicate;
}
}
}
}
for (int i = 0; i < smugmug->uploadQueue.size(); i++)
{
if (smugmug->uploadQueue[i]->getAlbumId().id == ur->getAlbumId().id)
{
for (int j = 0; j < smugmug->uploadQueue[i]->getNumImages(); j++)
{
for (int k = 0; k < ur->getNumImages(); k++)
{
if (ur->getImageFile(k).getFileName() == smugmug->uploadQueue[i]->getImageFile(j).getFileName())
{
ur->getImageFileInfo(k).status = UploadFile::Duplicate;
}
}
}
}
}
smugmug->lock.exit();
smugmug->uploadImages(ur, false);
smugmug->lock.enter();
smugmug->dupeThreads.removeFirstMatchingValue(this);
smugmug->lock.exit();
triggerAsyncUpdate();
}
示例7: updateChildComponents
void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree& children)
{
using namespace ComponentBuilderHelpers;
const int numExistingChildComps = parent.getNumChildComponents();
Array<Component*> componentsInOrder;
componentsInOrder.ensureStorageAllocated (numExistingChildComps);
{
OwnedArray<Component> existingComponents;
existingComponents.ensureStorageAllocated (numExistingChildComps);
for (int i = 0; i < numExistingChildComps; ++i)
existingComponents.add (parent.getChildComponent (i));
const int newNumChildren = children.getNumChildren();
for (int i = 0; i < newNumChildren; ++i)
{
const ValueTree childState (children.getChild (i));
Component* c = removeComponentWithID (existingComponents, getStateId (childState));
if (c == nullptr)
{
if (TypeHandler* const type = getHandlerForState (childState))
c = ComponentBuilderHelpers::createNewComponent (*type, childState, &parent);
else
jassertfalse;
}
if (c != nullptr)
componentsInOrder.add (c);
}
// (remaining unused items in existingComponents get deleted here as it goes out of scope)
}
// Make sure the z-order is correct..
if (componentsInOrder.size() > 0)
{
componentsInOrder.getLast()->toFront (false);
for (int i = componentsInOrder.size() - 1; --i >= 0;)
componentsInOrder.getUnchecked(i)->toBehind (componentsInOrder.getUnchecked (i + 1));
}
}
示例8: removeAllInputs
void MixerAudioSource::removeAllInputs()
{
OwnedArray<AudioSource> toDelete;
{
const ScopedLock sl (lock);
for (int i = inputs.size(); --i >= 0;)
if (inputsToDelete[i])
toDelete.add (inputs.getUnchecked(i));
inputs.clear();
}
for (int i = toDelete.size(); --i >= 0;)
toDelete.getUnchecked(i)->releaseResources();
}
示例9: countTotalChannels
//==============================================================================
static int countTotalChannels (const OwnedArray<AudioProcessor::Bus>& buses) noexcept
{
int n = 0;
for (int i = 0; i < buses.size(); ++i)
n += buses[i]->getNumberOfChannels();
return n;
}
示例10: containsWgRef
int SAMCompiler::containsWgRef(const OwnedArray<WgWithSuffixes>& wws, const String& wId)
{
for (int i = 0; i < wws.size(); ++i)
{
WgWithSuffixes* w = wws[i];
if (w->wgId.compare(wId) == 0)
return i;
}
return -1;
}
示例11: createRequiredModules
void EnabledModuleList::createRequiredModules (OwnedArray<LibraryModule>& modules)
{
for (int i = 0; i < getNumModules(); ++i)
{
ModuleDescription info (getModuleInfo (getModuleID (i)));
if (info.isValid())
modules.add (new LibraryModule (info));
}
}
示例12: containsMassLinkRef
int SAMCompiler::containsMassLinkRef(const OwnedArray<MassLinkRef>& mlf, const String& mId)
{
for (int i = 0; i < mlf.size(); ++i)
{
MassLinkRef* m = mlf[i];
if (m->massId.compare(mId) == 0)
return i;
}
return -1;
}
示例13: TextPropertyComponent
void ProjectExporter::createPropertyEditors (PropertyListBuilder& props)
{
props.add (new TextPropertyComponent (getTargetLocationValue(), "Target Project Folder", 1024, false),
"The location of the folder in which the " + name + " project will be created. "
"This path can be absolute, but it's much more sensible to make it relative to the jucer project directory.");
OwnedArray<LibraryModule> modules;
project.getModules().createRequiredModules (modules);
for (int i = 0; i < modules.size(); ++i)
modules.getUnchecked(i)->createPropertyEditors (*this, props);
props.add (new TextPropertyComponent (getExporterPreprocessorDefs(), "Extra Preprocessor Definitions", 32768, true),
"Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace, commas, "
"or new-lines to separate the items - to include a space or comma in a definition, precede it with a backslash.");
props.add (new TextPropertyComponent (getExtraCompilerFlags(), "Extra compiler flags", 2048, true),
"Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor definitions in the "
"form ${NAME_OF_DEFINITION}, which will be replaced with their values.");
props.add (new TextPropertyComponent (getExtraLinkerFlags(), "Extra linker flags", 2048, true),
"Extra command-line flags to be passed to the linker. You might want to use this for adding additional libraries. "
"This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values.");
props.add (new TextPropertyComponent (getExternalLibraries(), "External libraries to link", 2048, true),
"Additional libraries to link (one per line). You should not add any platform specific decoration to these names. "
"This string can contain references to preprocessor definitions in the form ${NAME_OF_VALUE}, which will be replaced with their values.");
{
OwnedArray<Project::Item> images;
project.findAllImageItems (images);
StringArray choices;
Array<var> ids;
choices.add ("<None>");
ids.add (var::null);
choices.add (String::empty);
ids.add (var::null);
for (int i = 0; i < images.size(); ++i)
{
choices.add (images.getUnchecked(i)->getName());
ids.add (images.getUnchecked(i)->getID());
}
props.add (new ChoicePropertyComponent (getSmallIconImageItemID(), "Icon (small)", choices, ids),
"Sets an icon to use for the executable.");
props.add (new ChoicePropertyComponent (getBigIconImageItemID(), "Icon (large)", choices, ids),
"Sets an icon to use for the executable.");
}
createExporterProperties (props);
props.add (new TextPropertyComponent (getUserNotes(), "Notes", 32768, true),
"Extra comments: This field is not used for code or project generation, it's just a space where you can express your thoughts.");
}
示例14: createControllerUpdatesForTime
//==============================================================================
void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumber,
const double time,
OwnedArray<MidiMessage>& dest)
{
bool doneProg = false;
bool donePitchWheel = false;
Array<int> doneControllers;
doneControllers.ensureStorageAllocated (32);
for (int i = list.size(); --i >= 0;)
{
const MidiMessage& mm = list.getUnchecked(i)->message;
if (mm.isForChannel (channelNumber) && mm.getTimeStamp() <= time)
{
if (mm.isProgramChange())
{
if (! doneProg)
{
dest.add (new MidiMessage (mm, 0.0));
doneProg = true;
}
}
else if (mm.isController())
{
if (! doneControllers.contains (mm.getControllerNumber()))
{
dest.add (new MidiMessage (mm, 0.0));
doneControllers.add (mm.getControllerNumber());
}
}
else if (mm.isPitchWheel())
{
if (! donePitchWheel)
{
dest.add (new MidiMessage (mm, 0.0));
donePitchWheel = true;
}
}
}
}
}
示例15: moveItems
void ProjectTreeViewBase::moveItems (OwnedArray <Project::Item>& selectedNodes,
Project::Item destNode, int insertIndex)
{
for (int i = selectedNodes.size(); --i >= 0;)
{
Project::Item* const n = selectedNodes.getUnchecked(i);
if (destNode == *n || destNode.state.isAChildOf (n->state)) // Check for recursion.
return;
if (! destNode.canContain (*n))
selectedNodes.remove (i);
}
// Don't include any nodes that are children of other selected nodes..
for (int i = selectedNodes.size(); --i >= 0;)
{
Project::Item* const n = selectedNodes.getUnchecked(i);
for (int j = selectedNodes.size(); --j >= 0;)
{
if (j != i && n->state.isAChildOf (selectedNodes.getUnchecked(j)->state))
{
selectedNodes.remove (i);
break;
}
}
}
// Remove and re-insert them one at a time..
for (int i = 0; i < selectedNodes.size(); ++i)
{
Project::Item* selectedNode = selectedNodes.getUnchecked(i);
if (selectedNode->state.getParent() == destNode.state
&& indexOfNode (destNode.state, selectedNode->state) < insertIndex)
--insertIndex;
selectedNode->removeItemFromProject();
destNode.addChild (*selectedNode, insertIndex++);
}
}