libbio
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Friends | List of all members
bio::ImmutableString Class Reference

#include <ImmutableString.h>

Inheritance diagram for bio::ImmutableString:
Inheritance graph
[legend]

Public Member Functions

BIO_CONSTEXPR ImmutableString ()
 
BIO_CONSTEXPR ImmutableString (const char *string)
 
 ImmutableString (const char *string, const ::std::size_t length)
 
BIO_CONSTEXPR ImmutableString (const ImmutableString &toCopy)
 
BIO_CONSTEXPR ImmutableStringoperator= (const ImmutableString &toCopy)
 
BIO_CONSTEXPR const charData () const
 
BIO_CONSTEXPR::std::size_t Length () const
 
BIO_CONSTEXPR bool Empty () const
 
BIO_CONSTEXPR::std::size_t Find (const ImmutableString &substring) const
 
BIO_CONSTEXPR::std::size_t FirstDifference (const ImmutableString &other) const
 
BIO_CONSTEXPR ImmutableString GetImmutableSubString (const ::std::size_t start, const ::std::size_t length) const
 

Protected Attributes

const charmString
 
::std::size_t mLength
 

Friends

class String
 

Detailed Description

ImmutableStrings provide a bare-bones String implementation and are essentially a backwards-compatible std::string_view.
These can be used in constexpr and also serve as borrowed read-only runtime text views.
For more on Strings, see String.h

Constructor & Destructor Documentation

◆ ImmutableString() [1/4]

BIO_CONSTEXPR bio::ImmutableString::ImmutableString ( )
inline

An empty string will point to NULL and have a length of 0.

◆ ImmutableString() [2/4]

BIO_CONSTEXPR bio::ImmutableString::ImmutableString ( const char string)
inline
Parameters
string

◆ ImmutableString() [3/4]

bio::ImmutableString::ImmutableString ( const char string,
const ::std::size_t  length 
)
inlineexplicit

For derived classes only.

Parameters
string
length

◆ ImmutableString() [4/4]

BIO_CONSTEXPR bio::ImmutableString::ImmutableString ( const ImmutableString toCopy)
inline
Parameters
toCopy

Member Function Documentation

◆ Data()

BIO_CONSTEXPR const char * bio::ImmutableString::Data ( ) const
inline
Returns
the raw character storage backing *this.

◆ Empty()

BIO_CONSTEXPR bool bio::ImmutableString::Empty ( ) const
inline
Returns
whether or not *this has zero length.

◆ Find()

BIO_CONSTEXPR::std::size_t bio::ImmutableString::Find ( const ImmutableString substring) const
inline

Find the start position of a sub-string in *this.

Parameters
substring
Returns
the first Index where substring appears.

◆ FirstDifference()

BIO_CONSTEXPR::std::size_t bio::ImmutableString::FirstDifference ( const ImmutableString other) const
inline

Find the first position at which *this and other differ. Used to calibrate compiler-specific PRETTY_FUNCTION / FUNCSIG renderings without depending on a sentinel-name substring appearing at a predictable offset — see TypeName.h.

Parameters
other
Returns
index of the first differing character, or min(Length(), other.Length()) if no difference is found within the shared length.

◆ GetImmutableSubString()

BIO_CONSTEXPR ImmutableString bio::ImmutableString::GetImmutableSubString ( const ::std::size_t  start,
const ::std::size_t  length 
) const
inline

Get a smaller string from *this.

Parameters
start
length
Returns
a READ_ONLY String consisting of the contents of *this between start and end.

◆ Length()

BIO_CONSTEXPR::std::size_t bio::ImmutableString::Length ( ) const
inline
Returns
the number of characters in *this.

◆ operator=()

BIO_CONSTEXPR ImmutableString & bio::ImmutableString::operator= ( const ImmutableString toCopy)
inline
Parameters
toCopy
Returns

Friends And Related Symbol Documentation

◆ String

Member Data Documentation

◆ mLength

::std::size_t bio::ImmutableString::mLength
protected

◆ mString

const char* bio::ImmutableString::mString
protected

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