diff --git a/reference/Value/Value.cpp b/reference/Value/Value.cpp index f296b93d5..95718cf9e 100644 --- a/reference/Value/Value.cpp +++ b/reference/Value/Value.cpp @@ -7,7 +7,7 @@ struct RawFoo { int b; }; -struct RichFoo : AssignValueTypeNo > > { +struct RichFoo : ValueType > > { String a; int b; @@ -18,14 +18,14 @@ struct RichFoo : AssignValueTypeNo(*this); } - RichFoo(const Value& v) { *this = ValueTo(v); } + RichFoo(const Value& v) { *this = v.To(); } RichFoo() {} }; INITBLOCK { - RichValue::Register(); + Value::Register(); } void Print(const Value& x) diff --git a/reference/XmlizeCustomValue/XmlizeCustomValue.cpp b/reference/XmlizeCustomValue/XmlizeCustomValue.cpp index c470aba98..e506b23f8 100644 --- a/reference/XmlizeCustomValue/XmlizeCustomValue.cpp +++ b/reference/XmlizeCustomValue/XmlizeCustomValue.cpp @@ -2,36 +2,32 @@ using namespace Upp; -struct MyCustomValue : AssignValueTypeNo { +struct MyCustomValue : ValueType { int x, y, z; - bool operator==(const MyCustomValue& o) const { return false; } - void Serialize(Stream& s) {} - String ToString() const { return "MyCustomValue"; } - unsigned GetHashValue() const { return 0; } - bool IsNullInstance() const { return false; } + String ToString() const { return "MyCustomValue"; } + operator Value() const { return RichValue(*this); } - MyCustomValue(const Value& v) { *this = ValueTo(v); } + MyCustomValue(const Value& v) { *this = v.To(); } + void Xmlize(XmlIO& xio); MyCustomValue() {} }; -void Xmlize(XmlIO xml, MyCustomValue& v) +void MyCustomValue::Xmlize(XmlIO& xio) { - xml - .Attr("x", v.x) - .Attr("y", v.y) - .Attr("z", v.z) + xio + .Attr("x", x) + .Attr("y", y) + .Attr("z", z) ; } INITBLOCK { - RichValue::Register(); + Value::Register("MyCustomValue"); } -REGISTER_VALUE_XMLIZE(MyCustomValue); - CONSOLE_APP_MAIN { StdLogSetup(LOG_COUT|LOG_FILE);