ML Reference
ml::ContainerProxy< T, R, I, Count, Access > Class Template Reference

This template implements a proxy for container that contain a collection of items that are normally accessed with a get by index method. More...

#include <mlContainerHelpers.h>

Classes

class  iterator
 

Public Types

using value_type = R *
 
using const_iterator = const iterator
 

Public Member Functions

 ContainerProxy (const T &object)
 
 ContainerProxy (const ContainerProxy &)=default
 
ContainerProxyoperator= (const ContainerProxy &)=default
 
 ContainerProxy (ContainerProxy &&)=default
 
ContainerProxyoperator= (ContainerProxy &&)=default
 
iterator begin () const
 
iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 

Detailed Description

template<class T, class R, typename I, I(T::*)() const Count, R *(T::*)(I) const Access>
class ml::ContainerProxy< T, R, I, Count, Access >

This template implements a proxy for container that contain a collection of items that are normally accessed with a get by index method.

Because of this structure it is not possible to use them in any STL compatible algorithm or range based for loop. So the proxy provides a begin()/end() pair that follow the standard STL conventions. So calling *end() is no good idea.

By defining a proxy like eg: using TreeWidgetProxy = ContainerHelpers::ContainerProxy<QTreeWidget, QTreeWidgetItem, int, &QTreeWidget::topLevelItemCount, &QTreeWidget::topLevelItem>; auto element = SCR::in(TreeWidgetProxy(<em>myListView)).find([&value](QTreeWidgetItem item) { return item->text(0) == value; }).or_return_nullptr();

NOTE: It is not wise to add or remove items within any loop!

Definition at line 64 of file mlContainerHelpers.h.

Member Typedef Documentation

◆ const_iterator

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
using ml::ContainerProxy< T, R, I, Count, Access >::const_iterator = const iterator

Definition at line 157 of file mlContainerHelpers.h.

◆ value_type

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
using ml::ContainerProxy< T, R, I, Count, Access >::value_type = R *

Definition at line 69 of file mlContainerHelpers.h.

Constructor & Destructor Documentation

◆ ContainerProxy() [1/3]

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
ml::ContainerProxy< T, R, I, Count, Access >::ContainerProxy ( const T & object)
inlineexplicit

Definition at line 71 of file mlContainerHelpers.h.

◆ ContainerProxy() [2/3]

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
ml::ContainerProxy< T, R, I, Count, Access >::ContainerProxy ( const ContainerProxy< T, R, I, Count, Access > & )
default

◆ ContainerProxy() [3/3]

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
ml::ContainerProxy< T, R, I, Count, Access >::ContainerProxy ( ContainerProxy< T, R, I, Count, Access > && )
default

Member Function Documentation

◆ begin()

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
iterator ml::ContainerProxy< T, R, I, Count, Access >::begin ( ) const
inline

Definition at line 159 of file mlContainerHelpers.h.

◆ cbegin()

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
const_iterator ml::ContainerProxy< T, R, I, Count, Access >::cbegin ( ) const
inline

Definition at line 169 of file mlContainerHelpers.h.

◆ cend()

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
const_iterator ml::ContainerProxy< T, R, I, Count, Access >::cend ( ) const
inline

Definition at line 174 of file mlContainerHelpers.h.

◆ end()

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
iterator ml::ContainerProxy< T, R, I, Count, Access >::end ( ) const
inline

Definition at line 164 of file mlContainerHelpers.h.

◆ operator=() [1/2]

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
ContainerProxy & ml::ContainerProxy< T, R, I, Count, Access >::operator= ( const ContainerProxy< T, R, I, Count, Access > & )
default

◆ operator=() [2/2]

template<class T , class R , typename I , I(T::*)() const Count, R *(T::*)(I) const Access>
ContainerProxy & ml::ContainerProxy< T, R, I, Count, Access >::operator= ( ContainerProxy< T, R, I, Count, Access > && )
default

The documentation for this class was generated from the following file: