Home » U++ Library support » U++ Core » ValueArray behaviour / inconsistantcy / BUG?
ValueArray behaviour / inconsistantcy / BUG? [message #29434] |
Wed, 20 October 2010 09:33 |
|
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
hi guys, i'm trying to make ValueArray work for me.
i cant quite get it to the point to be persistant, means to serialize and xmlize properly..
maybe one of you familiar with ValueArray could quickly spot the error in my code bellow (if there is any).
the test prog is attached as well as a ready to run package.
thanks a lot in advance.
Xmlize of ValueArray is kinda custom, but seems to work..
Serialize OTOH does not, and i dont exactly know why..
it deserializes but i cant get the ValueArray back from beeing Value.
#include <Core/Core.h>
using namespace Upp;
void ValueArrayXmlize(XmlIO xml, Value& v)
{
if(xml.IsStoring())
{
const ValueArray& va = v;
XmlizeStore(xml, va.Get());
}
if(xml.IsLoading())
{
ValueArray va;
Vector<Value>& vv = const_cast<Vector<Value>&>(va.Get());
::Xmlize(xml, vv);
v = va;
}
}
INITBLOCK { RegisterValueXmlize(GetValueTypeNo<ValueArray>(), &ValueArrayXmlize, "ValueArray"); }
CONSOLE_APP_MAIN
{
ValueArray va;
Vector<Value>& vv = const_cast<Vector<Value>&>(va.Get());
vv << 123;
vv << "Hallo";
Value v = va;
RLOG(v);
StoreAsXMLFile(v);
StoreToFile(v);
Value v2;
LoadFromXMLFile(v2);
RLOG(v2);
const ValueArray& va2 = v2;
const Vector<Value>& vv2 = va2.Get();
ASSERT(v2.Is<ValueArray>());
ASSERT(va2.GetCount() == va.GetCount());
ASSERT(vv2.GetCount() == vv.GetCount());
for(int i = 0; i < vv2.GetCount(); i++)
ASSERT(vv2[i] == vv[i]);
Value v3;
LoadFromFile(v3);
RLOG(v3);
const ValueArray& va3 = v3; //CRASH
const Vector<Value>& vv3 = va3.Get();
ASSERT(v3.Is<ValueArray>());
ASSERT(va3.GetCount() == va.GetCount());
ASSERT(vv3.GetCount() == vv.GetCount());
for(int i = 0; i < vv3.GetCount(); i++)
ASSERT(vv3[i] == vv[i]);
}
|
|
|
|
|
ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Wed, 20 October 2010 09:33
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Wed, 20 October 2010 10:45
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Wed, 20 October 2010 16:00
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Thu, 21 October 2010 22:40
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Thu, 21 October 2010 23:08
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Thu, 21 October 2010 23:12
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Thu, 21 October 2010 23:32
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Fri, 22 October 2010 00:09
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Fri, 22 October 2010 07:30
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Fri, 22 October 2010 09:53
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Fri, 22 October 2010 10:12
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Fri, 22 October 2010 10:17
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Fri, 22 October 2010 11:01
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Fri, 22 October 2010 13:52
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Mon, 25 October 2010 13:59
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Wed, 27 October 2010 19:32
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Thu, 28 October 2010 07:45
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Thu, 28 October 2010 10:10
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Thu, 28 October 2010 18:20
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: mirek on Fri, 29 October 2010 08:37
|
|
|
Re: ValueArray behaviour / inconsistantcy / BUG?
By: kohait00 on Fri, 29 October 2010 12:13
|
Goto Forum:
Current Time: Wed May 15 09:29:49 CEST 2024
Total time taken to generate the page: 0.03005 seconds
|