mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-02 06:12:41 -06:00
reference: Value related examples modernized
git-svn-id: svn://ultimatepp.org/upp/trunk@5157 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9d32760da1
commit
52329bf08f
2 changed files with 14 additions and 18 deletions
|
|
@ -2,36 +2,32 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
struct MyCustomValue : AssignValueTypeNo<MyCustomValue, 514> {
|
||||
struct MyCustomValue : ValueType<MyCustomValue, 514> {
|
||||
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<MyCustomValue>(*this); }
|
||||
MyCustomValue(const Value& v) { *this = ValueTo<MyCustomValue>(v); }
|
||||
MyCustomValue(const Value& v) { *this = v.To<MyCustomValue>(); }
|
||||
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<MyCustomValue>::Register();
|
||||
Value::Register<MyCustomValue>("MyCustomValue");
|
||||
}
|
||||
|
||||
REGISTER_VALUE_XMLIZE(MyCustomValue);
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue