TermOx
Public Types | Public Member Functions | List of all members
ox::layout::Set< Layout_t, Projection, Comparison > Class Template Reference

Provides a set-like interface to Layout_t. More...

#include <set.hpp>

Inheritance diagram for ox::layout::Set< Layout_t, Projection, Comparison >:

Public Types

using Child_t = typename Layout_t::Child_t
 
using Key_t = std::invoke_result_t< Projection, std::add_const_t< std::add_lvalue_reference_t< typename Layout_t::Child_t > >>
 

Public Member Functions

auto insert_child (std::unique_ptr< Child_t > child) -> Child_t &
 Insert child into correct position based on Projection and Comparison.
 
template<typename Widget_t = Child_t, typename... Args>
auto make_child (Args &&... args) -> Widget_t &
 Create a Widget and insert it into the list of children. More...
 
auto find_child (Key_t const &key) -> Child_t *
 Find a child widget by its key type(the result of the Projection fn). More...
 

Detailed Description

template<typename Layout_t, typename Projection = Identity, typename Comparison = std::less< std::invoke_result_t<Projection, std::add_const_t<std::add_lvalue_reference_t< typename Layout_t::Child_t>>>>>
class ox::layout::Set< Layout_t, Projection, Comparison >

Provides a set-like interface to Layout_t.

Projection transforms a Layout::Child_t into a comparable. Comparison is fed the output of Projection, used to find insertion pos. Comparison{}(Projection{}(element), Projection{}(child));

Member Function Documentation

◆ find_child()

template<typename Layout_t , typename Projection = Identity, typename Comparison = std::less< std::invoke_result_t<Projection, std::add_const_t<std::add_lvalue_reference_t< typename Layout_t::Child_t>>>>>
auto ox::layout::Set< Layout_t, Projection, Comparison >::find_child ( Key_t const &  key) -> Child_t*
inline

Find a child widget by its key type(the result of the Projection fn).

Uses the Projection function on each child until a result equal to key is found. Retuns nullptr if no child found.

◆ make_child()

template<typename Layout_t , typename Projection = Identity, typename Comparison = std::less< std::invoke_result_t<Projection, std::add_const_t<std::add_lvalue_reference_t< typename Layout_t::Child_t>>>>>
template<typename Widget_t = Child_t, typename... Args>
auto ox::layout::Set< Layout_t, Projection, Comparison >::make_child ( Args &&...  args) -> Widget_t&
inline

Create a Widget and insert it into the list of children.

Return a reference to this newly created Widget.


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