5#ifndef QRANGEMODELADAPTER_IMPL_H
6#define QRANGEMODELADAPTER_IMPL_H
10#ifndef QRANGEMODELADAPTER_H
11#error Do not include qrangemodeladapter_impl.h directly
15#pragma qt_sync_skip_header_check
16#pragma qt_sync_stop_processing
19#include <QtCore/qrangemodel.h>
20#include <QtCore/qspan.h>
37template <
typename ...Args>
40template <
typename ...
Args>
44template <
typename ...
Args>
47template <
typename Output,
typename Input>
50 if constexpr (std::is_same_v<q20::remove_cvref<Output>, q20::remove_cvref<Input>>)
51 return std::forward<Input>(input);
53 return Output(
std::forward<Input>(input));
58template <
typename T,
typename =
void>
84template <
template <
typename>
typename U,
typename T>
96template <
typename const_row_type,
typename Iterator,
typename Sentinel>
135 template <
typename I = Iterator, if_atLeast<I, std::bidirectional_iterator_tag> =
true>
142 template <
typename I = Iterator, if_atLeast<I, std::bidirectional_iterator_tag> =
true>
151 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
158 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
166 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
174 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
180 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
185 copy.m_it = it.m_it - n;
189 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
196 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
200 return lhs.m_it - rhs.m_it;
203 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
207 return lhs.m_it < rhs.m_it;
209 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
213 return lhs.m_it <= rhs.m_it;
216 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
220 return lhs.m_it > rhs.m_it;
222 template <
typename I = Iterator, if_atLeast<I, std::random_access_iterator_tag> =
true>
226 return lhs.m_it >= rhs.m_it;
234
235
236
237
238
239
240
241
242
243
244
245
249 return lhs.m_it == rhs.m_it;
261 return lhs.m_begin == rhs.m_begin;
265 template <
typename RHS>
270 template <
typename RHS>
287template <
typename T,
typename =
void>
struct AsConstRow {
using type =
const T &; };
290template <
template <
typename>
typename U,
typename T>
298template <
template <
typename,
typename ...>
typename R,
typename T,
typename ...
Args>
305template <
template <
typename,
typename ...>
typename R,
typename T,
typename ...
Args>
314template <
template <
typename,
typename ...>
typename R,
typename T,
typename ...
Args>
330template <
typename Type>
333 Q_ASSERT_X(index.isValid(),
"QRangeModelAdapter::dataAtIndex",
"Index at position is invalid");
334 QVariant variant = qVariantAtIndex(index);
336 if constexpr (std::is_same_v<QVariant, Type>)
339 return variant.value<Type>();
342template <
typename Type>
345 Q_ASSERT_X(index.isValid(),
"QRangeModelAdapter::dataAtIndex",
"Index at position is invalid");
346 QVariant variant = index.data(role);
348 if constexpr (std::is_same_v<QVariant, Type>)
351 return variant.value<Type>();
354template <
bool isTree =
false>
357 ParentIndex(
const QModelIndex &dummy = {}) { Q_ASSERT(!dummy.isValid()); }
368template <
typename Model,
typename Impl>
375 static_assert(
isRangeModel,
"The model must be a QRangeModel (not a subclass).");
378 template <
typename I = Impl, std::enable_if_t<I::protocol_traits::is_tree,
bool> =
true>
379 explicit AdapterStorage(
const std::shared_ptr<QRangeModel> &model,
const QModelIndex &root)
390 return static_cast<
const Impl *>(QRangeModelImplBase::getImplementation(m_model.get()));
395 return static_cast<Impl *>(QRangeModelImplBase::getImplementation(m_model.get()));
401 return implementation();
403 return m_model.get();
409 return implementation();
411 return m_model.get();
static Type dataAtIndex(const QModelIndex &index, int role)
static Type dataAtIndex(const QModelIndex &index)
decltype(auto) forwardOrConvert(Input &&input)
static constexpr bool can_construct_rangeModel
decltype(QRangeModel(std::declval< Args && >()...)) construct_rangeModel_test
const Impl * implementation() const
const auto * operator->() const
std::shared_ptr< QRangeModel > m_model
AdapterStorage(const std::shared_ptr< QRangeModel > &model, const QModelIndex &root)
AdapterStorage(Model *model)
static constexpr bool isRangeModel
const QModelIndex m_rootIndex
ParentIndex(const QModelIndex &dummy={})
friend constexpr iterator & operator-=(iterator &it, difference_type n) noexcept(noexcept(std::declval< I & >() -=1))
friend constexpr iterator operator+(const iterator &it, difference_type n) noexcept(noexcept(std::declval< I & >()+1))
friend constexpr iterator & operator+=(iterator &it, difference_type n) noexcept(noexcept(std::declval< I & >()+=1))
friend constexpr iterator operator-(const iterator &it, difference_type n) noexcept(noexcept(std::declval< I & >() - 1))
friend constexpr iterator operator+(difference_type n, const iterator &it) noexcept(noexcept(1+std::declval< I & >()))
reference operator*() const
friend constexpr difference_type operator-(const iterator &lhs, const iterator &rhs) noexcept(noexcept(std::declval< I & >() - std::declval< I & >()))
friend constexpr bool operator<=(const iterator &lhs, const iterator &rhs) noexcept(noexcept(std::declval< I & >()<=std::declval< I & >()))
friend constexpr bool operator>(const iterator &lhs, const iterator &rhs) noexcept(noexcept(std::declval< I & >() > std::declval< I & >()))
friend constexpr iterator & operator++(iterator &it) noexcept(noexcept(++std::declval< Iterator & >()))
friend constexpr bool operator<(const iterator &lhs, const iterator &rhs) noexcept(noexcept(std::declval< I & >()< std::declval< I & >()))
typename std::iterator_traits< Iterator >::iterator_category iterator_category
friend constexpr iterator operator++(iterator &it, int) noexcept(noexcept(std::declval< Iterator & >()++))
friend constexpr iterator & operator--(iterator &it) noexcept(noexcept(--std::declval< I & >()))
friend bool comparesEqual(const iterator &lhs, const iterator &rhs) noexcept
pointer operator->() const
typename Iterator::difference_type difference_type
friend constexpr bool operator>=(const iterator &lhs, const iterator &rhs) noexcept(noexcept(std::declval< I & >() >=std::declval< I & >()))
friend constexpr iterator operator--(iterator &it, int) noexcept(noexcept(std::declval< I & >() --))
constexpr reference operator[](difference_type n) const noexcept(noexcept(I::operator[]()))
static constexpr bool is_atLeast
typename iterator::difference_type difference_type
typename iterator::value_type value_type
friend bool comparesEqual(const RowView &lhs, const RowView &rhs) noexcept