zoukankan      html  css  js  c++  java
  • 字符串与枚举相互转换

    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])
  • 相关阅读:
    六.Linux其他命令
    五.Linux压缩文件的操作命令(压缩解压)
    sigaction
    log_note log_error log_warning
    SIGHUP
    pthread_create
    semaphore
    getpwuid
    close port
    pthread
  • 原文地址:https://www.cnblogs.com/wenrisheng/p/6047553.html
Copyright © 2011-2022 走看看