![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qstringtokenizer.h>
Public Types | |
using | value_type = typename Base::value_type |
using | difference_type = typename Base::difference_type |
using | size_type = typename Base::size_type |
using | reference = typename Base::reference |
using | const_reference = typename Base::const_reference |
using | pointer = typename Base::pointer |
using | const_pointer = typename Base::const_pointer |
using | iterator = typename Base::iterator |
using | const_iterator = typename Base::const_iterator |
\typealias QStringTokenizer::value_type | |
using | sentinel = typename Base::sentinel |
Public Types inherited from QStringTokenizerBase< ViewFor< Haystack >, ViewFor< Needle > > | |
using | const_iterator |
using | size_type |
using | difference_type |
using | value_type |
using | pointer |
using | const_pointer |
using | reference |
using | const_reference |
Public Member Functions | |
constexpr | QStringTokenizer (Haystack haystack, Needle needle, Qt::CaseSensitivity cs, Qt::SplitBehavior sb=Qt::KeepEmptyParts) noexcept(std::is_nothrow_copy_constructible< QStringTokenizer >::value) |
\typealias QStringTokenizer::sentinel | |
constexpr | QStringTokenizer (Haystack haystack, Needle needle, Qt::SplitBehavior sb=Qt::KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept(std::is_nothrow_copy_constructible< QStringTokenizer >::value) |
Constructs a string tokenizer that splits the string haystack into substrings wherever needle occurs, and allows iteration over those strings as they are found. | |
template<typename Container = QList<value_type>, if_compatible_container< Container > = true> | |
Container | toContainer (Container &&c={}) const & |
template<typename Container = QList<value_type>, if_compatible_container< Container > = true, if_haystack_not_pinned< Container > = true> | |
Container | toContainer (Container &&c={}) const && |
Public Member Functions inherited from QStringTokenizerBase< ViewFor< Haystack >, ViewFor< Needle > > | |
constexpr | QStringTokenizerBase (Haystack haystack, Needle needle, Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept |
iterator | begin () const noexcept |
iterator | cbegin () const noexcept |
constexpr sentinel | end () const noexcept |
constexpr sentinel | cend () const noexcept |
Related Symbols | |
(Note that these are not member symbols.) | |
template< typename Haystack, typename Needle, typename...Flags > auto | qTokenize (Haystack &&haystack, Needle &&needle, Flags...flags) |
Additional Inherited Members | |
Protected Member Functions inherited from QStringTokenizerBaseBase | |
~QStringTokenizerBaseBase ()=default | |
constexpr | QStringTokenizerBaseBase (Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept |
Protected Attributes inherited from QStringTokenizerBaseBase | |
Qt::SplitBehavior | m_sb |
Qt::CaseSensitivity | m_cs |
\inmodule QtCore
The QStringTokenizer class splits strings into tokens along given separators. \reentrant
Splits a string into substrings wherever a given separator occurs, returning a (lazily constructed) list of those strings. If the separator does not match anywhere in the string, produces a single-element list containing this string. If the separator is empty, QStringTokenizer produces an empty string, followed by each of the string's characters, followed by another empty string. The two enumerations Qt::SplitBehavior and Qt::CaseSensitivity further control the output.
QStringTokenizer drives QStringView::tokenize(), but you can use it directly, too:
{QStringTokenizer{string, separator}} (without template arguments), or use either QStringView::tokenize() or QLatin1StringView::tokenize(), then store the return value only in an
{auto} variable:This is because the template arguments of QStringTokenizer have a very subtle dependency on the specific string and separator types from with which they are constructed, and they don't usually correspond to the actual types passed.
Definition at line 234 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::const_iterator = typename Base::const_iterator |
\typealias QStringTokenizer::value_type
Alias for {const QStringView} or
{const QLatin1StringView}, depending on the tokenizer's
Haystack
template argument.
\typealias QStringTokenizer::difference_type
Alias for qsizetype.
\typealias QStringTokenizer::size_type
Alias for qsizetype.
\typealias QStringTokenizer::reference
Alias for {value_type &}.
QStringTokenizer does not support mutable references, so this is the same as const_reference.
\typealias QStringTokenizer::const_reference
Alias for {value_type &}.
\typealias QStringTokenizer::pointer
Alias for {value_type *}.
QStringTokenizer does not support mutable iterators, so this is the same as const_pointer.
\typealias QStringTokenizer::const_pointer
Alias for {value_type *}.
\typealias QStringTokenizer::iterator
This typedef provides an STL-style const iterator for QStringTokenizer.
QStringTokenizer does not support mutable iterators, so this is the same as const_iterator.
This typedef provides an STL-style const iterator for QStringTokenizer.
Definition at line 263 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::const_pointer = typename Base::const_pointer |
Definition at line 261 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::const_reference = typename Base::const_reference |
Definition at line 259 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::difference_type = typename Base::difference_type |
Definition at line 256 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::iterator = typename Base::iterator |
Definition at line 262 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::pointer = typename Base::pointer |
Definition at line 260 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::reference = typename Base::reference |
Definition at line 258 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::sentinel = typename Base::sentinel |
Definition at line 264 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::size_type = typename Base::size_type |
Definition at line 257 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::value_type = typename Base::value_type |
Definition at line 255 of file qstringtokenizer.h.
|
inlineexplicitconstexprnoexcept |
\typealias QStringTokenizer::sentinel
This typedef provides an STL-style sentinel for QStringTokenizer::iterator and QStringTokenizer::const_iterator.
Definition at line 273 of file qstringtokenizer.h.
|
inlineexplicitconstexprnoexcept |
Constructs a string tokenizer that splits the string haystack into substrings wherever needle occurs, and allows iteration over those strings as they are found.
If needle does not match anywhere in haystack, a single element containing haystack is produced.
cs specifies whether needle should be matched case sensitively or case insensitively.
If sb is Qt::SkipEmptyParts, empty entries don't appear in the result. By default, empty entries are included.
Definition at line 288 of file qstringtokenizer.h.
|
inline |
Definition at line 303 of file qstringtokenizer.h.
|
inline |
Definition at line 311 of file qstringtokenizer.h.
|
Factory function for a QStringTokenizer that splits the string haystack into substrings wherever needle occurs, and allows iteration over those strings as they are found. If needle does not match anywhere in haystack, a single element containing haystack is produced.
Pass values from Qt::CaseSensitivity and Qt::SplitBehavior enumerators as flags to modify the behavior of the tokenizer.
Definition at line 370 of file qstringtokenizer.h.
References qTokenize().