Sat, 22 Aug 2015 13:04:58 +0300
Commit work on scripting
| 923 | 1 | /* |
| 2 | * LDForge: LDraw parts authoring CAD | |
|
925
2f316b57b508
- added/corrected license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
923
diff
changeset
|
3 | * Copyright (C) 2015 Teemu Piippo |
| 923 | 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify | |
| 6 | * it under the terms of the GNU General Public License as published by | |
| 7 | * the Free Software Foundation, either version 3 of the License, or | |
| 8 | * (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | * GNU General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU General Public License | |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 17 | */ | |
| 18 | ||
| 19 | #pragma once | |
| 20 | #include "../main.h" | |
| 21 | ||
| 22 | namespace Script | |
| 23 | { | |
|
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
24 | class ObjectType |
| 923 | 25 | { |
| 26 | public: | |
|
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
27 | ObjectType(); |
| 923 | 28 | virtual QString asString() const = 0; |
| 29 | }; | |
| 30 | ||
|
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
31 | class BasicType : public ObjectType |
| 923 | 32 | { |
| 33 | public: | |
| 34 | enum Kind | |
| 35 | { | |
| 36 | VAR, // mixed | |
| 37 | INT, | |
| 38 | REAL, | |
| 39 | STRING, | |
| 40 | TYPE, // heh | |
| 41 | OBJECT, | |
| 42 | }; | |
| 43 | ||
| 44 | QString asString() const override; | |
| 45 | Kind kind() const { return m_kind; } | |
| 46 | ||
| 47 | private: | |
| 48 | Kind m_kind; | |
| 49 | }; | |
| 50 | ||
|
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
51 | class ContainerType : public ObjectType |
| 923 | 52 | { |
| 53 | public: | |
| 54 | enum Kind | |
| 55 | { | |
| 56 | ARRAY, | |
| 57 | TUPLE, | |
| 58 | MATRIX | |
| 59 | }; | |
| 60 | ||
| 61 | ContainerType (Kind kind, int n1, int n2) : | |
| 62 | m_kind (kind), m_n1 (n1), m_n2 (n2) {} | |
| 63 | ||
| 64 | QString asString() const override; | |
| 65 | Kind kind() const { return m_kind; } | |
| 66 | int n1() const { return m_n1; } | |
| 67 | int n2() const { return m_n1; } | |
|
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
68 | QSharedPointer<ObjectType> elementType() const { return m_elementType; } |
| 923 | 69 | |
| 70 | private: | |
| 71 | Kind m_kind; | |
|
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
72 | QSharedPointer<ObjectType> m_elementType; |
| 923 | 73 | int m_n1; |
| 74 | int m_n2; | |
| 75 | }; | |
| 76 | } |