StringRef is a reference to a string owned by something else.
More...
#include <string_ref.h>
StringRef is a reference to a string owned by something else.
So it behaves like simple string, but it does not own pointer. When it is default constructed, it has empty string. You can freely copy or move around this struct, but never free its pointer. str() function can be used to export the content as std::string. StringRef is adopted from https://github.com/nghttp2/nghttp2/blob/29cbf8b83ff78faf405d1086b16adc09a8772eca/src/template.h#L376
Definition at line 26 of file string_ref.h.
◆ allocator_type
◆ const_iterator
◆ const_pointer
◆ const_reference
◆ const_reverse_iterator
◆ difference_type
◆ size_type
◆ traits_type
◆ value_type
◆ StringRef() [1/7]
| esphome::StringRef::StringRef |
( |
| ) |
|
|
inlineconstexpr |
◆ StringRef() [2/7]
| esphome::StringRef::StringRef |
( |
const std::string & | s | ) |
|
|
inlineexplicit |
◆ StringRef() [3/7]
| esphome::StringRef::StringRef |
( |
const char * | s | ) |
|
|
inlineexplicit |
◆ StringRef() [4/7]
| esphome::StringRef::StringRef |
( |
const char * | s, |
|
|
size_t | n ) |
|
inlineconstexpr |
◆ StringRef() [5/7]
template<typename CharT >
| esphome::StringRef::StringRef |
( |
const CharT * | s, |
|
|
size_t | n ) |
|
inlineconstexpr |
◆ StringRef() [6/7]
template<typename InputIt >
| esphome::StringRef::StringRef |
( |
InputIt | first, |
|
|
InputIt | last ) |
|
inline |
◆ StringRef() [7/7]
template<typename InputIt >
| esphome::StringRef::StringRef |
( |
InputIt * | first, |
|
|
InputIt * | last ) |
|
inline |
◆ begin()
◆ byte()
| const uint8_t * esphome::StringRef::byte |
( |
| ) |
const |
|
inline |
◆ c_str()
| const char * esphome::StringRef::c_str |
( |
| ) |
const |
|
inlineconstexpr |
◆ cbegin()
◆ cend()
◆ compare() [1/3]
| int esphome::StringRef::compare |
( |
const char * | s | ) |
const |
|
inline |
◆ compare() [2/3]
| int esphome::StringRef::compare |
( |
const std::string & | s | ) |
const |
|
inline |
◆ compare() [3/3]
| int esphome::StringRef::compare |
( |
const StringRef & | other | ) |
const |
|
inline |
Compare (compatible with std::string::compare)
Definition at line 85 of file string_ref.h.
◆ crbegin()
◆ crend()
◆ empty()
| bool esphome::StringRef::empty |
( |
| ) |
const |
|
inlineconstexpr |
◆ end()
◆ find() [1/2]
◆ find() [2/2]
Find first occurrence of substring, returns std::string::npos if not found.
Note: Requires the underlying string to be null-terminated.
Definition at line 100 of file string_ref.h.
◆ from_lit()
template<typename CharT , size_t N>
| static constexpr StringRef esphome::StringRef::from_lit |
( |
const CharT(&) | s[N] | ) |
|
|
inlinestaticconstexpr |
◆ from_maybe_nullptr()
| static StringRef esphome::StringRef::from_maybe_nullptr |
( |
const char * | s | ) |
|
|
inlinestatic |
◆ length()
| size_type esphome::StringRef::length |
( |
| ) |
const |
|
inlineconstexpr |
◆ operator std::string()
| esphome::StringRef::operator std::string |
( |
| ) |
const |
|
inline |
◆ operator[]()
◆ rbegin()
◆ rend()
◆ size()
◆ str()
| std::string esphome::StringRef::str |
( |
| ) |
const |
|
inline |
◆ substr()
| std::string esphome::StringRef::substr |
( |
size_type | pos = 0, |
|
|
size_type | count = std::string::npos ) const |
|
inline |
Return substring as std::string.
Definition at line 117 of file string_ref.h.
The documentation for this class was generated from the following file: