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

Method determineTypeVarSet

src/Gui/Dialogs/DlgExpressionInput.cpp:189–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189Base::Type DlgExpressionInput::determineTypeVarSet()
190{
191 Base::Type typePath = getTypePath();
192
193 // The type of the path is leading. If it is one of the types below, we
194 // can create a property in the varset.
195 if (typePath == App::PropertyString::getClassTypeId()
196 || typePath.isDerivedFrom(App::PropertyFloat::getClassTypeId())
197 || typePath.isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
198 return typePath;
199 }
200
201 // If we cannot determine the type by means of the path, for example when
202 // dealing with a sketcher constraint list or with the x, y, or z of a
203 // Placement, the type of the unit allows us to create a property in the
204 // varset. Since unit properties are derived from App::PropertyFloat, it
205 // allows us to create a property and set the value.
206
207 std::string unitTypeString = impliedUnit.getTypeString();
208 if (unitTypeString.empty()) {
209 // no type was provided
210 return Base::Type::BadType;
211 }
212
213 std::string typeString = "App::Property" + unitTypeString;
214 // may return badType
215 return Base::Type::fromName(typeString.c_str());
216}
217
218bool DlgExpressionInput::typeOkForVarSet()
219{

Callers

nothing calls this directly

Calls 4

getTypeStringMethod · 0.80
isDerivedFromMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected