Used when defining data structures.
More...
#include <ObjectBase.hpp>
|
constexpr FSTR_NOINLINE const size_t | length () const |
| Get the length of the object data in bytes. More...
|
|
constexpr const size_t | size () const |
| Get the object data size in bytes. More...
|
|
bool | operator== (const ObjectBase &other) const |
|
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...
|
|
constexpr const bool | isCopy () const |
|
constexpr 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>>();
◆ data()
const uint8_t* FSTR::ObjectBase::data |
( |
| ) |
const |
Get a pointer to the flash data.
◆ isCopy()
constexpr const bool FSTR::ObjectBase::isCopy |
( |
| ) |
const |
|
inlineconstexpr |
◆ isNull()
constexpr const bool FSTR::ObjectBase::isNull |
( |
| ) |
const |
|
inlineconstexpr |
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()
constexpr FSTR_NOINLINE const size_t FSTR::ObjectBase::length |
( |
void |
| ) |
const |
|
inlineconstexpr |
Get the length of the object data in bytes.
◆ operator==()
bool FSTR::ObjectBase::operator== |
( |
const ObjectBase & |
other | ) |
const |
◆ read()
size_t FSTR::ObjectBase::read |
( |
size_t |
offset, |
|
|
void * |
buffer, |
|
|
size_t |
count |
|
) |
| const |
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()
constexpr const size_t FSTR::ObjectBase::size |
( |
| ) |
const |
|
inlineconstexpr |
Get the object data size in bytes.
- Note
- Always an integer multiple of 4 bytes
◆ copyBit
constexpr uint32_t FSTR::ObjectBase::copyBit = 0x80000000U |
|
staticconstexprprotected |
◆ empty_
◆ flashLength_
const uint32_t FSTR::ObjectBase::flashLength_ |
◆ lengthInvalid
constexpr uint32_t FSTR::ObjectBase::lengthInvalid = copyBit | 0 |
|
staticconstexprprotected |
Indicates null string in a copy.
The documentation for this class was generated from the following file: