26NamedValueSet::NamedValue::NamedValue() noexcept {}
27NamedValueSet::NamedValue::~NamedValue() noexcept {}
29NamedValueSet::NamedValue::NamedValue (
const Identifier& n,
const var& v) : name (n), value (v) {}
30NamedValueSet::NamedValue::NamedValue (
const NamedValue& other) : NamedValue (other.name, other.value) {}
32NamedValueSet::NamedValue::NamedValue (NamedValue&& other) noexcept
33 : NamedValue (std::move (other.name),
34 std::move (other.value))
37NamedValueSet::NamedValue::NamedValue (
const Identifier& n, var&& v) noexcept
38 : name (n), value (std::move (v))
42NamedValueSet::NamedValue::NamedValue (Identifier&& n, var&& v) noexcept
43 : name (std::move (n)),
47NamedValueSet::NamedValue& NamedValueSet::NamedValue::operator= (NamedValue&& other)
noexcept
49 name = std::move (other.name);
50 value = std::move (other.value);
54bool NamedValueSet::NamedValue::operator== (
const NamedValue& other)
const noexcept {
return name == other.name && value == other.value; }
55bool NamedValueSet::NamedValue::operator!= (
const NamedValue& other)
const noexcept {
return ! operator== (other); }
64 : values (std::move (other.values)) {}
67 : values (std::move (list))
74 values =
other.values;
78NamedValueSet& NamedValueSet::operator= (NamedValueSet&& other)
noexcept
96 for (
int i = 0; i <
num; ++i)
107 for (
int j = i;
j <
num; ++
j)
109 if (
auto*
otherVal =
other.getVarPointer (values.getReference(
j).name))
110 if (values.getReference(
j).value == *
otherVal)
136 if (
auto* v = getVarPointer (name))
139 return getNullVarRef();
152 for (
auto& i : values)
161 for (
auto& i : values)
172 if (v->equalsWithSameType (newValue))
175 *v = std::move (newValue);
179 values.
add ({ name, std::move (newValue) });
187 if (v->equalsWithSameType (newValue))
194 values.
add ({ name, newValue });
200 return getVarPointer (name) !=
nullptr;
208 if (values.getReference(i).name == name)
232 if (isPositiveAndBelow (index, values.size()))
233 return values.getReference (index).name;
241 if (isPositiveAndBelow (index, values.size()))
245 return getNullVarRef();
250 if (isPositiveAndBelow (index, values.size()))
251 return &(values.getReference (index).value);
258 if (isPositiveAndBelow (index, values.size()))
259 return &(values.getReference (index).value);
268 for (
auto*
att = xml.attributes.
get();
att !=
nullptr;
att =
att->nextListItem)
270 if (
att->name.toString().startsWith (
"base64:"))
274 if (
mb.fromBase64Encoding (
att->value))
276 values.
add ({
att->name.toString().substring (7),
var (
mb) });
287 for (
auto& i : values)
289 if (
auto*
mb = i.value.getBinaryData())
291 xml.
setAttribute (
"base64:" + i.name.toString(),
mb->toBase64Encoding());
296 jassert (! i.value.isObject());
297 jassert (! i.value.isMethod());
298 jassert (! i.value.isArray());
void swapWith(OtherArrayType &otherArray) noexcept
bool isEmpty() const noexcept
int size() const noexcept
void remove(int indexToRemove)
void add(const ElementType &newElement)
ElementType & getReference(int index) noexcept
ObjectType * get() const noexcept
var * getVarPointerAt(int index) noexcept
bool set(const Identifier &name, const var &newValue)
bool contains(const Identifier &name) const noexcept
bool remove(const Identifier &name)
int indexOf(const Identifier &name) const noexcept
const var & getValueAt(int index) const noexcept
bool isEmpty() const noexcept
bool operator==(const NamedValueSet &) const noexcept
Identifier getName(int index) const noexcept
var getWithDefault(const Identifier &name, const var &defaultReturnValue) const
int size() const noexcept
const var & operator[](const Identifier &name) const noexcept
var * getVarPointer(const Identifier &name) noexcept
void copyToXmlAttributes(XmlElement &xml) const
void setFromXmlAttributes(const XmlElement &xml)
void setAttribute(const Identifier &attributeName, const String &newValue)