12 #include <OpenMS/OpenMSConfig.h>
43 StringView(
const std::string& s) : begin_(s.data()), size_(s.size())
50 if (size_ < other.
size_)
return true;
52 if (size_ > other.
size_)
return false;
56 if (begin_ == other.
begin_)
return false;
58 return strncmp(begin_, other.
begin_, size_) < 0;
63 if (size_ != other.
size_)
return false;
67 if (begin_ == other.
begin_)
return true;
69 return strncmp(begin_, other.
begin_, size_) == 0;
75 if (!size_)
return *
this;
78 sv.
begin_ = begin_ + start;
92 if (!size_)
return String();
93 return String(begin_, begin_ + size_);
StringView provides a non-owning view on an existing string.
Definition: StringView.h:30
StringView(const StringView &)=default
StringView substr(Size start, Size length) const
create view that references a substring of the original string
Definition: StringView.h:73
const char * begin_
Definition: StringView.h:97
bool operator<(const StringView other) const
less operator
Definition: StringView.h:48
StringView & operator=(const StringView &)=default
StringView(const std::string &s)
Definition: StringView.h:43
Size size() const
size of view
Definition: StringView.h:84
String getString() const
create String object from view
Definition: StringView.h:90
bool operator==(const StringView other) const
Definition: StringView.h:61
Size size_
Definition: StringView.h:98
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22