OpenMS  2.7.0
Public Member Functions | Private Attributes | List of all members
StringView Class Reference

StringView provides a non-owning view on an existing string. More...

#include <OpenMS/DATASTRUCTURES/String.h>

Collaboration diagram for StringView:
[legend]

Public Member Functions

 StringView ()=default
 
 StringView (const StringView &)=default
 
StringViewoperator= (const StringView &)=default
 
 StringView (const std::string &s)
 
bool operator< (const StringView other) const
 less operator More...
 
bool operator== (const StringView other) const
 
StringView substr (Size start, Size length) const
 create view that references a substring of the original string More...
 
Size size () const
 size of view More...
 
String getString () const
 create String object from view More...
 

Private Attributes

const char * begin_
 
Size size_
 

Detailed Description

StringView provides a non-owning view on an existing string.

Minimal replacement for boost::string_ref or std::experimental::string_view until we increase our min boost version

Constructor & Destructor Documentation

◆ StringView() [1/3]

StringView ( )
default

◆ StringView() [2/3]

StringView ( const StringView )
default

◆ StringView() [3/3]

StringView ( const std::string &  s)
inline

Member Function Documentation

◆ getString()

String getString ( ) const
inline

create String object from view

◆ operator<()

bool operator< ( const StringView  other) const
inline

less operator

References StringView::begin_, and StringView::size_.

◆ operator=()

StringView& operator= ( const StringView )
default

◆ operator==()

bool operator== ( const StringView  other) const
inline

◆ size()

Size size ( ) const
inline

size of view

◆ substr()

StringView substr ( Size  start,
Size  length 
) const
inline

create view that references a substring of the original string

References StringView::begin_, and StringView::size_.

Member Data Documentation

◆ begin_

const char* begin_
private

◆ size_

Size size_
private