Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
\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< Haystack, Needle > | |
using | const_iterator = iterator |
using | size_type = std::size_t |
using | difference_type = typename iterator::difference_type |
using | value_type = typename iterator::value_type |
using | pointer = typename iterator::pointer |
using | const_pointer = pointer |
using | reference = typename iterator::reference |
using | const_reference = 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< Haystack, Needle > | |
constexpr | QStringTokenizerBase (Haystack haystack, Needle needle, Qt::SplitBehavior sb, Qt::CaseSensitivity cs) noexcept |
iterator | begin () const noexcept |
iterator | cbegin () const noexcept |
template<bool = std::is_same<iterator, sentinel>::value> | |
constexpr sentinel | end () const noexcept |
template<bool = std::is_same<iterator, sentinel>::value> | |
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, at least with a recent compiler, you can use it directly, too:
{QStringTokenizer{string, separator}} (without template arguments). If you can't use C++17 CTAD, you must use the QStringView::split() or QLatin1StringView::split() member functions and store the return value only in
{auto} variables: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 246 of file qstringtokenizer.h.
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 275 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::const_pointer = typename Base::const_pointer |
Definition at line 273 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::const_reference = typename Base::const_reference |
Definition at line 271 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::difference_type = typename Base::difference_type |
Definition at line 268 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::iterator = typename Base::iterator |
Definition at line 274 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::pointer = typename Base::pointer |
Definition at line 272 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::reference = typename Base::reference |
Definition at line 270 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::sentinel = typename Base::sentinel |
Definition at line 276 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::size_type = typename Base::size_type |
Definition at line 269 of file qstringtokenizer.h.
using QStringTokenizer< Haystack, Needle >::value_type = typename Base::value_type |
Definition at line 267 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 285 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 300 of file qstringtokenizer.h.
|
inline |
Definition at line 315 of file qstringtokenizer.h.
|
inline |
Definition at line 323 of file qstringtokenizer.h.
|
related |
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.
You can use this function if your compiler doesn't, yet, support C++17 Class Template Argument Deduction (CTAD). We recommend direct use of QStringTokenizer with CTAD instead.
Definition at line 382 of file qstringtokenizer.h.