openshot-audio  0.1.6
juce_DynamicObject.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_DYNAMICOBJECT_H_INCLUDED
30 #define JUCE_DYNAMICOBJECT_H_INCLUDED
31 
32 
33 //==============================================================================
45 {
46 public:
47  //==============================================================================
48  DynamicObject();
50  ~DynamicObject();
51 
53 
54  //==============================================================================
58  virtual bool hasProperty (const Identifier& propertyName) const;
59 
63  virtual const var& getProperty (const Identifier& propertyName) const;
64 
66  virtual void setProperty (const Identifier& propertyName, const var& newValue);
67 
69  virtual void removeProperty (const Identifier& propertyName);
70 
71  //==============================================================================
78  virtual bool hasMethod (const Identifier& methodName) const;
79 
88  virtual var invokeMethod (Identifier methodName,
89  const var::NativeFunctionArgs& args);
90 
97  void setMethod (Identifier methodName, var::NativeFunction function);
98 
99  //==============================================================================
101  void clear();
102 
104  NamedValueSet& getProperties() noexcept { return properties; }
105 
107  void cloneAllProperties();
108 
109  //==============================================================================
115  virtual Ptr clone();
116 
117  //==============================================================================
123  virtual void writeAsJSON (OutputStream&, int indentLevel, bool allOnOneLine);
124 
125 private:
126  //==============================================================================
127  NamedValueSet properties;
128 
129  #if JUCE_CATCH_DEPRECATED_CODE_MISUSE
130  // These methods have been deprecated - use var::invoke instead
131  virtual void invokeMethod (const Identifier&, const var*, int) {}
132  #endif
133 
135 };
136 
137 
138 
139 #endif // JUCE_DYNAMICOBJECT_H_INCLUDED
Definition: juce_Variant.h:46
#define noexcept
Definition: juce_CompilerSupport.h:141
var(* NativeFunction)(const NativeFunctionArgs &)
Definition: juce_Variant.h:64
Definition: juce_Variant.h:53
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_DynamicObject.h:44
Definition: juce_ReferenceCountedObject.h:65
ReferenceCountedObjectPtr< DynamicObject > Ptr
Definition: juce_DynamicObject.h:52
Definition: juce_NamedValueSet.h:39
Definition: juce_ReferenceCountedObject.h:227
Definition: juce_OutputStream.h:42
NamedValueSet & getProperties() noexcept
Definition: juce_DynamicObject.h:104
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
Definition: juce_Identifier.h:43