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 if (mObjects.count() < 2) return; // Avoid assert in qBound()!
328 i = qBound(0, i, count() - 1);
329 j = qBound(0, j, count() - 1);
330 if (i == j) return;
331 if (i > j) qSwap(i, j);
332 std::shared_ptr<T> oj = take(j);
333 std::shared_ptr<T> oi = take(i);
334 insert(i, oj);
335 insert(j, oi);
336 }
337 int insert(int index, const std::shared_ptr<T>& obj) noexcept {
338 Q_ASSERT(obj);
339 index = qBound(0, index, count());
340 insertElement(index, obj);
341 return index;
342 }
343 int append(const std::shared_ptr<T>& obj) noexcept {
344 return insert(count(), obj);
345 }
346 void append(SerializableObjectList& list) noexcept { // shallow -> NOT const!
347 mObjects.reserve(mObjects.count() + list.count());
348 for (const std::shared_ptr<T>& ptr : list.mObjects) {
349 append(ptr); // copy only the pointer, NOT the object
350 }
351 }
352 std::shared_ptr<T> take(int index) noexcept {
353 Q_ASSERT(contains(index));
354 return takeElement(index);
355 }
356 std::shared_ptr<T> take(const T* obj) noexcept { return take(indexOf(obj)); }
357 std::shared_ptr<T> take(const Uuid& uuid) noexcept {
358 return take(indexOf(uuid));
359 }
360 std::shared_ptr<T> take(const QString& name) noexcept {
361 return take(indexOf(name));
362 }
363 void remove(int index) noexcept { take(index); }
364 void remove(const T* obj) noexcept { take(obj); }
365 void remove(const Uuid& uuid) noexcept { take(uuid); }
366 void remove(const QString& name) noexcept { take(name); }
367 void clear() noexcept {
368 // do not call mObjects.clear() because it would not notify the observers
369 for (int i = count() - 1; i >= 0; --i) {
370 remove(i);
371 }
372 Q_ASSERT(isEmpty() && mObjects.isEmpty());
373 }
374
380 void serialize(SExpression& root) const {
381 for (const std::shared_ptr<T>& ptr : mObjects) {
382 root.ensureLineBreak();
383 ptr->serialize(root.appendList(P::tagname)); // can throw
384 }
385 root.ensureLineBreak();
386 }
387
388 // Convenience Methods
389 template <typename Compare>
390 SerializableObjectList<T, P, OnEditedArgs...> sorted(
391 Compare lessThan) const noexcept {
392 SerializableObjectList<T, P, OnEditedArgs...> copiedList;
393 copiedList.mObjects = mObjects; // copy only the pointers, not the objects!
394 std::sort(copiedList.mObjects.begin(), copiedList.mObjects.end(),
395 [&lessThan](const std::shared_ptr<T>& ptr1,
396 const std::shared_ptr<T>& ptr2) {
397 return lessThan(*ptr1, *ptr2);
398 });
399 return copiedList;
400 }
401 SerializableObjectList<T, P, OnEditedArgs...> sortedByUuid() const noexcept {
402 return sorted([](const T& lhs, const T& rhs) {
403 return lhs.getUuid() < rhs.getUuid();
404 });
405 }
406
407 // Operator Overloadings
408 std::shared_ptr<T> operator[](int i) noexcept {
409 Q_ASSERT(contains(i));
410 return mObjects[i];
411 }
412 std::shared_ptr<const T> operator[](int i) const noexcept {
413 Q_ASSERT(contains(i));
414 return mObjects[i];
415 }
417 const SerializableObjectList<T, P, OnEditedArgs...>& rhs) const noexcept {
418 if (rhs.mObjects.count() != mObjects.count()) return false;
419 for (int i = 0; i < mObjects.count(); ++i) {
420 if (*rhs.mObjects[i] != *mObjects[i]) return false;
421 }
422 return true;
423 }
425 const SerializableObjectList<T, P, OnEditedArgs...>& rhs) const noexcept {
426 return !(*this == rhs);
427 }
428 SerializableObjectList<T, P, OnEditedArgs...>& operator=(
430 // Important: Self-assignment would accidentally clear the container, thus
431 // it must be replaced by a no-op!
432 if (&rhs != this) {
433 clear();
434 mObjects.reserve(rhs.count());
435 for (const std::shared_ptr<T>& ptr : rhs.mObjects) {
437 *ptr, typename std::is_nothrow_copy_constructible<T>::type()));
438 }
439 }
440 return *this;
441 }
442 SerializableObjectList<T, P, OnEditedArgs...>& operator=(
444 // Important: Self-assignment would accidentally clear the container, thus
445 // it must be replaced by a no-op!
446 if (&rhs != this) {
447 clear();
448 mObjects.reserve(rhs.count());
449 for (const std::shared_ptr<T>& ptr : rhs.mObjects) {
450 append(ptr); // copy only the pointer, NOT the object
451 }
452 rhs.clear();
453 }
454 return *this;
455 }
456
457protected: // Methods
458 void insertElement(int index, const std::shared_ptr<T>& obj) noexcept {
459 mObjects.insert(index, obj);
460 obj->onEdited.attach(mOnEditedSlot);
461 onEdited.notify(index, obj, Event::ElementAdded);
462 }
463 std::shared_ptr<T> takeElement(int index) noexcept {
464 std::shared_ptr<T> obj = mObjects.takeAt(index);
465 obj->onEdited.detach(mOnEditedSlot);
466 onEdited.notify(index, obj, Event::ElementRemoved);
467 return obj;
468 }
469 void elementEditedHandler(const T& obj, OnEditedArgs... args) noexcept {
470 int index = indexOf(&obj);
471 if (contains(index)) {
472 onElementEdited.notify(index, at(index), args...);
473 onEdited.notify(index, at(index), Event::ElementEdited);
474 } else {
475 qCritical() << "Received notification from unknown list element!";
476 }
477 }
478 void throwKeyNotFoundException(const Uuid& key) const {
479 throw RuntimeError(
480 __FILE__, __LINE__,
481 QString(
482 tr("There is "
483 "no element of type \"%1\" with the UUID \"%2\" in the list."))
484 .arg(P::tagname)
485 .arg(key.toStr()));
486 }
487 void throwNameNotFoundException(const QString& name) const {
488 throw RuntimeError(
489 __FILE__, __LINE__,
490 QString(
491 tr("There is "
492 "no element of type \"%1\" with the name \"%2\" in the list."))
493 .arg(P::tagname)
494 .arg(name));
495 }
496
497private: // Internal Helper Methods
498 std::shared_ptr<T> copyObject(const T& other,
499 std::true_type copyConstructable) noexcept {
500 Q_UNUSED(copyConstructable);
501 return std::make_shared<T>(other); // Call copy constructor of object.
502 }
503 std::shared_ptr<T> copyObject(const T& other,
504 std::false_type copyConstructable) noexcept {
505 Q_UNUSED(copyConstructable);
506 return other.cloneShared(); // Call cloneShared() on object.
507 }
508 template <typename TStr>
509 inline const QString& asStr(const TStr& obj) const noexcept {
510 return *obj;
511 }
512 inline const QString& asStr(const QString& obj) const noexcept { return obj; }
513
514protected: // Data
515 QVector<std::shared_ptr<T>> mObjects;
516 Slot<T, OnEditedArgs...> mOnEditedSlot;
517};
518
519} // namespace librepcb
520
521/*******************************************************************************
522 * Prevent from using SerializableObjectList in a foreach loop because it
523 * always would create a deep copy of the list! You should use C++11 range
524 * based for loops instead.
525 ******************************************************************************/
526namespace QtPrivate {
527
528template <typename T, typename P, typename... OnEditedArgs>
529class QForeachContainer<
530 librepcb::SerializableObjectList<T, P, OnEditedArgs...>> {
531public:
533};
534template <typename T, typename P, typename... OnEditedArgs>
535class QForeachContainer<
536 const librepcb::SerializableObjectList<T, P, OnEditedArgs...>> {
537public:
539};
540
541} // namespace QtPrivate
542
543/*******************************************************************************
544 * End of File
545 ******************************************************************************/
546
547#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:515
void clear() noexcept
Definition serializableobjectlist.h:367
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:343
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:357
int count() const noexcept
Definition serializableobjectlist.h:199
const QString & asStr(const QString &obj) const noexcept
Definition serializableobjectlist.h:512
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:424
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:487
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:509
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:503
std::shared_ptr< T > copyObject(const T &other, std::true_type copyConstructable) noexcept
Definition serializableobjectlist.h:498
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:366
std::shared_ptr< T > operator[](int i) noexcept
Definition serializableobjectlist.h:408
SerializableObjectList< T, P, OnEditedArgs... > sorted(Compare lessThan) const noexcept
Definition serializableobjectlist.h:390
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:412
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:442
void throwKeyNotFoundException(const Uuid &key) const
Definition serializableobjectlist.h:478
void remove(const Uuid &uuid) noexcept
Definition serializableobjectlist.h:365
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:363
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:401
std::shared_ptr< T > take(int index) noexcept
Definition serializableobjectlist.h:352
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition serializableobjectlist.h:380
void elementEditedHandler(const T &obj, OnEditedArgs... args) noexcept
Definition serializableobjectlist.h:469
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:428
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:337
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:364
void append(SerializableObjectList &list) noexcept
Definition serializableobjectlist.h:346
std::shared_ptr< T > take(const QString &name) noexcept
Definition serializableobjectlist.h:360
std::shared_ptr< T > takeElement(int index) noexcept
Definition serializableobjectlist.h:463
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:516
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:416
std::shared_ptr< T > take(const T *obj) noexcept
Definition serializableobjectlist.h:356
void insertElement(int index, const std::shared_ptr< T > &obj) noexcept
Definition serializableobjectlist.h:458
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:526
Definition occmodel.cpp:77