enum DPodRecordType{
DPodRecordTypeA = 0,
DPodRecordTypeCNAME, DPodRecordTypeMX, DPodRecordTypeTXT, DPodRecordTypeNS,
DPodRecordTypeAAAA, DPodRecordTypeSRV, DPodRecordTypeURL }; typedef enum DPodRecordType DPodRecordType; const NSArray *___DPodRecordType; // 创建初始化函数。等于用宏创建一个getter函数 #define cDPodRecordTypeGet (___DPodRecordType == nil ? ___DPodRecordType = [[NSArray alloc] initWithObjects:\ @"A",\ @"CNAME",\ @"MX",\ @"TXT",\ @"NS",\ @"AAAA",\ @"SRV",\ @"URL", nil] : ___DPodRecordType) // 枚举 to 字串 #define cDPodRecordTypeString(type) ([cDPodRecordTypeGet objectAtIndex:type]) // 字串 to 枚举 #define cDPodRecordTypeEnum(string) ([cDPodRecordTypeGet indexOfObject:string])
字符串与枚举相互转换
最新推荐文章于 2022-03-24 10:28:04 发布