static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
const TypedefDecl *TypedefDcl,
const NSAPI &NS, edit::Commit &commit,
- bool IsNSIntegerType) {
- std::string ClassString =
- IsNSIntegerType ? "typedef NS_ENUM(NSInteger, " : "typedef NS_OPTIONS(NSUInteger, ";
+ bool IsNSIntegerType,
+ bool NSOptions) {
+ std::string ClassString;
+ if (NSOptions)
+ ClassString = "typedef NS_OPTIONS(NSUInteger, ";
+ else
+ ClassString =
+ IsNSIntegerType ? "typedef NS_ENUM(NSInteger, "
+ : "typedef NS_ENUM(NSUInteger, ";
+
ClassString += TypedefDcl->getIdentifier()->getName();
ClassString += ')';
SourceRange R(EnumDcl->getLocStart(), EnumDcl->getLocStart());
}
return;
}
- if (IsNSIntegerType && UseNSOptionsMacro(PP, Ctx, EnumDcl)) {
- // We may still use NS_OPTIONS based on what we find in the enumertor list.
- IsNSIntegerType = false;
- IsNSUIntegerType = true;
- }
+ // We may still use NS_OPTIONS based on what we find in the enumertor list.
+ bool NSOptions = UseNSOptionsMacro(PP, Ctx, EnumDcl);
// NS_ENUM must be available.
if (IsNSIntegerType && !Ctx.Idents.get("NS_ENUM").hasMacroDefinition())
return;
if (IsNSUIntegerType && !Ctx.Idents.get("NS_OPTIONS").hasMacroDefinition())
return;
edit::Commit commit(*Editor);
- rewriteToNSEnumDecl(EnumDcl, TypedefDcl, *NSAPIObj, commit, IsNSIntegerType);
+ rewriteToNSEnumDecl(EnumDcl, TypedefDcl, *NSAPIObj, commit, IsNSIntegerType, NSOptions);
Editor->commit(commit);
}
UIView1 = 0XBADBEEF
};
typedef NSInteger UIStyle;
+
+enum {
+ NSTIFFFileType,
+ NSBMPFileType,
+ NSGIFFileType,
+ NSJPEGFileType,
+ NSPNGFileType,
+ NSJPEG2000FileType
+};
+typedef NSUInteger NSBitmapImageFileType;
+
+enum {
+ NSWarningAlertStyle = 0,
+ NSInformationalAlertStyle = 1,
+ NSCriticalAlertStyle = 2
+};
+typedef NSUInteger NSAlertStyle;
+
};
-typedef NS_OPTIONS(NSUInteger, UITableViewCellStyle) {
+typedef NS_ENUM(NSUInteger, UITableViewCellStyle) {
UIViewAutoresizingNone = 0,
UIViewAutoresizingFlexibleLeftMargin,
UIViewAutoresizingFlexibleWidth,
UIView1 = 0XBADBEEF
};
+
+typedef NS_ENUM(NSUInteger, NSBitmapImageFileType) {
+ NSTIFFFileType,
+ NSBMPFileType,
+ NSGIFFileType,
+ NSJPEGFileType,
+ NSPNGFileType,
+ NSJPEG2000FileType
+};
+
+
+typedef NS_ENUM(NSUInteger, NSAlertStyle) {
+ NSWarningAlertStyle = 0,
+ NSInformationalAlertStyle = 1,
+ NSCriticalAlertStyle = 2
+};
+
+