7#include "grid_layout.hpp"
8#include "../geometry/module.hpp"
9#include "../macros.hpp"
11namespace hi {
inline namespace v1 {
13template<axis Axis,
typename T>
16 static_assert(
Axis == axis::x
or Axis == axis::y);
20 using cell_type = grid_type::cell_type;
21 using iterator = grid_type::iterator;
22 using const_iterator = grid_type::const_iterator;
32 [[
nodiscard]]
constexpr bool empty()
const noexcept
37 [[
nodiscard]]
constexpr size_t size()
const noexcept
42 [[
nodiscard]]
constexpr iterator begin()
noexcept
47 [[
nodiscard]]
constexpr const_iterator begin()
const noexcept
52 [[
nodiscard]]
constexpr const_iterator cbegin()
const noexcept
54 return _grid.cbegin();
57 [[
nodiscard]]
constexpr iterator end()
noexcept
62 [[
nodiscard]]
constexpr const_iterator end()
const noexcept
67 [[
nodiscard]]
constexpr const_iterator cend()
const noexcept
72 [[
nodiscard]]
constexpr cell_type& operator[](
size_t index)
noexcept
78 [[
nodiscard]]
constexpr cell_type
const& operator[](
size_t index)
const noexcept
84 cell_type& insert(const_iterator
pos, std::convertible_to<T>
auto&& value)
noexcept
88 for (
auto it = begin() + index;
it != end(); ++
it) {
89 if constexpr (
Axis == axis::x) {
98 if constexpr (
Axis == axis::x) {
99 return _grid.
add_cell(index, 0, hi_forward(value));
101 return _grid.
add_cell(0, index, hi_forward(value));
105 cell_type& push_front(std::convertible_to<T>
auto&& value)
noexcept
107 return insert(cbegin(), hi_forward(value));
110 cell_type& push_back(std::convertible_to<T>
auto&& value)
noexcept
112 return insert(cend(), hi_forward(value));
115 void clear()
noexcept
117 return _grid.clear();
122 return _grid.constraints(left_to_right);
125 void set_layout(
box_shape const &shape,
float guideline)
noexcept
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
2D constraints.
Definition box_constraints.hpp:25
Definition box_shape.hpp:18
Grid layout algorithm.
Definition grid_layout.hpp:945
constexpr reference add_cell(size_t first_column, size_t first_row, size_t last_column, size_t last_row, Value &&value, bool beyond_maximum=false) noexcept
Check if the cell on the grid is already in use.
Definition grid_layout.hpp:1067
constexpr void set_layout(box_shape const &shape, float baseline_adjustment) noexcept
Layout the cells based on the width and height.
Definition grid_layout.hpp:1143
Definition row_column_layout.hpp:14