Loading...
Searching...
No Matches
juce_DynamicObject.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class JUCE_API DynamicObject : public ReferenceCountedObject
{
public:
//==============================================================================
DynamicObject();
DynamicObject (const DynamicObject&);
~DynamicObject() override;
using Ptr = ReferenceCountedObjectPtr<DynamicObject>;
//==============================================================================
virtual bool hasProperty (const Identifier& propertyName) const;
virtual const var& getProperty (const Identifier& propertyName) const;
virtual void setProperty (const Identifier& propertyName, const var& newValue);
virtual void removeProperty (const Identifier& propertyName);
//==============================================================================
virtual bool hasMethod (const Identifier& methodName) const;
virtual var invokeMethod (Identifier methodName,
const var::NativeFunctionArgs& args);
void setMethod (Identifier methodName, var::NativeFunction function);
//==============================================================================
void clear();
NamedValueSet& getProperties() noexcept { return properties; }
const NamedValueSet& getProperties() const noexcept { return properties; }
void cloneAllProperties();
//==============================================================================
virtual std::unique_ptr<DynamicObject> clone() const;
//==============================================================================
virtual void writeAsJSON (OutputStream&, const JSON::FormatOptions&);
private:
//==============================================================================
NamedValueSet properties;
JUCE_LEAK_DETECTOR (DynamicObject)
};
} // namespace juce
juce::DynamicObject
Definition juce_DynamicObject.h:40
juce::DynamicObject::getProperties
NamedValueSet & getProperties() noexcept
Definition juce_DynamicObject.h:99
juce::DynamicObject::hasProperty
virtual bool hasProperty(const Identifier &propertyName) const
Definition juce_DynamicObject.cpp:39
juce::DynamicObject::setMethod
void setMethod(Identifier methodName, var::NativeFunction function)
Definition juce_DynamicObject.cpp:73
juce::DynamicObject::removeProperty
virtual void removeProperty(const Identifier &propertyName)
Definition juce_DynamicObject.cpp:55
juce::DynamicObject::invokeMethod
virtual var invokeMethod(Identifier methodName, const var::NativeFunctionArgs &args)
Definition juce_DynamicObject.cpp:65
juce::DynamicObject::getProperties
const NamedValueSet & getProperties() const noexcept
Definition juce_DynamicObject.h:102
juce::DynamicObject::hasMethod
virtual bool hasMethod(const Identifier &methodName) const
Definition juce_DynamicObject.cpp:60
juce::DynamicObject::getProperty
virtual const var & getProperty(const Identifier &propertyName) const
Definition juce_DynamicObject.cpp:45
juce::DynamicObject::setProperty
virtual void setProperty(const Identifier &propertyName, const var &newValue)
Definition juce_DynamicObject.cpp:50
juce::DynamicObject::clear
void clear()
Definition juce_DynamicObject.cpp:78
juce::Identifier
Definition juce_Identifier.h:39
juce::JSON::FormatOptions
Definition juce_JSON.h:102
juce::NamedValueSet
Definition juce_NamedValueSet.h:35
juce::OutputStream
Definition juce_OutputStream.h:38
juce::ReferenceCountedObjectPtr
Definition juce_ReferenceCountedObject.h:247
juce::ReferenceCountedObject::ReferenceCountedObject
ReferenceCountedObject()=default
juce::var
Definition juce_Variant.h:42
juce::var::NativeFunctionArgs
Definition juce_Variant.h:49