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

Method checkImport

src/App/ObjectIdentifier.cpp:1412–1453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1410}
1411
1412void ObjectIdentifier::String::checkImport(const App::DocumentObject* owner,
1413 const App::DocumentObject* obj,
1414 const String* objName)
1415{
1416 if (owner && owner->getDocument() && !str.empty()
1417 && ExpressionParser::ExpressionImporter::reader()) {
1418 auto reader = ExpressionParser::ExpressionImporter::reader();
1419 if (obj || objName) {
1420 bool restoreLabel = false;
1421 str = PropertyLinkBase::importSubName(*reader, str.c_str(), restoreLabel);
1422 if (restoreLabel) {
1423 if (!obj) {
1424 std::bitset<32> flags;
1425 obj = getDocumentObject(owner->getDocument(), *objName, flags);
1426 if (!obj) {
1427 FC_ERR("Cannot find object " << objName->toString());
1428 }
1429 }
1430
1431 if (obj) {
1432 PropertyLinkBase::restoreLabelReference(obj, str);
1433 }
1434 }
1435 }
1436 else if (str.back() != '@') {
1437 str = reader->getName(str.c_str());
1438 }
1439 else {
1440 str.resize(str.size() - 1);
1441 auto mapped = reader->getName(str.c_str());
1442 auto objForMapped = owner->getDocument()->getObject(mapped);
1443 if (!objForMapped) {
1444 FC_ERR("Cannot find object " << str);
1445 }
1446 else {
1447 isString = true;
1448 forceIdentifier = false;
1449 str = objForMapped->Label.getValue();
1450 }
1451 }
1452 }
1453}
1454
1455Py::Object
1456ObjectIdentifier::access(const ResolveResults& result, const Py::Object* value, Dependencies* deps) const

Callers 2

yyparseFunction · 0.80
setDocumentObjectNameMethod · 0.80

Calls 10

getDocumentMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
toStringMethod · 0.45
backMethod · 0.45
getNameMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
getObjectMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected