Used when defining data structures.
More...
#include <ObjectBase.hpp>
|
size_t | length () const |
| Get the length of the object data in bytes. More...
|
|
size_t | size () const |
| Get the object data size in bytes. More...
|
|
template<class ObjectType > |
constexpr const ObjectType & | as () const |
| Cast to a different object type. More...
|
|
const uint8_t * | data () const |
| Get a pointer to the flash data. 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 offset, void *buffer, size_t count) const |
| Read contents of a String into RAM, using flashread() More...
|
|
bool | isCopy () const |
|
bool | isNull () const |
| Indicates an invalid String, used for return value from lookups, etc. More...
|
|
Used when defining data structures.
- Note
- Should not be used directly, use appropriate Object methods instead
◆ as()
template<class ObjectType >
constexpr const ObjectType& FSTR::ObjectBase::as |
( |
| ) |
const |
|
inlineconstexpr |
Cast to a different object type.
- Note
- example:
fstr.as<Array<int>>();
◆ copy()
void FSTR::ObjectBase::copy |
( |
const ObjectBase & |
obj | ) |
|
|
inlineprotected |
◆ data()
const uint8_t* FSTR::ObjectBase::data |
( |
| ) |
const |
Get a pointer to the flash data.
◆ invalidate()
void FSTR::ObjectBase::invalidate |
( |
| ) |
|
|
protected |
◆ isCopy()
bool FSTR::ObjectBase::isCopy |
( |
| ) |
const |
|
inline |
◆ isNull()
bool FSTR::ObjectBase::isNull |
( |
| ) |
const |
|
inline |
Indicates an invalid String, used for return value from lookups, etc.
- Note
- A real String can be zero-length, but it cannot be null
◆ length()
size_t FSTR::ObjectBase::length |
( |
| ) |
const |
Get the length of the object data in bytes.
◆ read()
size_t FSTR::ObjectBase::read |
( |
size_t |
offset, |
|
|
void * |
buffer, |
|
|
size_t |
count |
|
) |
| const |
|
inline |
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 |
◆ readFlash()
size_t FSTR::ObjectBase::readFlash |
( |
size_t |
offset, |
|
|
void * |
buffer, |
|
|
size_t |
count |
|
) |
| const |
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.
◆ size()
size_t FSTR::ObjectBase::size |
( |
| ) |
const |
|
inline |
Get the object data size in bytes.
- Note
- Always an integer multiple of 4 bytes
◆ empty_
◆ flashLength_
uint32_t FSTR::ObjectBase::flashLength_ |
The documentation for this class was generated from the following file: