Home » U++ Library support » U++ Core » Xmlize default value
Xmlize default value [message #37808] |
Wed, 14 November 2012 10:27  |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
A possible idea to improve Xmlize/Serialize functions would be to add a default value to be used when no data is found loading the class.
It could be like this
void Xmlize(XmlIO &xml) {
xml
("MyString", myString, "Default value")
("MyDouble", myDouble, 1200.2)
;
}
Best regards
Iñaki
|
|
|
|
|
|
|
Re: Xmlize default value [message #42003 is a reply to message #41707] |
Mon, 10 February 2014 15:07   |
 |
mirek
Messages: 14256 Registered: November 2005
|
Ultimate Member |
|
|
I have implemented this, but I have encountred nasty problem on the way. All works fine except for string, where there is unresolvable overloading ambiguity with
template <class T> XmlIO operator()(const char *tag, const char *itemtag, T& var);
which is variant intended to choose tag of items while serializing containers.
The only nice solution would be to change this non-operator method, something like
template <class T> XmlIO Container(const char *tag, const char *itemtag, T& var);
or perhaps possible remove it completely (currently, there are also default variants with "item", "key" etc...).
Any suggestions?
|
|
|
|
|
Goto Forum:
Current Time: Wed Apr 30 09:19:45 CEST 2025
Total time taken to generate the page: 0.04624 seconds
|