forked from bblanchon/ArduinoJson
Renamed StdStringAdapter to StlStringAdapter (internal use only)
This commit is contained in:
@ -10,7 +10,7 @@
|
|||||||
#include <ArduinoJson/Strings/ConstRamStringAdapter.hpp>
|
#include <ArduinoJson/Strings/ConstRamStringAdapter.hpp>
|
||||||
#include <ArduinoJson/Strings/FlashStringAdapter.hpp>
|
#include <ArduinoJson/Strings/FlashStringAdapter.hpp>
|
||||||
#include <ArduinoJson/Strings/SizedRamStringAdapter.hpp>
|
#include <ArduinoJson/Strings/SizedRamStringAdapter.hpp>
|
||||||
#include <ArduinoJson/Strings/StlStringAdapter.hpp>
|
#include <ArduinoJson/Strings/StdStringAdapter.hpp>
|
||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ TEST_CASE("FlashStringAdapter") {
|
|||||||
|
|
||||||
TEST_CASE("std::string") {
|
TEST_CASE("std::string") {
|
||||||
std::string str("bravo");
|
std::string str("bravo");
|
||||||
StlStringAdapter<std::string> adapter = adaptString(str);
|
StdStringAdapter<std::string> adapter = adaptString(str);
|
||||||
|
|
||||||
CHECK(adapter.compare(NULL) > 0);
|
CHECK(adapter.compare(NULL) > 0);
|
||||||
CHECK(adapter.compare("alpha") > 0);
|
CHECK(adapter.compare("alpha") > 0);
|
||||||
@ -132,7 +132,7 @@ TEST_CASE("Arduino String") {
|
|||||||
|
|
||||||
TEST_CASE("custom_string") {
|
TEST_CASE("custom_string") {
|
||||||
custom_string str("bravo");
|
custom_string str("bravo");
|
||||||
StlStringAdapter<custom_string> adapter = adaptString(str);
|
StdStringAdapter<custom_string> adapter = adaptString(str);
|
||||||
|
|
||||||
CHECK(adapter.compare(NULL) > 0);
|
CHECK(adapter.compare(NULL) > 0);
|
||||||
CHECK(adapter.compare("alpha") > 0);
|
CHECK(adapter.compare("alpha") > 0);
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
namespace ARDUINOJSON_NAMESPACE {
|
namespace ARDUINOJSON_NAMESPACE {
|
||||||
|
|
||||||
template <typename TString>
|
template <typename TString>
|
||||||
class StlStringAdapter {
|
class StdStringAdapter {
|
||||||
public:
|
public:
|
||||||
StlStringAdapter(const TString& str) : _str(&str) {}
|
StdStringAdapter(const TString& str) : _str(&str) {}
|
||||||
|
|
||||||
void copyTo(char* p, size_t n) const {
|
void copyTo(char* p, size_t n) const {
|
||||||
memcpy(p, _str->c_str(), n);
|
memcpy(p, _str->c_str(), n);
|
||||||
@ -56,9 +56,9 @@ struct IsString<std::basic_string<char, TCharTraits, TAllocator> > : true_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename TCharTraits, typename TAllocator>
|
template <typename TCharTraits, typename TAllocator>
|
||||||
inline StlStringAdapter<std::basic_string<char, TCharTraits, TAllocator> >
|
inline StdStringAdapter<std::basic_string<char, TCharTraits, TAllocator> >
|
||||||
adaptString(const std::basic_string<char, TCharTraits, TAllocator>& str) {
|
adaptString(const std::basic_string<char, TCharTraits, TAllocator>& str) {
|
||||||
return StlStringAdapter<std::basic_string<char, TCharTraits, TAllocator> >(
|
return StdStringAdapter<std::basic_string<char, TCharTraits, TAllocator> >(
|
||||||
str);
|
str);
|
||||||
}
|
}
|
||||||
|
|
@ -9,7 +9,7 @@
|
|||||||
#include <ArduinoJson/Strings/SizedRamStringAdapter.hpp>
|
#include <ArduinoJson/Strings/SizedRamStringAdapter.hpp>
|
||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_STD_STRING
|
#if ARDUINOJSON_ENABLE_STD_STRING
|
||||||
#include <ArduinoJson/Strings/StlStringAdapter.hpp>
|
#include <ArduinoJson/Strings/StdStringAdapter.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_ARDUINO_STRING
|
#if ARDUINOJSON_ENABLE_ARDUINO_STRING
|
||||||
|
Reference in New Issue
Block a user