Loading...
Searching...
No Matches
juce_NamedValueSet.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 NamedValueSet
{
public:
//==============================================================================
struct JUCE_API NamedValue
{
NamedValue() noexcept;
~NamedValue() noexcept;
NamedValue (const Identifier& name, const var& value);
NamedValue (const Identifier& name, var&& value) noexcept;
NamedValue (Identifier&& name, var&& value) noexcept;
NamedValue (const NamedValue&);
NamedValue (NamedValue&&) noexcept;
NamedValue& operator= (NamedValue&&) noexcept;
bool operator== (const NamedValue&) const noexcept;
bool operator!= (const NamedValue&) const noexcept;
Identifier name;
var value;
};
//==============================================================================
NamedValueSet() noexcept;
NamedValueSet (const NamedValueSet&);
NamedValueSet (NamedValueSet&&) noexcept;
NamedValueSet& operator= (const NamedValueSet&);
NamedValueSet& operator= (NamedValueSet&&) noexcept;
NamedValueSet (std::initializer_list<NamedValue>);
~NamedValueSet() noexcept;
bool operator== (const NamedValueSet&) const noexcept;
bool operator!= (const NamedValueSet&) const noexcept;
const NamedValueSet::NamedValue* begin() const noexcept { return values.begin(); }
const NamedValueSet::NamedValue* end() const noexcept { return values.end(); }
//==============================================================================
int size() const noexcept;
bool isEmpty() const noexcept;
const var& operator[] (const Identifier& name) const noexcept;
var getWithDefault (const Identifier& name, const var& defaultReturnValue) const;
bool set (const Identifier& name, const var& newValue);
bool set (const Identifier& name, var&& newValue);
bool contains (const Identifier& name) const noexcept;
bool remove (const Identifier& name);
Identifier getName (int index) const noexcept;
var* getVarPointer (const Identifier& name) noexcept;
const var* getVarPointer (const Identifier& name) const noexcept;
const var& getValueAt (int index) const noexcept;
var* getVarPointerAt (int index) noexcept;
const var* getVarPointerAt (int index) const noexcept;
int indexOf (const Identifier& name) const noexcept;
void clear();
//==============================================================================
void setFromXmlAttributes (const XmlElement& xml);
void copyToXmlAttributes (XmlElement& xml) const;
private:
//==============================================================================
Array<NamedValue> values;
};
} // namespace juce
juce::Identifier
Definition juce_Identifier.h:39
juce::NamedValueSet::NamedValueSet
NamedValueSet() noexcept
Definition juce_NamedValueSet.cpp:58
juce::var
Definition juce_Variant.h:42
juce::NamedValueSet::NamedValue
Definition juce_NamedValueSet.h:40