21 #ifndef GF_STRING_REF_H 22 #define GF_STRING_REF_H 28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 73 constexpr
StringRef(
const char *str, std::size_t size)
89 , m_size(
std::strlen(str))
111 constexpr
const char *
getData() const noexcept {
120 constexpr std::size_t
getSize() const noexcept {
142 constexpr
const char *
begin() const noexcept {
153 constexpr
const char *
end() const noexcept {
154 return m_data + m_size;
166 return m_data[index];
175 if (m_size == 0 || m_data ==
nullptr) {
179 return std::string(m_data, m_size);
188 #ifndef DOXYGEN_SHOULD_SKIP_THIS 193 #endif // GF_STRING_REF_H constexpr StringRef()
Default constructor.
Definition: StringRef.h:48
StringRef(const std::string &str)
Constructor from a std::string
Definition: StringRef.h:99
constexpr const char * getData() const noexcept
Get a pointer to the string.
Definition: StringRef.h:111
constexpr bool isEmpty() const noexcept
Check if the string is empty.
Definition: StringRef.h:131
The namespace for gf classes.
Definition: Action.h:34
constexpr StringRef(std::nullptr_t)
Null constructor.
Definition: StringRef.h:60
constexpr const char * begin() const noexcept
Get an iterator to the beginning of the string.
Definition: StringRef.h:142
constexpr const char * end() const noexcept
Get an iterator past the end of the string.
Definition: StringRef.h:153
std::string toString() const
Get a std::string.
Definition: StringRef.h:174
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:165
constexpr std::size_t getSize() const noexcept
Get the size of the string.
Definition: StringRef.h:120
StringRef(const char *str)
Constructor from a null-terminated string.
Definition: StringRef.h:87
constexpr StringRef(const char *str, std::size_t size)
Constructor from a pointer and a size.
Definition: StringRef.h:73