Debian Codegraph @

src/App/FeatureTest.h

raw
1 /***************************************************************************
2 * Copyright (c) 2006 Jürgen Riegel <[email protected]> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23
24 #ifndef APP_FEATURETEST_H
25 #define APP_FEATURETEST_H
26
27 #include "DocumentObject.h"
28 #include "PropertyGeo.h"
29 #include "PropertyLinks.h"
30 #include "PropertyPythonObject.h"
31 #include "PropertyUnits.h"
32
33
34 namespace App
35 {
36
37 /// The testing feature
38 class FeatureTest: public DocumentObject
39 {
40 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTest);
41
42 public:
43 FeatureTest();
44
45 ~FeatureTest() override;
46
47 // Standard Properties (PropertyStandard.h)
48 App::PropertyInteger Integer;
49 App::PropertyFloat Float;
50 App::PropertyBool Bool;
51 App::PropertyBoolList BoolList;
52 App::PropertyString String;
53 App::PropertyPath Path;
54 App::PropertyStringList StringList;
55
56 App::PropertyColor Colour;
57 App::PropertyColorList ColourList;
58 App::PropertyMaterial Material;
59 App::PropertyMaterialList MaterialList;
60
61 // special types
62 App::PropertyDistance Distance;
63 App::PropertyAngle Angle;
64
65 // Constraint types
66 App::PropertyEnumeration Enum;
67 App::PropertyIntegerConstraint ConstraintInt;
68 App::PropertyFloatConstraint ConstraintFloat;
69
70 // Standard Properties (PrppertyStandard.h)
71 App::PropertyIntegerList IntegerList;
72 App::PropertyFloatList FloatList;
73
74 // Standard Properties (PropertyLinks.h)
75 App::PropertyLink Link;
76 App::PropertyLinkSub LinkSub;
77 App::PropertyLinkList LinkList;
78 App::PropertyLinkSubList LinkSubList;
79
80 // Standard Properties (PropertyGeo.h)
81 App::PropertyMatrix Matrix;
82 App::PropertyVector Vector;
83 App::PropertyVectorList VectorList;
84 App::PropertyPlacement Placement;
85
86 // Properties to test the Document::recompute()
87 App::PropertyLink Source1;
88 App::PropertyLink Source2;
89 App::PropertyLinkList SourceN;
90 App::PropertyString ExecResult;
91 App::PropertyInteger ExceptionType;
92 App::PropertyInteger ExecCount;
93
94 App::PropertyInteger TypeHidden;
95 App::PropertyInteger TypeReadOnly;
96 App::PropertyInteger TypeOutput;
97 App::PropertyInteger TypeAll;
98 App::PropertyInteger TypeTransient;
99 App::PropertyInteger TypeNoRecompute;
100
101 App::PropertyQuantity QuantityLength;
102 App::PropertyQuantity QuantityOther;
103 // App::PropertyQuantity QuantityMass;
104 // App::PropertyQuantity QuantityAngle;
105
106 /** @name methods override Feature */
107 //@{
108 short mustExecute() const override;
109 /// recalculate the Feature
110 DocumentObjectExecReturn* execute() override;
111 /// returns the type name of the ViewProvider
112 // Hint: Probably it makes sense to have a view provider for unittests (e.g.
113 // Gui::ViewProviderTest)
114 const char* getViewProviderName() const override
115 {
116 return "Gui::ViewProviderFeature";
117 }
118 //@}
119 };
120
121 /// The exception testing feature
122 class FeatureTestException: public FeatureTest
123 {
124 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTestException);
125
126 public:
127 FeatureTestException();
128
129 /// this property defines which kind of exceptio the feature throw on you
130 App::PropertyInteger ExceptionType;
131
132 /// recalculate the Feature and throw an exception
133 DocumentObjectExecReturn* execute() override;
134 /// returns the type name of the ViewProvider
135 const char* getViewProviderName() const override
136 {
137 return "Gui::ViewProviderFeature";
138 }
139 };
140
141 class FeatureTestColumn: public DocumentObject
142 {
143 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTestColumn);
144
145 public:
146 FeatureTestColumn();
147
148 // Standard Properties (PropertyStandard.h)
149 App::PropertyString Column;
150 App::PropertyBool Silent;
151 App::PropertyInteger Value;
152
153 /** @name methods override Feature */
154 //@{
155 DocumentObjectExecReturn* execute() override;
156 //@}
157 };
158
159 class FeatureTestRow: public DocumentObject
160 {
161 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTestRow);
162
163 public:
164 FeatureTestRow();
165
166 // Standard Properties (PropertyStandard.h)
167 App::PropertyString Row;
168 App::PropertyBool Silent;
169 App::PropertyInteger Value;
170
171 /** @name methods override Feature */
172 //@{
173 DocumentObjectExecReturn* execute() override;
174 //@}
175 };
176
177 class FeatureTestAbsAddress: public DocumentObject
178 {
179 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTestAbsAddress);
180
181 public:
182 FeatureTestAbsAddress();
183 DocumentObjectExecReturn* execute() override;
184
185 App::PropertyString Address;
186 App::PropertyBool Valid;
187 };
188
189 class FeatureTestPlacement: public DocumentObject
190 {
191 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTestPlacement);
192
193 public:
194 FeatureTestPlacement();
195
196 // Standard Properties (PropertyStandard.h)
197 App::PropertyPlacement Input1;
198 App::PropertyPlacement Input2;
199 App::PropertyPlacement MultLeft;
200 App::PropertyPlacement MultRight;
201
202 /** @name methods override Feature */
203 //@{
204 DocumentObjectExecReturn* execute() override;
205 //@}
206 };
207
208 class FeatureTestAttribute: public DocumentObject
209 {
210 PROPERTY_HEADER_WITH_OVERRIDE(App::FeatureTestAttribute);
211
212 public:
213 FeatureTestAttribute();
214 ~FeatureTestAttribute() override;
215 DocumentObjectExecReturn* execute() override;
216
217 App::PropertyPythonObject Object;
218 App::PropertyString Attribute;
219 };
220
221
222 } // namespace App
223
224 #endif // APP_FEATURETEST_H