[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: Casting rules in kspread
From:       Ariya Hidayat <ariya () kde ! org>
Date:       2004-07-26 8:10:44
Message-ID: 4104BC84.6090307 () kde ! org
[Download RAW message or body]


> libs/koscript/ has a couple of functions that do the casting. I'm
> just a bit confused about how kspread decides when the
> contents are integer, and when it is a bool. Can anyone
> give me a hint as to how it is supposed to work?

These are the tryParse* functions.
However, for the function TEXT above, rather than using 
KSUtil::checkType (which checks e.g integer can be casted to boolean, 
hence the bug if the order of the checks are not good), how about 
directly check the type of the KSValue of the argument and convert it to 
the correspoding string value ?

Pseudocode:

switch( type of arg )
{
case string: result = arg; break;
case integer: result = format integer as string; break;
case double: result = format double as string; break;
};

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic