Added namespace

This commit is contained in:
Benoît Blanchon
2014-07-03 13:54:27 +02:00
parent 538b15b400
commit bae5c36f41
12 changed files with 248 additions and 212 deletions

View File

@ -8,6 +8,10 @@
#include "JsonObjectBase.h" #include "JsonObjectBase.h"
#include "StringBuilder.h" #include "StringBuilder.h"
namespace ArduinoJson
{
namespace Generator
{
template<int N> template<int N>
class JsonArray : public JsonObjectBase class JsonArray : public JsonObjectBase
{ {
@ -63,4 +67,5 @@ private:
return n; return n;
} }
}; };
}
}

View File

@ -7,6 +7,10 @@
#include "JsonObjectBase.h" #include "JsonObjectBase.h"
namespace ArduinoJson
{
namespace Generator
{
template<int N> template<int N>
class JsonHashTable : public JsonObjectBase class JsonHashTable : public JsonObjectBase
{ {
@ -75,4 +79,5 @@ private:
return n; return n;
} }
}; };
}
}

View File

@ -9,6 +9,10 @@
#include "Print.h" #include "Print.h"
#include "Printable.h" #include "Printable.h"
namespace ArduinoJson
{
namespace Generator
{
class JsonObjectBase : public Printable class JsonObjectBase : public Printable
{ {
public: public:
@ -21,4 +25,5 @@ public:
virtual size_t printTo(Print& p) const = 0; virtual size_t printTo(Print& p) const = 0;
}; };
}
}

View File

@ -5,6 +5,8 @@
#include "JsonValue.h" #include "JsonValue.h"
using namespace ArduinoJson::Generator;
size_t JsonValue::printBoolTo(Print& p) const size_t JsonValue::printBoolTo(Print& p) const
{ {
return p.print(content.asBool ? "true" : "false"); return p.print(content.asBool ? "true" : "false");

View File

@ -8,6 +8,10 @@
#include "Printable.h" #include "Printable.h"
#include "StringBuilder.h" #include "StringBuilder.h"
namespace ArduinoJson
{
namespace Generator
{
class JsonValue : public Printable class JsonValue : public Printable
{ {
public: public:
@ -92,3 +96,5 @@ private:
size_t printPrintableTo(Print& p) const; size_t printPrintableTo(Print& p) const;
size_t printStringTo(Print& p) const; size_t printStringTo(Print& p) const;
}; };
}
}

View File

@ -5,6 +5,8 @@
#include "StringBuilder.h" #include "StringBuilder.h"
using namespace ArduinoJson::Generator;
size_t StringBuilder::write(uint8_t c) size_t StringBuilder::write(uint8_t c)
{ {
if (length >= capacity) return 0; if (length >= capacity) return 0;

View File

@ -7,6 +7,10 @@
#include "Print.h" #include "Print.h"
namespace ArduinoJson
{
namespace Generator
{
class StringBuilder : public Print class StringBuilder : public Print
{ {
public: public:
@ -23,4 +27,5 @@ private:
int capacity; int capacity;
int length; int length;
}; };
}
}

View File

@ -3,6 +3,7 @@
#include "JsonHashTable.h" #include "JsonHashTable.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace ArduinoJson::Generator;
namespace JsonGeneratorTests namespace JsonGeneratorTests
{ {

View File

@ -3,6 +3,7 @@
#include "JsonHashTable.h" #include "JsonHashTable.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace ArduinoJson::Generator;
namespace JsonGeneratorTests namespace JsonGeneratorTests
{ {

View File

@ -3,6 +3,7 @@
#include "JsonValue.h" #include "JsonValue.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace ArduinoJson::Generator;
namespace JsonGeneratorTests namespace JsonGeneratorTests
{ {

View File

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

View File

@ -5,6 +5,8 @@
#include <JsonGenerator.h> #include <JsonGenerator.h>
using namespace ArduinoJson::Generator;
void setup() void setup()
{ {
Serial.begin(9600); Serial.begin(9600);