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++ MT-multithreading and servers » How to pass vector/array of structs to witz?
Re: How to pass vector/array of structs to witz? [message #40327 is a reply to message #40322] Fri, 19 July 2013 15:58 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Zbych,

If I'm not mistaken, the closest you can get is to use ValueArray instead of Array and ValueMap instead of DataSet. ValueArray/Map are not really ergonomic to handle, so the best approach is probably to convert your data before passing them to witz.

Something like
struct DataSet{
	int data1;
	double data2;
	String data3;
};

Array<DataSet> set;

ValueArray v;
for (int i=0; i<set.GetCount(); ++i) {
    ValueMap vm;
    vm["data1"]=set[i].data1;
    vm["data2"]=set[i].data2;
    vm["data3"]=set[i].data3;
    v.Add(vm);
}

http("set", v);

Note: I'd not try to compile or run the code Wink

It is quite verbose, so some helper functions might be a good idea...

Best regards,
Honza
 
Read Message
Read Message
Read Message
Previous Topic: Probable bug in Skylark and sessions
Next Topic: Skylark - serving CSS style sheets
Goto Forum:
  


Current Time: Sun May 12 19:10:35 CEST 2024

Total time taken to generate the page: 0.04217 seconds