openshot-audio  0.1.6
juce_PropertySet.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_PROPERTYSET_H_INCLUDED
30 #define JUCE_PROPERTYSET_H_INCLUDED
31 
32 
33 //==============================================================================
44 {
45 public:
46  //==============================================================================
51  PropertySet (bool ignoreCaseOfKeyNames = false);
52 
54  PropertySet (const PropertySet& other);
55 
57  PropertySet& operator= (const PropertySet& other);
58 
60  virtual ~PropertySet();
61 
62  //==============================================================================
72  String getValue (StringRef keyName, const String& defaultReturnValue = String()) const noexcept;
73 
83  int getIntValue (StringRef keyName, int defaultReturnValue = 0) const noexcept;
84 
94  double getDoubleValue (StringRef keyName, double defaultReturnValue = 0.0) const noexcept;
95 
108  bool getBoolValue (StringRef keyName, bool defaultReturnValue = false) const noexcept;
109 
121  XmlElement* getXmlValue (StringRef keyName) const;
122 
123  //==============================================================================
129  void setValue (const String& keyName, const var& value);
130 
138  void setValue (const String& keyName, const XmlElement* xml);
139 
143  void addAllPropertiesFrom (const PropertySet& source);
144 
145  //==============================================================================
149  void removeValue (StringRef keyName);
150 
152  bool containsKey (StringRef keyName) const noexcept;
153 
155  void clear();
156 
157  //==============================================================================
159  StringPairArray& getAllProperties() noexcept { return properties; }
160 
162  const CriticalSection& getLock() const noexcept { return lock; }
163 
164  //==============================================================================
169  XmlElement* createXml (const String& nodeName) const;
170 
175  void restoreFromXml (const XmlElement& xml);
176 
177  //==============================================================================
190  void setFallbackPropertySet (PropertySet* fallbackProperties) noexcept;
191 
195  PropertySet* getFallbackPropertySet() const noexcept { return fallbackProperties; }
196 
197 protected:
199  virtual void propertyChanged();
200 
201 private:
202  StringPairArray properties;
203  PropertySet* fallbackProperties;
204  CriticalSection lock;
205  bool ignoreCaseOfKeys;
206 
208 };
209 
210 
211 #endif // JUCE_PROPERTYSET_H_INCLUDED
Definition: juce_Variant.h:46
Definition: juce_StringPairArray.h:39
Definition: juce_PropertySet.h:43
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
Definition: juce_CriticalSection.h:47
Definition: juce_XmlElement.h:142
StringPairArray & getAllProperties() noexcept
Definition: juce_PropertySet.h:159
Definition: juce_data_structures.cpp:30
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
PropertySet * getFallbackPropertySet() const noexcept
Definition: juce_PropertySet.h:195
const CriticalSection & getLock() const noexcept
Definition: juce_PropertySet.h:162
Definition: juce_StringRef.h:65