Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
|
Template file stream class. More...
#include <DataSourceStream.h>
Public Member Functions | |
TemplateFileStream (String templateFileName) | |
Create a template file stream. More... | |
virtual StreamType | getStreamType () |
Get the stream type. More... | |
virtual uint16_t | readMemoryBlock (char *data, int bufSize) |
Read a block of memory. More... | |
virtual bool | seek (int len) |
Move read cursor. More... | |
void | setVar (String name, String value) |
Set value of a variable in the template file. More... | |
void | setVarsFromRequest (const HttpRequest &request) |
Set the value of variables from the content of a HTTP request. More... | |
TemplateVariables & | variables () |
Get the template variables. More... | |
virtual bool | attach (String fileName, FileOpenFlags openFlags) |
virtual size_t | write (uint8_t charToWrite) |
virtual size_t | write (const uint8_t *buffer, size_t size) |
virtual bool | isFinished () |
Check if stream is finished. More... | |
String | fileName () |
Filename of file stream is attached to. More... | |
bool | fileExist () |
True if file exists. More... | |
int | getPos () |
Get the offset of cursor from beginning of data. More... | |
Template file stream class.
TemplateFileStream::TemplateFileStream | ( | String | templateFileName | ) |
Create a template file stream.
templateFileName | Template filename |
|
inherited |
True if file exists.
|
inherited |
Filename of file stream is attached to.
|
inlineinherited |
Get the offset of cursor from beginning of data.
int | Cursor offset |
|
inlinevirtual |
Get the stream type.
StreamType | The stream type. |
Reimplemented from FileStream.
|
virtualinherited |
|
virtual |
Read a block of memory.
data | Pointer to the data to be read |
bufSize | Quantity of chars to read |
uint16_t | Quantity of chars read |
Reimplemented from FileStream.
|
virtual |
Move read cursor.
len | Position within stream to move cursor to |
bool | True on success. |
Reimplemented from FileStream.
Set value of a variable in the template file.
name | Name of variable |
value | Value to assign to the variable |
void TemplateFileStream::setVarsFromRequest | ( | const HttpRequest & | request | ) |
Set the value of variables from the content of a HTTP request.
request | HTTP request |
|
inline |
Get the template variables.
TemplateVariables | Reference to the template variables |