21 #ifndef GF_STRING_REF_H 22 #define GF_STRING_REF_H 28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 76 constexpr
StringRef(
const char *str, std::size_t size)
92 , m_size(
std::char_traits<char>::length(str))
127 constexpr
const char *
getData() const noexcept {
136 constexpr std::size_t
getSize() const noexcept {
146 return static_cast<int>(m_size);
179 return m_data + m_size;
191 return m_data[index];
200 if (m_size == 0 || m_data ==
nullptr) {
204 return std::string(m_data, m_size);
213 #ifndef DOXYGEN_SHOULD_SKIP_THIS 218 #endif // GF_STRING_REF_H constexpr StringRef()
Default constructor.
Definition: StringRef.h:51
StringRef(const std::string &str)
Constructor from a std::string
Definition: StringRef.h:102
constexpr const char * getData() const noexcept
Get a pointer to the string.
Definition: StringRef.h:127
constexpr const_iterator begin() const noexcept
Get an iterator to the beginning of the string.
Definition: StringRef.h:167
constexpr bool isEmpty() const noexcept
Check if the string is empty.
Definition: StringRef.h:156
constexpr const_iterator end() const noexcept
Get an iterator past the end of the string.
Definition: StringRef.h:178
const char * const_iterator
Definition: StringRef.h:44
constexpr int getISize() const noexcept
Get the size of the string as an int.
Definition: StringRef.h:145
The namespace for gf classes.
Definition: Action.h:35
constexpr StringRef(std::nullptr_t)
Null constructor.
Definition: StringRef.h:63
std::string toString() const
Get a std::string.
Definition: StringRef.h:199
A constant reference to a string and its size.
Definition: StringRef.h:41
constexpr char operator[](std::size_t index) const
Get a character at a given index.
Definition: StringRef.h:190
constexpr StringRef(const char *b, const char *e)
Constructor from two iterators.
Definition: StringRef.h:115
constexpr std::size_t getSize() const noexcept
Get the size of the string.
Definition: StringRef.h:136
const char * iterator
Definition: StringRef.h:43
StringRef(const char *str)
Constructor from a null-terminated string.
Definition: StringRef.h:90
constexpr StringRef(const char *str, std::size_t size)
Constructor from a pointer and a size.
Definition: StringRef.h:76