Skip to content

Commit

Permalink
Rename ValueSetter to ValueSaver
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Jan 12, 2018
1 parent 7d05699 commit c2d1cf8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Expand Up @@ -13,7 +13,7 @@ namespace ArduinoJson {
namespace Internals {

template <typename Source, typename Enable = void>
struct ValueSetter {
struct ValueSaver {
template <typename Destination>
static bool save(JsonBuffer*, Destination& destination, Source source) {
destination = source;
Expand All @@ -22,10 +22,10 @@ struct ValueSetter {
};

template <typename Source>
struct ValueSetter<Source, typename TypeTraits::EnableIf<
TypeTraits::IsString<Source>::value>::type> {
template <typename TDestination>
static bool save(JsonBuffer* buffer, TDestination& destination,
struct ValueSaver<Source, typename TypeTraits::EnableIf<
TypeTraits::IsString<Source>::value>::type> {
template <typename Destination>
static bool save(JsonBuffer* buffer, Destination& destination,
Source source) {
return StringTraits<Source>::save(source, destination, buffer);
}
Expand Down
6 changes: 3 additions & 3 deletions src/ArduinoJson/JsonArray.hpp
Expand Up @@ -7,7 +7,7 @@
#include "Data/JsonBufferAllocated.hpp"
#include "Data/List.hpp"
#include "Data/ReferenceType.hpp"
#include "Data/ValueSetter.hpp"
#include "Data/ValueSaver.hpp"
#include "JsonVariant.hpp"
#include "Serialization/JsonPrintable.hpp"
#include "StringTraits/StringTraits.hpp"
Expand Down Expand Up @@ -206,14 +206,14 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>,
bool set_impl(size_t index, TValueRef value) {
iterator it = begin() += index;
if (it == end()) return false;
return Internals::ValueSetter<TValueRef>::save(_buffer, *it, value);
return Internals::ValueSaver<TValueRef>::save(_buffer, *it, value);
}

template <typename TValueRef>
bool add_impl(TValueRef value) {
iterator it = Internals::List<JsonVariant>::add();
if (it == end()) return false;
return Internals::ValueSetter<TValueRef>::save(_buffer, *it, value);
return Internals::ValueSaver<TValueRef>::save(_buffer, *it, value);
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/ArduinoJson/JsonObject.hpp
Expand Up @@ -7,7 +7,7 @@
#include "Data/JsonBufferAllocated.hpp"
#include "Data/List.hpp"
#include "Data/ReferenceType.hpp"
#include "Data/ValueSetter.hpp"
#include "Data/ValueSaver.hpp"
#include "JsonPair.hpp"
#include "Serialization/JsonPrintable.hpp"
#include "StringTraits/StringTraits.hpp"
Expand Down Expand Up @@ -291,10 +291,10 @@ class JsonObject : public Internals::JsonPrintable<JsonObject>,
if (it == end()) return false;

bool key_ok =
Internals::ValueSetter<TStringRef>::save(_buffer, it->key, key);
Internals::ValueSaver<TStringRef>::save(_buffer, it->key, key);
if (!key_ok) return false;
}
return Internals::ValueSetter<TValueRef>::save(_buffer, it->value, value);
return Internals::ValueSaver<TValueRef>::save(_buffer, it->value, value);
}

template <typename TStringRef, typename TValue>
Expand Down

0 comments on commit c2d1cf8

Please sign in to comment.