OpendTect  7.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
StringView Class Reference

OD::String that holds an existing text string. More...

Inheritance diagram for StringView:
[legend]

Public Member Functions

 StringView (const char *p=nullptr)
 
char firstChar () const override
 
bool isNull () const
 
 operator bool () const
 
 operator const char * () const
 
bool operator! () const
 
bool operator!= (const BufferString &) const
 
bool operator!= (const char *s) const
 
bool operator!= (const OD::String &s) const
 
bool operator!= (const StringView &fs) const
 
StringViewoperator= (const char *p)
 
StringViewoperator= (const StringView &fs)
 
bool operator== (const BufferString &) const
 
bool operator== (const char *s) const
 
bool operator== (const OD::String &s) const
 
bool operator== (const StringView &fs) const
 
- Public Member Functions inherited from OD::String
virtual ~String ()
 
const char * buf () const
 
bool contains (char) const
 
bool contains (const char *) const
 
unsigned int count (char) const
 
bool endsWith (const char *, CaseSensitivity c=CaseSensitive) const
 
const char * find (char) const
 
const char * find (const char *) const
 
const char * findLast (char) const
 
const char * findLast (const char *) const
 
unsigned int getLevenshteinDist (const char *, bool casesens) const
 
bool isEmpty () const
 
bool isEndOf (const char *, CaseSensitivity c=CaseSensitive) const
 
bool isEqual (const char *, CaseSensitivity c=CaseSensitive) const
 
bool isNumber (bool int_only=false) const
 
bool isStartOf (const char *, CaseSensitivity c=CaseSensitive) const
 
bool isYesNo () const
 
virtual char lastChar () const
 
bool matches (const char *, CaseSensitivity c=CaseSensitive) const
 
 operator const char * () const
 
bool operator!= (const char *) const
 
bool operator!= (const String &) const
 
template<class T >
bool operator!= (const T &t) const
 
bool operator< (const char *) const
 
bool operator< (const String &) const
 
template<class T >
bool operator< (const T &) const
 
bool operator== (const char *) const
 
bool operator== (const String &) const
 
template<class T >
bool operator== (const T &) const
 
bool operator> (const char *) const
 
bool operator> (const String &) const
 
template<class T >
bool operator> (const T &) const
 
const char & operator[] (int idx) const
 
unsigned int size () const
 
bool startsWith (const char *, CaseSensitivity c=CaseSensitive) const
 
const char * str () const
 
bool toBool () const
 
double toDouble () const
 
float toFloat () const
 
int toInt () const
 
std::uint64_t toUInt64 () const
 

Static Public Member Functions

static const StringViewempty ()
 
- Static Public Member Functions inherited from OD::String
static const Stringempty ()
 

Protected Member Functions

 StringView (const OD::String &)=delete
 
const char * gtBuf () const override
 
const char * gtStr () const override
 
StringViewoperator= (const OD::String &)=delete
 
- Protected Member Functions inherited from OD::String
 operator bool () const =delete
 

Protected Attributes

const char * str_
 

Detailed Description

OD::String that holds an existing text string.

The string is assumed to be owned by someone else or be static. In any case, it is assumed be be alive and well for the lifetime of the StringView.

The StringView is a light-weight, shallow adapter; it never changes the underlying string. It is comparable to std::string_view (C++17).

<>

Constructor & Destructor Documentation

◆ StringView() [1/2]

StringView::StringView ( const char *  p = nullptr)
inline

◆ StringView() [2/2]

StringView::StringView ( const OD::String )
protecteddelete

Member Function Documentation

◆ empty()

static const StringView& StringView::empty ( )
static

◆ firstChar()

char StringView::firstChar ( ) const
inlineoverridevirtual

Reimplemented from OD::String.

◆ gtBuf()

const char* StringView::gtBuf ( ) const
inlineoverrideprotectedvirtual
Returns
empty even if underlying is null

Implements OD::String.

◆ gtStr()

const char* StringView::gtStr ( ) const
inlineoverrideprotectedvirtual
Returns
null if empty

Implements OD::String.

◆ isNull()

bool StringView::isNull ( ) const
inline

◆ operator bool()

StringView::operator bool ( ) const
inline

◆ operator const char *()

StringView::operator const char * ( ) const
inline

◆ operator!()

bool StringView::operator! ( ) const
inline

◆ operator!=() [1/4]

bool StringView::operator!= ( const BufferString ) const

◆ operator!=() [2/4]

bool StringView::operator!= ( const char *  s) const
inline

◆ operator!=() [3/4]

bool StringView::operator!= ( const OD::String s) const
inline

◆ operator!=() [4/4]

bool StringView::operator!= ( const StringView fs) const
inline

◆ operator=() [1/3]

StringView& StringView::operator= ( const char *  p)
inline

◆ operator=() [2/3]

StringView& StringView::operator= ( const OD::String )
protecteddelete

◆ operator=() [3/3]

StringView& StringView::operator= ( const StringView fs)
inline

◆ operator==() [1/4]

bool StringView::operator== ( const BufferString ) const

◆ operator==() [2/4]

bool StringView::operator== ( const char *  s) const
inline

◆ operator==() [3/4]

bool StringView::operator== ( const OD::String s) const
inline

◆ operator==() [4/4]

bool StringView::operator== ( const StringView fs) const
inline

Member Data Documentation

◆ str_

const char* StringView::str_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024