|
ESPHome 2026.11.0-dev
|
Compile-time string table that packs strings into a single blob with offset lookup. More...
#include <progmem.h>
Static Public Member Functions | |
| static constexpr auto | make_blob () |
| Generate packed string blob at compile time. | |
| static constexpr auto | make_offsets () |
| Generate offset table at compile time. | |
Static Public Attributes | |
| static constexpr size_t | COUNT = sizeof...(Strs) |
| static constexpr size_t | BLOB_SIZE = (0 + ... + (Strs.size() + 1)) |
| static constexpr size_t | MAX_LENGTH = std::max({Strs.size()...}) |
| Length of the longest string, for sizing a RAM copy on ESP8266. | |
| static constexpr bool | INDEXED = BLOB_SIZE <= UINT8_MAX |
| One-byte offsets address up to 255 bytes; a larger blob has no offset table and is scanned instead, which costs less flash than wider offsets for the rarely read tables that get this big. | |
Compile-time string table that packs strings into a single blob with offset lookup.
Blobs over 255 bytes have no offsets and are scanned, so keep those for rarely read strings. Use PROGMEM_STRING_TABLE macro to instantiate with proper flash placement on ESP8266.
Example: PROGMEM_STRING_TABLE(MyStrings, "foo", "bar", "baz"); ProgmemStr str = MyStrings::get_progmem_str(idx, MyStrings::LAST_INDEX); // For ArduinoJson const LogString *log_str = MyStrings::get_log_str(idx, MyStrings::LAST_INDEX); // For logging
|
inlinestaticconstexpr |
|
inlinestaticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |