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 » Developing U++ » U++ Developers corner » Simple trick to have have bot JSON and XML for a class
Simple trick to have have bot JSON and XML for a class [message #49687] Tue, 03 April 2018 17:46 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I needed class to support both JSON and XML. Initially, I have implemented both Xmlize and Jsonize but that is tedious.

Then I have found an obvious solution to the problem:

template <class T>
void MyClass::Ize(T& io)
{
	io
		("min", uMin)
		("max", uMax)
.....

}

void MyClass::Xmlize(XmlIO& xml) { Ize(xml); }

void MyClass::Jsonize(JsonIO& json) { Ize(json); }



Perhaps this will help somebody... Smile
 
Read Message
Read Message
Previous Topic: Upp as a shared library
Next Topic: Help!!! Building 32 bit apps on Ubuntu64
Goto Forum:
  


Current Time: Fri Apr 19 09:37:19 CEST 2024

Total time taken to generate the page: 0.02726 seconds