Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » XmlIO - New function proposal
Re: XmlIO - New function proposal [message #8607 is a reply to message #8605] Wed, 21 March 2007 08:45 Go to previous messageGo to previous message
victorb is currently offline  victorb
Messages: 78
Registered: December 2005
Location: Nice, France
Member
Oops... you are right about XmlAttrLoad not always returning Null and thanks for pointing me to the right direction "Maybe we should change it so that XmlAttrLoad would not set the value if it is missing?"

The following function should do the trick:

	template <class T> XmlIO Attr(const char *id, T& var, T def) {
		if(IsLoading())
		    if (IsNull(node.Attr(id)))
				var = def;
		    else
				XmlAttrLoad(var, node.Attr(id));		        
	 	else if (var != def) 
				node.SetAttr(id, XmlAttrStore(var));		
		return *this;
	}
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: "Copy folder recursively" is there a function?
Next Topic: Unsafe Deep Copy
Goto Forum:
  


Current Time: Tue Sep 02 10:32:05 CEST 2025

Total time taken to generate the page: 0.05933 seconds