It is pending all the rest of value base types.
return Angle::deg(atof(val.c_str()));
}
+bool
+CanvasParser::parse_static(xmlpp::Element *element)
+{
+ if(!element->get_attribute("static"))
+ return false;
+
+ string val=element->get_attribute("static")->get_value();
+
+ if(val=="true" || val=="1")
+ return true;
+ if(val=="false" || val=="0")
+ return false;
+
+ error(element,strprintf(_("Bad value \"%s\" in <%s>"),val.c_str(),"bool"));
+
+ return false;
+}
+
+
ValueBase
CanvasParser::parse_value(xmlpp::Element *element,Canvas::Handle canvas)
{
if(element->get_name()=="real")
- return parse_real(element);
+ {
+ ValueBase ret;
+ ret.set(parse_real(element));
+ ret.set_static(parse_static(element));
+ return ret;
+ }
else
if(element->get_name()=="time")
return parse_time(element,canvas);
//! Dynamic List Parsnig Function
etl::handle<ValueNode_DynamicList> parse_dynamic_list(xmlpp::Element *node,Canvas::Handle canvas);
+ //! Static option for ValueBase parsing fucntion
+ bool parse_static(xmlpp::Element *node);
+
}; // END of CanvasParser
/* === E X T E R N S ======================================================= */
}
-xmlpp::Element* encode_real(xmlpp::Element* root,Real v)
+xmlpp::Element* encode_real(xmlpp::Element* root,Real v, bool s=false)
{
root->set_name("real");
root->set_attribute("value",strprintf(VECTOR_VALUE_TYPE_FORMAT,v));
+ if(s)
+ root->set_attribute("static", s?"true":"false");
return root;
}
switch(data.get_type())
{
case ValueBase::TYPE_REAL:
- return encode_real(root,data.get(Real()));
+ return encode_real(root,data.get(Real()), data.get_static());
case ValueBase::TYPE_TIME:
return encode_time(root,data.get(Time()));
case ValueBase::TYPE_INTEGER: