Own fork of MbedSmartRestMain
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
Diff: util/SmartRestTemplate.cpp
- Revision:
- 55:a0f7295ed6b6
- Parent:
- 41:804f6a0bda26
- Child:
- 91:48069375dffa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/util/SmartRestTemplate.cpp Thu Oct 23 12:50:07 2014 +0000 @@ -0,0 +1,39 @@ +#include "SmartRestTemplate.h" +#include <string.h> + +SmartRestTemplate::SmartRestTemplate() +{ + _len = NULL; +} + +bool SmartRestTemplate::add(const char *line) +{ + if (_len == SMARTREST_TEMPLATE_FIXED_SIZE) + return false; + _buffer[_len++] = line; +} + +size_t SmartRestTemplate::writeTo(AbstractDataSink& sink) const +{ + size_t len = 0; + + for (size_t n = 0; n < _len; n++) + len += sink.write((char*)_buffer[n], strlen(_buffer[n])); + + return len; +} + +size_t SmartRestTemplate::writtenLength() const +{ + size_t len = 0; + + for (size_t n = 0; n < _len; n++) + len += strlen(_buffer[n]); + + return len; +} + +DataGenerator * SmartRestTemplate::copy() const +{ + return NULL; +}