Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

get enum valueName from value



I defined the following as a consistent convention for
my business objects' status (the mapping here is quite arbitrary, i don't
care:-):

typedef enum _EObjectStatus {
    STATUS_Pending  = -5,
    STATUS_Incomplete  = -4,
    STATUS_Expired  = -3,
    STATUS_Disabled  = -2,
    STATUS_Denied  = -1,
    STATUS_Active  = 1,
    STATUS_Complete  = 2,
    STATUS_Reserved  = 3,
    STATUS_Paid  = 4,
    STATUS_Confirmed  = 5,
} EObjectStatus;

It works quite handy but sometimes i need to display the status valueName
for a runtime status value.
Of course i can define a dictionary to find out value name from value, but
is there a better solution?
(without duplicated mapping definition?)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden

References: 
 >Sending floats using objc_msgSendv (From: Nathaniel Gray <email@hidden>)
 >Re: Sending floats using objc_msgSendv (From: Greg Parker <email@hidden>)
 >Re: Sending floats using objc_msgSendv (From: Sherm Pendley <email@hidden>)
 >Re: Sending floats using objc_msgSendv (From: Nathaniel Gray <email@hidden>)
 >Re: Sending floats using objc_msgSendv (From: Sherm Pendley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.