mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
NSMassFormatter skeleton
This commit is contained in:
parent
9ef1c7b0ac
commit
7092968ed5
2 changed files with 92 additions and 2 deletions
|
@ -26,16 +26,51 @@
|
|||
#ifndef _NSMassFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSMassFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSFormatter.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
enum {
|
||||
NSMassFormatterUnitGram = 11,
|
||||
NSMassFormatterUnitKilogram = 14,
|
||||
NSMassFormatterUnitOunce = (6 << 8) + 1,
|
||||
NSMassFormatterUnitPound = (6 << 8) + 2,
|
||||
NSMassFormatterUnitStone = (6 << 8) + 3,
|
||||
};
|
||||
typedef NSInteger NSMassFormatterUnit;
|
||||
|
||||
@class NSNumberFormatter;
|
||||
|
||||
@interface NSMassFormatter : NSObject
|
||||
{
|
||||
NSNumberFormatter *_numberFormatter;
|
||||
BOOL _isForPersonMassUse;
|
||||
NSFormattingUnitStyle _unitStyle;
|
||||
}
|
||||
|
||||
- (NSNumberFormatter *) numberFormatter;
|
||||
- (void) setNumberFormatter: (NSNumberFormatter *)formatter;
|
||||
|
||||
- (NSFormattingUnitStyle) unitStyle;
|
||||
- (void) setUnitStyle: (NSFormattingUnitStyle)style;
|
||||
|
||||
- (BOOL) isForPersonMassUse;
|
||||
- (void) setForPersonMassUse: (BOOL)flag;
|
||||
|
||||
- (NSString *)stringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
|
||||
- (NSString *)stringFromKilograms: (double)numberInKilograms;
|
||||
|
||||
- (NSString *)unitStringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
|
||||
- (NSString *)unitStringFromKilograms: (double)numberInKilograms usedUnit: (NSMassFormatterUnit *)unitp;
|
||||
|
||||
- (BOOL)getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -27,5 +27,60 @@
|
|||
|
||||
@implementation NSMassFormatter
|
||||
|
||||
- (NSNumberFormatter *) numberFormatter
|
||||
{
|
||||
return _numberFormatter;
|
||||
}
|
||||
|
||||
- (void) setNumberFormatter: (NSNumberFormatter *)formatter
|
||||
{
|
||||
ASSIGN(_numberFormatter, formatter);
|
||||
}
|
||||
|
||||
- (NSFormattingUnitStyle) unitStyle
|
||||
{
|
||||
return _unitStyle;
|
||||
}
|
||||
|
||||
- (void) setUnitStyle: (NSFormattingUnitStyle)style;
|
||||
{
|
||||
_unitStyle = style;
|
||||
}
|
||||
|
||||
- (BOOL) isForPersonMassUse;
|
||||
{
|
||||
return _isForPersonMassUse;
|
||||
}
|
||||
|
||||
- (void) setForPersonMassUse: (BOOL)flag;
|
||||
{
|
||||
_isForPersonMassUse = flag;
|
||||
}
|
||||
|
||||
- (NSString *)stringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)stringFromKilograms: (double)numberInKilograms;
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)unitStringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)unitStringFromKilograms: (double)numberInKilograms usedUnit: (NSMassFormatterUnit *)unit
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue