Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
CoreStringView Class Reference
Inheritance diagram for CoreStringView:
CoreBasicString

Public Member Functions

constexpr CoreStringView (void) noexcept
 
constexpr CoreStringView (CoreStringView &&other) noexcept
 
constexpr CoreStringView (const CoreStringView &other) noexcept
 
constexpr CoreStringView (const char *data) noexcept
 
constexpr CoreStringView (const char *data, size_t len) noexcept
 
constexpr unsigned int hash (void) const noexcept
 
constexpr const char * data (void) const noexcept
 
constexpr size_t size (void) const noexcept
 
bool operator== (const CoreStringView &str) const
 
bool operator!= (const CoreStringView &str) const
 
constexpr bool equal (const CoreStringView &str) const
 
 CoreStringView (const CoreBasicString &string)
 
CoreStringViewoperator= (const CoreStringView &other) noexcept
 
CoreStringViewoperator= (CoreStringView &&other) noexcept
 
- Public Member Functions inherited from CoreBasicString
 CoreBasicString (void)
 
 CoreBasicString (const char *data, size_t length=CORE_INVALID_INDEX_64)
 
bool is_empty () const
 
unsigned int get_length () const
 
unsigned int get_count () const
 
unsigned int get_capacity () const
 
const char * get_data () const
 
const char & front () const
 
const char & first () const
 
const char & back () const
 
const char & last () const
 
const char & operator[] (unsigned int index) const
 
bool start_with (const CoreBasicString &str) const
 
bool end_with (const CoreBasicString &str) const
 
bool contains (const CoreBasicString &str) const
 
unsigned int count_occurences (char token) const
 
unsigned int find (const CoreBasicString &str, unsigned int start_index=0) const
 
unsigned int find (char str, unsigned int start_index=0) const
 
unsigned int rev_find (const CoreBasicString &str, unsigned int start_index=CORE_INVALID_INDEX) const
 
unsigned int rev_find (char c, unsigned int start_index=CORE_INVALID_INDEX) const
 
bool start_with (const char *str) const
 
bool end_with (const char *str) const
 
bool contains (const char *str) const
 
unsigned int find (const char *str, unsigned int start_index=0) const
 
unsigned int rev_find (const char *str, unsigned int start_index=CORE_INVALID_INDEX) const
 
CoreBasicStringIterator< true > begin (void) const
 
CoreBasicStringIterator< true > end (void) const
 
bool operator== (const CoreBasicString &str) const
 
bool operator== (const char *str) const
 
bool operator!= (const CoreBasicString &str) const
 
bool operator!= (const char *str) const
 
bool operator< (const CoreBasicString &str) const
 
bool operator< (const char *str) const
 

Additional Inherited Members

- Static Public Attributes inherited from CoreBasicString
static constexpr unsigned int INVALID_INDEX = CORE_INVALID_INDEX
 For backward compatibility only. Please use CORE_INVALID_INDEX instead.
 
- Protected Member Functions inherited from CoreBasicString
constexpr CoreBasicString (const char *data, size_t length, unsigned int capacity)
 
- Protected Attributes inherited from CoreBasicString
char * m_data
 Pointer to the first element of the string.
 
unsigned int m_length
 The length of the string.
 
unsigned int m_capacity
 

Detailed Description

A string view is meant to be a compile-time view on a string literal. This allows to use the fonctionalities of CoreBasicStrings with literals. It also supports a few compile-time operators.

Note
String views are immutable, so they compute the hash of their data in their constructors to speed up equality testing. To avoid wasting space, it uses CoreBasicString::m_capacity to store the hash.

Constructor & Destructor Documentation

constexpr CoreStringView::CoreStringView ( void  )
noexcept

Default constructor.

constexpr CoreStringView::CoreStringView ( CoreStringView &&  other)
noexcept

Move constructor

constexpr CoreStringView::CoreStringView ( const CoreStringView other)
explicitnoexcept

Copy constructor

constexpr CoreStringView::CoreStringView ( const char *  data)
explicitnoexcept

Construct from a string literal. Do not use this constructor when data is not a constexpr! Use CoreStringView(const CoreBasicString&) instead. e.g. Only use this constructor for stuff like constexpr CoreStringView foo("some_string");

constexpr CoreStringView::CoreStringView ( const char *  data,
size_t  len 
)
explicitnoexcept

Construct from a string literal + length

CoreStringView::CoreStringView ( const CoreBasicString string)
inline

Construct from another string. Beware that this instance will not be compile-time constant. It's used to create a lightweight view of a string with precomputed hash. Use it like this for instance: CoreStringView view(some_core_string.get_data());

Member Function Documentation

constexpr const char * CoreStringView::data ( void  ) const
noexcept

Get the current data

constexpr unsigned int CoreStringView::hash ( void  ) const
noexcept

Get the hash of the string

bool CoreStringView::operator!= ( const CoreStringView str) const
inline

Runtime inequality check against another string view.

CoreStringView & CoreStringView::operator= ( const CoreStringView other)
inlinenoexcept

Assignment operator. Only works on non constexpr instances.

CoreStringView & CoreStringView::operator= ( CoreStringView &&  other)
inlinenoexcept

Assignment operator. Only works on non constexpr instances.

bool CoreStringView::operator== ( const CoreStringView str) const
inline

Runtime equality check against another string view.

constexpr size_t CoreStringView::size ( void  ) const
noexcept

Get the current size