73 JUCE_PUBLIC_IN_DLL_BUILD (
class SharedObject)
132 std::initializer_list<NamedValueSet::NamedValue> properties,
133 std::initializer_list<ValueTree> subTrees = {});
156 bool operator== (
const ValueTree&)
const noexcept;
162 bool operator!= (
const ValueTree&)
const noexcept;
176 bool isValid() const noexcept {
return object !=
nullptr; }
205 bool hasType (const
Identifier& typeName) const noexcept;
213 const
var& getProperty (const
Identifier& name) const noexcept;
220 var getProperty (const
Identifier& name, const
var& defaultReturnValue) const;
226 const
var* getPropertyPointer (const
Identifier& name) const noexcept;
233 const
var& operator[] (const
Identifier& name) const noexcept;
245 bool hasProperty (const
Identifier& name) const noexcept;
257 void removeAllProperties (
UndoManager* undoManager);
262 int getNumProperties() const noexcept;
270 Identifier getPropertyName (
int index) const noexcept;
281 bool shouldUpdateSynchronously = false);
287 int getNumChildren() const noexcept;
346 void removeChild (
int childIndex,
UndoManager* undoManager);
366 void moveChild (
int currentIndex,
int newIndex,
UndoManager* undoManager);
371 bool isAChildOf (const
ValueTree& possibleParent) const noexcept;
376 int indexOf (const
ValueTree& child) const noexcept;
395 ValueTree getSibling (
int delta) const noexcept;
405 Iterator& operator++();
407 bool operator== (
const Iterator&)
const;
408 bool operator!= (
const Iterator&)
const;
411 using difference_type = std::ptrdiff_t;
415 using iterator_category = std::forward_iterator_tag;
418 SharedObject** internal =
nullptr;
467 static ValueTree readFromData (
const void* data,
size_t numBytes);
472 static ValueTree readFromGZIPData (
const void* data,
size_t numBytes);
513 int indexFromWhichChildWasRemoved);
523 int oldIndex,
int newIndex);
593 template <
typename ElementComparator>
594 void sort (ElementComparator& comparator,
UndoManager* undoManager,
bool retainOrderOfEquivalentItems)
596 if (
object !=
nullptr)
599 createListOfChildren (sortedList);
600 ComparatorAdapter<ElementComparator> adapter (comparator);
601 sortedList.
sort (adapter, retainOrderOfEquivalentItems);
602 reorderChildren (sortedList, undoManager);
609 int getReferenceCount() const noexcept;
611 #if JUCE_ALLOW_STATIC_NULL_VARIABLES && ! defined (DOXYGEN)
613 [[deprecated (
"If you need an empty ValueTree object, just use ValueTree() or {}.")]]
619 friend class SharedObject;
624 template <
typename ElementComparator>
625 struct ComparatorAdapter
627 ComparatorAdapter (ElementComparator& comp) noexcept : comparator (comp) {}
629 int compareElements (
const ValueTree*
const first,
const ValueTree*
const second)
631 return comparator.compareElements (*first, *second);
635 ElementComparator& comparator;
636 JUCE_DECLARE_NON_COPYABLE (ComparatorAdapter)
639 void createListOfChildren (OwnedArray<ValueTree>&)
const;
640 void reorderChildren (
const OwnedArray<ValueTree>&, UndoManager*);
642 explicit ValueTree (ReferenceCountedObjectPtr<SharedObject>)
noexcept;
643 explicit ValueTree (SharedObject&)
noexcept;