added GSdoc comments to class, method, and function declarations; for some classes some comments were already in the source file (not the header), in which case further comments were added here; otherwise comments were put in the headers

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19586 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adrian Robert 2004-06-22 22:27:39 +00:00
parent 3e78bdb1e7
commit 9e3ec7ecff
38 changed files with 2408 additions and 161 deletions

View file

@ -33,6 +33,42 @@
@class NSString, NSAttributedString, NSDictionary;
/**
* <p><em><strong>This class is currently not implemented in GNUstep! All set
* methods will work, but stringForObject: will ignore the format completely.
* The documentation below describes what the behavior SHOULD
* be...</strong></em></p>
*
* <p>A specialization of the [NSFormatter] class for generating string
* representations of numbers ([NSNumber] and [NSDecimalNumber] instances) and
* for parsing numeric values in strings.</p>
*
* <p>See the [NSFormatter] documentation for description of the basic methods
* for formatting and parsing that are available.</p>
*
* <p>There are no convenience initializers or constructors for this class.
* Instead, to obtain an instance, call alloc init and then -setFormat: .</p>
*
* <p>The basic format of a format string uses "#" signs to represent digits,
* and other characters to represent themselves, in a context-dependent way.
* Thus, for example, <code>@"#,###.00"</code> means to print the number
* ending in .00 if it has no decimal part, otherwise print two decimal
* places, and to print one comma if it is greater than 1000. Thus, 1000
* prints as "1,000.00", and 1444555.979 prints as "1444,555.98" (see
* -setRoundingBehavior:).</p>
*
* <p>After setting the format, you may change the thousands separator and
* decimal point using set methods, or by calling -setLocalizesFormat: .</p>
*
* <p>You may set separate formats to be used for positive numbers, negative
* numbers, and zero independently.</p>
*
* <p>In addition, this class supports attributed strings (see
* [NSAttributedString]), so that you can specify font and color attributes,
* among others, to display aspects of a number. You can assign specific sets
* of attributes for positive and negative numbers, and for specific cases
* including 0, NaN, and nil... </p>
*/
@interface NSNumberFormatter: NSFormatter
{
BOOL _hasThousandSeparators;
@ -53,45 +89,207 @@
}
// Format
/**
* Returns the format string this instance was initialized with.
*/
- (NSString*) format;
/**
* Sets format string. See class description for more information.
*/
- (void) setFormat: (NSString*)aFormat;
/**
* Returns whether this format should defer to the locale in determining
* thousands separator and decimal point. The default is to NOT localize.
*/
- (BOOL) localizesFormat;
/**
* Set whether this format should defer to the locale in determining thousands
* separator and decimal point. The default is to NOT localize.
*/
- (void) setLocalizesFormat: (BOOL)flag;
/**
* Returns format used for negative numbers.
*/
- (NSString*) negativeFormat;
/**
* Sets format used for negative numbers. See class description for more
* information.
*/
- (void) setNegativeFormat: (NSString*)aFormat;
/**
* Returns format used for positive numbers.
*/
- (NSString*) positiveFormat;
/**
* Sets format used for positive numbers. See class description for more
* information.
*/
- (void) setPositiveFormat: (NSString*)aFormat;
// Attributed Strings
/**
* Returns the exact attributed string used for nil values. By default this
* is an empty string.
*/
- (NSAttributedString*) attributedStringForNil;
/**
* Sets the exact attributed string used for nil values. By default this
* is an empty string.
*/
- (void) setAttributedStringForNil: (NSAttributedString*)newAttributedString;
/**
* Returns the exact attributed string used for NaN values. By default this
* is the string "NaN" with no attributes.
*/
- (NSAttributedString*) attributedStringForNotANumber;
/**
* Sets the exact attributed string used for NaN values. By default this
* is the string "NaN" with no attributes.
*/
- (void) setAttributedStringForNotANumber: (NSAttributedString*)newAttributedString;
/**
* Returns the exact attributed string used for zero values. By default this
* is based on the format for zero values, if set, or the format for positive
* values otherwise.
*/
- (NSAttributedString*) attributedStringForZero;
/**
* Sets the exact attributed string used for zero values. By default this
* is based on the format for zero values, if set, or the format for positive
* values otherwise.
*/
- (void) setAttributedStringForZero: (NSAttributedString*)newAttributedString;
/**
* Returns the attributes to apply to negative values (whole string), when
* -attributedStringForObjectValue:withDefaultAttributes: is called. Default
* is none.
*/
- (NSDictionary*) textAttributesForNegativeValues;
/**
* Sets the attributes to apply to negative values (whole string), when
* -attributedStringForObjectValue:withDefaultAttributes: is called. Default
* is none.
*/
- (void) setTextAttributesForNegativeValues: (NSDictionary*)newAttributes;
/**
* Returns the attributes to apply to positive values (whole string), when
* -attributedStringForObjectValue:withDefaultAttributes: is called. Default
* is none.
*/
- (NSDictionary*) textAttributesForPositiveValues;
/**
* Sets the attributes to apply to positive values (whole string), when
* -attributedStringForObjectValue:withDefaultAttributes: is called. Default
* is none.
*/
- (void) setTextAttributesForPositiveValues: (NSDictionary*)newAttributes;
// Rounding
// Rounding.. this should be communicated as id<NSDecimalNumberBehaviors>,
// not NSDecimalNumberHandler, but this is the way OpenStep and OS X do it..
/**
* Returns object specifying the rounding behavior used when truncating
* decimal digits in formats. Default is
* [NSDecimalNumberHandler+defaultDecimalNumberHandler].
*/
- (NSDecimalNumberHandler*) roundingBehavior;
/**
* Sets object specifying the rounding behavior used when truncating
* decimal digits in formats. Default is
* [NSDecimalNumberHandler+defaultDecimalNumberHandler].
*/
- (void) setRoundingBehavior: (NSDecimalNumberHandler*)newRoundingBehavior;
// Separators
/**
* Returns whether thousands separator should be used, regardless of whether
* it is set in format. (Default is YES if explicitly set in format.)
*/
- (BOOL) hasThousandSeparators;
/**
* Sets whether thousands separator should be used, regardless of whether
* it is set in format. (Default is YES if explicitly set in format.)
*/
- (void) setHasThousandSeparators: (BOOL)flag;
/**
* Returns thousands separator used; default is ','.
*/
- (NSString*) thousandSeparator;
/**
* Sets thousands separator used; default is ','.
*/
- (void) setThousandSeparator: (NSString*)newSeparator;
/**
* Returns whether number parsing will accept floating point values or generate
* an exception (only int values are valid). Default is YES.
*/
- (BOOL) allowsFloats;
/**
* Sets whether number parsing will accept floating point values or generate
* an exception (only int values are valid). Default is YES.
*/
- (void) setAllowsFloats: (BOOL)flag;
/**
* Returns thousands separator used; default is '.'.
*/
- (NSString*) decimalSeparator;
/**
* Sets thousands separator used; default is '.'.
*/
- (void) setDecimalSeparator: (NSString*)newSeparator;
// Maximum/minimum
/**
* Returns maximum value that will be accepted as valid in number parsing.
* Default is none.
*/
- (NSDecimalNumber*) maximum;
/**
* Sets maximum value that will be accepted as valid in number parsing.
* Default is none.
*/
- (void) setMaximum: (NSDecimalNumber*)aMaximum;
/**
* Returns minimum value that will be accepted as valid in number parsing.
* Default is none.
*/
- (NSDecimalNumber*) minimum;
/**
* Sets minimum value that will be accepted as valid in number parsing.
* Default is none.
*/
- (void) setMinimum: (NSDecimalNumber*)aMinimum;
@end