mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-25 02:04:23 +00:00
Added a DynamicObject::cloneAllProperties() method.
This commit is contained in:
parent
4d16481aa0
commit
f38dc2fe3a
2 changed files with 11 additions and 6 deletions
|
|
@ -83,12 +83,9 @@ void DynamicObject::clear()
|
|||
properties.clear();
|
||||
}
|
||||
|
||||
DynamicObject::Ptr DynamicObject::clone()
|
||||
void DynamicObject::cloneAllProperties()
|
||||
{
|
||||
DynamicObject* newCopy = new DynamicObject();
|
||||
newCopy->properties = properties;
|
||||
|
||||
for (LinkedListPointer<NamedValueSet::NamedValue>* i = &(newCopy->properties.values);;)
|
||||
for (LinkedListPointer<NamedValueSet::NamedValue>* i = &(properties.values);;)
|
||||
{
|
||||
if (NamedValueSet::NamedValue* const v = i->get())
|
||||
{
|
||||
|
|
@ -98,8 +95,13 @@ DynamicObject::Ptr DynamicObject::clone()
|
|||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return newCopy;
|
||||
DynamicObject::Ptr DynamicObject::clone()
|
||||
{
|
||||
Ptr d (new DynamicObject (*this));
|
||||
d->cloneAllProperties();
|
||||
return d;
|
||||
}
|
||||
|
||||
void DynamicObject::writeAsJSON (OutputStream& out, const int indentLevel, const bool allOnOneLine)
|
||||
|
|
|
|||
|
|
@ -103,6 +103,9 @@ public:
|
|||
/** Returns the NamedValueSet that holds the object's properties. */
|
||||
NamedValueSet& getProperties() noexcept { return properties; }
|
||||
|
||||
/** Calls var::clone() on all the properties that this object contains. */
|
||||
void cloneAllProperties();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a clone of this object.
|
||||
The default implementation of this method just returns a new DynamicObject
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue