Moved PrettyPrintDecorator into the namespace ArduinoJson::Generator

This commit is contained in:
Benoit Blanchon
2014-08-25 13:19:07 +02:00
parent 1df6cde026
commit d877d77b63
5 changed files with 59 additions and 49 deletions

View File

@ -5,6 +5,8 @@
#include "PrettyPrintDecorator.h" #include "PrettyPrintDecorator.h"
using namespace ArduinoJson::Generator;
size_t PrettyPrintDecorator::write(uint8_t c) size_t PrettyPrintDecorator::write(uint8_t c)
{ {
size_t n = inString ? handleStringChar(c) : handleMarkupChar(c); size_t n = inString ? handleStringChar(c) : handleMarkupChar(c);

View File

@ -8,9 +8,13 @@
#include "Print.h" #include "Print.h"
class PrettyPrintDecorator : public Print namespace ArduinoJson
{ {
public: namespace Generator
{
class PrettyPrintDecorator : public Print
{
public:
PrettyPrintDecorator(Print& p) PrettyPrintDecorator(Print& p)
: indent(0), sink(p) : indent(0), sink(p)
@ -21,7 +25,7 @@ public:
virtual size_t write(uint8_t); virtual size_t write(uint8_t);
private: private:
int indent; int indent;
uint8_t previousChar; uint8_t previousChar;
Print& sink; Print& sink;
@ -58,5 +62,6 @@ private:
{ {
return sink.write(c); return sink.write(c);
} }
}; };
}
}

View File

@ -8,6 +8,7 @@
#include "StringBuilder.h" #include "StringBuilder.h"
using namespace ArduinoJson::Internals; using namespace ArduinoJson::Internals;
using namespace ArduinoJson::Generator;
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace JsonGeneratorTests namespace JsonGeneratorTests

View File

@ -8,6 +8,7 @@
#include "StringBuilder.h" #include "StringBuilder.h"
using namespace ArduinoJson::Internals; using namespace ArduinoJson::Internals;
using namespace ArduinoJson::Generator;
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace JsonGeneratorTests namespace JsonGeneratorTests

View File

@ -8,6 +8,7 @@
#include "StringBuilder.h" #include "StringBuilder.h"
using namespace ArduinoJson::Internals; using namespace ArduinoJson::Internals;
using namespace ArduinoJson::Generator;
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace JsonGeneratorTests namespace JsonGeneratorTests