2 #include <score/tools/Debug.hpp>
3 #include <score/tools/std/IndirectContainer.hpp>
5 #include <ossia/detail/algorithms.hpp>
18 auto begin()
const {
return score::make_indirect_iterator(m_list.begin()); }
19 auto cbegin()
const {
return score::make_indirect_iterator(m_list.cbegin()); }
20 auto end()
const {
return score::make_indirect_iterator(m_list.end()); }
21 auto cend()
const {
return score::make_indirect_iterator(m_list.cend()); }
22 auto size()
const {
return m_list.size(); }
23 bool empty()
const {
return m_list.empty(); }
24 auto& unsafe_list() {
return m_list; }
25 const auto& list()
const {
return m_list; }
26 const auto& get()
const {
return m_list.get(); }
27 T& at(
const Id<T>&
id)
30 SCORE_ASSERT(it != m_list.end());
33 T& at(
const Id<T>&
id)
const
36 SCORE_ASSERT(it != m_list.end());
39 T& at_pos(std::size_t n)
const
41 SCORE_ASSERT(n < m_list.size());
42 auto it = m_list.begin();
46 auto find(
const Id<T>&
id)
const
48 return ossia::find_if(m_list, [&](
auto ptr) {
return ptr->id() ==
id; });
50 auto find(
const Id<T>&
id)
52 return ossia::find_if(m_list, [&](
auto ptr) {
return ptr->id() ==
id; });
55 auto index(
const Id<T>&
id)
const
57 auto it = ossia::find_if(m_list, [&](
auto ptr) {
return ptr->id() ==
id; });
59 SCORE_ASSERT(it != m_list.end());
60 return std::distance(m_list.begin(), it);
64 mutable Nano::Signal<void(T&)> mutable_added;
65 mutable Nano::Signal<void(
const T&)> added;
66 mutable Nano::Signal<void(
const T&)> removing;
67 mutable Nano::Signal<void(
const T&)> removed;
68 mutable Nano::Signal<void()> orderChanged;
73 unsafe_list().push_back(t);
81 auto it = ossia::find(m_list, &elt);
82 SCORE_ASSERT(it != m_list.end());
95 void remove(T* elt) { remove(*elt); }
97 void remove(
const Id<T>&
id)
100 SCORE_ASSERT(it != m_list.end());
111 while(!m_list.empty())
113 remove(*m_list.begin());
117 void insert_at(std::size_t pos, T* t)
119 SCORE_ASSERT(pos <= m_list.size());
120 auto it = m_list.begin();
121 std::advance(it, pos);
123 m_list.insert(it, t);
127 void move(
const Id<T>&
id, std::size_t pos)
129 auto new_it = m_list.begin();
130 std::advance(new_it, pos);
132 m_list.splice(new_it, m_list, it1);
138 std::list<T*> m_list;
The id_base_t class.
Definition: Identifier.hpp:57
Definition: EntityList.hpp:14
Base toolkit upon which the software is built.
Definition: Application.cpp:90