ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::ProgmemStringRef Class Reference

A string that may live in flash (on ESP8266): pointer and length, with no byte-reading operations. More...

#include <string_ref.h>

Public Member Functions

constexpr ProgmemStringRef ()=default
 
constexpr ProgmemStringRef (const char *s, size_t len)
 
constexpr ProgmemStringRef (const StringRef &s)
 
constexpr const char * progmem_ptr () const
 
constexpr size_t size () const
 
constexpr bool empty () const
 
bool equals (const StringRef &other) const
 
constexpr const char * c_str () const
 

Static Public Member Functions

template<size_t N>
static constexpr ProgmemStringRef from_lit (const char(&s)[N])
 A PROGMEM char array, with its length known at compile time.
 

Detailed Description

A string that may live in flash (on ESP8266): pointer and length, with no byte-reading operations.

progmem_ptr() is safe as a "%s" log argument; compare the contents with equals().

Definition at line 230 of file string_ref.h.

Constructor & Destructor Documentation

◆ ProgmemStringRef() [1/3]

esphome::ProgmemStringRef::ProgmemStringRef ( )
constexprdefault

◆ ProgmemStringRef() [2/3]

esphome::ProgmemStringRef::ProgmemStringRef ( const char * s,
size_t len )
inlineconstexpr

Definition at line 233 of file string_ref.h.

◆ ProgmemStringRef() [3/3]

esphome::ProgmemStringRef::ProgmemStringRef ( const StringRef & s)
inlineexplicitconstexpr

Definition at line 234 of file string_ref.h.

Member Function Documentation

◆ c_str()

const char * esphome::ProgmemStringRef::c_str ( ) const
inlineconstexpr

Definition at line 255 of file string_ref.h.

◆ empty()

bool esphome::ProgmemStringRef::empty ( ) const
inlineconstexpr

Definition at line 240 of file string_ref.h.

◆ equals()

bool esphome::ProgmemStringRef::equals ( const StringRef & other) const
inline

Definition at line 242 of file string_ref.h.

◆ from_lit()

template<size_t N>
static constexpr ProgmemStringRef esphome::ProgmemStringRef::from_lit ( const char(&) s[N])
inlinestaticconstexpr

A PROGMEM char array, with its length known at compile time.

Definition at line 236 of file string_ref.h.

◆ progmem_ptr()

const char * esphome::ProgmemStringRef::progmem_ptr ( ) const
inlineconstexpr

Definition at line 238 of file string_ref.h.

◆ size()

size_t esphome::ProgmemStringRef::size ( ) const
inlineconstexpr

Definition at line 239 of file string_ref.h.


The documentation for this class was generated from the following file: