[Openmcl-devel] inverse of #$ - does it exist?
gb at clozure.com
Thu Apr 15 12:49:49 PDT 2010
Not really; by the time it's stored in the .cdb file, it's just an integer constant
(not a "member of the NSStringEncoding enumeration").
You can enumerate the key/value pairs in a .cdb file (a la MAPHASH); I
don't remember how off the top of my head; the ObjC bridge does this
to find all classes/methods. If enumerated types were better
supported (if integer constants were stored as members of that enumerated
type, not just as integers) you could do:
(lambda (k v)
(if (is-member-of-enumeration v NSStringEncoding)
(add-to-your-own-mapping v k))))
and then use that mapping to map values back to names.
You could fake that by saying "the value is likely a member of the NSStringEncoding
enumeration if it's an integer and the key contains the substring "StringEncoding".
That's a bit sleazy and imprecise, but I don't think that you can do better.
On Thu, 15 Apr 2010, Raffael Cavallaro wrote:
> I know that I can do:
> ? #$NSUTF8StringEncoding
> Is there any way to do the reverse - to determine the symbolic name given the type (here, NSStringEncoding) and the integer value?
> warmest regards,
> Raffael Cavallaro
> raffaelcavallaro at me.com
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel