Home » Developing U++ » U++ Developers corner » Xmlize values
Re: Xmlize values [message #25501 is a reply to message #25496] |
Fri, 26 February 2010 12:27 |
|
koldo
Messages: 3361 Registered: August 2008
|
Senior Veteran |
|
|
luzr wrote on Fri, 26 February 2010 11:57 | I was thinking about Xmlize Value problem and I think this should be quite a fine solution:
First, Xmlize itself should know all Values that are in the Core (I guess we are there already, right?).
Then, add registering mechanism for unknown Values. Anyway, I think it would be better not to register any values automatically, because that would link all XML code into any application. So
Last but not least, for non-registered Values, use binary serialization and put a hex string there. Important - this should be signalled in the serialization so that even if type is registered later, old XML files can still be loaded.
What do you think?
Mirek
|
Hello Mirek
This is out of my knowledge. I am not strong in templates but, it would be great if Value Xmlize would use automatically the Xmlize method for every class.
I mean, this is a detail of actual implementation:
template<> void Xmlize(XmlIO xml, Value& var) {
dword t;
if(xml.IsLoading()) {
xml.Attr("type", t);
switch(t) {
case INT_V:
int i;
xml.Attr("value", i);
var = i;
break;
case DOUBLE_V:
double d;
xml.Attr("value", d);
var = d;
break;
... the same for all Value types
However it would be great to have something like this (pseudocode):
template<> void Xmlize(XmlIO xml, Value& var) {
dword t;
if(xml.IsLoading()) {
xml.Attr("type", t);
xml.Attr("value", var->v as type t); // force var to be as its type
} else {
...
Best regards
IƱaki
|
|
|
|
|
Xmlize values
By: mdelfede on Wed, 24 February 2010 00:12
|
|
|
Re: Xmlize values
By: mdelfede on Wed, 24 February 2010 00:20
|
|
|
Re: Xmlize values
By: koldo on Wed, 24 February 2010 12:14
|
|
|
Re: Xmlize values
By: mirek on Fri, 26 February 2010 11:57
|
|
|
Re: Xmlize values
By: koldo on Fri, 26 February 2010 12:27
|
|
|
Re: Xmlize values
By: mdelfede on Fri, 26 February 2010 12:37
|
|
|
Re: Xmlize values
By: mirek on Fri, 26 February 2010 13:12
|
|
|
Re: Xmlize values
By: mirek on Sun, 28 February 2010 15:08
|
|
|
Re: Xmlize values
By: koldo on Sun, 28 February 2010 15:44
|
|
|
Re: Xmlize values
By: mirek on Sun, 28 February 2010 17:03
|
|
|
Re: Xmlize values
By: koldo on Sun, 28 February 2010 17:32
|
|
|
Re: Xmlize values
By: mirek on Sun, 28 February 2010 23:09
|
|
|
Re: Xmlize values
By: mdelfede on Mon, 01 March 2010 09:53
|
|
|
Re: Xmlize values
By: mirek on Mon, 01 March 2010 10:20
|
|
|
Re: Xmlize values
|
|
|
Re: Xmlize values
By: mdelfede on Mon, 01 March 2010 11:08
|
|
|
Re: Xmlize values
|
|
|
Re: Xmlize values
By: mirek on Tue, 09 March 2010 09:35
|
|
|
Re: Xmlize values
|
|
|
Re: Xmlize values
By: mirek on Wed, 10 March 2010 08:55
|
|
|
Re: Xmlize values
By: mdelfede on Sun, 28 February 2010 20:41
|
Goto Forum:
Current Time: Thu May 09 16:36:36 CEST 2024
Total time taken to generate the page: 0.01410 seconds
|