OpenShot Audio Library | OpenShotAudio  0.3.0
juce_DynamicObject.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
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  void cloneAllProperties();
103 
104  //==============================================================================
110  virtual Ptr clone();
111 
112  //==============================================================================
118  virtual void writeAsJSON (OutputStream&, int indentLevel, bool allOnOneLine, int maximumDecimalPlaces);
119 
120 private:
121  //==============================================================================
122  NamedValueSet properties;
123 
124  #if JUCE_CATCH_DEPRECATED_CODE_MISUSE
125  // This method has been deprecated - use var::invoke instead
126  virtual void invokeMethod (const Identifier&, const var*, int) {}
127  #endif
128 
129  JUCE_LEAK_DETECTOR (DynamicObject)
130 };
131 
132 } // namespace juce
NamedValueSet & getProperties() noexcept