-xmlpp::Element* encode_subtract(xmlpp::Element* root,ValueNode_Subtract::ConstHandle value_node,Canvas::ConstHandle canvas=0)
-{
- assert(value_node);
- root->set_name("subtract");
-
- ValueNode::ConstHandle lhs=value_node->get_lhs();
- ValueNode::ConstHandle rhs=value_node->get_rhs();
- ValueNode::ConstHandle scalar=value_node->get_scalar();
-
- assert(lhs);
- assert(rhs);
-
- root->set_attribute("type",ValueBase::type_name(value_node->get_type()));
-
- if(lhs==rhs)
- warning("LHS is equal to RHS, this <subtract> will always be zero!");
-
- //if(value_node->get_scalar()!=1)
- // root->set_attribute("scalar",strprintf(VECTOR_VALUE_TYPE_FORMAT,value_node->get_scalar()));
-
- if(!scalar->get_id().empty())
- root->set_attribute("scalar",scalar->get_relative_id(canvas));
- else
- encode_value_node(root->add_child("scalar")->add_child("value_node"),scalar,canvas);
-
- if(!lhs->get_id().empty())
- root->set_attribute("lhs",lhs->get_relative_id(canvas));
- else
- encode_value_node(root->add_child("lhs")->add_child("value_node"),lhs,canvas);
-
- if(!rhs->get_id().empty())
- root->set_attribute("rhs",rhs->get_relative_id(canvas));
- else
- encode_value_node(root->add_child("rhs")->add_child("value_node"),rhs,canvas);
-
- return root;
-}
-