| 1060 | } |
| 1061 | |
| 1062 | Property* PropertyExpressionEngine::CopyOnLabelChange(App::DocumentObject* obj, |
| 1063 | const std::string& ref, |
| 1064 | const char* newLabel) const |
| 1065 | { |
| 1066 | std::unique_ptr<PropertyExpressionEngine> engine; |
| 1067 | for (auto it = expressions.begin(); it != expressions.end(); ++it) { |
| 1068 | #ifdef BOOST_NO_CXX11_SMART_PTR |
| 1069 | std::shared_ptr<Expression> expr( |
| 1070 | it->second.expression->updateLabelReference(obj, ref, newLabel).release()); |
| 1071 | #else |
| 1072 | std::shared_ptr<Expression> expr( |
| 1073 | it->second.expression->updateLabelReference(obj, ref, newLabel)); |
| 1074 | #endif |
| 1075 | if (!expr && !engine) { |
| 1076 | continue; |
| 1077 | } |
| 1078 | if (!engine) { |
| 1079 | engine = std::make_unique<PropertyExpressionEngine>(); |
| 1080 | for (auto it2 = expressions.begin(); it2 != it; ++it2) { |
| 1081 | ExpressionInfo info; |
| 1082 | if (it2->second.expression) { |
| 1083 | info.expression = std::shared_ptr<Expression>(it2->second.expression->copy()); |
| 1084 | } |
| 1085 | engine->expressions[it2->first] = info; |
| 1086 | } |
| 1087 | } |
| 1088 | else if (!expr) { |
| 1089 | expr = it->second.expression; |
| 1090 | } |
| 1091 | engine->expressions[it->first] = ExpressionInfo(expr); |
| 1092 | } |
| 1093 | if (!engine) { |
| 1094 | return nullptr; |
| 1095 | } |
| 1096 | engine->validator = validator; |
| 1097 | return engine.release(); |
| 1098 | } |
| 1099 | |
| 1100 | Property* PropertyExpressionEngine::CopyOnLinkReplace(const App::DocumentObject* parent, |
| 1101 | App::DocumentObject* oldObj, |
nothing calls this directly
no test coverage detected