| OpenMS 2.5.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>`

## Public Member Functions

| StringView ()
| StringView (const std::string &s)
| StringView (const StringView &s)
bool | operator< (const StringView other) const
| less operator More...
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 | ( |  | ) |

inline

## ◆ StringView() [2/3]

StringView | ( | const std::string & | s | ) |

inline

## ◆ StringView() [3/3]

StringView | ( | const StringView & | 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_.

## ◆ 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

Referenced by StringView::operator<(), and StringView::substr().

## ◆ size_

Size size_

private

Referenced by StringView::operator<(), and StringView::substr().