26 using size_type = std::allocator_traits<allocator_type>::size_type;
35 explicit StringRef(
const char *s) : base_(s), len_(strlen(s)) {}
36 constexpr
StringRef(
const char *s,
size_t n) : base_(s), len_(n) {}
37 template<
typename CharT>
38 constexpr
StringRef(
const CharT *s,
size_t n) : base_(reinterpret_cast<const char *>(s)), len_(n) {}
39 template<
typename InputIt>
41 : base_(reinterpret_cast<const char *>(&*first)), len_(
std::distance(first, last)) {}
42 template<
typename InputIt>
44 : base_(reinterpret_cast<const char *>(first)), len_(
std::distance(first, last)) {}
45 template<
typename CharT,
size_t N> constexpr
static StringRef from_lit(
const CharT (&s)[N]) {
68 constexpr
const char *
c_str()
const {
return base_; }
70 constexpr
bool empty()
const {
return len_ == 0; }
73 std::string
str()
const {
return std::string(base_, len_); }
74 const uint8_t *
byte()
const {
return reinterpret_cast<const uint8_t *
>(base_); }
76 operator std::string()
const {
return str(); }
84 return lhs.
size() == rhs.
size() && std::equal(std::begin(lhs),
std::end(lhs), std::begin(rhs));
88 return lhs.
size() == rhs.size() && std::equal(std::begin(lhs),
std::end(lhs), std::begin(rhs));
94 return lhs.
size() == strlen(rhs) && std::equal(std::begin(lhs),
std::end(lhs), rhs);
110 return std::lexicographical_compare(std::begin(lhs),
std::end(lhs), std::begin(rhs),
std::end(rhs));
119 auto str = std::string(lhs);
std::reverse_iterator< const_iterator > const_reverse_iterator
const value_type * const_pointer
std::char_traits< char > traits_type
StringRef is a reference to a string owned by something else.
std::allocator< char > allocator_type
constexpr const_reference operator[](size_type pos) const
void convertToJson(const StringRef &src, JsonVariant dst)
const value_type & const_reference
constexpr bool empty() const
static StringRef from_maybe_nullptr(const char *s)
const_reverse_iterator rend() const
StringRef(InputIt *first, InputIt *last)
const_reverse_iterator crend() const
static constexpr StringRef from_lit(const CharT(&s)[N])
constexpr const_iterator cend() const
constexpr StringRef(const char *s, size_t n)
StringRef(InputIt first, InputIt last)
bool operator!=(optional< T > const &x, optional< U > const &y)
std::string & operator+=(std::string &lhs, const StringRef &rhs)
bool operator<(optional< T > const &x, optional< U > const &y)
std::string operator+(const char *lhs, const StringRef &rhs)
constexpr const char * c_str() const
std::allocator_traits< allocator_type >::size_type size_type
constexpr const_iterator begin() const
constexpr const_iterator end() const
const_reverse_iterator rbegin() const
bool operator==(optional< T > const &x, optional< U > const &y)
const uint8_t * byte() const
Implementation of SPI Controller mode.
const_reverse_iterator crbegin() const
constexpr const_iterator cbegin() const
StringRef(const std::string &s)
constexpr size_type size() const
std::allocator_traits< allocator_type >::difference_type difference_type
traits_type::char_type value_type
const_pointer const_iterator
constexpr StringRef(const CharT *s, size_t n)