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 » S_type and ValueMap
Re: S_type and ValueMap [message #52519 is a reply to message #52518] Tue, 15 October 2019 13:54 Go to previous messageGo to previous message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi,
thank you for your suggestion.

This is what I came up with, I post it here for reference and improvements.


[...]
		//S_FILLER s(*vm); Crashes if it contains int or double
		S_FILLER s;
		S_convert(&s,vm);

[...]

	template <class T>
	void S_convert(T * s, ValueMap * vm){
	
		for(int i=0;i<vm->GetCount();i++){
			
			Ref r=s->GetRef(SqlId(vm->GetKey(i)));
			if(r.Is<double>())
				s->Set(SqlId(vm->GetKey(i)),StrDbl(AsString(vm->GetValue(i))));
				
			if(r.Is<int>())
				s->Set(SqlId(vm->GetKey(i)),StrInt(AsString(vm->GetValue(i))));
				
			if(r.Is<String>())
				s->Set(SqlId(vm->GetKey(i)),AsString(vm->GetValue(i)));
		}
		
	}


 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Doubt about container
Next Topic: [SOLVED] Vector Bug
Goto Forum:
  


Current Time: Thu Aug 21 09:15:45 CEST 2025

Total time taken to generate the page: 0.04719 seconds