OpenShot Audio Library | OpenShotAudio  0.6.0
juce_DynamicObject.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2022 - Raw Material Software Limited
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  The code included in this file is provided under the terms of the ISC license
11  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12  To use, copy, modify, and/or distribute this software for any purpose with or
13  without fee is hereby granted provided that the above copyright notice and
14  this permission notice appear in all copies.
15 
16  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18  DISCLAIMED.
19 
20  ==============================================================================
21 */
22 
23 namespace juce
24 {
25 
26 //==============================================================================
39 class JUCE_API DynamicObject : public ReferenceCountedObject
40 {
41 public:
42  //==============================================================================
43  DynamicObject();
45  ~DynamicObject() override;
46 
48 
49  //==============================================================================
53  virtual bool hasProperty (const Identifier& propertyName) const;
54 
58  virtual const var& getProperty (const Identifier& propertyName) const;
59 
61  virtual void setProperty (const Identifier& propertyName, const var& newValue);
62 
64  virtual void removeProperty (const Identifier& propertyName);
65 
66  //==============================================================================
73  virtual bool hasMethod (const Identifier& methodName) const;
74 
83  virtual var invokeMethod (Identifier methodName,
84  const var::NativeFunctionArgs& args);
85 
92  void setMethod (Identifier methodName, var::NativeFunction function);
93 
94  //==============================================================================
96  void clear();
97 
99  NamedValueSet& getProperties() noexcept { return properties; }
100 
102  const NamedValueSet& getProperties() const noexcept { return properties; }
103 
105  void cloneAllProperties();
106 
107  //==============================================================================
113  virtual std::unique_ptr<DynamicObject> clone() const;
114 
115  //==============================================================================
121  virtual void writeAsJSON (OutputStream&, const JSON::FormatOptions&);
122 
123 private:
124  //==============================================================================
125  NamedValueSet properties;
126 
127  JUCE_LEAK_DETECTOR (DynamicObject)
128 };
129 
130 } // namespace juce
NamedValueSet & getProperties() noexcept
const NamedValueSet & getProperties() const noexcept