EscValue EscFromStdValue(const Value& v) { EscValue r; Time t; if(!IsNull(v)) switch(v.GetType()) { case BOOL_V: case INT_V: case INT64_V: case DOUBLE_V: r = (double)v; break; case STRING_V: case WSTRING_V: r = (WString)v; break; case TIME_V: t = v; r.MapSet("hour", t.hour); r.MapSet("minute", t.minute); r.MapSet("second", t.second); case DATE_V: t = v; r.MapSet("year", t.year); r.MapSet("month", t.month); r.MapSet("day", t.day); break; case VALUEARRAY_V: ValueArray va = v; r.SetEmptyArray(); for(int i = 0; i < va.GetCount(); i++) r.ArrayAdd(EscFromStdValue(va[i])); } return r; }
EscValue EscRect(const Rect& r) { EscValue v; v.MapSet("left", r.left); v.MapSet("right", r.right); v.MapSet("top", r.top); v.MapSet("bottom", r.bottom); return v; }
EscValue EscColor(Color c) { EscValue v; if(!IsNull(c)) { v.MapSet("r", c.GetR()); v.MapSet("g", c.GetG()); v.MapSet("b", c.GetB()); } return v; }
EscValue EscPoint(Point sz) { EscValue v; v.MapSet("x", sz.x); v.MapSet("y", sz.y); return v; }
EscValue EscSize(Size sz) { EscValue v; v.MapSet("cx", sz.cx); v.MapSet("cy", sz.cy); return v; }