forked from bblanchon/ArduinoJson
Added namespace ArduinoJson::Internals for private types
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "EscapedString.h"
|
#include "EscapedString.h"
|
||||||
|
|
||||||
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
size_t EscapedString::printTo(Print& p) const
|
size_t EscapedString::printTo(Print& p) const
|
||||||
{
|
{
|
||||||
|
@ -7,18 +7,23 @@
|
|||||||
|
|
||||||
#include "Print.h"
|
#include "Print.h"
|
||||||
|
|
||||||
class EscapedString
|
namespace ArduinoJson
|
||||||
{
|
{
|
||||||
public:
|
namespace Internals
|
||||||
|
|
||||||
void set(const char* s)
|
|
||||||
{
|
{
|
||||||
rawString = s;
|
class EscapedString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
void set(const char* s)
|
||||||
|
{
|
||||||
|
rawString = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t printTo(Print&) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const char* rawString;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
size_t printTo(Print&) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char* rawString;
|
|
||||||
};
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace ArduinoJson
|
|||||||
using JsonObjectBase::printTo;
|
using JsonObjectBase::printTo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JsonValue items[N];
|
Internals::JsonValue items[N];
|
||||||
int itemCount;
|
int itemCount;
|
||||||
|
|
||||||
virtual size_t printTo(Print& p) const
|
virtual size_t printTo(Print& p) const
|
||||||
|
@ -53,8 +53,8 @@ namespace ArduinoJson
|
|||||||
|
|
||||||
struct KeyValuePair
|
struct KeyValuePair
|
||||||
{
|
{
|
||||||
EscapedString key;
|
Internals::EscapedString key;
|
||||||
JsonValue value;
|
Internals::JsonValue value;
|
||||||
};
|
};
|
||||||
|
|
||||||
KeyValuePair items[N];
|
KeyValuePair items[N];
|
||||||
|
@ -19,6 +19,8 @@ namespace ArduinoJson
|
|||||||
|
|
||||||
size_t printTo(char* buffer, size_t bufferSize)
|
size_t printTo(char* buffer, size_t bufferSize)
|
||||||
{
|
{
|
||||||
|
using namespace Internals;
|
||||||
|
|
||||||
StringBuilder sb(buffer, bufferSize);
|
StringBuilder sb(buffer, bufferSize);
|
||||||
return printTo(sb);
|
return printTo(sb);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "EscapedString.h"
|
#include "EscapedString.h"
|
||||||
#include "JsonValue.h"
|
#include "JsonValue.h"
|
||||||
|
|
||||||
using namespace ArduinoJson::Generator;
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
size_t JsonValue::printBoolTo(const Content& c, Print& p)
|
size_t JsonValue::printBoolTo(const Content& c, Print& p)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace ArduinoJson
|
namespace ArduinoJson
|
||||||
{
|
{
|
||||||
namespace Generator
|
namespace Internals
|
||||||
{
|
{
|
||||||
class JsonValue
|
class JsonValue
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "StringBuilder.h"
|
#include "StringBuilder.h"
|
||||||
|
|
||||||
using namespace ArduinoJson::Generator;
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
size_t StringBuilder::write(uint8_t c)
|
size_t StringBuilder::write(uint8_t c)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
namespace ArduinoJson
|
namespace ArduinoJson
|
||||||
{
|
{
|
||||||
namespace Generator
|
namespace Internals
|
||||||
{
|
{
|
||||||
class StringBuilder : public Print
|
class StringBuilder : public Print
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "JsonValue.h"
|
#include "JsonValue.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
using namespace ArduinoJson::Generator;
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
namespace JsonGeneratorTests
|
namespace JsonGeneratorTests
|
||||||
{
|
{
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
#include "StringBuilder.h"
|
#include "StringBuilder.h"
|
||||||
|
|
||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
using namespace ArduinoJson::Generator;
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
namespace JsonGeneratorTests
|
namespace JsonGeneratorTests
|
||||||
{
|
{
|
||||||
TEST_CLASS(StringBuilderTests)
|
TEST_CLASS(StringBuilderTests)
|
||||||
{
|
{
|
||||||
char buffer[20];
|
char buffer[20];
|
||||||
Print* sb;
|
Print* sb;
|
||||||
size_t returnValue;
|
size_t returnValue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TEST_METHOD_INITIALIZE(Initialize)
|
TEST_METHOD_INITIALIZE(Initialize)
|
||||||
{
|
{
|
||||||
sb = new StringBuilder(buffer, sizeof(buffer));
|
sb = new StringBuilder(buffer, sizeof(buffer));
|
||||||
@ -77,5 +77,5 @@ namespace JsonGeneratorTests
|
|||||||
{
|
{
|
||||||
Assert::AreEqual(expected, returnValue);
|
Assert::AreEqual(expected, returnValue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
Reference in New Issue
Block a user