NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class is the immutable (const) version of a string view. It can be constructed from a MutableStringView, but cannot be used to construct a mutable version. More...
#include <structures.hpp>
Public Member Functions | |
StringView () | |
StringView default constructor. More... | |
StringView (const std::string *data) | |
StringView constructor from a const std::string pointer. More... | |
StringView (const std::string &data) | |
StringView constructor from a const std::string reference. More... | |
StringView (const std::string &data, size_t start, size_t len=std::string::npos) | |
StringView constructor from a const std::string reference, a start and a length. More... | |
StringView (const StringView &view) | |
StringView copy constructor. More... | |
StringView (const MutableStringView &view) | |
StringView constructor from a MutableStringView class instance. More... | |
StringView (StringView &&view) | |
StringView move constructor. More... | |
StringView & | operator= (const StringView &view) |
Assignment operator for another StringView instance. More... | |
StringView & | operator= (const MutableStringView &view) |
Assignment operator for a MutableStringView class instance. More... | |
StringView & | operator= (const std::string *data) |
Assignment operator for a const std::string pointer. More... | |
StringView & | operator= (const std::string &data) |
Assignment operator for a const std::string reference. More... | |
const char & | operator[] (size_t pos) const |
Random access operator, returning a const char reference. More... | |
StringView | subview (size_t pos=0, size_t len=std::string::npos) const |
This member function creates a new StringView class instance using the selected position and length as a new viewed part. The position has to be part of the viewed section of this instance. This function can be used to replace std::string::substr. More... | |
MutableStringView | make_mutable () const |
This member function returns a MutableStringView instance with the data of this instance. More... | |
Public Member Functions inherited from StringViewBase | |
StringViewBase () | |
StringViewBase default constructor. More... | |
virtual const std::string * | getData () const |
This member function returns a const pointer to the viewed string. Is only used internally. More... | |
bool | operator== (const StringViewBase &view) const |
This member function is an overload for the equality operator using another StringViewBase instance. More... | |
bool | operator== (const std::string &sString) const |
This member function is an overload for the equality operator using a const std::string instance. More... | |
bool | operator== (const char *sString) const |
This member function is an overload for the equality operator using a const char*. More... | |
bool | operator!= (const StringViewBase &view) const |
This member function is an overload for the inequality operator using another StringViewBase instance. More... | |
bool | operator!= (const std::string &sString) const |
This member function is an overload for the inequality operator using a const std::string instance. More... | |
bool | operator!= (const char *sString) const |
This member function is an overload for the inequality operator using a const char*. More... | |
bool | operator< (const StringViewBase &view) const |
This member function is an overload for the less operator using another StringViewBase instance. More... | |
bool | operator< (const std::string &sString) const |
This member function is an overload for the less operator using a const std::string instance. More... | |
bool | operator<= (const StringViewBase &view) const |
This member function is an overload for the less-equal operator using another StringViewBase instance. More... | |
bool | operator<= (const std::string &sString) const |
This member function is an overload for the less-equal operator using a const std::string instance. More... | |
bool | operator> (const StringViewBase &view) const |
This member function is an overload for the greater operator using another StringViewBase instance. More... | |
bool | operator> (const std::string &sString) const |
This member function is an overload for the greater operator using a const std::string instance. More... | |
bool | operator>= (const StringViewBase &view) const |
This member function is an overload for the greater-equal operator using another StringViewBase instance. More... | |
bool | operator>= (const std::string &sString) const |
This member function is an overload for the greater-equal operator using a const std::string instance. More... | |
std::string | operator+ (const StringViewBase &view) const |
This member function is an overload for the concatenation operator using another StringViewBase instance. More... | |
std::string | operator+ (const std::string &sString) const |
This member function is an overload for the concatenation operator using a const std::string instance. More... | |
const char & | front () const |
This member function provides a const char reference to the first character in the viewed section. More... | |
const char & | back () const |
This member function provides a const char reference to the last character in the viewed section. More... | |
std::string::const_iterator | begin () const |
This member function provides an iterator to the beginning of the viewed section of the internal string. More... | |
std::string::const_iterator | end () const |
This member function provides an iterator to the end of the viewed section of the internal string. More... | |
void | trim_front (size_t len) |
This member function can be used to remove characters from the front of the viewed section. More... | |
void | trim_back (size_t len) |
This member function can be used to remove characters from the back of the viewed section. More... | |
void | strip () |
This member function shrinks the viewed section to remove all leading or trailing whitespace characters. This is the corresponding member function to StripSpaces(std::string&). More... | |
size_t | length () const |
This member function simply returns the length of the viewed section. More... | |
std::string | to_string () const |
This member function returns a copy of the viewed section of the string (via std::string::substr). Note that this is an inefficient operation. More... | |
size_t | find (const std::string &findstr, size_t pos=0) const |
Wrapper member function for std::string::find() More... | |
size_t | find (char c, size_t pos=0) const |
Wrapper member function for std::string::find() More... | |
size_t | rfind (const std::string &findstr, size_t pos=std::string::npos) const |
Wrapper member function for std::string::rfind() More... | |
size_t | rfind (char c, size_t pos=std::string::npos) const |
Wrapper member function for std::string::rfind() More... | |
size_t | find_first_of (const std::string &findstr, size_t pos=0) const |
Wrapper member function for std::string::find_first_of() More... | |
size_t | find_first_of (char c, size_t pos=0) const |
Wrapper member function for std::string::find_first_of() More... | |
size_t | find_first_not_of (const std::string &findstr, size_t pos=0) const |
Wrapper member function for std::string::find_first_not_of() More... | |
size_t | find_first_not_of (char c, size_t pos=0) const |
Wrapper member function for std::string::find_first_not_of() More... | |
size_t | find_last_of (const std::string &findstr, size_t pos=std::string::npos) const |
Wrapper member function for std::string::find_last_of() More... | |
size_t | find_last_of (char c, size_t pos=std::string::npos) const |
Wrapper member function for std::string::find_last_of() More... | |
size_t | find_last_not_of (const std::string &findstr, size_t pos=std::string::npos) const |
Wrapper member function for std::string::find_last_not_of() More... | |
size_t | find_last_not_of (char c, size_t pos=std::string::npos) const |
Wrapper member function for std::string::find_last_not_of() More... | |
Protected Member Functions | |
virtual const std::string * | getData () const override |
Override to return a pointer to the internal string. More... | |
void | assign (const StringView &view) |
Assignment member function from another StringView instance. More... | |
void | assign (const MutableStringView &view) |
Assignment member function from a MutableStringView instance. More... | |
void | assign (const std::string *data) |
Assignment member function from a const std::string pointer. More... | |
virtual void | clear () override |
Override to clear the internal pointer as well. More... | |
Protected Member Functions inherited from StringViewBase | |
size_t | validizeLength (size_t pos, size_t len) const |
This private member function evaluates, whether the passed length is part of the viewed section and adapts the length correspondingly. More... | |
virtual void | clear () |
Reset function. More... | |
bool | validAbsolutePosition (size_t pos) const |
This member function checks, whether the passed (absolute) position is part of the viewed string section. Is mostly used in string find operations. More... | |
Private Member Functions | |
StringView (const std::string *data, size_t start, size_t len) | |
Private constructor used by the subview member function. More... | |
Private Attributes | |
const std::string * | m_data |
Additional Inherited Members | |
Protected Attributes inherited from StringViewBase | |
size_t | m_start |
size_t | m_len |
This class is the immutable (const) version of a string view. It can be constructed from a MutableStringView, but cannot be used to construct a mutable version.
Definition at line 2034 of file structures.hpp.
|
inlineprivate |
Private constructor used by the subview member function.
data | std::string* const |
start | size_t |
len | size_t |
Definition at line 2048 of file structures.hpp.
References StringViewBase::m_len, and StringViewBase::m_start.
|
inline |
StringView default constructor.
Definition at line 2133 of file structures.hpp.
Referenced by subview().
|
inline |
StringView constructor from a const std::string pointer.
data | const std::string* |
Definition at line 2142 of file structures.hpp.
References assign().
|
inline |
StringView constructor from a const std::string reference.
data | const std::string& |
Definition at line 2154 of file structures.hpp.
References assign().
|
inline |
StringView constructor from a const std::string reference, a start and a length.
data | const std::string& |
start | size_t |
len | size_t |
Definition at line 2168 of file structures.hpp.
References assign(), m_data, StringViewBase::m_len, StringViewBase::m_start, and StringViewBase::validizeLength().
|
inline |
StringView copy constructor.
view | const StringView& |
Definition at line 2186 of file structures.hpp.
References assign().
|
inline |
StringView constructor from a MutableStringView class instance.
view | const MutableStringView& |
Definition at line 2198 of file structures.hpp.
References assign().
|
inline |
StringView move constructor.
view | StringView&& |
Definition at line 2209 of file structures.hpp.
References m_data, StringViewBase::m_len, and StringViewBase::m_start.
|
inlineprotected |
Assignment member function from a MutableStringView instance.
view | const MutableStringView& |
Definition at line 2090 of file structures.hpp.
References MutableStringView::m_data, m_data, StringViewBase::m_len, and StringViewBase::m_start.
|
inlineprotected |
Assignment member function from a const std::string pointer.
data | const std::string* |
Definition at line 2105 of file structures.hpp.
References m_data, StringViewBase::m_len, and StringViewBase::m_start.
|
inlineprotected |
Assignment member function from another StringView instance.
view | const StringView& |
Definition at line 2075 of file structures.hpp.
References m_data, StringViewBase::m_len, and StringViewBase::m_start.
Referenced by operator=(), and StringView().
|
inlineoverrideprotectedvirtual |
Override to clear the internal pointer as well.
Reimplemented from StringViewBase.
Definition at line 2122 of file structures.hpp.
References m_data, StringViewBase::m_len, and StringViewBase::m_start.
|
inlineoverrideprotectedvirtual |
Override to return a pointer to the internal string.
Reimplemented from StringViewBase.
Definition at line 2062 of file structures.hpp.
References m_data.
|
inline |
This member function returns a MutableStringView instance with the data of this instance.
Definition at line 2320 of file structures.hpp.
References m_data, StringViewBase::m_len, and StringViewBase::m_start.
|
inline |
Assignment operator for a MutableStringView class instance.
view | const MutableStringView& |
Definition at line 2238 of file structures.hpp.
References assign().
|
inline |
Assignment operator for a const std::string reference.
data | const std::string& |
Definition at line 2266 of file structures.hpp.
References assign().
|
inline |
Assignment operator for a const std::string pointer.
data | const std::string* |
Definition at line 2252 of file structures.hpp.
References assign().
|
inline |
Assignment operator for another StringView instance.
view | const StringView& |
Definition at line 2224 of file structures.hpp.
References assign().
|
inline |
Random access operator, returning a const char reference.
pos | size_t |
Definition at line 2281 of file structures.hpp.
References m_data, and StringViewBase::m_start.
|
inline |
This member function creates a new StringView class instance using the selected position and length as a new viewed part. The position has to be part of the viewed section of this instance. This function can be used to replace std::string::substr.
pos | size_t |
len | size_t |
Definition at line 2299 of file structures.hpp.
References m_data, StringViewBase::m_len, StringViewBase::m_start, StringView(), and StringViewBase::validizeLength().
Referenced by FlowCtrl::calc(), NumeRe::StringLogicParser::concatenateStrings(), mu::ParserBase::ContainsVectorVars(), NumeRe::StringParser::createStack(), DataAccessParser::DataAccessParser(), expandIndexVectors(), findCasualCommand(), findCommandWithReturnValue(), mu::ParserBase::FindMultiArgFunc(), NumeRe::StringFuncHandler::findNextFunction(), findShortestMatchForCommand(), NumeRe::ClusterManager::getCluster(), NumeRe::StringFuncHandler::getFunctionArgumentList(), getIndices(), getNextCommandLineToken(), NumeRe::ClusterManager::isCluster(), isCompleteCluster(), isCompleteTable(), isInQuotes(), StringVector::makePureString(), strfnc_findfile(), strfnc_locate(), strfnc_regex(), strfnc_strip(), strfnc_substr(), strfnc_textparse(), and NumeRe::ClusterManager::updateClusterSizeVariables().
|
private |
Definition at line 2037 of file structures.hpp.
Referenced by assign(), clear(), getData(), make_mutable(), operator[](), StringView(), and subview().