Now use uint8_t to store decimal count

This commit is contained in:
Benoit Blanchon
2014-11-03 18:28:24 +01:00
parent 2f8fde6772
commit 04cde11a04
6 changed files with 7 additions and 6 deletions

View File

@ -28,7 +28,7 @@ class JsonWriter {
void writeString(const char *value);
void writeInteger(long value);
void writeBoolean(bool value);
void writeDouble(double value, int decimals);
void writeDouble(double value, uint8_t decimals);
void writeColon() { _length += _sink->write(':'); }
void writeComma() { _length += _sink->write(','); }

View File

@ -41,7 +41,7 @@ class JsonArray : public JsonPrintable<JsonArray>,
}
value_type &add();
void add(double value, int decimals) { add().set(value, decimals); }
void add(double value, uint8_t decimals) { add().set(value, decimals); }
void add(JsonArray &nestedArray) { add().set(nestedArray); }
void add(JsonObject &nestedObject) { add().set(nestedObject); }

View File

@ -7,6 +7,7 @@
#pragma once
#include <stddef.h>
#include <stdint.h> // for uint8_t
#include "Internals/JsonValueContent.hpp"
#include "Internals/JsonValueType.hpp"
@ -25,7 +26,7 @@ class JsonValue {
JsonValue() : _type(Internals::JSON_UNDEFINED) {}
void set(bool value);
void set(double value, int decimals = 2);
void set(double value, uint8_t decimals = 2);
void set(signed char value) { set(static_cast<long>(value)); }
void set(signed int value) { set(static_cast<long>(value)); }
void set(signed long value);