Find an integer value in Objective-C enum -
is possible in objective-c see if int
value in particular enum
? instance, in enum:
enum { validationloginfailed = 2000, validationsessiontokenexpired = 2001, validationsessiontokeninvalid = 2002, validationemailnotfound = 2003 }; typedef int validationstatuscodes;
is possible see if arbitrary integer value in validationstatuscodes
enum
?
[validationstatuscodes contains:intresponsecode]
or @ least
[self intisinrangeofenum:validationstatuscodes forvalue:intresponsecode]
there's no simpler way doing
(validationloginfailed == intresponsecode || validationsessiontokenexpired == intresponsecode || validationsessiontokeninvalid == intresponsecode || validationemailnotfound == intresponsecode)
in general, c not helpful doing dynamic things or reflecting on types, , enums c feature.
Comments
Post a Comment