1 /** @file defs/model.h  Model definition accessor.
2  *
3  * @authors Copyright (c) 2014-2017 Jaakko Keränen <jaakko.keranen@iki.fi>
4  *
5  * @par License
6  * GPL: http://www.gnu.org/licenses/gpl.html
7  *
8  * <small>This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version. This program is distributed in the hope that it
12  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details. You should have received a copy of the GNU
15  * General Public License along with this program; if not, see:
16  * http://www.gnu.org/licenses</small>
17  */
18 
19 #ifndef LIBDOOMSDAY_DEFN_MODEL_H
20 #define LIBDOOMSDAY_DEFN_MODEL_H
21 
22 #include "definition.h"
23 #include <de/RecordAccessor>
24 
25 namespace defn {
26 
27 /**
28  * Utility for handling model definitions.
29  */
30 class LIBDOOMSDAY_PUBLIC Model : public Definition
31 {
32 public:
Model()33     Model()                    : Definition() {}
Model(Model const & other)34     Model(Model const &other)  : Definition(other) {}
Model(de::Record & d)35     Model(de::Record &d)       : Definition(d) {}
Model(de::Record const & d)36     Model(de::Record const &d) : Definition(d) {}
37 
38     void resetToDefaults();
39 
40     de::Record &addSub();
41     int subCount() const;
42     bool hasSub(int index) const;
43     de::Record &sub(int index);
44     de::Record const &sub(int index) const;
45 
46     void cleanupAfterParsing(de::Record const &prev);
47 };
48 
49 } // namespace defn
50 
51 #endif // LIBDOOMSDAY_DEFN_MODEL_H
52