26 NamedValueSet::NamedValue::NamedValue() noexcept {}
27 NamedValueSet::NamedValue::~NamedValue() noexcept {}
29 NamedValueSet::NamedValue::NamedValue (
const Identifier& n,
const var& v) : name (n), value (v) {}
30 NamedValueSet::NamedValue::NamedValue (
const NamedValue& other) : NamedValue (other.name, other.value) {}
32 NamedValueSet::NamedValue::NamedValue (NamedValue&& other) noexcept
33 : NamedValue (std::move (other.name),
34 std::move (other.value))
37 NamedValueSet::NamedValue::NamedValue (
const Identifier& n, var&& v) noexcept
38 : name (n), value (std::move (v))
42 NamedValueSet::NamedValue::NamedValue (Identifier&& n, var&& v) noexcept
43 : name (std::move (n)),
47 NamedValueSet::NamedValue& NamedValueSet::NamedValue::operator= (NamedValue&& other) noexcept
49 name = std::move (other.name);
50 value = std::move (other.value);
54 bool NamedValueSet::NamedValue::operator== (
const NamedValue& other)
const noexcept {
return name == other.name && value == other.value; }
55 bool 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;
78 NamedValueSet& NamedValueSet::operator= (NamedValueSet&& other) noexcept
80 other.values.swapWith (values);
91 auto num = values.size();
93 if (num != other.values.size())
96 for (
int i = 0; i < num; ++i)
99 if (values.getReference(i).name == other.values.getReference(i).name)
101 if (values.getReference(i).value != other.values.getReference(i).value)
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)
123 bool NamedValueSet::operator!= (
const NamedValueSet& other)
const noexcept {
return ! operator== (other); }
128 static const var& getNullVarRef() noexcept
136 if (
auto* v = getVarPointer (name))
139 return getNullVarRef();
147 return defaultReturnValue;
152 for (
auto& i : values)
163 if (v->equalsWithSameType (newValue))
166 *v = std::move (newValue);
170 values.add ({ name, std::move (newValue) });
178 if (v->equalsWithSameType (newValue))
185 values.add ({ name, newValue });
191 return getVarPointer (name) !=
nullptr;
196 auto numValues = values.size();
198 for (
int i = 0; i < numValues; ++i)
199 if (values.getReference(i).name == name)
207 auto numValues = values.size();
209 for (
int i = 0; i < numValues; ++i)
211 if (values.getReference(i).name == name)
223 if (isPositiveAndBelow (index, values.size()))
224 return values.getReference (index).name;
232 if (isPositiveAndBelow (index, values.size()))
233 return values.getReference (index).value;
236 return getNullVarRef();
241 if (isPositiveAndBelow (index, values.size()))
242 return &(values.getReference (index).value);
251 for (
auto* att = xml.attributes.
get(); att !=
nullptr; att = att->nextListItem)
253 if (att->name.toString().startsWith (
"base64:"))
259 values.add ({ att->name.toString().substring (7),
var (mb) });
264 values.add ({ att->name,
var (att->value) });
270 for (
auto& i : values)
272 if (
auto* mb = i.value.getBinaryData())
274 xml.
setAttribute (
"base64:" + i.name.toString(), mb->toBase64Encoding());
279 jassert (! i.value.isObject());
280 jassert (! i.value.isMethod());
281 jassert (! i.value.isArray());