Debian Codegraph @

src/editor/objectmodelloader.hpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2011 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 OBJECT_MODEL_LOADER_HPP
17 #define OBJECT_MODEL_LOADER_HPP
18
19 #include <QtCore>
20
21 #include "objectmodel.hpp"
22
23 //! Class that loads and manages object models used to
24 //! build race tracks.
25 class ObjectModelLoader
26 {
27 public:
28 typedef QVector<ObjectModel> ObjectDataVector;
29
30 //! Constructor.
31 ObjectModelLoader();
32
33 //! Load data from the given file.
34 //! \param filePath The config file to be used.
35 //! \return true If failed succeeded.
36 bool load(QString path);
37
38 //! Get all object models of the given category.
39 ObjectDataVector getObjectModelsByCategory(QString category) const;
40
41 //! Get object model of the given role.
42 ObjectModel getObjectModelByRole(QString role) const;
43
44 //! Get category by role.
45 QString getCategoryByRole(QString role) const;
46
47 //! Get all objects.
48 ObjectDataVector objects() const;
49
50 //! Get pixmap by role.
51 QPixmap getPixmapByRole(QString role) const;
52
53 private:
54 Q_DISABLE_COPY(ObjectModelLoader)
55
56 ObjectDataVector m_objects;
57 };
58
59 #endif // OBJECT_MODEL_LOADER_HPP