MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / execute

Method execute

src/App/FeatureTest.cpp:179–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179DocumentObjectExecReturn* FeatureTest::execute()
180{
181 // Enum handling
182 Enumeration enumObj1 = Enum.getEnum();
183 enumObj1.setValue(7, false);
184 enumObj1.setValue(4, true);
185
186 Enumeration enumObj2 = Enum.getEnum();
187 enumObj2.setValue(4, true);
188
189 Enumeration enumObj3(enumObj2);
190 const char* val = enumObj3.getCStr();
191 enumObj3.isValue(val);
192 enumObj3.getEnumVector();
193
194 Enumeration enumObj4("Single item");
195 enumObj4.setEnums(enums);
196 boost::ignore_unused(enumObj4 == enumObj2);
197 enumObj4.setEnums(nullptr);
198 enumObj4 = enumObj2;
199 boost::ignore_unused(enumObj4 == enumObj4.getCStr());
200
201 Enumeration enumObj5(enums, enums[3]);
202 enumObj5.isValue(enums[2]);
203 enumObj5.isValue(enums[3]);
204 enumObj5.contains(enums[1]);
205
206 Enumeration enumObj6;
207 enumObj6.setEnums(enums);
208 enumObj6.setValue(enums[1]);
209 std::vector<std::string> list;
210 list.emplace_back("Hello");
211 list.emplace_back("World");
212 enumObj6.setEnums(list);
213 enumObj6.setValue(list.back());
214
215 int *i = nullptr, j;
216 float f;
217 void* s;
218 std::string t;
219
220 // Code analyzers may complain about some errors. This can be ignored
221 // because this is done on purpose to test the error handling mechanism
222 switch (ExceptionType.getValue()) {
223 case 0:
224 break;
225 case 1:
226 throw std::runtime_error("Test Exception");
227 case 2:
228 throw Base::RuntimeError("FeatureTestException::execute(): Testexception");
229 default:
230 (void)i;
231 (void)j;
232 (void)f;
233 (void)s;
234 (void)t;
235 break;
236 }

Callers

nothing calls this directly

Calls 13

getEnumMethod · 0.80
getCStrMethod · 0.80
parseAbsoluteAddressMethod · 0.80
setValueMethod · 0.45
isValueMethod · 0.45
getEnumVectorMethod · 0.45
setEnumsMethod · 0.45
containsMethod · 0.45
backMethod · 0.45
getValueMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected