Added reload of levels on F7 (Update levelpack) to ease the test of changes.
[enigmagame.git] / src / AttributeDescriptor.hh
blob03885401bb9bce366bba2bbf601e5f60b06d468e
1 /*
2 * Copyright (C) 2008 Ronald Lamprecht
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef ATTRIBUTEDESCRIPTOR_HH_INCLUDED
20 #define ATTRIBUTEDESCRIPTOR_HH_INCLUDED
22 #include "Value.hh"
23 #include "Object.hh"
24 #include <string>
26 namespace enigma
28 enum validationType {
29 VAL_BOOL,
30 VAL_INT,
31 VAL_DOUBLE,
32 VAL_NIL,
33 VAL_DIR,
34 // VAL_POS,
35 VAL_STRING,
36 VAL_ENUM,
37 VAL_TOKENS
38 };
40 class AttributeDescriptor {
41 public:
42 AttributeDescriptor(std::string name, validationType valType, Value defaultValue,
43 bool allowRead, bool allowWrite, Value minVal, Value maxVal);
44 std::string getName();
45 validationType getType();
46 bool isReadable();
47 bool isWritable();
48 Value getDefaultValue();
49 Value getValue();
50 ValidationResult checkValue(Value val);
51 void setReadable(bool allowRead);
52 void setWritable(bool allowWrite);
53 void setDefaultValue(const Value &newDefault);
54 void setMinValue(const Value &newMin);
55 void setMaxValue(const Value &newMax);
56 void setValue(const Value &newValue);
57 void limitToKindValue();
59 private:
60 std::string name;
61 validationType type;
62 Value defaultValue;
63 bool readable;
64 bool writable;
65 Value min;
66 Value max;
67 Value value;
68 bool isKindValue;
70 } // namespace enigma
71 #endif