Home » U++ Library support » U++ Core » XmlIO - New function proposal
XmlIO - New function proposal [message #8602] |
Tue, 20 March 2007 23:22 |
victorb
Messages: 78 Registered: December 2005 Location: Nice, France
|
Member |
|
|
My application is using XML to store/retrieve data. Many elements are using the same default value. In this case I don't want to store the attribute value in the XML but I want it restored to a default value (instead of Null) when reading the configuration back. I have added this new function to XmlIO class
template <class T> XmlIO Attr(const char *id, T& var, T def) {
if(IsLoading()) {
XmlAttrLoad(var, node.Attr(id));
var = Nvl(var, def);
} else if (var != def)
node.SetAttr(id, XmlAttrStore(var));
return *this;
}
Do you think it might be useful to have this in standard Upp ?
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Nov 01 00:42:46 CET 2024
Total time taken to generate the page: 0.02050 seconds
|