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

Method _renameObjectIdentifier

src/App/Expression.cpp:3008–3034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3006}
3007
3008bool VariableExpression::_renameObjectIdentifier(
3009 const std::map<ObjectIdentifier, ObjectIdentifier>& paths,
3010 const ObjectIdentifier& path,
3011 ExpressionVisitor& visitor)
3012{
3013 const auto& oldPath = var.canonicalPath();
3014 auto it = paths.find(oldPath);
3015 if (it != paths.end()) {
3016 visitor.aboutToChange();
3017 const bool originalHasDocumentObjectName = var.hasDocumentObjectName();
3018 ObjectIdentifier::String originalDocumentObjectName = var.getDocumentObjectName();
3019 std::string originalSubObjectName = var.getSubObjectName();
3020 if (path.getOwner()) {
3021 var = it->second.relativeTo(path);
3022 }
3023 else {
3024 var = it->second;
3025 }
3026 if (originalHasDocumentObjectName) {
3027 var.setDocumentObjectName(std::move(originalDocumentObjectName),
3028 true,
3029 originalSubObjectName);
3030 }
3031 return true;
3032 }
3033 return false;
3034}
3035
3036void VariableExpression::_collectReplacement(
3037 std::map<ObjectIdentifier,ObjectIdentifier> &paths,

Callers 1

Calls 12

hasDocumentObjectNameMethod · 0.80
getDocumentObjectNameMethod · 0.80
relativeToMethod · 0.80
setDocumentObjectNameMethod · 0.80
ObjectIdentifierClass · 0.70
moveFunction · 0.50
canonicalPathMethod · 0.45
findMethod · 0.45
endMethod · 0.45
aboutToChangeMethod · 0.45
getOwnerMethod · 0.45
getPropertyNameMethod · 0.45

Tested by

no test coverage detected