Authored by Fabrice Aneche

NS_ENUM & NS_OPTIONS

... ... @@ -9,11 +9,11 @@
#import <Foundation/Foundation.h>
#import "SDWebImageCompat.h"
enum SDImageCacheType {
typedef NS_ENUM(NSInteger, SDImageCacheType) {
/**
* The image wasn't available the SDWebImage caches, but was downloaded from the web.
*/
SDImageCacheTypeNone = 0,
SDImageCacheTypeNone,
/**
* The image was obtained from the disk cache.
*/
... ... @@ -23,7 +23,6 @@ enum SDImageCacheType {
*/
SDImageCacheTypeMemory
};
typedef enum SDImageCacheType SDImageCacheType;
/**
* SDImageCache maintains a memory cache and an optional disk cache. Disk cache write operations are performed
... ...
... ... @@ -31,6 +31,14 @@
#endif
#ifndef NS_ENUM
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#endif
#ifndef NS_OPTIONS
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
#endif
#if OS_OBJECT_USE_OBJC
#undef SDDispatchQueueRelease
#undef SDDispatchQueueSetterSementics
... ...
... ... @@ -10,7 +10,7 @@
#import "SDWebImageCompat.h"
#import "SDWebImageOperation.h"
typedef enum {
typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) {
SDWebImageDownloaderLowPriority = 1 << 0,
SDWebImageDownloaderProgressiveDownload = 1 << 1,
/**
... ... @@ -39,9 +39,9 @@ typedef enum {
*/
SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6
} SDWebImageDownloaderOptions;
};
typedef enum {
typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
SDWebImageDownloaderFIFOExecutionOrder,
/**
* Default value. All download operations will execute in queue style (first-in-first-out).
... ... @@ -50,7 +50,7 @@ typedef enum {
/**
* All download operations will execute in stack style (last-in-first-out).
*/
} SDWebImageDownloaderExecutionOrder;
};
extern NSString *const SDWebImageDownloadStartNotification;
extern NSString *const SDWebImageDownloadStopNotification;
... ...
... ... @@ -11,7 +11,7 @@
#import "SDWebImageDownloader.h"
#import "SDImageCache.h"
typedef enum {
typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) {
/**
* By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying.
* This flag disable this blacklisting.
... ... @@ -56,7 +56,7 @@ typedef enum {
* Useful for testing purposes. Use with caution in production.
*/
SDWebImageAllowInvalidSSLCertificates = 1 << 7
} SDWebImageOptions;
};
typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, SDImageCacheType cacheType);
... ...