| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
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?)
NSString * const STATUS_Pending = @"STATUS_Pending";
NSString * const STATUS_Incomplete = @"STATUS_Incomplete"; typedef NSString * const EObjectStatus;
#define DefineEObjectStatus(name) EObjectStatus (name) = @#name; DefineEObjectStatus(STATUS_Pending);
DefineEObjectStatus(STATUS_Incomplete);-- Adam
_______________________________________________ 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
| 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>) | |
| >get enum valueName from value (From: "YL" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.