2019-10-09 11:32:30 +00:00
|
|
|
/* Definition of class NSLengthFormatter
|
|
|
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
|
|
2019-10-23 20:03:52 +00:00
|
|
|
By: Gregory John Casamento <greg.casamento@gmail.com>
|
2019-10-09 11:32:30 +00:00
|
|
|
Date: Tue Oct 8 13:30:33 EDT 2019
|
|
|
|
|
|
|
|
This file is part of the GNUstep Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
|
|
|
|
#include <Foundation/NSFormatter.h>
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-10-23 20:03:52 +00:00
|
|
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
|
|
|
enum {
|
|
|
|
NSLengthFormatterUnitMillimeter = 8,
|
|
|
|
NSLengthFormatterUnitCentimeter = 9,
|
|
|
|
NSLengthFormatterUnitMeter = 11,
|
|
|
|
NSLengthFormatterUnitKilometer = 14,
|
|
|
|
NSLengthFormatterUnitInch = (5 << 8) + 1,
|
|
|
|
NSLengthFormatterUnitFoot = (5 << 8) + 2,
|
|
|
|
NSLengthFormatterUnitYard = (5 << 8) + 3,
|
|
|
|
NSLengthFormatterUnitMile = (5 << 8) + 4,
|
|
|
|
};
|
|
|
|
typedef NSInteger NSLengthFormatterUnit;
|
2019-10-09 11:32:30 +00:00
|
|
|
|
2019-10-23 20:03:52 +00:00
|
|
|
@class NSNumberFormatter, NSString;
|
|
|
|
|
2019-10-09 11:32:30 +00:00
|
|
|
@interface NSLengthFormatter : NSFormatter
|
2019-10-23 20:03:52 +00:00
|
|
|
{
|
|
|
|
BOOL _isForPersonHeightUse;
|
|
|
|
NSNumberFormatter *_numberFormatter;
|
2019-10-23 20:49:50 +00:00
|
|
|
NSFormattingUnitStyle _unitStyle;
|
2019-10-23 20:03:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSNumberFormatter *) numberFormatter;
|
|
|
|
- (void) setNumberFormatter: (NSNumberFormatter *)formatter;
|
|
|
|
|
|
|
|
- (NSFormattingUnitStyle) unitStyle;
|
|
|
|
- (void) setUnitStyle: (NSFormattingUnitStyle)style;
|
|
|
|
|
|
|
|
- (BOOL) isForPersonHeightUse;
|
|
|
|
- (void) setForPersonHeightUse: (BOOL)flag;
|
|
|
|
|
|
|
|
- (NSString *) stringFromValue: (double)value unit: (NSLengthFormatterUnit)unit;
|
|
|
|
|
|
|
|
- (NSString *) stringFromMeters: (double)numberInMeters;
|
|
|
|
|
|
|
|
- (NSString *) unitStringFromValue: (double)value unit: (NSLengthFormatterUnit)unit;
|
|
|
|
|
|
|
|
- (NSString *) unitStringFromMeters: (double)numberInMeters usedUnit: (NSLengthFormatterUnit *)unit;
|
|
|
|
|
2019-10-24 18:18:47 +00:00
|
|
|
- (BOOL)getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error;
|
2019-10-09 11:32:30 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* GS_API_MACOSX */
|
|
|
|
|
|
|
|
#endif /* _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE */
|
|
|
|
|