mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-07 04:10:08 +00:00
Added a standard iterator to NamedValueSet
This commit is contained in:
parent
2fd331fac7
commit
e35aba3444
2 changed files with 39 additions and 35 deletions
|
|
@ -26,40 +26,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
struct NamedValueSet::NamedValue
|
||||
{
|
||||
NamedValue() noexcept {}
|
||||
NamedValue (const Identifier& n, const var& v) : name (n), value (v) {}
|
||||
NamedValue (const NamedValue& other) : name (other.name), value (other.value) {}
|
||||
|
||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
|
||||
NamedValue (NamedValue&& other) noexcept
|
||||
: name (static_cast<Identifier&&> (other.name)),
|
||||
value (static_cast<var&&> (other.value))
|
||||
{
|
||||
}
|
||||
|
||||
NamedValue (Identifier&& n, var&& v) noexcept
|
||||
: name (static_cast<Identifier&&> (n)),
|
||||
value (static_cast<var&&> (v))
|
||||
{
|
||||
}
|
||||
|
||||
NamedValue& operator= (NamedValue&& other) noexcept
|
||||
{
|
||||
name = static_cast<Identifier&&> (other.name);
|
||||
value = static_cast<var&&> (other.value);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool operator== (const NamedValue& other) const noexcept { return name == other.name && value == other.value; }
|
||||
bool operator!= (const NamedValue& other) const noexcept { return ! operator== (other); }
|
||||
|
||||
Identifier name;
|
||||
var value;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
NamedValueSet::NamedValueSet() noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -60,6 +60,45 @@ public:
|
|||
bool operator!= (const NamedValueSet&) const;
|
||||
|
||||
//==============================================================================
|
||||
struct NamedValue
|
||||
{
|
||||
NamedValue() noexcept {}
|
||||
NamedValue (const Identifier& n, const var& v) : name (n), value (v) {}
|
||||
NamedValue (const NamedValue& other) : name (other.name), value (other.value) {}
|
||||
|
||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
|
||||
NamedValue (NamedValue&& other) noexcept
|
||||
: name (static_cast<Identifier&&> (other.name)),
|
||||
value (static_cast<var&&> (other.value))
|
||||
{
|
||||
}
|
||||
|
||||
NamedValue (Identifier&& n, var&& v) noexcept
|
||||
: name (static_cast<Identifier&&> (n)),
|
||||
value (static_cast<var&&> (v))
|
||||
{
|
||||
}
|
||||
|
||||
NamedValue& operator= (NamedValue&& other) noexcept
|
||||
{
|
||||
name = static_cast<Identifier&&> (other.name);
|
||||
value = static_cast<var&&> (other.value);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool operator== (const NamedValue& other) const noexcept { return name == other.name && value == other.value; }
|
||||
bool operator!= (const NamedValue& other) const noexcept { return ! operator== (other); }
|
||||
|
||||
Identifier name;
|
||||
var value;
|
||||
};
|
||||
|
||||
NamedValueSet::NamedValue* begin() { return values.begin(); }
|
||||
NamedValueSet::NamedValue* end() { return values.end(); }
|
||||
|
||||
//==============================================================================
|
||||
|
||||
/** Returns the total number of values that the set contains. */
|
||||
int size() const noexcept;
|
||||
|
||||
|
|
@ -140,7 +179,6 @@ public:
|
|||
|
||||
private:
|
||||
//==============================================================================
|
||||
struct NamedValue;
|
||||
Array<NamedValue> values;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue