mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 09:41:15 +00:00
Add attributed string method.
This commit is contained in:
parent
a58a58373d
commit
de062d44e9
2 changed files with 26 additions and 15 deletions
|
@ -52,6 +52,7 @@ typedef NSUInteger NSPersonNameComponentsFormatterOptions;
|
||||||
@private
|
@private
|
||||||
BOOL _phonetic;
|
BOOL _phonetic;
|
||||||
NSPersonNameComponentsFormatterStyle _style;
|
NSPersonNameComponentsFormatterStyle _style;
|
||||||
|
NSPersonNameComponentsFormatterOptions _nameOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Designated init...
|
// Designated init...
|
||||||
|
|
|
@ -22,9 +22,10 @@
|
||||||
Boston, MA 02111 USA.
|
Boston, MA 02111 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#import "Foundation/NSPersonNameComponentsFormatter.h"
|
|
||||||
#import "Foundation/NSString.h"
|
#import "Foundation/NSString.h"
|
||||||
|
#import "Foundation/NSAttributedString.h"
|
||||||
#import "Foundation/NSPersonNameComponents.h"
|
#import "Foundation/NSPersonNameComponents.h"
|
||||||
|
#import "Foundation/NSPersonNameComponentsFormatter.h"
|
||||||
|
|
||||||
@implementation NSPersonNameComponentsFormatter
|
@implementation NSPersonNameComponentsFormatter
|
||||||
|
|
||||||
|
@ -35,24 +36,25 @@
|
||||||
{
|
{
|
||||||
_phonetic = NO;
|
_phonetic = NO;
|
||||||
_style = NSPersonNameComponentsFormatterStyleDefault;
|
_style = NSPersonNameComponentsFormatterStyleDefault;
|
||||||
|
_nameOptions = 0L;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _setNameOptions: (NSPersonNameComponentsFormatterOptions)opts
|
||||||
|
{
|
||||||
|
_nameOptions = opts;
|
||||||
|
}
|
||||||
|
|
||||||
// Designated init...
|
// Designated init...
|
||||||
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||||
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
||||||
options: (NSPersonNameComponentsFormatterOptions)nameOptions
|
options: (NSPersonNameComponentsFormatterOptions)nameOptions
|
||||||
{
|
{
|
||||||
return nil;
|
NSPersonNameComponentsFormatter *fmt = [[NSPersonNameComponentsFormatter alloc] init];
|
||||||
}
|
[fmt setStyle: nameFormatStyle];
|
||||||
|
[fmt _setNameOptions: nameOptions];
|
||||||
- (NSString *)stringForObjectValue: (id)obj
|
return [fmt stringForObjectValue: components] ;
|
||||||
{
|
|
||||||
NSPersonNameComponents *pnc = (NSPersonNameComponents *)obj;
|
|
||||||
return [[self class] localizedStringFromPersonNameComponents: pnc
|
|
||||||
style: NSPersonNameComponentsFormatterStyleDefault
|
|
||||||
options: 0L];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
@ -90,22 +92,30 @@
|
||||||
|
|
||||||
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||||
{
|
{
|
||||||
return nil;
|
return AUTORELEASE([[NSAttributedString alloc] initWithString:
|
||||||
|
[self stringFromPersonNameComponents: components]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string
|
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string
|
||||||
{
|
{
|
||||||
|
NSPersonNameComponents *pnc = AUTORELEASE([[NSPersonNameComponents alloc] init]);
|
||||||
|
|
||||||
return nil;
|
return pnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)getObjectValue: (id *)obj
|
- (BOOL) getObjectValue: (id *)obj
|
||||||
forString: (NSString *)string
|
forString: (NSString *)string
|
||||||
errorDescription: (NSString **)error
|
errorDescription: (NSString **)error
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)stringForObjectValue: (id)obj
|
||||||
|
{
|
||||||
|
NSPersonNameComponents *pnc = (NSPersonNameComponents *)obj;
|
||||||
|
return [self stringFromPersonNameComponents: pnc];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// components for attributed strings;
|
// components for attributed strings;
|
||||||
|
|
Loading…
Reference in a new issue