diff --git a/modules/juce_core/containers/juce_DynamicObject.cpp b/modules/juce_core/containers/juce_DynamicObject.cpp index eb9d0c10ac..fa7b3fb7a4 100644 --- a/modules/juce_core/containers/juce_DynamicObject.cpp +++ b/modules/juce_core/containers/juce_DynamicObject.cpp @@ -151,6 +151,11 @@ void DynamicObject::writeAsJSON (OutputStream& out, const JSON::FormatOptions& f out << '}'; } +bool DynamicObject::equals (const DynamicObject& other) const +{ + return properties == other.properties; +} + //============================================================================== //============================================================================== diff --git a/modules/juce_core/containers/juce_DynamicObject.h b/modules/juce_core/containers/juce_DynamicObject.h index 0bac0b023a..69b782bb42 100644 --- a/modules/juce_core/containers/juce_DynamicObject.h +++ b/modules/juce_core/containers/juce_DynamicObject.h @@ -125,6 +125,19 @@ public: */ virtual void writeAsJSON (OutputStream&, const JSON::FormatOptions&); + /** Returns true if the properties of this object match the properties of the specified object, + or false otherwise. + */ + bool equals (const DynamicObject& other) const; + + /** Returns true if the properties of this object match the properties of the specified object, + or false otherwise. + */ + bool operator== (const DynamicObject& other) const { return equals (other); } + + /** The inverse of operator==() */ + bool operator!= (const DynamicObject& other) const { return ! operator== (other); } + private: /** Derived classes may override this function to take additional actions after properties are assigned or removed.