mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-21 06:22:23 +02:00
Renamed and moved internal files
This commit is contained in:
53
src/ArduinoJson/Object/Pair.hpp
Normal file
53
src/ArduinoJson/Object/Pair.hpp
Normal file
@ -0,0 +1,53 @@
|
||||
// ArduinoJson - arduinojson.org
|
||||
// Copyright Benoit Blanchon 2014-2018
|
||||
// MIT License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../Variant/VariantRef.hpp"
|
||||
#include "Key.hpp"
|
||||
|
||||
namespace ARDUINOJSON_NAMESPACE {
|
||||
// A key value pair for ObjectData.
|
||||
class Pair {
|
||||
public:
|
||||
Pair(MemoryPool* memoryPool, VariantSlot* slot) : _key(slot) {
|
||||
if (slot) {
|
||||
_value = VariantRef(memoryPool, &slot->value);
|
||||
}
|
||||
}
|
||||
|
||||
Key key() const {
|
||||
return _key;
|
||||
}
|
||||
|
||||
VariantRef value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
private:
|
||||
Key _key;
|
||||
VariantRef _value;
|
||||
};
|
||||
|
||||
class PairConst {
|
||||
public:
|
||||
PairConst(const VariantSlot* slot) : _key(slot) {
|
||||
if (slot) {
|
||||
_value = VariantConstRef(&slot->value);
|
||||
}
|
||||
}
|
||||
|
||||
Key key() const {
|
||||
return _key;
|
||||
}
|
||||
|
||||
VariantConstRef value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
private:
|
||||
Key _key;
|
||||
VariantConstRef _value;
|
||||
};
|
||||
} // namespace ARDUINOJSON_NAMESPACE
|
Reference in New Issue
Block a user