//
//  BEBytesValueTransformer.h
//  BEToolkit
//
//  Created by Johan Kool on 10-09-09.
//  Copyright 2015 Incredible Bee Ltd. All rights reserved.
//

#import <Cocoa/Cocoa.h>

/**
 * Determines the mode in which file sizes are calculated.
 */
typedef enum {
	//! Automatically detect the mode based on the user's current OS version
	BEBytesValueTransformerAutoDetectMode,
	//! Use Mac OS X 10.6 Snow Leopard's method to calculate file sizes
	BEBytesValueTransformerPreSnowLeopardMode,
	//! Use Mac OS X 10.5 Leopard's (and earlier) method to calculate file sizes
	BEBytesValueTransformerSnowLeopardMode,
} BEBytesValueTransformerMode;

/**
 * Special values
 */
extern NSUInteger const BEBytesValueTransformerCalculatingSize;


/**
 * Note that from 10.6 on Apple uses a different way to calculate sizes. In Mac OS X
 * 10.5 and earlier Apple uses the mathematically correct way by using powers of 2 to
 * convert between bytes. So for example 1 kilobytes = 2^10 bytes and so on.
 *
 * As of Mac OS X 10.6 Apple has started to follow disk manufacturers and use the language
 * correct way of equating kilo, mega and so on to convert bytes, so 1 kilobytes is 1000
 * bytes.
 *
 * See also http://support.apple.com/kb/TS2419
 */
@interface BEBytesValueTransformer : NSValueTransformer {
	BEBytesValueTransformerMode mode;
}
+ (NSString *) formatBytes: (unsigned long long) bytes;

@property (assign) BEBytesValueTransformerMode mode;

@end
