38 #include <OpenMS/OpenMSConfig.h>
69 StringView(
const std::string& s) : begin_(s.data()), size_(s.size())
76 if (size_ < other.
size_)
return true;
78 if (size_ > other.
size_)
return false;
82 if (begin_ == other.
begin_)
return false;
84 return strncmp(begin_, other.
begin_, size_) < 0;
89 if (size_ != other.
size_)
return false;
93 if (begin_ == other.
begin_)
return true;
95 return strncmp(begin_, other.
begin_, size_) == 0;
101 if (!size_)
return *
this;
104 sv.
begin_ = begin_ + start;
105 sv.
size_ = std::min(length, sv.
size_ - start);
118 if (!size_)
return String();
119 return String(begin_, begin_ + size_);
StringView provides a non-owning view on an existing string.
Definition: StringView.h:56
StringView(const StringView &)=default
StringView substr(Size start, Size length) const
create view that references a substring of the original string
Definition: StringView.h:99
const char * begin_
Definition: StringView.h:123
bool operator<(const StringView other) const
less operator
Definition: StringView.h:74
StringView & operator=(const StringView &)=default
StringView(const std::string &s)
Definition: StringView.h:69
Size size() const
size of view
Definition: StringView.h:110
String getString() const
create String object from view
Definition: StringView.h:116
bool operator==(const StringView other) const
Definition: StringView.h:87
Size size_
Definition: StringView.h:124
A more convenient string class.
Definition: String.h:60
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48