describes a counted string stored in flash memory More...
#include <String.hpp>
Public Types | |
using | Iterator = ObjectIterator< String, char > |
Public Member Functions | |
size_t | size () const |
Get the number of bytes used to store the String. More... | |
flash_string_t | data () const |
Get a WString-compatible pointer to the flash data. More... | |
bool | equals (const char *cstr, size_t len=0) const |
Check for equality with a C-string. More... | |
bool | equals (const String &str) const |
Check for equality with another String. More... | |
bool | operator== (const char *str) const |
bool | operator== (const String &str) const |
bool | operator!= (const char *str) const |
bool | operator!= (const String &str) const |
operator WString () const | |
bool | equals (const WString &str) const |
bool | equalsIgnoreCase (const WString &str) const |
bool | operator== (const WString &str) const |
bool | operator!= (const WString &str) const |
StringPrinter | printer () const |
Supports printing of large String objects. More... | |
size_t | printTo (Print &p) const |
Iterator | begin () const |
Iterator | end () const |
size_t | length () const |
Get the length of the content in elements. More... | |
int | indexOf (const ValueType &value) const |
char | valueAt (unsigned index) const |
char | operator[] (unsigned index) const |
Array operator[]. More... | |
size_t | elementSize () const |
size_t | read (size_t index, char *buffer, size_t count) const |
Read content into RAM. More... | |
size_t | read (size_t offset, void *buffer, size_t count) const |
Read contents of a String into RAM. More... | |
size_t | readFlash (size_t index, char *buffer, size_t count) const |
Read content into RAM,using flashmem_read() More... | |
size_t | readFlash (size_t offset, void *buffer, size_t count) const |
Read contents of a String into RAM, using flashread() More... | |
template<class ObjectType > | |
constexpr const ObjectType & | as () const |
Cast to a different object type. More... | |
bool | isCopy () const |
bool | isNull () const |
Indicates an invalid String, used for return value from lookups, etc. More... | |
Static Public Member Functions | |
static const String & | empty () |
Return an empty object which evaluates to null. More... | |
Public Attributes | |
uint32_t | flashLength_ |
Protected Member Functions | |
void | invalidate () |
void | copy (const ObjectBase &obj) |
Static Protected Attributes | |
static const ObjectBase | empty_ |
Detailed Description
describes a counted string stored in flash memory
Member Typedef Documentation
◆ Iterator
|
inherited |
Member Function Documentation
◆ as()
|
inlineinherited |
Cast to a different object type.
- Note
- example:
fstr.as<Array<int>>();
◆ begin()
|
inlineinherited |
◆ copy()
|
inlineprotectedinherited |
◆ data()
|
inline |
Get a WString-compatible pointer to the flash data.
◆ elementSize()
|
inlineinherited |
◆ empty()
|
inlinestaticinherited |
Return an empty object which evaluates to null.
◆ end()
|
inlineinherited |
◆ equals() [1/3]
bool FSTR::String::equals | ( | const char * | cstr, |
size_t | len = 0 |
||
) | const |
Check for equality with a C-string.
- Parameters
-
cstr len Length of cstr (optional)
- Return values
-
bool true if strings are identical
- Note
- loads string into a stack buffer for the comparison, no heap required
◆ equals() [2/3]
Check for equality with another String.
- Parameters
-
str
- Return values
-
bool true if strings are identical
◆ equals() [3/3]
◆ equalsIgnoreCase()
◆ indexOf()
|
inlineinherited |
◆ invalidate()
|
protectedinherited |
◆ isCopy()
|
inlineinherited |
◆ isNull()
|
inlineinherited |
◆ length()
|
inlineinherited |
Get the length of the content in elements.
◆ operator WString()
FSTR::String::operator WString | ( | ) | const |
◆ operator!=() [1/3]
|
inline |
◆ operator!=() [2/3]
◆ operator!=() [3/3]
◆ operator==() [1/3]
|
inline |
◆ operator==() [2/3]
◆ operator==() [3/3]
◆ operator[]()
|
inlineinherited |
Array operator[].
◆ printer()
|
inline |
◆ printTo()
|
inline |
◆ read() [1/2]
|
inlineinherited |
Read contents of a String into RAM.
- Parameters
-
offset Zero-based offset from start of flash data to start reading buffer Where to store data count How many bytes to read
- Return values
-
size_t Number of bytes actually read
◆ read() [2/2]
|
inlineinherited |
Read content into RAM.
- Parameters
-
index First element to read buffer Where to store data count How many elements to read
- Return values
-
size_t Number of elements actually read
◆ readFlash() [1/2]
|
inherited |
Read contents of a String into RAM, using flashread()
- Parameters
-
offset Zero-based offset from start of flash data to start reading buffer Where to store data count How many bytes to read
- Return values
-
size_t Number of bytes actually read
- See also
- See also
FlashMemoryStream
class.
PROGMEM data is accessed via the CPU data cache, so to avoid degrading performance you can use this method to read data directly from flash memory. This is appropriate for infrequently accessed data, especially if it is large. For example, if storing content using IMPORT_FSTR
instead of SPIFFS then it is generally better to avoid contaminating the cache.
◆ readFlash() [2/2]
|
inlineinherited |
Read content into RAM,using flashmem_read()
- Parameters
-
index First element to read buffer Where to store data count How many elements to read
- Return values
-
size_t Number of elements actually read
◆ size()
|
inline |
Get the number of bytes used to store the String.
- Note
- Always an integer multiple of 4 bytes
◆ valueAt()
|
inlineinherited |
Member Data Documentation
◆ empty_
|
staticprotectedinherited |
◆ flashLength_
|
inherited |
The documentation for this class was generated from the following file: