Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
FlashString Struct Reference

describes a counted string stored in flash memory More...

#include <FlashString.h>

Public Member Functions

uint32_t length () const
 
uint32_t size () const
 
flash_string_t data () const
 
bool isEqual (const char *cstr) const
 Check for equality with a C-string. More...
 
bool isEqual (const FlashString &str) const
 Check for equality with another FlashString. More...
 
bool isEqual (const String &str) const
 
bool operator== (const char *str) const
 
bool operator== (const FlashString &str) const
 
bool operator== (const String &str) const
 
bool operator!= (const char *str) const
 
bool operator!= (const FlashString &str) const
 
bool operator!= (const String &str) const
 

Public Attributes

uint32_t flashLength
 Only needs to be uint16_t but ensures data is aligned. More...
 
char flashData []
 

Detailed Description

describes a counted string stored in flash memory

Note
because the string length is stored there is no need to call strlen_P before reading the content into RAM. Data is stored word-aligned so it can be read as efficiently as possible.

Member Function Documentation

bool FlashString::isEqual ( const char *  cstr) const
inline

Check for equality with a C-string.

Parameters
str
Return values
booltrue if strings are identical
Note
loads string into a stack buffer for the comparison, no heap required
bool FlashString::isEqual ( const FlashString str) const
inline

Check for equality with another FlashString.

Parameters
str
Return values
booltrue if strings are identical

Member Data Documentation

uint32_t FlashString::flashLength

Only needs to be uint16_t but ensures data is aligned.