Loading...
Searching...
No Matches
juce::NamedValueSet Class Reference

`#include <juce_NamedValueSet.h>`

## Classes

struct | NamedValue

## Public Member Functions

| 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
const NamedValueSet::NamedValue * | end () const noexcept
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

## Detailed Description

Holds a set of named var objects.

This can be used as a basic structure to hold a set of var object, which can be retrieved by using their identifier.

Definition at line 34 of file juce_NamedValueSet.h.

## Constructor & Destructor Documentation

## NamedValueSet() [1/4]

juce::NamedValueSet::NamedValueSet | ( |  | ) |

noexcept

Creates an empty set.

Definition at line 58 of file juce_NamedValueSet.cpp.

Referenced by NamedValueSet(), and operator==().

## NamedValueSet() [2/4]

juce::NamedValueSet::NamedValueSet | ( | const NamedValueSet & | other | ) |

Definition at line 61 of file juce_NamedValueSet.cpp.

## NamedValueSet() [3/4]

juce::NamedValueSet::NamedValueSet | ( | NamedValueSet && | other | ) |

noexcept

Definition at line 63 of file juce_NamedValueSet.cpp.

## NamedValueSet() [4/4]

juce::NamedValueSet::NamedValueSet | ( | std::initializer_list< NamedValue > | list | ) |

Creates a NamedValueSet from a list of names and properties.

Definition at line 66 of file juce_NamedValueSet.cpp.

## ~NamedValueSet()

juce::NamedValueSet::~NamedValueSet | ( |  | ) |

noexcept

Destructor.

Definition at line 59 of file juce_NamedValueSet.cpp.

Referenced by ~NamedValueSet().

## Member Function Documentation

## begin()

const NamedValueSet::NamedValue * juce::NamedValueSet::begin | ( |  | ) | const

inline noexcept

Definition at line 80 of file juce_NamedValueSet.h.

## clear()

void juce::NamedValueSet::clear | ( |  | ) |

Removes all values.

Definition at line 84 of file juce_NamedValueSet.cpp.

## contains()

bool juce::NamedValueSet::contains | ( | const Identifier & | name | ) | const

noexcept

Returns true if the set contains an item with the specified name.

Definition at line 198 of file juce_NamedValueSet.cpp.

## copyToXmlAttributes()

void juce::NamedValueSet::copyToXmlAttributes | ( | XmlElement & | xml | ) | const

Sets attributes in an XML element corresponding to each of this object's properties.

Definition at line 285 of file juce_NamedValueSet.cpp.

## end()

const NamedValueSet::NamedValue * juce::NamedValueSet::end | ( |  | ) | const

inline noexcept

Definition at line 81 of file juce_NamedValueSet.h.

## getName()

Identifier juce::NamedValueSet::getName | ( | int | index | ) | const

noexcept

Returns the name of the value at a given index. The index must be between 0 and size() - 1.

Definition at line 230 of file juce_NamedValueSet.cpp.

## getValueAt()

const var & juce::NamedValueSet::getValueAt | ( | int | index | ) | const

noexcept

Returns the value of the item at a given index. The index must be between 0 and size() - 1.

Definition at line 239 of file juce_NamedValueSet.cpp.

## getVarPointer() [1/2]

const var * juce::NamedValueSet::getVarPointer | ( | const Identifier & | name | ) | const

noexcept

Returns a pointer to the var that holds a named value, or null if there is no value with this name.

Do not use this method unless you really need access to the internal var object for some reason - for normal reading and writing always prefer operator[]() and set(). Also note that the pointer returned may become invalid as soon as any subsequent methods are called on the NamedValueSet.

Definition at line 159 of file juce_NamedValueSet.cpp.

## getVarPointer() [2/2]

var * juce::NamedValueSet::getVarPointer | ( | const Identifier & | name | ) |

noexcept

Returns a pointer to the var that holds a named value, or null if there is no value with this name.

Do not use this method unless you really need access to the internal var object for some reason - for normal reading and writing always prefer operator[]() and set(). Also note that the pointer returned may become invalid as soon as any subsequent methods are called on the NamedValueSet.

Definition at line 150 of file juce_NamedValueSet.cpp.

Referenced by contains(), getWithDefault(), operator[](), set(), and set().

## getVarPointerAt() [1/2]

const var * juce::NamedValueSet::getVarPointerAt | ( | int | index | ) | const

noexcept

Returns the value of the item at a given index. The index must be between 0 and size() - 1, or this will return a nullptr Also note that the pointer returned may become invalid as soon as any subsequent methods are called on the NamedValueSet.

Definition at line 256 of file juce_NamedValueSet.cpp.

## getVarPointerAt() [2/2]

var * juce::NamedValueSet::getVarPointerAt | ( | int | index | ) |

noexcept

Returns the value of the item at a given index. The index must be between 0 and size() - 1, or this will return a nullptr Also note that the pointer returned may become invalid as soon as any subsequent methods are called on the NamedValueSet.

Definition at line 248 of file juce_NamedValueSet.cpp.

## getWithDefault()

var juce::NamedValueSet::getWithDefault | ( | const Identifier & | name,
|  | const var & | defaultReturnValue ) const

Tries to return the named value, but if no such value is found, this will instead return the supplied default value.

Definition at line 142 of file juce_NamedValueSet.cpp.

## indexOf()

int juce::NamedValueSet::indexOf | ( | const Identifier & | name | ) | const

noexcept

Returns the index of the given name, or -1 if it's not found.

Definition at line 203 of file juce_NamedValueSet.cpp.

## isEmpty()

bool juce::NamedValueSet::isEmpty | ( |  | ) | const

noexcept

Returns true if the set is empty.

Definition at line 126 of file juce_NamedValueSet.cpp.

## operator!=()

bool juce::NamedValueSet::operator!= | ( | const NamedValueSet & | other | ) | const

noexcept

Definition at line 123 of file juce_NamedValueSet.cpp.

## operator=() [1/2]

NamedValueSet & juce::NamedValueSet::operator= | ( | const NamedValueSet & | other | ) |

Definition at line 71 of file juce_NamedValueSet.cpp.

## operator=() [2/2]

NamedValueSet & juce::NamedValueSet::operator= | ( | NamedValueSet && | other | ) |

noexcept

Definition at line 78 of file juce_NamedValueSet.cpp.

## operator==()

bool juce::NamedValueSet::operator== | ( | const NamedValueSet & | other | ) | const

noexcept

Two NamedValueSets are considered equal if they contain all the same key/value pairs, regardless of the order.

Definition at line 89 of file juce_NamedValueSet.cpp.

## operator[]()

const var & juce::NamedValueSet::operator[] | ( | const Identifier & | name | ) | const

noexcept

Returns the value of a named item. If the name isn't found, this will return a void variant.

Definition at line 134 of file juce_NamedValueSet.cpp.

## remove()

bool juce::NamedValueSet::remove | ( | const Identifier & | name | ) |

Removes a value from the set.

Returns
  true if a value was removed; false if there was no value with the name that was given.

Definition at line 214 of file juce_NamedValueSet.cpp.

## set() [1/2]

bool juce::NamedValueSet::set | ( | const Identifier & | name,
|  | const var & | newValue )

Changes or adds a named value.

Returns
  true if a value was changed or added; false if the value was already set the value passed-in.

Definition at line 183 of file juce_NamedValueSet.cpp.

## set() [2/2]

bool juce::NamedValueSet::set | ( | const Identifier & | name,
|  | var && | newValue )

Changes or adds a named value.

Returns
  true if a value was changed or added; false if the value was already set the value passed-in.

Definition at line 168 of file juce_NamedValueSet.cpp.

## setFromXmlAttributes()

void juce::NamedValueSet::setFromXmlAttributes | ( | const XmlElement & | xml | ) |

Sets properties to the values of all of an XML element's attributes.

Definition at line 264 of file juce_NamedValueSet.cpp.

## size()

int juce::NamedValueSet::size | ( |  | ) | const

noexcept

Returns the total number of values that the set contains.

Definition at line 125 of file juce_NamedValueSet.cpp.

Referenced by juce::JSONUtils::deepEqual().

The documentation for this class was generated from the following files:

- juce_NamedValueSet.h
- juce_NamedValueSet.cpp