forked from bblanchon/ArduinoJson
Fixed remaining cpplint warnings
This commit is contained in:
@ -14,6 +14,8 @@
|
||||
// This class reproduces Arduino's Print
|
||||
class Print {
|
||||
public:
|
||||
virtual ~Print() {}
|
||||
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
|
||||
size_t print(const char[]);
|
||||
|
@ -16,7 +16,7 @@ namespace Internals {
|
||||
// for your own purpose, like logging.
|
||||
class IndentedPrint : public Print {
|
||||
public:
|
||||
IndentedPrint(Print &p) : sink(&p) {
|
||||
explicit IndentedPrint(Print &p) : sink(&p) {
|
||||
level = 0;
|
||||
tabSize = 2;
|
||||
isNewLine = true;
|
||||
|
@ -21,7 +21,7 @@ class List {
|
||||
typedef ListIterator<T> iterator;
|
||||
typedef ListConstIterator<T> const_iterator;
|
||||
|
||||
List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
|
||||
explicit List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
|
||||
|
||||
bool success() const { return _buffer != NULL; }
|
||||
int size() const;
|
||||
|
@ -48,7 +48,7 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>,
|
||||
|
||||
private:
|
||||
// constructor is private: instance must be created via a JsonBuffer
|
||||
JsonArray(JsonBuffer *buffer) : List(buffer) {}
|
||||
explicit JsonArray(JsonBuffer *buffer) : List(buffer) {}
|
||||
|
||||
static JsonArray _invalid;
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ class JsonObject : public Internals::JsonPrintable<JsonObject>,
|
||||
|
||||
private:
|
||||
// constructor is private, instance must be created via JsonBuffer
|
||||
JsonObject(JsonBuffer *buffer) : List(buffer) {}
|
||||
explicit JsonObject(JsonBuffer *buffer) : List(buffer) {}
|
||||
|
||||
JsonVariant &add(key_type key) { return (*this)[key]; }
|
||||
|
||||
|
@ -83,8 +83,8 @@ class JsonVariant : public Internals::JsonPrintable<JsonVariant> {
|
||||
operator JsonObject &() const;
|
||||
|
||||
const char *asString() const { return this->as<const char *>(); }
|
||||
JsonArray &asArray() const { return this->as<JsonArray &>(); };
|
||||
JsonObject &asObject() const { return this->as<JsonObject &>(); };
|
||||
JsonArray &asArray() const { return this->as<JsonArray &>(); }
|
||||
JsonObject &asObject() const { return this->as<JsonObject &>(); }
|
||||
|
||||
template <typename T>
|
||||
T as() const {
|
||||
@ -111,7 +111,7 @@ class JsonVariant : public Internals::JsonPrintable<JsonVariant> {
|
||||
JsonVariant &operator[](const char *key);
|
||||
|
||||
private:
|
||||
JsonVariant(Internals::JsonVariantType type) : _type(type) {}
|
||||
explicit JsonVariant(Internals::JsonVariantType type) : _type(type) {}
|
||||
|
||||
Internals::JsonVariantType _type;
|
||||
Internals::JsonVariantContent _content;
|
||||
|
@ -1,5 +1,5 @@
|
||||
CPPLINT="python third-party/cpplint/cpplint.py"
|
||||
FLAGS="--filter=-runtime/printf,-runtime/int,-readability/todo,-build/namespace,-runtime/references"
|
||||
FLAGS="--filter=-runtime/printf,-runtime/int,-readability/todo,-build/namespace,-runtime/references,-readability/streams"
|
||||
|
||||
cd ..
|
||||
$CPPLINT $FLAGS $(find include src test -regex ".*\.[hc]pp$")
|
@ -1,7 +1,8 @@
|
||||
/*
|
||||
* Arduino JSON library
|
||||
* Benoit Blanchon 2014 - MIT License
|
||||
*/
|
||||
// Copyright Benoit Blanchon 2014
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
||||
|
@ -9,10 +9,10 @@
|
||||
|
||||
class StreamPrintAdapter : public Print {
|
||||
public:
|
||||
StreamPrintAdapter(std::ostream& os) : _os(os) {}
|
||||
explicit StreamPrintAdapter(std::ostream& os) : _os(os) {}
|
||||
|
||||
virtual size_t write(uint8_t c) {
|
||||
_os << (char)c;
|
||||
_os << static_cast<char>(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user