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++ Widgets - General questions or Mixed problems » Converters and Value problem
Re: Converters and Value problem [message #27552 is a reply to message #27547] Fri, 23 July 2010 10:51 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
mubeta wrote on Thu, 22 July 2010 16:44

Hi all,
I am using my own class for converting an integer number in a binary mode:

...
Value ConvertBinShort::Scan(const Value& text) const 
{
	Value v = UPP::ScanInt((const char*)String(text), NULL, 2);
	if(IsError(v)) return v;
	if(IsNull(v)) return notnull ? NotNullError() : v;
	int m = v;
>>>>>>	if(m > 0x7FFF) m = 0xFFFF - m;		
	if(m >= minval && m <= maxval) return v;	
	return ErrorValue(UPP::Format(t_("Number must be between %X and %X."), minval, maxval));
}
...


For every type of number: char, short, int and int64 I have a different class. The same problem for Octal ed Hexadecimal converters.

In fact, I don't found any solution for get the type of the number from Value.



v.GetType() == INT_V
v.GetType() == INT64_V

or

v.Is<int>
v.Is<int64>

Not that I would recommend testing in most cases...

Mirek

[Updated on: Fri, 23 July 2010 10:51]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: DONE: ColumnList with Ctrl's
Next Topic: Persistent "tips"
Goto Forum:
  


Current Time: Wed May 08 22:29:42 CEST 2024

Total time taken to generate the page: 0.02610 seconds