Schim
component.h
1 #ifndef COMPONENT_H
2 #define COMPONENT_H
3 
4 #include "model/compositeobject.h"
5 #include "terminal.h"
6 #include "text.h"
7 
8 #include <QList>
9 #include <QSharedPointer>
10 
11 class Device;
12 
16 class Component : public CompositeObject
17 {
18 public:
19  // CONSTRUCTORS
20  Component() = default;
21  explicit Component(QSharedPointer<Device> device);
22  Component(const Component &obj);
23  virtual ~Component();
24  Object *clone() const override;
25 
26  // GETTERS
27  QList<Text*> &getTexts();
28  QList<Terminal*> &getTerminals();
29 
30  // SETTERS
31  void addText(Text *text);
32  void addTexts(const QList<Text*> &texts);
33  void addTerminal(Terminal *terminal);
34  void addTerminals(const QList<Terminal*> &terminals);
35  void remove(Object *obj);
36 
37  // MISCELLANEOUS
44  static Component *absorb(CompositeObject *obj);
45 
46  // OPERATORS
47  virtual bool operator==(const Component &obj) const;
48  virtual bool operator!=(const Component &obj) const;
49 
50 private:
51  QList<Text*> texts;
52  QList<Terminal*> terminals;
53  QSharedPointer<Device> device;
54 };
55 
56 #endif // COMPONENT_H
The abstract base class for all objects in a sheet.
Definition: object.h:21
static Component * absorb(CompositeObject *obj)
Steal everything from obj and delete it.
Definition: device.h:9
Definition: terminal.h:16
Model of an electrical component.
Definition: component.h:16
An object that consists of other child objects.
Definition: compositeobject.h:16
A visual text object.
Definition: text.h:17