|
Qx v0.7.2
Qt Extensions Library
|
The FixedStringList template class is a FixedList with a few added convenience functions for handling lists of string views (i.e. the FixedList equivalent of QStringList). More...
#include <qx/core/qx-fixedstringlist.h>
Public Member Functions | |
| constexpr | FixedStringList ()=default |
| template<typename A> requires std::same_as<std::remove_cvref_t<A>, std::array<ViewT, N>> | |
| constexpr | FixedStringList (A &&arr) |
| template<typename... Args> requires (N > 0 && sizeof...(Args) == N && (std::constructible_from<ViewT, Args> && ...)) | |
| constexpr | FixedStringList (Args &&... args) noexcept |
| template<typename B> requires std::same_as<std::remove_cvref_t<B>, Base> | |
| constexpr | FixedStringList (B &&base) |
| template<size_t M> requires (M == N) | |
| constexpr | FixedStringList (const ViewT(&arr)[M]) |
| template<qsizetype K> | |
| constexpr auto | chopped () const |
| bool | contains (QLatin1StringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
| bool | contains (QStringView str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
| constexpr reference | first () |
| template<qsizetype K> | |
| constexpr auto | first () const |
| qsizetype | indexOf (QLatin1StringView str, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
| qsizetype | indexOf (QStringView str, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
| QString | join (QChar separator) const |
| QString | join (QLatin1StringView separator) const |
| QString | join (QStringView separator) const |
| constexpr reference | last () |
| template<qsizetype K> | |
| constexpr auto | last () const |
| qsizetype | lastIndexOf (QLatin1StringView str, qsizetype from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
| qsizetype | lastIndexOf (QStringView str, qsizetype from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept |
| template<qsizetype Pos, qsizetype Len = -1> | |
| constexpr auto | mid () const |
| template<size_t M> | |
| constexpr FixedStringList< ViewT, N+M > | operator+ (const FixedStringList< ViewT, M > &other) const |
| template<size_t M> | |
| constexpr FixedStringList< ViewT, N+M > | operator+ (const ViewT(&other)[M]) const |
| template<typename L> requires std::constructible_from<ViewT, L> | |
| constexpr FixedStringList< ViewT, N+1 > | operator+ (L &&other) const |
| template<qsizetype Pos, qsizetype K> | |
| constexpr auto | sliced () const |
| template<qsizetype Pos> | |
| constexpr auto | sliced () const |
| QStringList | toStringList () const |
Public Member Functions inherited from Qx::FixedList< ViewT, N > | |
| constexpr | FixedList ()=default |
| constexpr | FixedList (A &&arr) |
| constexpr | FixedList (A &&arr) |
| constexpr | FixedList (Args &&... args) |
| constexpr | FixedList (Args &&... args) |
| constexpr | FixedList (const ViewT(&arr)[M]) |
| constexpr | FixedList (const ViewT(&arr)[M]) |
| constexpr reference | at (qsizetype i) |
| constexpr reference | at (qsizetype i) |
| constexpr const_reference | at (qsizetype i) const |
| constexpr const_reference | at (qsizetype i) const |
| constexpr reference | back () |
| constexpr reference | back () |
| constexpr const_reference | back () const |
| constexpr const_reference | back () const |
| constexpr const_iterator | begin () const noexcept |
| constexpr const_iterator | begin () const noexcept |
| constexpr iterator | begin () noexcept |
| constexpr iterator | begin () noexcept |
| constexpr const_iterator | cbegin () const noexcept |
| constexpr const_iterator | cbegin () const noexcept |
| constexpr const_iterator | cend () const noexcept |
| constexpr const_iterator | cend () const noexcept |
| constexpr auto | chopped () const |
| constexpr auto | chopped () const |
| constexpr const_iterator | constBegin () const noexcept |
| constexpr const_iterator | constBegin () const noexcept |
| constexpr const_pointer | constData () const noexcept |
| constexpr const_pointer | constData () const noexcept |
| constexpr const_iterator | constEnd () const noexcept |
| constexpr const_iterator | constEnd () const noexcept |
| constexpr const_reference | constFirst () const |
| constexpr const_reference | constFirst () const |
| constexpr const_reference | constLast () const |
| constexpr const_reference | constLast () const |
| constexpr bool | contains (const AT &t) const |
| constexpr bool | contains (const AT &t) const |
| constexpr qsizetype | count (const AT &t) const |
| constexpr qsizetype | count (const AT &t) const |
| constexpr const_reverse_iterator | crbegin () const noexcept |
| constexpr const_reverse_iterator | crbegin () const noexcept |
| constexpr const_reverse_iterator | crend () const noexcept |
| constexpr const_reverse_iterator | crend () const noexcept |
| constexpr const_pointer | data () const noexcept |
| constexpr const_pointer | data () const noexcept |
| constexpr pointer | data () noexcept |
| constexpr pointer | data () noexcept |
| constexpr const_iterator | end () const noexcept |
| constexpr const_iterator | end () const noexcept |
| constexpr iterator | end () noexcept |
| constexpr iterator | end () noexcept |
| constexpr bool | endsWith (const AT &t) const |
| constexpr bool | endsWith (const AT &t) const |
| constexpr FixedList & | fill (const AT &t) |
| constexpr FixedList & | fill (const AT &t) |
| constexpr reference | first () |
| constexpr reference | first () |
| constexpr const_reference | first () const |
| constexpr const_reference | first () const |
| constexpr auto | first () const |
| constexpr auto | first () const |
| constexpr reference | front () |
| constexpr reference | front () |
| constexpr const_reference | front () const |
| constexpr const_reference | front () const |
| constexpr ViewT && | get () &&noexcept |
| constexpr ViewT && | get () &&noexcept |
| constexpr ViewT & | get () &noexcept |
| constexpr ViewT & | get () &noexcept |
| constexpr const ViewT & | get () const &noexcept |
| constexpr const ViewT & | get () const &noexcept |
| constexpr qsizetype | indexOf (const AT &t, qsizetype from=0) const |
| constexpr qsizetype | indexOf (const AT &t, qsizetype from=0) const |
| constexpr reference | last () |
| constexpr reference | last () |
| constexpr const_reference | last () const |
| constexpr const_reference | last () const |
| constexpr auto | last () const |
| constexpr auto | last () const |
| constexpr qsizetype | lastIndexOf (const AT &t, qsizetype from=-1) const |
| constexpr qsizetype | lastIndexOf (const AT &t, qsizetype from=-1) const |
| constexpr auto | mid () const |
| constexpr auto | mid () const |
| constexpr void | move (qsizetype from, qsizetype to) |
| constexpr void | move (qsizetype from, qsizetype to) |
| constexpr FixedList< ViewT, N+M > | operator+ (const FixedList< ViewT, M > &other) const |
| constexpr FixedList< ViewT, N+M > | operator+ (const FixedList< ViewT, M > &other) const |
| constexpr FixedList< ViewT, N+1 > | operator+ (const ViewT &other) const |
| constexpr FixedList< ViewT, N+1 > | operator+ (const ViewT &other) const |
| constexpr FixedList< ViewT, N+M > | operator+ (const ViewT(&other)[M]) const |
| constexpr FixedList< ViewT, N+M > | operator+ (const ViewT(&other)[M]) const |
| constexpr auto | operator<=> (const FixedList &other) const=default |
| constexpr auto | operator<=> (const FixedList &other) const=default |
| constexpr bool | operator== (const FixedList &other) const=default |
| constexpr bool | operator== (const FixedList &other) const=default |
| constexpr reference | operator[] (qsizetype i) |
| constexpr reference | operator[] (qsizetype i) |
| constexpr const_reference | operator[] (qsizetype i) const |
| constexpr const_reference | operator[] (qsizetype i) const |
| constexpr const_reverse_iterator | rbegin () const noexcept |
| constexpr const_reverse_iterator | rbegin () const noexcept |
| constexpr reverse_iterator | rbegin () noexcept |
| constexpr reverse_iterator | rbegin () noexcept |
| constexpr const_reverse_iterator | rend () const noexcept |
| constexpr const_reverse_iterator | rend () const noexcept |
| constexpr reverse_iterator | rend () noexcept |
| constexpr reverse_iterator | rend () noexcept |
| constexpr void | replace (qsizetype i, const AT &t) |
| constexpr void | replace (qsizetype i, const AT &t) |
| constexpr auto | sliced () const |
| constexpr auto | sliced () const |
| constexpr auto | sliced () const |
| constexpr auto | sliced () const |
| constexpr bool | startsWith (const AT &t) const |
| constexpr bool | startsWith (const AT &t) const |
| constexpr const std::array< ViewT, N > & | stdArray () const noexcept |
| constexpr const std::array< ViewT, N > & | stdArray () const noexcept |
| constexpr std::array< ViewT, N > & | stdArray () noexcept |
| constexpr std::array< ViewT, N > & | stdArray () noexcept |
| constexpr void | swap (FixedList &other) noexcept(std::is_nothrow_swappable_v< ViewT >) |
| constexpr void | swap (FixedList &other) noexcept(std::is_nothrow_swappable_v< ViewT >) |
| constexpr void | swapItemsAt (qsizetype i, qsizetype j) |
| constexpr void | swapItemsAt (qsizetype i, qsizetype j) |
| QList< ViewT > | toList () const |
| QList< ViewT > | toList () const |
| constexpr std::array< ViewT, N > | toStdArray () const |
| constexpr std::array< ViewT, N > | toStdArray () const |
| constexpr ViewT | value (qsizetype i) const |
| constexpr ViewT | value (qsizetype i) const |
| constexpr ViewT | value (qsizetype i, const AT &defaultValue) const |
| constexpr ViewT | value (qsizetype i, const AT &defaultValue) const |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename ViewT, size_t M, size_t N> | |
| constexpr FixedStringList< ViewT, M+N > | operator+ (const ViewT(&a)[M], const FixedStringList< ViewT, N > &b) |
| template<typename L, typename ViewT, size_t N> | |
| constexpr FixedStringList< ViewT, 1+N > | operator+ (L &&a, const FixedStringList< ViewT, N > &b) |
Related Symbols inherited from Qx::FixedList< ViewT, N > | |
| constexpr FixedList< ViewT, N > | makeFixedList (const ViewT(&arr)[N]) |
| constexpr FixedList< ViewT, N > | makeFixedList (const ViewT(&arr)[N]) |
| constexpr FixedList< ViewT, 1+N > | operator+ (const std::type_identity_t< ViewT > &a, const FixedList< ViewT, N > &b) |
| constexpr FixedList< ViewT, 1+N > | operator+ (const std::type_identity_t< ViewT > &a, const FixedList< ViewT, N > &b) |
| constexpr FixedList< ViewT, M+N > | operator+ (const ViewT(&a)[M], const FixedList< ViewT, N > &b) |
| constexpr FixedList< ViewT, M+N > | operator+ (const ViewT(&a)[M], const FixedList< ViewT, N > &b) |
Additional Inherited Members | |
Public Types inherited from Qx::FixedList< ViewT, N > | |
| using | const_iterator |
| using | const_pointer |
| using | const_reference |
| using | const_reverse_iterator |
| using | ConstIterator |
| using | difference_type |
| using | Iterator |
| using | iterator |
| using | parameter_type |
| using | pointer |
| using | reference |
| using | reverse_iterator |
| using | size_type |
| using | value_type |
Static Public Member Functions inherited from Qx::FixedList< ViewT, N > | |
| static constexpr qsizetype | count () noexcept |
| static constexpr qsizetype | count () noexcept |
| static constexpr bool | empty () noexcept |
| static constexpr bool | empty () noexcept |
| static constexpr bool | isEmpty () noexcept |
| static constexpr bool | isEmpty () noexcept |
| static constexpr qsizetype | length () noexcept |
| static constexpr qsizetype | length () noexcept |
| static constexpr qsizetype | size () noexcept |
| static constexpr qsizetype | size () noexcept |
Static Public Attributes inherited from Qx::FixedList< ViewT, N > | |
| static constexpr qsizetype | size_v |
| static constexpr qsizetype | size_v |
The element type must be either QStringView or QLatin1StringView. As with any other view, the underlying strings are not owned by the list, so they must outlive it. This is naturally the case for string literals, which is the primary use-case for this class.
All of FixedList's functionality also applies to FixedStringList. For example you can use functions like isEmpty(), at(), and size() to inspect the list.
Both the view type and the size can be deduced from the type of literal used to construct the list; char16_t literals (and QString or QStringView) will result in a QStringView list, while char literals (and QLatin1StringView) will result in a QLatin1StringView list. The StringViewList and Latin1StringViewList aliases can be used to make the type explicit while still having the size deduced.
|
constexprdefault |
Constructs an empty FixedStringList.
|
inlineconstexpr |
Constructs a list that contains copies of the views in the C array arr.
Requires that M is equal to N.
|
inlineconstexpr |
Constructs a list that contains the views in the std::array arr.
Requires that A is a (possibly cv-qualified/reference) std::array<ViewT, N>.
|
inlineexplicitconstexpr |
Constructs a list from the FixedList base, which allows the result of a FixedList operation to be used as a FixedStringList.
Requires that B is a (possibly cv-qualified/reference) FixedList<ViewT, N>.
|
inlineconstexprnoexcept |
Constructs a list from args, each of which must be usable to construct a ViewT, such as a string literal.
Requires that the number of arguments is equal to N, and that N is greater than zero.
|
inlineconstexpr |
Returns a FixedStringList<ViewT, N - K> that contains copies of all but the last K views in this list.
K must be non-negative and no greater than N.
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns true if the list contains the Latin-1 string viewed by str; otherwise, returns false.
|
inlinenoexcept |
Returns true if the list contains the string str; otherwise, returns false.
The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
|
inlineconstexpr |
Returns a reference to the first item in the list.
Requires the list to not be empty.
|
inlineconstexpr |
Returns a FixedStringList<ViewT, K> that contains copies of the first K views in this list.
K must be non-negative and no greater than N.
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the index position of the first occurrence of the Latin-1 string viewed by str.
|
inlinenoexcept |
Returns the index position of the first occurrence of the string str in the list, searching forward from index position from. Returns -1 if no item matched.
If from is negative, it is interpreted as an offset from the end of the list (i.e. -1 starts the search at the last item).
The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
inline |
Joins all the strings in the list into a single string with each element separated by the given separator (which can be an empty string).
If the list is empty, an empty string is returned.
|
inlineconstexpr |
Returns a reference to the last item in the list.
Requires the list to not be empty.
|
inlineconstexpr |
Returns a FixedStringList<ViewT, K> that contains copies of the last K views in this list.
K must be non-negative and no greater than N.
|
inlinenoexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the index position of the last occurrence of the Latin-1 string viewed by str.
|
inlinenoexcept |
Returns the index position of the last occurrence of the string str in the list, searching backward from index position from. Returns -1 if no item matched.
If from is negative, it is interpreted as an offset from the end of the list (i.e. -1, the default, starts the search at the last item). If from is greater than or equal to the size of the list, the search starts at the last item.
The search is case insensitive if cs is Qt::CaseInsensitive; the search is case sensitive by default.
|
inlineconstexpr |
Returns a FixedStringList that contains copies of up to Len views in this list, starting at index position Pos.
The size of the result and the requirements of the parameters are the same as FixedList::mid().
|
inlineconstexpr |
Returns a FixedStringList of size N + M that contains all the views in this list followed by all the views in other.
|
inlineconstexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a FixedStringList of size N + M that contains all the views in this list followed by all the views in the C array other.
|
inlineconstexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a FixedStringList of size N + 1 that contains all the views in this list followed by a ViewT constructed from other, which can be anything that a ViewT can be constructed from (i.e. a string literal).
|
inlineconstexpr |
Returns a FixedStringList<ViewT, K> that contains copies of K views in this list, starting at index position Pos.
Pos and K must be non-negative and Pos + K must be no greater than N.
|
inlineconstexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns a FixedStringList<ViewT, N - Pos> that contains copies of all views in this list from index position Pos to the end.
Pos must be non-negative and no greater than N.
|
inline |
Returns a QStringList that contains a QString copy of each of the strings in the list.
|
Returns a FixedStringList which is the result of concatenating a and b.
|
Returns a FixedStringList which is the result of concatenating a and b.