Thu, 29 Mar 2018 12:09:05 +0300
Branch close
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 | #include "objtype.h" | |
20 | ||
21 | ||
942
afbd122f3eff
Commit work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
925
diff
changeset
|
22 | Script::ObjectType::ObjectType() {} |
923 | 23 | |
24 | QString Script::ContainerType::asString() const | |
25 | { | |
26 | switch (m_kind) | |
27 | { | |
28 | case ARRAY: | |
29 | return m_elementType->asString() + "[]"; | |
30 | ||
31 | case TUPLE: | |
32 | return m_elementType->asString() | |
33 | + "(" + QString::number(m_n1) + ")"; | |
34 | ||
35 | case MATRIX: | |
36 | return m_elementType->asString() | |
37 | + "(" + QString::number(m_n1) | |
38 | + "," + QString::number(m_n2) + ")"; | |
39 | } | |
40 | ||
41 | return "???"; | |
42 | } | |
43 | ||
44 | QString Script::BasicType::asString() const | |
45 | { | |
46 | static const char* names[] = | |
47 | { | |
48 | "var", | |
49 | "int", | |
50 | "real", | |
51 | "string", | |
52 | "type", | |
53 | "object", | |
54 | }; | |
55 | ||
56 | return names[int (m_kind)]; | |
57 | } |