AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AListModel< StoredType > Class Template Reference

Public Types

using iterator = typename decltype(mVector)::iterator
 
using const_iterator = typename decltype(mVector)::const_iterator
 
using size_type = typename decltype(mVector)::size_type
 
using value_type = typename decltype(mVector)::value_type
 
- Public Types inherited from IListModel< StoredType >
using value_type
 
using stored_t
 

Public Member Functions

 AListModel (const self &s)
 
 AListModel (self &&s) noexcept
 
 AListModel (AVector< StoredType > &&vector) noexcept
 
AListModeloperator= (AVector< StoredType > &&rhs) noexcept
 
void setItem (const AListModelIndex &item, const StoredType &value) override
 
bool empty () const noexcept
 
void reserve (size_t s) noexcept
 
void resize (size_t s) noexcept
 
iterator erase (iterator begin) noexcept
 
iterator erase (iterator begin, iterator end) noexcept
 
void push_back (const StoredType &data)
 
void push_back (StoredType &&data)
 
const_iterator insert (const_iterator at, StoredType data)
 
void pop_back () noexcept
 
AListModeloperator<< (const StoredType &data)
 
AListModeloperator<< (StoredType &&data)
 
size_t listSize () override
 
StoredType listItemAt (const AListModelIndex &index) override
 
void invalidate (size_t index)
 
void invalidate (iterator index)
 
void clear () noexcept
 
void removeItems (const AListModelRange< StoredType > &items) override
 
void removeItem (const AListModelIndex &item) override
 
size_t size () const noexcept
 
const StoredType & at (size_t index) const
 
StoredType & at (size_t index)
 
const StoredType & operator[] (size_t index) const
 
void removeAt (size_t index) noexcept
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
template<typename UnaryOperation>
auto map (UnaryOperation &&transformer)
 
const AVector< StoredType > & toVector () noexcept
 
- Public Member Functions inherited from IRemovableListModel< StoredType >
virtual void removeItems (const AListModelSelection< StoredType > &items)
 
- Public Member Functions inherited from IListModel< StoredType >
AListModelRange< StoredType > range (const AListModelIndex &begin, const AListModelIndex &end)
 
AListModelRange< StoredType > range (const AListModelIndex &item)
 
AVector< StoredType > toVector () noexcept
 
AVector< AListModelRange< StoredType > > rangesIncluding (Filter &&filter)
 
- Public Member Functions inherited from AObject
_< AObjectsharedPtr ()
 
_weak< AObjectweakPtr ()
 
template<typename Connectable, ACompatibleSlotFor< Connectable > Function>
void connect (const Connectable &connectable, Function &&function)
 Connects signal or property to slot of "this" object.
 
void setSignalsEnabled (bool enabled)
 
bool isSignalsEnabled () const noexcept
 
template<ASignalInvokable T>
void operator^ (T &&t)
 
_< AAbstractThreadgetThread () const
 
bool isSlotsCallsOnlyOnMyThread () const noexcept
 
void setSlotsCallsOnlyOnMyThread (bool slotsCallsOnlyOnMyThread)
 
- Public Member Functions inherited from AObjectBase
 AObjectBase (AObjectBase &&rhs) noexcept
 
void clearSignals () noexcept
 
- Public Member Functions inherited from aui::noncopyable
 noncopyable (const noncopyable &)=delete
 
noncopyableoperator= (const noncopyable &)=delete
 

Static Public Member Functions

template<typename V>
static _< AListModel< StoredType > > make (const std::initializer_list< V > &t)
 
template<typename V>
static _< AListModel< StoredType > > fromVector (AVector< V > t)
 
template<typename V>
static _< AListModel< StoredType > > fromVector (std::vector< V > t)
 
- Static Public Member Functions inherited from AObject
static void disconnect ()
 
template<AAnySignal Signal, aui::derived_from< AObjectBase > Object, ACompatibleSlotFor< Signal > Function>
static void connect (const Signal &signal, Object *object, Function &&function)
 Connects signal to the slot of the specified object.
 
template<AAnyProperty Property, aui::derived_from< AObjectBase > Object, typename Function>
static void connect (const Property &property, Object *object, Function &&function)
 Connects property to the slot of the specified object.
 
template<APropertyReadable PropertySource, APropertyWritable PropertyDestination>
requires requires { { *propertySource } -> aui::convertible_to<std::decay_t<decltype(*propertyDestination)>>; }
static void connect (PropertySource &&propertySource, PropertyDestination &&propertyDestination)
 Connects source property to the destination property.
 
template<APropertyWritable PropertySource, APropertyWritable PropertyDestination>
requires requires { { *propertySource } -> aui::convertible_to<std::decay_t<decltype(*propertyDestination)>>; { *propertyDestination } -> aui::convertible_to<std::decay_t<decltype(*propertySource)>>; }
static void biConnect (PropertySource &&propertySource, PropertyDestination &&propertyDestination)
 Connects source property to the destination property and opposite (bidirectionally).
 
template<AAnySignalOrProperty Connectable, aui::derived_from< AObjectBase > Object, ACompatibleSlotFor< Connectable > Function>
static void connect (const Connectable &connectable, Object &object, Function &&function)
 Connects signal or property to the slot of the specified object.
 
template<AAnySignalOrProperty Connectable, aui::derived_from< AObjectBase > Object, ACompatibleSlotFor< Connectable > Function>
static void connect (const Connectable &connectable, _< Object > object, Function &&function)
 Connects signal or property to the slot of the specified object.
 
template<AAnySignalOrProperty Connectable, aui::derived_from< AObjectBase > Object, typename Function>
static void connect (const Connectable &connectable, ASlotDef< Object *, Function > slotDef)
 Connects signal to the slot of the specified object. Slot is packed to single argument.
 
template<AAnyProperty Property, typename Object, ACompatibleSlotFor< Property > Function>
requires (!aui::derived_from<Object, AObject>)
static void connect (const Property &property, _< Object > object, Function &&function)
 Connects signal or property to the slot of the specified non-AObject type.
 
static void moveToThread (aui::no_escape< AObject > object, _< AAbstractThread > thread)
 

Additional Inherited Members

- Signals and public fields inherited from IListModel< StoredType >
emits< AListModelRange< StoredType > > dataChanged
 Model data was changed.
 
emits< AListModelRange< StoredType > > dataInserted
 Model data was added.
 
emits< AListModelRange< StoredType > > dataRemoved
 Model data about to remove.
 
- Protected Member Functions inherited from AObject
void setThread (_< AAbstractThread > thread)
 Set thread of the object.
 

Member Function Documentation

◆ at() [1/2]

template<typename StoredType>
StoredType & AListModel< StoredType >::at ( size_t index)
inline

Fetches element by index.

Sneaky exceptions
AException thrown if out of bounds.
Performance note
if guaranteed index is not out of bounds, use the operator[] function instead.
Data model note
A mutable reference returned by this method. If you want to change data, you should report changes by invalidate function.

◆ at() [2/2]

template<typename StoredType>
const StoredType & AListModel< StoredType >::at ( size_t index) const
inline

Fetches element by index.

Sneaky exceptions
AException thrown if out of bounds.
Performance note
if guaranteed index is not out of bounds, use the operator[] function instead.

◆ fromVector() [1/2]

template<typename StoredType>
template<typename V>
static _< AListModel< StoredType > > AListModel< StoredType >::fromVector ( AVector< V > t)
inlinestatic

Create AListModel from initializer list. Applicable for initializing AListModel<AString> from const char* initializer list.

Template Parameters
Vtype that converts to T
Returns
a new AListModel

◆ fromVector() [2/2]

template<typename StoredType>
template<typename V>
static _< AListModel< StoredType > > AListModel< StoredType >::fromVector ( std::vector< V > t)
inlinestatic

Create AListModel from initializer list. Applicable for initializing AListModel<AString> from const char* initializer list.

Template Parameters
Vtype that converts to T
Returns
a new AListModel

◆ listItemAt()

template<typename StoredType>
StoredType AListModel< StoredType >::listItemAt ( const AListModelIndex & index)
inlineoverridevirtual

◆ listSize()

template<typename StoredType>
size_t AListModel< StoredType >::listSize ( )
inlineoverridevirtual

◆ make()

template<typename StoredType>
template<typename V>
static _< AListModel< StoredType > > AListModel< StoredType >::make ( const std::initializer_list< V > & t)
inlinestatic

Create AListModel from initializer list. Applicable for initializing AListModel<AString> from const char* initializer list.

Template Parameters
Vtype that converts to T
Returns
a new AListModel

◆ operator[]()

template<typename StoredType>
const StoredType & AListModel< StoredType >::operator[] ( size_t index) const
inline

Fetches element by index.

Sneaky assertions
index points to the existing element.

◆ removeAt()

template<typename StoredType>
void AListModel< StoredType >::removeAt ( size_t index)
inlinenoexcept

Removes element at the specified index.

Sneaky assertions
index points to the existing element.
Parameters
indexindex of the element.

◆ removeItem()

template<typename StoredType>
void AListModel< StoredType >::removeItem ( const AListModelIndex & item)
inlineoverridevirtual

◆ removeItems()

template<typename StoredType>
void AListModel< StoredType >::removeItems ( const AListModelRange< StoredType > & items)
inlineoverridevirtual

◆ setItem()

template<typename StoredType>
void AListModel< StoredType >::setItem ( const AListModelIndex & item,
const StoredType & value )
inlineoverridevirtual

The documentation for this class was generated from the following file:
Inheritance diagram for AListModel< StoredType >:
Collaboration diagram for AListModel< StoredType >: