LibrePCB Developers Documentation
serializableobjectlist.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_CORE_SERIALIZABLEOBJECTLIST_H
21 #define LIBREPCB_CORE_SERIALIZABLEOBJECTLIST_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../exceptions.h"
27 #include "../types/uuid.h"
28 #include "../utils/signalslot.h"
29 #include "sexpression.h"
30 
31 #include <QtCore>
32 
33 #include <algorithm>
34 #include <memory>
35 
36 /*******************************************************************************
37  * Namespace / Forward Declarations
38  ******************************************************************************/
39 namespace librepcb {
40 
41 /*******************************************************************************
42  * Class SerializableObjectList
43  ******************************************************************************/
44 
95 template <typename T, typename P, typename... OnEditedArgs>
97  Q_DECLARE_TR_FUNCTIONS(SerializableObjectList)
98 
99 public:
100  // Iterator Types
101  template <typename I, typename O>
102  class Iterator {
103  I it;
104 
105  public:
106  Iterator() = delete;
107  Iterator(const Iterator& other) noexcept : it(other.it) {}
108  Iterator(const I& it) noexcept : it(it) {}
109  bool operator!=(const Iterator& rhs) const noexcept { return it != rhs.it; }
111  ++it;
112  return *this;
113  }
114  O& operator*() { return **it; }
115  O* operator->() { return it->get(); }
116  std::shared_ptr<O> ptr() noexcept {
117  return std::const_pointer_cast<O>(*it);
118  }
120  };
121  using iterator = Iterator<typename QVector<std::shared_ptr<T>>::iterator, T>;
122  using const_iterator =
123  Iterator<typename QVector<std::shared_ptr<T>>::const_iterator, const T>;
124 
125  // Signals
126  enum class Event {
127  ElementAdded,
128  ElementRemoved,
129  ElementEdited,
130  };
131  Signal<SerializableObjectList<T, P, OnEditedArgs...>, int,
132  const std::shared_ptr<const T>&, Event>
134  typedef Slot<SerializableObjectList<T, P, OnEditedArgs...>, int,
135  const std::shared_ptr<const T>&, Event>
137  Signal<SerializableObjectList<T, P, OnEditedArgs...>, int,
138  const std::shared_ptr<const T>&, OnEditedArgs...>
140  typedef Slot<SerializableObjectList<T, P, OnEditedArgs...>, int,
141  const std::shared_ptr<const T>&, OnEditedArgs...>
143 
144  // Constructors / Destructor
146  : onEdited(*this),
147  onElementEdited(*this),
149  *this,
151  OnEditedArgs...>::elementEditedHandler) {}
153  const SerializableObjectList<T, P, OnEditedArgs...>& other) noexcept
154  : onEdited(*this),
155  onElementEdited(*this),
157  *this,
159  OnEditedArgs...>::elementEditedHandler) {
160  *this = other; // copy all elements
161  }
164  : onEdited(*this),
165  onElementEdited(*this),
167  *this,
169  OnEditedArgs...>::elementEditedHandler) {
170  while (!other.isEmpty()) {
171  append(other.take(0)); // copy all pointers (NOT the objects!)
172  }
173  }
175  std::initializer_list<std::shared_ptr<T>> elements) noexcept
176  : onEdited(*this),
177  onElementEdited(*this),
179  *this,
181  OnEditedArgs...>::elementEditedHandler) {
182  foreach (const std::shared_ptr<T>& obj, elements) { append(obj); }
183  }
184  explicit SerializableObjectList(const SExpression& node)
185  : onEdited(*this),
186  onElementEdited(*this),
188  *this,
190  OnEditedArgs...>::elementEditedHandler) {
191  loadFromSExpression(node); // can throw
192  }
193  virtual ~SerializableObjectList() noexcept {}
194 
195  // Getters
196  bool isEmpty() const noexcept { return mObjects.empty(); }
197  int count() const noexcept { return mObjects.count(); }
198  const QVector<std::shared_ptr<T>>& values() noexcept { return mObjects; }
199  std::vector<Uuid> getUuids() const noexcept {
200  std::vector<Uuid> uuids;
201  uuids.reserve(mObjects.count());
202  foreach (const std::shared_ptr<T>& obj, mObjects) {
203  uuids.push_back(obj->getUuid());
204  }
205  return uuids;
206  }
207  QSet<Uuid> getUuidSet() const noexcept {
208  QSet<Uuid> uuids;
209  uuids.reserve(mObjects.count());
210  foreach (const std::shared_ptr<T>& obj, mObjects) {
211  uuids.insert(obj->getUuid());
212  }
213  return uuids;
214  }
215 
216  // Element Query
217  int indexOf(const T* obj) const noexcept {
218  for (int i = 0; i < count(); ++i) {
219  if (mObjects[i].get() == obj) {
220  return i;
221  }
222  }
223  return -1;
224  }
225  int indexOf(const Uuid& key) const noexcept {
226  for (int i = 0; i < count(); ++i) {
227  if (mObjects[i]->getUuid() == key) {
228  return i;
229  }
230  }
231  return -1;
232  }
233  int indexOf(const QString& name) const noexcept {
234  for (int i = 0; i < count(); ++i) {
235  if (mObjects[i]->getName() == name) {
236  return i;
237  }
238  }
239  return -1;
240  }
241  bool contains(int index) const noexcept {
242  return index >= 0 && index < mObjects.count();
243  }
244  bool contains(const T* obj) const noexcept { return indexOf(obj) >= 0; }
245  bool contains(const Uuid& key) const noexcept { return indexOf(key) >= 0; }
246  bool contains(const QString& name) const noexcept {
247  return indexOf(name) >= 0;
248  }
249 
250  // "Soft" Element Access (null if not found)
251  std::shared_ptr<T> value(int index) noexcept { return mObjects.value(index); }
252  std::shared_ptr<const T> value(int index) const noexcept {
253  return std::const_pointer_cast<const T>(mObjects.value(index));
254  }
255  std::shared_ptr<T> find(const T* obj) noexcept { return value(indexOf(obj)); }
256  std::shared_ptr<T> find(const Uuid& key) noexcept {
257  return value(indexOf(key));
258  }
259  std::shared_ptr<const T> find(const Uuid& key) const noexcept {
260  return value(indexOf(key));
261  }
262  std::shared_ptr<T> find(const QString& name) noexcept {
263  return value(indexOf(name));
264  }
265  std::shared_ptr<const T> find(const QString& name) const noexcept {
266  return value(indexOf(name));
267  }
268 
269  // "Hard" Element Access (assertion or exception if not found!)
270  std::shared_ptr<const T> at(int index) const noexcept {
271  return std::const_pointer_cast<const T>(mObjects.at(index));
272  } // always read-only!
273  std::shared_ptr<T>& first() noexcept { return mObjects.first(); }
274  std::shared_ptr<const T> first() const noexcept { return mObjects.first(); }
275  std::shared_ptr<T>& last() noexcept { return mObjects.last(); }
276  std::shared_ptr<const T> last() const noexcept { return mObjects.last(); }
277  std::shared_ptr<T> get(const T* obj) {
278  std::shared_ptr<T> ptr = find(obj);
279  if (!ptr) throw LogicError(__FILE__, __LINE__);
280  return ptr;
281  }
282  std::shared_ptr<T> get(const Uuid& key) {
283  std::shared_ptr<T> ptr = find(key);
284  if (!ptr) throwKeyNotFoundException(key);
285  return ptr;
286  }
287  std::shared_ptr<const T> get(const Uuid& key) const {
288  std::shared_ptr<const T> ptr = find(key);
289  if (!ptr) throwKeyNotFoundException(key);
290  return ptr;
291  }
292  std::shared_ptr<T> get(const QString& name) {
293  std::shared_ptr<T> ptr = find(name);
294  if (!ptr) throwNameNotFoundException(name);
295  return ptr;
296  }
297  std::shared_ptr<const T> get(const QString& name) const {
298  std::shared_ptr<const T> ptr = find(name);
299  if (!ptr) throwNameNotFoundException(name);
300  return ptr;
301  }
302 
303  // Iterator Access
304  const_iterator begin() const noexcept { return mObjects.begin(); }
305  const_iterator end() const noexcept { return mObjects.end(); }
306  const_iterator cbegin() noexcept { return mObjects.cbegin(); }
307  const_iterator cend() noexcept { return mObjects.cend(); }
308  iterator begin() noexcept { return mObjects.begin(); }
309  iterator end() noexcept { return mObjects.end(); }
310 
311  // General Methods
312  int loadFromSExpression(const SExpression& node) {
313  clear();
314  foreach (const SExpression* child, node.getChildren(P::tagname)) {
315  append(std::make_shared<T>(*child)); // can throw
316  }
317  return count();
318  }
319  void swap(int i, int j) noexcept {
320  // do not call mObjects.swap() because it would not notify the observers
321  qBound(0, i, count() - 1);
322  qBound(0, j, count() - 1);
323  if (i == j) return;
324  if (i > j) qSwap(i, j);
325  std::shared_ptr<T> oj = take(j);
326  std::shared_ptr<T> oi = take(i);
327  insert(i, oj);
328  insert(j, oi);
329  }
330  int insert(int index, const std::shared_ptr<T>& obj) noexcept {
331  Q_ASSERT(obj);
332  qBound(0, index, count());
333  insertElement(index, obj);
334  return index;
335  }
336  int append(const std::shared_ptr<T>& obj) noexcept {
337  return insert(count(), obj);
338  }
339  void append(SerializableObjectList& list) noexcept { // shallow -> NOT const!
340  mObjects.reserve(mObjects.count() + list.count());
341  foreach (const std::shared_ptr<T>& ptr, list.mObjects) {
342  append(ptr); // copy only the pointer, NOT the object
343  }
344  }
345  std::shared_ptr<T> take(int index) noexcept {
346  Q_ASSERT(contains(index));
347  return takeElement(index);
348  }
349  std::shared_ptr<T> take(const T* obj) noexcept { return take(indexOf(obj)); }
350  std::shared_ptr<T> take(const Uuid& uuid) noexcept {
351  return take(indexOf(uuid));
352  }
353  std::shared_ptr<T> take(const QString& name) noexcept {
354  return take(indexOf(name));
355  }
356  void remove(int index) noexcept { take(index); }
357  void remove(const T* obj) noexcept { take(obj); }
358  void remove(const Uuid& uuid) noexcept { take(uuid); }
359  void remove(const QString& name) noexcept { take(name); }
360  void clear() noexcept {
361  // do not call mObjects.clear() because it would not notify the observers
362  for (int i = count() - 1; i >= 0; --i) {
363  remove(i);
364  }
365  Q_ASSERT(isEmpty() && mObjects.isEmpty());
366  }
367 
373  void serialize(SExpression& root) const {
374  foreach (const std::shared_ptr<T>& ptr, mObjects) {
375  root.ensureLineBreak();
376  ptr->serialize(root.appendList(P::tagname)); // can throw
377  }
378  root.ensureLineBreak();
379  }
380 
381  // Convenience Methods
382  template <typename Compare>
383  SerializableObjectList<T, P, OnEditedArgs...> sorted(Compare lessThan) const
384  noexcept {
385  SerializableObjectList<T, P, OnEditedArgs...> copiedList;
386  copiedList.mObjects = mObjects; // copy only the pointers, not the objects!
387  std::sort(copiedList.mObjects.begin(), copiedList.mObjects.end(),
388  [&lessThan](const std::shared_ptr<T>& ptr1,
389  const std::shared_ptr<T>& ptr2) {
390  return lessThan(*ptr1, *ptr2);
391  });
392  return copiedList;
393  }
394  SerializableObjectList<T, P, OnEditedArgs...> sortedByUuid() const noexcept {
395  return sorted([](const T& lhs, const T& rhs) {
396  return lhs.getUuid() < rhs.getUuid();
397  });
398  }
399 
400  // Operator Overloadings
401  std::shared_ptr<T> operator[](int i) noexcept {
402  Q_ASSERT(contains(i));
403  return mObjects[i];
404  }
405  std::shared_ptr<const T> operator[](int i) const noexcept {
406  Q_ASSERT(contains(i));
407  return mObjects[i];
408  }
410  const SerializableObjectList<T, P, OnEditedArgs...>& rhs) const noexcept {
411  if (rhs.mObjects.count() != mObjects.count()) return false;
412  for (int i = 0; i < mObjects.count(); ++i) {
413  if (*rhs.mObjects[i] != *mObjects[i]) return false;
414  }
415  return true;
416  }
418  const SerializableObjectList<T, P, OnEditedArgs...>& rhs) const noexcept {
419  return !(*this == rhs);
420  }
421  SerializableObjectList<T, P, OnEditedArgs...>& operator=(
422  const SerializableObjectList<T, P, OnEditedArgs...>& rhs) noexcept {
423  clear();
424  mObjects.reserve(rhs.count());
425  foreach (const std::shared_ptr<T>& ptr, rhs.mObjects) {
427  *ptr, typename std::is_nothrow_copy_constructible<T>::type()));
428  }
429  return *this;
430  }
431  SerializableObjectList<T, P, OnEditedArgs...>& operator=(
433  clear();
434  mObjects.reserve(rhs.count());
435  foreach (const std::shared_ptr<T>& ptr, rhs.mObjects) {
436  append(ptr); // copy only the pointer, NOT the object
437  }
438  rhs.clear();
439  return *this;
440  }
441 
442 protected: // Methods
443  void insertElement(int index, const std::shared_ptr<T>& obj) noexcept {
444  mObjects.insert(index, obj);
445  obj->onEdited.attach(mOnEditedSlot);
446  onEdited.notify(index, obj, Event::ElementAdded);
447  }
448  std::shared_ptr<T> takeElement(int index) noexcept {
449  std::shared_ptr<T> obj = mObjects.takeAt(index);
450  obj->onEdited.detach(mOnEditedSlot);
451  onEdited.notify(index, obj, Event::ElementRemoved);
452  return obj;
453  }
454  void elementEditedHandler(const T& obj, OnEditedArgs... args) noexcept {
455  int index = indexOf(&obj);
456  if (contains(index)) {
457  onElementEdited.notify(index, at(index), args...);
458  onEdited.notify(index, at(index), Event::ElementEdited);
459  } else {
460  qCritical() << "Received notification from unknown list element!";
461  }
462  }
463  void throwKeyNotFoundException(const Uuid& key) const {
464  throw RuntimeError(
465  __FILE__, __LINE__,
466  QString(
467  tr("There is "
468  "no element of type \"%1\" with the UUID \"%2\" in the list."))
469  .arg(P::tagname)
470  .arg(key.toStr()));
471  }
472  void throwNameNotFoundException(const QString& name) const {
473  throw RuntimeError(
474  __FILE__, __LINE__,
475  QString(
476  tr("There is "
477  "no element of type \"%1\" with the name \"%2\" in the list."))
478  .arg(P::tagname)
479  .arg(name));
480  }
481 
482 private: // Internal Helper Methods
483  std::shared_ptr<T> copyObject(const T& other,
484  std::true_type copyConstructable) noexcept {
485  Q_UNUSED(copyConstructable);
486  return std::make_shared<T>(other); // Call copy constructor of object.
487  }
488  std::shared_ptr<T> copyObject(const T& other,
489  std::false_type copyConstructable) noexcept {
490  Q_UNUSED(copyConstructable);
491  return other.cloneShared(); // Call cloneShared() on object.
492  }
493 
494 protected: // Data
495  QVector<std::shared_ptr<T>> mObjects;
496  Slot<T, OnEditedArgs...> mOnEditedSlot;
497 };
498 
499 } // namespace librepcb
500 
501 /*******************************************************************************
502  * Prevent from using SerializableObjectList in a foreach loop because it always
503  *would create a deep copy of the list! You should use C++11 range based for
504  *loops instead.
505  ******************************************************************************/
506 
507 #if (QT_VERSION > QT_VERSION_CHECK(5, 9, 0))
508 namespace QtPrivate {
509 #endif
510 
511 template <typename T, typename P, typename... OnEditedArgs>
512 class QForeachContainer<
513  librepcb::SerializableObjectList<T, P, OnEditedArgs...>> {
514 public:
515  ~QForeachContainer() = delete;
516 };
517 template <typename T, typename P, typename... OnEditedArgs>
518 class QForeachContainer<
519  const librepcb::SerializableObjectList<T, P, OnEditedArgs...>> {
520 public:
521  ~QForeachContainer() = delete;
522 };
523 
524 #if (QT_VERSION > QT_VERSION_CHECK(5, 9, 0))
525 } // namespace QtPrivate
526 #endif
527 
528 /*******************************************************************************
529  * End of File
530  ******************************************************************************/
531 
532 #endif
I it
Definition: serializableobjectlist.h:103
const_iterator cend() noexcept
Definition: serializableobjectlist.h:307
The LogicError class.
Definition: exceptions.h:179
bool operator!=(const Iterator &rhs) const noexcept
Definition: serializableobjectlist.h:109
SerializableObjectList(SerializableObjectList< T, P, OnEditedArgs... > &&other) noexcept
Definition: serializableobjectlist.h:162
Slot< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, Event > OnEditedSlot
Definition: serializableobjectlist.h:136
std::shared_ptr< T > & last() noexcept
Definition: serializableobjectlist.h:275
SerializableObjectList< T, P, OnEditedArgs... > sortedByUuid() const noexcept
Definition: serializableobjectlist.h:394
const QList< SExpression > & getChildren() const noexcept
Get all children of this node.
Definition: sexpression.h:99
std::shared_ptr< T > value(int index) noexcept
Definition: serializableobjectlist.h:251
void clear() noexcept
Definition: serializableobjectlist.h:360
int loadFromSExpression(const SExpression &node)
Definition: serializableobjectlist.h:312
std::shared_ptr< T > copyObject(const T &other, std::true_type copyConstructable) noexcept
Definition: serializableobjectlist.h:483
void ensureLineBreak()
Definition: sexpression.cpp:191
std::vector< Uuid > getUuids() const noexcept
Definition: serializableobjectlist.h:199
std::shared_ptr< T > operator[](int i) noexcept
Definition: serializableobjectlist.h:401
iterator end() noexcept
Definition: serializableobjectlist.h:309
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: serializableobjectlist.h:373
Definition: occmodel.cpp:76
Iterator(const I &it) noexcept
Definition: serializableobjectlist.h:108
The SerializableObjectList class implements a list of serializable objects.
Definition: serializableobjectlist.h:96
int indexOf(const QString &name) const noexcept
Definition: serializableobjectlist.h:233
Slot< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, OnEditedArgs... > OnElementEditedSlot
Definition: serializableobjectlist.h:142
O & operator*()
Definition: serializableobjectlist.h:114
std::shared_ptr< O > ptr() noexcept
Definition: serializableobjectlist.h:116
int count() const noexcept
Definition: serializableobjectlist.h:197
void elementEditedHandler(const T &obj, OnEditedArgs... args) noexcept
Definition: serializableobjectlist.h:454
SerializableObjectList< T, P, OnEditedArgs... > & operator=(const SerializableObjectList< T, P, OnEditedArgs... > &rhs) noexcept
Definition: serializableobjectlist.h:421
SExpression & appendList(const QString &name)
Definition: sexpression.cpp:197
bool contains(int index) const noexcept
Definition: serializableobjectlist.h:241
QSet< Uuid > getUuidSet() const noexcept
Definition: serializableobjectlist.h:207
bool contains(const T *obj) const noexcept
Definition: serializableobjectlist.h:244
Signal< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, Event > onEdited
Definition: serializableobjectlist.h:133
~Iterator()
Definition: serializableobjectlist.h:119
std::shared_ptr< T > & first() noexcept
Definition: serializableobjectlist.h:273
void insertElement(int index, const std::shared_ptr< T > &obj) noexcept
Definition: serializableobjectlist.h:443
SerializableObjectList(const SExpression &node)
Definition: serializableobjectlist.h:184
bool isEmpty() const noexcept
Definition: serializableobjectlist.h:196
Iterator< typename QVector< std::shared_ptr< Polygon > >::const_iterator, const Polygon > const_iterator
Definition: serializableobjectlist.h:123
bool operator==(const SerializableObjectList< T, P, OnEditedArgs... > &rhs) const noexcept
Definition: serializableobjectlist.h:409
const QVector< std::shared_ptr< T > > & values() noexcept
Definition: serializableobjectlist.h:198
iterator begin() noexcept
Definition: serializableobjectlist.h:308
Iterator< typename QVector< std::shared_ptr< Polygon > >::iterator, Polygon > iterator
Definition: serializableobjectlist.h:121
void append(SerializableObjectList &list) noexcept
Definition: serializableobjectlist.h:339
Signal< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, OnEditedArgs... > onElementEdited
Definition: serializableobjectlist.h:139
std::shared_ptr< const T > at(int index) const noexcept
Definition: serializableobjectlist.h:270
std::shared_ptr< const T > find(const Uuid &key) const noexcept
Definition: serializableobjectlist.h:259
void throwKeyNotFoundException(const Uuid &key) const
Definition: serializableobjectlist.h:463
int append(const std::shared_ptr< T > &obj) noexcept
Definition: serializableobjectlist.h:336
std::shared_ptr< const T > operator[](int i) const noexcept
Definition: serializableobjectlist.h:405
bool contains(const QString &name) const noexcept
Definition: serializableobjectlist.h:246
std::shared_ptr< T > take(int index) noexcept
Definition: serializableobjectlist.h:345
std::shared_ptr< const T > value(int index) const noexcept
Definition: serializableobjectlist.h:252
The RuntimeError class.
Definition: exceptions.h:216
std::shared_ptr< const T > find(const QString &name) const noexcept
Definition: serializableobjectlist.h:265
std::shared_ptr< T > copyObject(const T &other, std::false_type copyConstructable) noexcept
Definition: serializableobjectlist.h:488
void swap(int i, int j) noexcept
Definition: serializableobjectlist.h:319
int indexOf(const T *obj) const noexcept
Definition: serializableobjectlist.h:217
int insert(int index, const std::shared_ptr< T > &obj) noexcept
Definition: serializableobjectlist.h:330
void throwNameNotFoundException(const QString &name) const
Definition: serializableobjectlist.h:472
std::shared_ptr< T > find(const Uuid &key) noexcept
Definition: serializableobjectlist.h:256
SerializableObjectList(const SerializableObjectList< T, P, OnEditedArgs... > &other) noexcept
Definition: serializableobjectlist.h:152
Definition: serializableobjectlist.h:102
bool operator!=(const SerializableObjectList< T, P, OnEditedArgs... > &rhs) const noexcept
Definition: serializableobjectlist.h:417
std::shared_ptr< T > find(const QString &name) noexcept
Definition: serializableobjectlist.h:262
std::shared_ptr< T > take(const QString &name) noexcept
Definition: serializableobjectlist.h:353
std::shared_ptr< T > takeElement(int index) noexcept
Definition: serializableobjectlist.h:448
SerializableObjectList< T, P, OnEditedArgs... > & operator=(SerializableObjectList< T, P, OnEditedArgs... > &&rhs) noexcept
Definition: serializableobjectlist.h:431
The Signal class is used to emit signals on non-QObject derived classes.
Definition: signalslot.h:65
Iterator(const Iterator &other) noexcept
Definition: serializableobjectlist.h:107
const_iterator cbegin() noexcept
Definition: serializableobjectlist.h:306
O * operator->()
Definition: serializableobjectlist.h:115
virtual ~SerializableObjectList() noexcept
Definition: serializableobjectlist.h:193
std::shared_ptr< T > take(const Uuid &uuid) noexcept
Definition: serializableobjectlist.h:350
std::shared_ptr< T > take(const T *obj) noexcept
Definition: serializableobjectlist.h:349
int indexOf(const Uuid &key) const noexcept
Definition: serializableobjectlist.h:225
std::shared_ptr< T > find(const T *obj) noexcept
Definition: serializableobjectlist.h:255
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:56
const_iterator end() const noexcept
Definition: serializableobjectlist.h:305
QVector< std::shared_ptr< T > > mObjects
Definition: serializableobjectlist.h:495
bool contains(const Uuid &key) const noexcept
Definition: serializableobjectlist.h:245
Iterator & operator++()
Definition: serializableobjectlist.h:110
SerializableObjectList(std::initializer_list< std::shared_ptr< T >> elements) noexcept
Definition: serializableobjectlist.h:174
SerializableObjectList< T, P, OnEditedArgs... > sorted(Compare lessThan) const noexcept
Definition: serializableobjectlist.h:383
The Slot class is used to receive signals from non-QObject derived classes.
Definition: signalslot.h:36
The SExpression class.
Definition: sexpression.h:66
QString toStr() const noexcept
Get the UUID as a string (without braces)
Definition: uuid.h:86
SerializableObjectList() noexcept
Definition: serializableobjectlist.h:145
Slot< T, OnEditedArgs... > mOnEditedSlot
Definition: serializableobjectlist.h:496
std::shared_ptr< const T > last() const noexcept
Definition: serializableobjectlist.h:276
std::shared_ptr< const T > first() const noexcept
Definition: serializableobjectlist.h:274
const_iterator begin() const noexcept
Definition: serializableobjectlist.h:304