OTB
9.0.0
Orfeo Toolbox
|
#include <otbStringUtilities.h>
Classes | |
struct | build_empty |
struct | char_iterator |
Public Types | |
typedef char_iterator | const_iterator |
typedef char const * | const_pointer |
typedef char const & | const_reference |
typedef std::reverse_iterator< char_iterator > | const_reverse_iterator |
typedef char const * | pointer |
typedef char const & | reference |
typedef std::vcl_size_t | size_type |
typedef const char | value_type |
Public Member Functions | |
template<std::vcl_size_t N> | |
string_view (char const (&array)[N]) | |
string_view (char const *ptr) | |
template<typename II > | |
string_view (II first, II last) | |
template<typename II > | |
string_view (II first, size_type size_) | |
string_view (std::string const &s) | |
Static Public Member Functions | |
static string_view | null () |
std::vcl_size_t | m_size |
const_iterator | m_first |
bool | belongs_to (char const *first, char const *last) const |
template<std::vcl_size_t N> | |
bool | belongs_to (char const (&array)[N]) const |
bool | belongs_to (char const *ptr) const |
template<typename String > | |
bool | belongs_to (String const &s) const |
size_type | size () const |
bool | empty () const |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
const_reverse_iterator | rbegin () const |
const_reverse_iterator | rend () const |
const_reverse_iterator | crbegin () const |
const_reverse_iterator | crend () const |
const_reference | operator[] (size_type p) |
const_reference | front () const |
const_reference | back () const |
const_pointer | data () const |
void | remove_prefix (std::vcl_size_t n) |
void | remove_suffix (std::vcl_size_t n) |
string_view (build_empty) | |
String view class. Class inspired by C++17 std::string_view
and gsl::string_span
.
This idea is to bring efficiency and correctness to C++ functions that take strings. A function that receives a string_view
can receive any kind of string flavour and guarantee 0-copy.
The only side effect to be aware of: no terminal-0 is to be expected. i.e. a string_view
data cannot be passed freely to a function with a C API that expect a null-terminated string.
Definition at line 58 of file otbStringUtilities.h.
Definition at line 114 of file otbStringUtilities.h.
typedef char const* otb::string_view::const_pointer |
Definition at line 63 of file otbStringUtilities.h.
typedef char const& otb::string_view::const_reference |
Definition at line 62 of file otbStringUtilities.h.
typedef std::reverse_iterator<char_iterator> otb::string_view::const_reverse_iterator |
Definition at line 116 of file otbStringUtilities.h.
typedef char const* otb::string_view::pointer |
Definition at line 64 of file otbStringUtilities.h.
typedef char const& otb::string_view::reference |
Definition at line 61 of file otbStringUtilities.h.
typedef std::vcl_size_t otb::string_view::size_type |
Definition at line 65 of file otbStringUtilities.h.
typedef const char otb::string_view::value_type |
Definition at line 60 of file otbStringUtilities.h.
|
inline |
Constructor from a standard string.
Definition at line 121 of file otbStringUtilities.h.
Referenced by null().
|
inline |
Constructor from an array of characters.
<= the array is built with this kind of syntax:
char const a[]="foobar";` Definition at line 130 of file otbStringUtilities.h.
|
inline |
Constructor from a pointer to a 0-terminated raw string.
Definition at line 137 of file otbStringUtilities.h.
|
inline |
Constructor from an input iterator and a size.
Definition at line 152 of file otbStringUtilities.h.
|
inline |
Constructor from a pair of input iterators.
Definition at line 160 of file otbStringUtilities.h.
|
inlineprivate |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 246 of file otbStringUtilities.h.
|
inline |
Returns last character of the view.
!empty()
, checked with an assertion. Definition at line 224 of file otbStringUtilities.h.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 195 of file otbStringUtilities.h.
References m_first.
Referenced by belongs_to(), otb::find(), front(), otb::is_same_view(), otb::splitter_on_delim::operator()(), otb::operator+(), otb::operator<<(), otb::operator==(), otb::starts_with(), otb::to< std::string >(), otb::details::to_integer(), and otb::details::to_uinteger().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 177 of file otbStringUtilities.h.
References belongs_to().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 173 of file otbStringUtilities.h.
References begin(), and end().
Referenced by belongs_to(), otb::find(), and otb::part_iterator< Splitter >::operator++().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 181 of file otbStringUtilities.h.
References belongs_to().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 185 of file otbStringUtilities.h.
References belongs_to().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 197 of file otbStringUtilities.h.
References m_first.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 198 of file otbStringUtilities.h.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 204 of file otbStringUtilities.h.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 205 of file otbStringUtilities.h.
References m_first.
|
inline |
Returns a pointer to the first character of the view.
Definition at line 229 of file otbStringUtilities.h.
References m_first.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 191 of file otbStringUtilities.h.
References m_size.
Referenced by back(), otb::details::decode_uint(), otb::find(), front(), and otb::details::to_float().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 196 of file otbStringUtilities.h.
References m_first, and m_size.
Referenced by back(), belongs_to(), otb::find(), otb::Wrapper::LearningApplicationBase< TInputValue, TOutputValue >::GetClassifierCategory(), otb::splitter_on_delim::operator()(), otb::operator+(), otb::part_iterator< Splitter >::operator++(), otb::operator<<(), otb::operator==(), otb::starts_with(), otb::to< std::string >(), otb::details::to_integer(), and otb::details::to_uinteger().
|
inline |
Returns first character of the view.
!empty()
, checked with an assertion. Definition at line 219 of file otbStringUtilities.h.
References begin(), and empty().
Referenced by otb::details::decode_uint().
|
inlinestatic |
Builds a peculiar empty view to points to nullptr.
Definition at line 167 of file otbStringUtilities.h.
References string_view().
Referenced by otb::contains(), otb::find(), and otb::part_iterator< Splitter >::operator++().
|
inline |
Indexed access.
p < size(),
checked with an assertion. Definition at line 210 of file otbStringUtilities.h.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 202 of file otbStringUtilities.h.
References m_first, and m_size.
Referenced by otb::ends_with().
|
inline |
Removes the n first characters.
n <= size()
, checked with an assertion begin()
iterator is n characters right. Definition at line 236 of file otbStringUtilities.h.
References m_first, and m_size.
Referenced by otb::details::decode_uint().
|
inline |
Removes the n last characters.
n <= size()
, checked with an assertion end()
iterator is n characters left. Definition at line 243 of file otbStringUtilities.h.
References m_size.
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 203 of file otbStringUtilities.h.
References m_first.
Referenced by otb::ends_with().
|
inline |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 190 of file otbStringUtilities.h.
References m_size.
Referenced by otb::ends_with(), otb::find(), otb::is_same_view(), otb::operator==(), operator[](), and otb::starts_with().
|
private |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 250 of file otbStringUtilities.h.
Referenced by begin(), cbegin(), cend(), crbegin(), crend(), data(), end(), operator[](), rbegin(), remove_prefix(), and rend().
|
private |
Tells whether a view is within another view. This functions doesn't test whether the characters from a view are found in the same relative positions in another view.
Definition at line 249 of file otbStringUtilities.h.
Referenced by cend(), crbegin(), empty(), end(), rbegin(), remove_prefix(), remove_suffix(), and size().