Merged the two StringBuilder classes into one

This commit is contained in:
Benoit Blanchon
2018-10-18 17:54:33 +02:00
parent 1a4515c0b9
commit ae089dcff7
9 changed files with 91 additions and 102 deletions

View File

@@ -4,20 +4,22 @@
#pragma once
#include "../Memory/MemoryPool.hpp"
#include "../Memory/StringBuilder.hpp"
namespace ARDUINOJSON_NAMESPACE {
template <typename TMemoryPool>
class StringCopier {
public:
StringCopier(TMemoryPool& memoryPool) : _memoryPool(&memoryPool) {}
typedef ARDUINOJSON_NAMESPACE::StringBuilder StringBuilder;
typedef typename TMemoryPool::StringBuilder StringBuilder;
StringCopier(MemoryPool* memoryPool) : _memoryPool(memoryPool) {}
StringBuilder startString() {
return _memoryPool->startString();
return StringBuilder(_memoryPool);
}
private:
TMemoryPool* _memoryPool;
MemoryPool* _memoryPool;
};
} // namespace ARDUINOJSON_NAMESPACE