Debian Codegraph @

src/common/objectbase.hpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2015 Jussi Lind <[email protected]>
3 //
4 // Dust Racing 2D is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 // Dust Racing 2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>.
15
16 #ifndef OBJECTBASE_HPP
17 #define OBJECTBASE_HPP
18
19 #include <QPointF>
20 #include <QString>
21
22 #include <memory>
23
24 //! Base class for freely placeable objects in the editor.
25 class ObjectBase
26 {
27 public:
28 //! Constructor.
29 ObjectBase(QString category, QString role);
30
31 ObjectBase(ObjectBase & other) = delete;
32
33 ObjectBase & operator=(ObjectBase & other) = delete;
34
35 //! Destructor.
36 virtual ~ObjectBase();
37
38 //! Get location in world / scene.
39 virtual QPointF location() const;
40
41 //! Set coordinates in the world.
42 virtual void setLocation(QPointF newLocation);
43
44 //! Get category.
45 QString category() const;
46
47 //! Get role.
48 QString role() const;
49
50 bool forceStationary() const;
51
52 void setForceStationary(bool forceStationary);
53
54 private:
55 //! Category of this object.
56 QString m_category;
57
58 //! Role of this object.
59 QString m_role;
60
61 //! Coordinates in the world.
62 QPointF m_location;
63
64 bool m_forceStationary;
65 };
66
67 using ObjectBasePtr = std::shared_ptr<ObjectBase>;
68
69 #endif // OBJECTBASE_HPP