{
public:
RenameObjectIdentifierExpressionVisitor(P & _prop,
const std::map (_prop)
, paths(_paths)
, owner(_owner)
{
}
void visit(Expression *node) {
VariableExpression *expr = Base::freecad_dynamic_cast ::setExpressionChanged();
expr->setPath(it->second.relativeTo(owner));
}
}
}
private:
const std::map {
public:
RelabelDocumentObjectExpressionVisitor(P & _prop, const std::string & _oldName, const std::string & _newName)
: ExpressionModifier (_prop)
, oldName(_oldName)
, newName(_newName)
{
}
~RelabelDocumentObjectExpressionVisitor() {
}
/**
* @brief Visit each node in the expression, and if it is a VariableExpression object, incoke renameDocumentObject in it.
* @param node Node to visit
*/
void visit(Expression * node) {
VariableExpression *expr = Base::freecad_dynamic_cast ::setExpressionChanged();
expr->renameDocumentObject(oldName, newName);
}
}
private:
std::string oldName; /**< Document object name to replace */
std::string newName; /**< New document object name */
};
template {
public:
RelabelDocumentExpressionVisitor(P & prop, const std::string & _oldName, const std::string & _newName)
: ExpressionModifier (prop)
, oldName(_oldName)
, newName(_newName)
{
}
void visit(Expression * node) {
VariableExpression *expr = Base::freecad_dynamic_cast ::setExpressionChanged();
expr->renameDocument(oldName, newName);
}
}
private:
std::string oldName;
std::string newName;
};
}
#endif // RENAMEOBJECTIDENTIFIEREXPRESSIONVISITOR_H