Showing
4 changed files
with
16 additions
and
9 deletions
@@ -9,11 +9,11 @@ | @@ -9,11 +9,11 @@ | ||
9 | #import <Foundation/Foundation.h> | 9 | #import <Foundation/Foundation.h> |
10 | #import "SDWebImageCompat.h" | 10 | #import "SDWebImageCompat.h" |
11 | 11 | ||
12 | -enum SDImageCacheType { | 12 | +typedef NS_ENUM(NSInteger, SDImageCacheType) { |
13 | /** | 13 | /** |
14 | * The image wasn't available the SDWebImage caches, but was downloaded from the web. | 14 | * The image wasn't available the SDWebImage caches, but was downloaded from the web. |
15 | */ | 15 | */ |
16 | - SDImageCacheTypeNone = 0, | 16 | + SDImageCacheTypeNone, |
17 | /** | 17 | /** |
18 | * The image was obtained from the disk cache. | 18 | * The image was obtained from the disk cache. |
19 | */ | 19 | */ |
@@ -23,7 +23,6 @@ enum SDImageCacheType { | @@ -23,7 +23,6 @@ enum SDImageCacheType { | ||
23 | */ | 23 | */ |
24 | SDImageCacheTypeMemory | 24 | SDImageCacheTypeMemory |
25 | }; | 25 | }; |
26 | -typedef enum SDImageCacheType SDImageCacheType; | ||
27 | 26 | ||
28 | /** | 27 | /** |
29 | * SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed | 28 | * SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed |
@@ -31,6 +31,14 @@ | @@ -31,6 +31,14 @@ | ||
31 | 31 | ||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | +#ifndef NS_ENUM | ||
35 | +#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type | ||
36 | +#endif | ||
37 | + | ||
38 | +#ifndef NS_OPTIONS | ||
39 | +#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type | ||
40 | +#endif | ||
41 | + | ||
34 | #if OS_OBJECT_USE_OBJC | 42 | #if OS_OBJECT_USE_OBJC |
35 | #undef SDDispatchQueueRelease | 43 | #undef SDDispatchQueueRelease |
36 | #undef SDDispatchQueueSetterSementics | 44 | #undef SDDispatchQueueSetterSementics |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | #import "SDWebImageCompat.h" | 10 | #import "SDWebImageCompat.h" |
11 | #import "SDWebImageOperation.h" | 11 | #import "SDWebImageOperation.h" |
12 | 12 | ||
13 | -typedef enum { | 13 | +typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) { |
14 | SDWebImageDownloaderLowPriority = 1 << 0, | 14 | SDWebImageDownloaderLowPriority = 1 << 0, |
15 | SDWebImageDownloaderProgressiveDownload = 1 << 1, | 15 | SDWebImageDownloaderProgressiveDownload = 1 << 1, |
16 | /** | 16 | /** |
@@ -39,9 +39,9 @@ typedef enum { | @@ -39,9 +39,9 @@ typedef enum { | ||
39 | */ | 39 | */ |
40 | SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6 | 40 | SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6 |
41 | 41 | ||
42 | -} SDWebImageDownloaderOptions; | 42 | +}; |
43 | 43 | ||
44 | -typedef enum { | 44 | +typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { |
45 | SDWebImageDownloaderFIFOExecutionOrder, | 45 | SDWebImageDownloaderFIFOExecutionOrder, |
46 | /** | 46 | /** |
47 | * Default value. All download operations will execute in queue style (first-in-first-out). | 47 | * Default value. All download operations will execute in queue style (first-in-first-out). |
@@ -50,7 +50,7 @@ typedef enum { | @@ -50,7 +50,7 @@ typedef enum { | ||
50 | /** | 50 | /** |
51 | * All download operations will execute in stack style (last-in-first-out). | 51 | * All download operations will execute in stack style (last-in-first-out). |
52 | */ | 52 | */ |
53 | -} SDWebImageDownloaderExecutionOrder; | 53 | +}; |
54 | 54 | ||
55 | extern NSString *const SDWebImageDownloadStartNotification; | 55 | extern NSString *const SDWebImageDownloadStartNotification; |
56 | extern NSString *const SDWebImageDownloadStopNotification; | 56 | extern NSString *const SDWebImageDownloadStopNotification; |
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | #import "SDWebImageDownloader.h" | 11 | #import "SDWebImageDownloader.h" |
12 | #import "SDImageCache.h" | 12 | #import "SDImageCache.h" |
13 | 13 | ||
14 | -typedef enum { | 14 | +typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { |
15 | /** | 15 | /** |
16 | * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. | 16 | * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. |
17 | * This flag disable this blacklisting. | 17 | * This flag disable this blacklisting. |
@@ -56,7 +56,7 @@ typedef enum { | @@ -56,7 +56,7 @@ typedef enum { | ||
56 | * Useful for testing purposes. Use with caution in production. | 56 | * Useful for testing purposes. Use with caution in production. |
57 | */ | 57 | */ |
58 | SDWebImageAllowInvalidSSLCertificates = 1 << 7 | 58 | SDWebImageAllowInvalidSSLCertificates = 1 << 7 |
59 | -} SDWebImageOptions; | 59 | +}; |
60 | 60 | ||
61 | typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType); | 61 | typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType); |
62 | 62 |
-
Please register or login to post a comment