Loading...
Searching...
No Matches
juce_PropertySet.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 PropertySet
{
public:
//==============================================================================
PropertySet (bool ignoreCaseOfKeyNames = false);
PropertySet (const PropertySet& other);
PropertySet& operator= (const PropertySet& other);
virtual ~PropertySet();
//==============================================================================
String getValue (StringRef keyName, const String& defaultReturnValue = String()) const noexcept;
int getIntValue (StringRef keyName, int defaultReturnValue = 0) const noexcept;
double getDoubleValue (StringRef keyName, double defaultReturnValue = 0.0) const noexcept;
bool getBoolValue (StringRef keyName, bool defaultReturnValue = false) const noexcept;
std::unique_ptr<XmlElement> getXmlValue (StringRef keyName) const;
//==============================================================================
void setValue (StringRef keyName, const var& value);
void setValue (StringRef keyName, const XmlElement* xml);
void addAllPropertiesFrom (const PropertySet& source);
//==============================================================================
void removeValue (StringRef keyName);
bool containsKey (StringRef keyName) const noexcept;
void clear();
//==============================================================================
StringPairArray& getAllProperties() noexcept { return properties; }
const CriticalSection& getLock() const noexcept { return lock; }
//==============================================================================
std::unique_ptr<XmlElement> createXml (const String& nodeName) const;
void restoreFromXml (const XmlElement& xml);
//==============================================================================
void setFallbackPropertySet (PropertySet* fallbackProperties) noexcept;
PropertySet* getFallbackPropertySet() const noexcept { return fallbackProperties; }
protected:
virtual void propertyChanged();
private:
StringPairArray properties;
PropertySet* fallbackProperties;
CriticalSection lock;
bool ignoreCaseOfKeys;
JUCE_LEAK_DETECTOR (PropertySet)
};
} // namespace juce
juce::CriticalSection
Definition juce_CriticalSection.h:43
juce::PropertySet
Definition juce_PropertySet.h:39
juce::PropertySet::getAllProperties
StringPairArray & getAllProperties() noexcept
Definition juce_PropertySet.h:154
juce::PropertySet::getLock
const CriticalSection & getLock() const noexcept
Definition juce_PropertySet.h:157
juce::PropertySet::clear
void clear()
Definition juce_PropertySet.cpp:54
juce::PropertySet::addAllPropertiesFrom
void addAllPropertiesFrom(const PropertySet &source)
Definition juce_PropertySet.cpp:163
juce::PropertySet::PropertySet
PropertySet(bool ignoreCaseOfKeyNames=false)
Definition juce_PropertySet.cpp:26
juce::PropertySet::getValue
String getValue(StringRef keyName, const String &defaultReturnValue=String()) const noexcept
Definition juce_PropertySet.cpp:65
juce::PropertySet::setValue
void setValue(StringRef keyName, const var &value)
Definition juce_PropertySet.cpp:118
juce::PropertySet::getDoubleValue
double getDoubleValue(StringRef keyName, double defaultReturnValue=0.0) const noexcept
Definition juce_PropertySet.cpp:89
juce::PropertySet::containsKey
bool containsKey(StringRef keyName) const noexcept
Definition juce_PropertySet.cpp:157
juce::PropertySet::getFallbackPropertySet
PropertySet * getFallbackPropertySet() const noexcept
Definition juce_PropertySet.h:190
juce::PropertySet::removeValue
void removeValue(StringRef keyName)
Definition juce_PropertySet.cpp:136
juce::PropertySet::getIntValue
int getIntValue(StringRef keyName, int defaultReturnValue=0) const noexcept
Definition juce_PropertySet.cpp:77
juce::PropertySet::getBoolValue
bool getBoolValue(StringRef keyName, bool defaultReturnValue=false) const noexcept
Definition juce_PropertySet.cpp:101
juce::PropertySet::getXmlValue
std::unique_ptr< XmlElement > getXmlValue(StringRef keyName) const
Definition juce_PropertySet.cpp:113
juce::StringPairArray
Definition juce_StringPairArray.h:35
juce::StringRef
Definition juce_StringRef.h:62
juce::String
Definition juce_String.h:53
juce::XmlElement
Definition juce_XmlElement.h:83
juce::var
Definition juce_Variant.h:42