LibrePCB Developers Documentation
Loading...
Searching...
No Matches
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 ******************************************************************************/
39namespace librepcb {
40
41/*******************************************************************************
42 * Class SerializableObjectList
43 ******************************************************************************/
44
95template <typename T, typename P, typename... OnEditedArgs>
97 Q_DECLARE_TR_FUNCTIONS(SerializableObjectList)
98
99public:
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 };
124
125 // Signals
126 enum class Event {
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) {}
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 for (const std::shared_ptr<T>& obj : elements) {
183 append(obj);
184 }
185 }
187 : onEdited(*this),
188 onElementEdited(*this),
190 *this,
192 OnEditedArgs...>::elementEditedHandler) {
193 loadFromSExpression(node); // can throw
194 }
195 virtual ~SerializableObjectList() noexcept {}
196
197 // Getters
198 bool isEmpty() const noexcept { return mObjects.empty(); }
199 int count() const noexcept { return mObjects.count(); }
200 const QVector<std::shared_ptr<T>>& values() noexcept { return mObjects; }
201 std::vector<Uuid> getUuids() const noexcept {
202 std::vector<Uuid> uuids;
203 uuids.reserve(mObjects.count());
204 for (const std::shared_ptr<T>& obj : mObjects) {
205 uuids.push_back(obj->getUuid());
206 }
207 return uuids;
208 }
209 QSet<Uuid> getUuidSet() const noexcept {
210 QSet<Uuid> uuids;
211 uuids.reserve(mObjects.count());
212 for (const std::shared_ptr<T>& obj : mObjects) {
213 uuids.insert(obj->getUuid());
214 }
215 return uuids;
216 }
217
218 // Element Query
219 int indexOf(const T* obj) const noexcept {
220 for (int i = 0; i < count(); ++i) {
221 if (mObjects[i].get() == obj) {
222 return i;
223 }
224 }
225 return -1;
226 }
227 int indexOf(const Uuid& key) const noexcept {
228 for (int i = 0; i < count(); ++i) {
229 if (mObjects[i]->getUuid() == key) {
230 return i;
231 }
232 }
233 return -1;
234 }
235 int indexOf(const QString& name,
236 Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept {
237 for (int i = 0; i < count(); ++i) {
238 if (QString::compare(asStr(mObjects[i]->getName()), name, cs) == 0) {
239 return i;
240 }
241 }
242 return -1;
243 }
244 bool contains(int index) const noexcept {
245 return index >= 0 && index < mObjects.count();
246 }
247 bool contains(const T* obj) const noexcept { return indexOf(obj) >= 0; }
248 bool contains(const Uuid& key) const noexcept { return indexOf(key) >= 0; }
249 bool contains(const QString& name) const noexcept {
250 return indexOf(name) >= 0;
251 }
252
253 // "Soft" Element Access (null if not found)
254 std::shared_ptr<T> value(int index) noexcept { return mObjects.value(index); }
255 std::shared_ptr<const T> value(int index) const noexcept {
256 return std::const_pointer_cast<const T>(mObjects.value(index));
257 }
258 std::shared_ptr<T> find(const T* obj) noexcept { return value(indexOf(obj)); }
259 std::shared_ptr<T> find(const Uuid& key) noexcept {
260 return value(indexOf(key));
261 }
262 std::shared_ptr<const T> find(const Uuid& key) const noexcept {
263 return value(indexOf(key));
264 }
265 std::shared_ptr<T> find(const QString& name,
266 Qt::CaseSensitivity cs = Qt::CaseSensitive) noexcept {
267 return value(indexOf(name, cs));
268 }
269 std::shared_ptr<const T> find(
270 const QString& name,
271 Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept {
272 return value(indexOf(name, cs));
273 }
274
275 // "Hard" Element Access (assertion or exception if not found!)
276 std::shared_ptr<const T> at(int index) const noexcept {
277 return std::const_pointer_cast<const T>(mObjects.at(index));
278 } // always read-only!
279 std::shared_ptr<T>& first() noexcept { return mObjects.first(); }
280 std::shared_ptr<const T> first() const noexcept { return mObjects.first(); }
281 std::shared_ptr<T>& last() noexcept { return mObjects.last(); }
282 std::shared_ptr<const T> last() const noexcept { return mObjects.last(); }
283 std::shared_ptr<T> get(const T* obj) {
284 std::shared_ptr<T> ptr = find(obj);
285 if (!ptr) throw LogicError(__FILE__, __LINE__);
286 return ptr;
287 }
288 std::shared_ptr<T> get(const Uuid& key) {
289 std::shared_ptr<T> ptr = find(key);
290 if (!ptr) throwKeyNotFoundException(key);
291 return ptr;
292 }
293 std::shared_ptr<const T> get(const Uuid& key) const {
294 std::shared_ptr<const T> ptr = find(key);
295 if (!ptr) throwKeyNotFoundException(key);
296 return ptr;
297 }
298 std::shared_ptr<T> get(const QString& name) {
299 std::shared_ptr<T> ptr = find(name);
300 if (!ptr) throwNameNotFoundException(name);
301 return ptr;
302 }
303 std::shared_ptr<const T> get(const QString& name) const {
304 std::shared_ptr<const T> ptr = find(name);
305 if (!ptr) throwNameNotFoundException(name);
306 return ptr;
307 }
308
309 // Iterator Access
310 const_iterator begin() const noexcept { return mObjects.begin(); }
311 const_iterator end() const noexcept { return mObjects.end(); }
312 const_iterator cbegin() noexcept { return mObjects.cbegin(); }
313 const_iterator cend() noexcept { return mObjects.cend(); }
314 iterator begin() noexcept { return mObjects.begin(); }
315 iterator end() noexcept { return mObjects.end(); }
316
317 // General Methods
319 clear();
320 foreach (const SExpression* child, node.getChildren(P::tagname)) {
321 append(std::make_shared<T>(*child)); // can throw
322 }
323 return count();
324 }
325 void swap(int i, int j) noexcept {
326 // do not call mObjects.swap() because it would not notify the observers
327 qBound(0, i, count() - 1);
328 qBound(0, j, count() - 1);
329 if (i == j) return;
330 if (i > j) qSwap(i, j);
331 std::shared_ptr<T> oj = take(j);
332 std::shared_ptr<T> oi = take(i);
333 insert(i, oj);
334 insert(j, oi);
335 }
336 int insert(int index, const std::shared_ptr<T>& obj) noexcept {
337 Q_ASSERT(obj);
338 qBound(0, index, count());
339 insertElement(index, obj);
340 return index;
341 }
342 int append(const std::shared_ptr<T>& obj) noexcept {
343 return insert(count(), obj);
344 }
345 void append(SerializableObjectList& list) noexcept { // shallow -> NOT const!
346 mObjects.reserve(mObjects.count() + list.count());
347 for (const std::shared_ptr<T>& ptr : list.mObjects) {
348 append(ptr); // copy only the pointer, NOT the object
349 }
350 }
351 std::shared_ptr<T> take(int index) noexcept {
352 Q_ASSERT(contains(index));
353 return takeElement(index);
354 }
355 std::shared_ptr<T> take(const T* obj) noexcept { return take(indexOf(obj)); }
356 std::shared_ptr<T> take(const Uuid& uuid) noexcept {
357 return take(indexOf(uuid));
358 }
359 std::shared_ptr<T> take(const QString& name) noexcept {
360 return take(indexOf(name));
361 }
362 void remove(int index) noexcept { take(index); }
363 void remove(const T* obj) noexcept { take(obj); }
364 void remove(const Uuid& uuid) noexcept { take(uuid); }
365 void remove(const QString& name) noexcept { take(name); }
366 void clear() noexcept {
367 // do not call mObjects.clear() because it would not notify the observers
368 for (int i = count() - 1; i >= 0; --i) {
369 remove(i);
370 }
371 Q_ASSERT(isEmpty() && mObjects.isEmpty());
372 }
373
379 void serialize(SExpression& root) const {
380 for (const std::shared_ptr<T>& ptr : mObjects) {
381 root.ensureLineBreak();
382 ptr->serialize(root.appendList(P::tagname)); // can throw
383 }
384 root.ensureLineBreak();
385 }
386
387 // Convenience Methods
388 template <typename Compare>
389 SerializableObjectList<T, P, OnEditedArgs...> sorted(
390 Compare lessThan) const noexcept {
391 SerializableObjectList<T, P, OnEditedArgs...> copiedList;
392 copiedList.mObjects = mObjects; // copy only the pointers, not the objects!
393 std::sort(copiedList.mObjects.begin(), copiedList.mObjects.end(),
394 [&lessThan](const std::shared_ptr<T>& ptr1,
395 const std::shared_ptr<T>& ptr2) {
396 return lessThan(*ptr1, *ptr2);
397 });
398 return copiedList;
399 }
400 SerializableObjectList<T, P, OnEditedArgs...> sortedByUuid() const noexcept {
401 return sorted([](const T& lhs, const T& rhs) {
402 return lhs.getUuid() < rhs.getUuid();
403 });
404 }
405
406 // Operator Overloadings
407 std::shared_ptr<T> operator[](int i) noexcept {
408 Q_ASSERT(contains(i));
409 return mObjects[i];
410 }
411 std::shared_ptr<const T> operator[](int i) const noexcept {
412 Q_ASSERT(contains(i));
413 return mObjects[i];
414 }
416 const SerializableObjectList<T, P, OnEditedArgs...>& rhs) const noexcept {
417 if (rhs.mObjects.count() != mObjects.count()) return false;
418 for (int i = 0; i < mObjects.count(); ++i) {
419 if (*rhs.mObjects[i] != *mObjects[i]) return false;
420 }
421 return true;
422 }
424 const SerializableObjectList<T, P, OnEditedArgs...>& rhs) const noexcept {
425 return !(*this == rhs);
426 }
427 SerializableObjectList<T, P, OnEditedArgs...>& operator=(
429 clear();
430 mObjects.reserve(rhs.count());
431 for (const std::shared_ptr<T>& ptr : rhs.mObjects) {
433 *ptr, typename std::is_nothrow_copy_constructible<T>::type()));
434 }
435 return *this;
436 }
437 SerializableObjectList<T, P, OnEditedArgs...>& operator=(
439 clear();
440 mObjects.reserve(rhs.count());
441 for (const std::shared_ptr<T>& ptr : rhs.mObjects) {
442 append(ptr); // copy only the pointer, NOT the object
443 }
444 rhs.clear();
445 return *this;
446 }
447
448protected: // Methods
449 void insertElement(int index, const std::shared_ptr<T>& obj) noexcept {
450 mObjects.insert(index, obj);
451 obj->onEdited.attach(mOnEditedSlot);
452 onEdited.notify(index, obj, Event::ElementAdded);
453 }
454 std::shared_ptr<T> takeElement(int index) noexcept {
455 std::shared_ptr<T> obj = mObjects.takeAt(index);
456 obj->onEdited.detach(mOnEditedSlot);
457 onEdited.notify(index, obj, Event::ElementRemoved);
458 return obj;
459 }
460 void elementEditedHandler(const T& obj, OnEditedArgs... args) noexcept {
461 int index = indexOf(&obj);
462 if (contains(index)) {
463 onElementEdited.notify(index, at(index), args...);
464 onEdited.notify(index, at(index), Event::ElementEdited);
465 } else {
466 qCritical() << "Received notification from unknown list element!";
467 }
468 }
469 void throwKeyNotFoundException(const Uuid& key) const {
470 throw RuntimeError(
471 __FILE__, __LINE__,
472 QString(
473 tr("There is "
474 "no element of type \"%1\" with the UUID \"%2\" in the list."))
475 .arg(P::tagname)
476 .arg(key.toStr()));
477 }
478 void throwNameNotFoundException(const QString& name) const {
479 throw RuntimeError(
480 __FILE__, __LINE__,
481 QString(
482 tr("There is "
483 "no element of type \"%1\" with the name \"%2\" in the list."))
484 .arg(P::tagname)
485 .arg(name));
486 }
487
488private: // Internal Helper Methods
489 std::shared_ptr<T> copyObject(const T& other,
490 std::true_type copyConstructable) noexcept {
491 Q_UNUSED(copyConstructable);
492 return std::make_shared<T>(other); // Call copy constructor of object.
493 }
494 std::shared_ptr<T> copyObject(const T& other,
495 std::false_type copyConstructable) noexcept {
496 Q_UNUSED(copyConstructable);
497 return other.cloneShared(); // Call cloneShared() on object.
498 }
499 template <typename TStr>
500 inline const QString& asStr(const TStr& obj) const noexcept {
501 return *obj;
502 }
503 inline const QString& asStr(const QString& obj) const noexcept { return obj; }
504
505protected: // Data
506 QVector<std::shared_ptr<T>> mObjects;
507 Slot<T, OnEditedArgs...> mOnEditedSlot;
508};
509
510} // namespace librepcb
511
512/*******************************************************************************
513 * Prevent from using SerializableObjectList in a foreach loop because it
514 * always would create a deep copy of the list! You should use C++11 range
515 * based for loops instead.
516 ******************************************************************************/
517namespace QtPrivate {
518
519template <typename T, typename P, typename... OnEditedArgs>
520class QForeachContainer<
521 librepcb::SerializableObjectList<T, P, OnEditedArgs...>> {
522public:
524};
525template <typename T, typename P, typename... OnEditedArgs>
526class QForeachContainer<
527 const librepcb::SerializableObjectList<T, P, OnEditedArgs...>> {
528public:
530};
531
532} // namespace QtPrivate
533
534/*******************************************************************************
535 * End of File
536 ******************************************************************************/
537
538#endif
The LogicError class.
Definition exceptions.h:181
The RuntimeError class.
Definition exceptions.h:218
The SExpression class.
Definition sexpression.h:69
SExpression & appendList(const QString &name)
Definition sexpression.cpp:212
QList< SExpression * > getChildren(Type type) noexcept
Definition sexpression.cpp:94
void ensureLineBreak()
Definition sexpression.cpp:206
Definition serializableobjectlist.h:102
O * operator->()
Definition serializableobjectlist.h:115
~Iterator()
Definition serializableobjectlist.h:119
O & operator*()
Definition serializableobjectlist.h:114
Iterator(const I &it) noexcept
Definition serializableobjectlist.h:108
Iterator(const Iterator &other) noexcept
Definition serializableobjectlist.h:107
Iterator & operator++()
Definition serializableobjectlist.h:110
bool operator!=(const Iterator &rhs) const noexcept
Definition serializableobjectlist.h:109
I it
Definition serializableobjectlist.h:103
std::shared_ptr< O > ptr() noexcept
Definition serializableobjectlist.h:116
The SerializableObjectList class implements a list of serializable objects.
Definition serializableobjectlist.h:96
QVector< std::shared_ptr< T > > mObjects
Definition serializableobjectlist.h:506
void clear() noexcept
Definition serializableobjectlist.h:366
std::shared_ptr< const T > find(const QString &name, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
Definition serializableobjectlist.h:269
int loadFromSExpression(const SExpression &node)
Definition serializableobjectlist.h:318
int append(const std::shared_ptr< T > &obj) noexcept
Definition serializableobjectlist.h:342
std::shared_ptr< const T > at(int index) const noexcept
Definition serializableobjectlist.h:276
bool contains(const QString &name) const noexcept
Definition serializableobjectlist.h:249
std::shared_ptr< const T > last() const noexcept
Definition serializableobjectlist.h:282
std::vector< Uuid > getUuids() const noexcept
Definition serializableobjectlist.h:201
std::shared_ptr< T > take(const Uuid &uuid) noexcept
Definition serializableobjectlist.h:356
int count() const noexcept
Definition serializableobjectlist.h:199
const QString & asStr(const QString &obj) const noexcept
Definition serializableobjectlist.h:503
std::shared_ptr< T > & last() noexcept
Definition serializableobjectlist.h:281
const_iterator begin() const noexcept
Definition serializableobjectlist.h:310
Signal< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, Event > onEdited
Definition serializableobjectlist.h:133
int indexOf(const Uuid &key) const noexcept
Definition serializableobjectlist.h:227
bool operator!=(const SerializableObjectList< T, P, OnEditedArgs... > &rhs) const noexcept
Definition serializableobjectlist.h:423
std::shared_ptr< T > find(const Uuid &key) noexcept
Definition serializableobjectlist.h:259
Slot< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, Event > OnEditedSlot
Definition serializableobjectlist.h:136
std::shared_ptr< T > & first() noexcept
Definition serializableobjectlist.h:279
virtual ~SerializableObjectList() noexcept
Definition serializableobjectlist.h:195
void throwNameNotFoundException(const QString &name) const
Definition serializableobjectlist.h:478
Signal< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, OnEditedArgs... > onElementEdited
Definition serializableobjectlist.h:139
std::shared_ptr< T > get(const Uuid &key)
Definition serializableobjectlist.h:288
std::shared_ptr< const T > get(const Uuid &key) const
Definition serializableobjectlist.h:293
std::shared_ptr< T > value(int index) noexcept
Definition serializableobjectlist.h:254
const_iterator cend() noexcept
Definition serializableobjectlist.h:313
const QString & asStr(const TStr &obj) const noexcept
Definition serializableobjectlist.h:500
std::shared_ptr< T > find(const QString &name, Qt::CaseSensitivity cs=Qt::CaseSensitive) noexcept
Definition serializableobjectlist.h:265
std::shared_ptr< T > copyObject(const T &other, std::false_type copyConstructable) noexcept
Definition serializableobjectlist.h:494
std::shared_ptr< T > copyObject(const T &other, std::true_type copyConstructable) noexcept
Definition serializableobjectlist.h:489
SerializableObjectList(SerializableObjectList< T, P, OnEditedArgs... > &&other) noexcept
Definition serializableobjectlist.h:162
Event
Definition serializableobjectlist.h:126
std::shared_ptr< T > get(const QString &name)
Definition serializableobjectlist.h:298
const_iterator end() const noexcept
Definition serializableobjectlist.h:311
std::shared_ptr< const T > find(const Uuid &key) const noexcept
Definition serializableobjectlist.h:262
const QVector< std::shared_ptr< T > > & values() noexcept
Definition serializableobjectlist.h:200
bool contains(int index) const noexcept
Definition serializableobjectlist.h:244
SerializableObjectList(std::initializer_list< std::shared_ptr< T > > elements) noexcept
Definition serializableobjectlist.h:174
void remove(const QString &name) noexcept
Definition serializableobjectlist.h:365
std::shared_ptr< T > operator[](int i) noexcept
Definition serializableobjectlist.h:407
SerializableObjectList< T, P, OnEditedArgs... > sorted(Compare lessThan) const noexcept
Definition serializableobjectlist.h:389
QSet< Uuid > getUuidSet() const noexcept
Definition serializableobjectlist.h:209
int indexOf(const QString &name, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
Definition serializableobjectlist.h:235
std::shared_ptr< const T > operator[](int i) const noexcept
Definition serializableobjectlist.h:411
bool contains(const Uuid &key) const noexcept
Definition serializableobjectlist.h:248
SerializableObjectList< T, P, OnEditedArgs... > & operator=(SerializableObjectList< T, P, OnEditedArgs... > &&rhs) noexcept
Definition serializableobjectlist.h:437
void throwKeyNotFoundException(const Uuid &key) const
Definition serializableobjectlist.h:469
void remove(const Uuid &uuid) noexcept
Definition serializableobjectlist.h:364
std::shared_ptr< T > find(const T *obj) noexcept
Definition serializableobjectlist.h:258
iterator begin() noexcept
Definition serializableobjectlist.h:314
void remove(int index) noexcept
Definition serializableobjectlist.h:362
Slot< SerializableObjectList< T, P, OnEditedArgs... >, int, const std::shared_ptr< const T > &, OnEditedArgs... > OnElementEditedSlot
Definition serializableobjectlist.h:142
SerializableObjectList< T, P, OnEditedArgs... > sortedByUuid() const noexcept
Definition serializableobjectlist.h:400
std::shared_ptr< T > take(int index) noexcept
Definition serializableobjectlist.h:351
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition serializableobjectlist.h:379
void elementEditedHandler(const T &obj, OnEditedArgs... args) noexcept
Definition serializableobjectlist.h:460
void swap(int i, int j) noexcept
Definition serializableobjectlist.h:325
SerializableObjectList() noexcept
Definition serializableobjectlist.h:145
std::shared_ptr< const T > value(int index) const noexcept
Definition serializableobjectlist.h:255
SerializableObjectList(const SExpression &node)
Definition serializableobjectlist.h:186
SerializableObjectList< T, P, OnEditedArgs... > & operator=(const SerializableObjectList< T, P, OnEditedArgs... > &rhs) noexcept
Definition serializableobjectlist.h:427
bool isEmpty() const noexcept
Definition serializableobjectlist.h:198
std::shared_ptr< const T > first() const noexcept
Definition serializableobjectlist.h:280
int insert(int index, const std::shared_ptr< T > &obj) noexcept
Definition serializableobjectlist.h:336
int indexOf(const T *obj) const noexcept
Definition serializableobjectlist.h:219
bool contains(const T *obj) const noexcept
Definition serializableobjectlist.h:247
void remove(const T *obj) noexcept
Definition serializableobjectlist.h:363
void append(SerializableObjectList &list) noexcept
Definition serializableobjectlist.h:345
std::shared_ptr< T > take(const QString &name) noexcept
Definition serializableobjectlist.h:359
std::shared_ptr< T > takeElement(int index) noexcept
Definition serializableobjectlist.h:454
const_iterator cbegin() noexcept
Definition serializableobjectlist.h:312
Iterator< typename QVector< std::shared_ptr< T > >::iterator, T > iterator
Definition serializableobjectlist.h:121
Slot< T, OnEditedArgs... > mOnEditedSlot
Definition serializableobjectlist.h:507
Iterator< typename QVector< std::shared_ptr< T > >::const_iterator, const T > const_iterator
Definition serializableobjectlist.h:123
SerializableObjectList(const SerializableObjectList< T, P, OnEditedArgs... > &other) noexcept
Definition serializableobjectlist.h:152
bool operator==(const SerializableObjectList< T, P, OnEditedArgs... > &rhs) const noexcept
Definition serializableobjectlist.h:415
std::shared_ptr< T > take(const T *obj) noexcept
Definition serializableobjectlist.h:355
void insertElement(int index, const std::shared_ptr< T > &obj) noexcept
Definition serializableobjectlist.h:449
iterator end() noexcept
Definition serializableobjectlist.h:315
std::shared_ptr< T > get(const T *obj)
Definition serializableobjectlist.h:283
std::shared_ptr< const T > get(const QString &name) const
Definition serializableobjectlist.h:303
The Signal class is used to emit signals on non-QObject derived classes.
Definition signalslot.h:65
The Slot class is used to receive signals from non-QObject derived classes.
Definition signalslot.h:170
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition uuid.h:56
QString toStr() const noexcept
Get the UUID as a string (without braces)
Definition uuid.h:91
Definition serializableobjectlist.h:517
Definition occmodel.cpp:76