Blender  V2.93
Public Member Functions | List of all members
blender::StringRefNull Class Reference

#include <BLI_string_ref.hh>

Inherits blender::StringRefBase.

Public Member Functions

constexpr StringRefNull ()
 
 StringRefNull (const char *str)
 
constexpr StringRefNull (const char *str, const int64_t size)
 
 StringRefNull (const std::string &str)
 
constexpr char operator[] (const int64_t index) const
 
constexpr const char * c_str () const
 
- Public Member Functions inherited from blender::StringRefBase
constexpr int64_t size () const
 
constexpr bool is_empty () const
 
constexpr const char * data () const
 
constexpr operator Span< char > () const
 
 operator std::string () const
 
constexpr operator std::string_view () const
 
constexpr const char * begin () const
 
constexpr const char * end () const
 
constexpr IndexRange index_range () const
 
void unsafe_copy (char *dst) const
 
void copy (char *dst, const int64_t dst_size) const
 
template<size_t N>
void copy (char(&dst)[N]) const
 
constexpr bool startswith (StringRef prefix) const
 
constexpr bool endswith (StringRef suffix) const
 
constexpr StringRef substr (int64_t start, const int64_t size) const
 
constexpr const char & front () const
 
constexpr const char & back () const
 
constexpr int64_t find (char c, int64_t pos=0) const
 
constexpr int64_t find (StringRef str, int64_t pos=0) const
 
constexpr int64_t rfind (char c, int64_t pos=INT64_MAX) const
 
constexpr int64_t rfind (StringRef str, int64_t pos=INT64_MAX) const
 
constexpr int64_t find_first_of (StringRef chars, int64_t pos=0) const
 
constexpr int64_t find_first_of (char c, int64_t pos=0) const
 
constexpr int64_t find_last_of (StringRef chars, int64_t pos=INT64_MAX) const
 
constexpr int64_t find_last_of (char c, int64_t pos=INT64_MAX) const
 
constexpr int64_t find_first_not_of (StringRef chars, int64_t pos=0) const
 
constexpr int64_t find_first_not_of (char c, int64_t pos=0) const
 
constexpr int64_t find_last_not_of (StringRef chars, int64_t pos=INT64_MAX) const
 
constexpr int64_t find_last_not_of (char c, int64_t pos=INT64_MAX) const
 

Additional Inherited Members

- Static Public Attributes inherited from blender::StringRefBase
static constexpr int64_t not_found = -1
 
- Protected Member Functions inherited from blender::StringRefBase
constexpr StringRefBase (const char *data, const int64_t size)
 
- Protected Attributes inherited from blender::StringRefBase
const char * data_
 
int64_t size_
 

Detailed Description

References a null-terminated const char array.

Definition at line 216 of file BLI_string_ref.hh.

Constructor & Destructor Documentation

◆ StringRefNull() [1/4]

constexpr blender::StringRefNull::StringRefNull ( )
inlineconstexpr

Definition at line 219 of file BLI_string_ref.hh.

◆ StringRefNull() [2/4]

blender::StringRefNull::StringRefNull ( const char *  str)
inline

Construct a StringRefNull from a null terminated c-string. The pointer must not point to NULL.

Definition at line 227 of file BLI_string_ref.hh.

References BLI_assert, blender::StringRefBase::data_, blender::StringRefBase::size_, and str.

◆ StringRefNull() [3/4]

constexpr blender::StringRefNull::StringRefNull ( const char *  str,
const int64_t  size 
)
inlineconstexpr

Construct a StringRefNull from a null terminated c-string. This invokes undefined behavior when the given size is not the correct size of the string.

Definition at line 237 of file BLI_string_ref.hh.

References BLI_assert, blender::StringRefBase::size(), and str.

◆ StringRefNull() [4/4]

blender::StringRefNull::StringRefNull ( const std::string &  str)
inline

Reference a std::string. Remember that when the std::string is destructed, the StringRefNull will point to uninitialized memory.

Definition at line 246 of file BLI_string_ref.hh.

Member Function Documentation

◆ c_str()

constexpr const char* blender::StringRefNull::c_str ( ) const
inlineconstexpr

◆ operator[]()

constexpr char blender::StringRefNull::operator[] ( const int64_t  index) const
inlineconstexpr

Get the char at the given index.

Definition at line 253 of file BLI_string_ref.hh.

References BLI_assert, blender::StringRefBase::data_, and blender::StringRefBase::size_.


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