2014-06-26 12:50:48 +02:00
|
|
|
/*
|
|
|
|
* Arduino JSON library
|
|
|
|
* Benoit Blanchon 2014 - MIT License
|
|
|
|
*/
|
|
|
|
|
2014-06-25 13:02:39 +02:00
|
|
|
#include "StringBuilder.h"
|
|
|
|
|
2014-06-25 13:50:28 +02:00
|
|
|
void StringBuilder::append(const char* s)
|
2014-06-25 13:02:39 +02:00
|
|
|
{
|
|
|
|
char* tail = buffer + length;
|
|
|
|
|
2014-06-26 13:00:14 +02:00
|
|
|
while (*s && length<capacity)
|
|
|
|
{
|
|
|
|
buffer[length++] = *s++;
|
|
|
|
}
|
2014-06-25 13:02:39 +02:00
|
|
|
|
2014-06-26 13:00:14 +02:00
|
|
|
buffer[length] = 0;
|
2014-06-25 13:47:28 +02:00
|
|
|
}
|
|
|
|
|
2014-06-26 13:10:52 +02:00
|
|
|
|
2014-06-30 19:19:39 +02:00
|
|
|
void StringBuilder::append(char c)
|
|
|
|
{
|
|
|
|
if (length >= capacity) return;
|
2014-06-25 13:47:28 +02:00
|
|
|
|
2014-06-30 19:19:39 +02:00
|
|
|
buffer[length++] = c;
|
2014-06-25 13:55:18 +02:00
|
|
|
buffer[length] = 0;
|
2014-06-25 13:02:39 +02:00
|
|
|
}
|