mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +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
|
||||
BOOL _phonetic;
|
||||
NSPersonNameComponentsFormatterStyle _style;
|
||||
NSPersonNameComponentsFormatterOptions _nameOptions;
|
||||
}
|
||||
|
||||
// Designated init...
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import "Foundation/NSPersonNameComponentsFormatter.h"
|
||||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSAttributedString.h"
|
||||
#import "Foundation/NSPersonNameComponents.h"
|
||||
#import "Foundation/NSPersonNameComponentsFormatter.h"
|
||||
|
||||
@implementation NSPersonNameComponentsFormatter
|
||||
|
||||
|
@ -35,24 +36,25 @@
|
|||
{
|
||||
_phonetic = NO;
|
||||
_style = NSPersonNameComponentsFormatterStyleDefault;
|
||||
_nameOptions = 0L;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) _setNameOptions: (NSPersonNameComponentsFormatterOptions)opts
|
||||
{
|
||||
_nameOptions = opts;
|
||||
}
|
||||
|
||||
// Designated init...
|
||||
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
||||
options: (NSPersonNameComponentsFormatterOptions)nameOptions
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue: (id)obj
|
||||
{
|
||||
NSPersonNameComponents *pnc = (NSPersonNameComponents *)obj;
|
||||
return [[self class] localizedStringFromPersonNameComponents: pnc
|
||||
style: NSPersonNameComponentsFormatterStyleDefault
|
||||
options: 0L];
|
||||
NSPersonNameComponentsFormatter *fmt = [[NSPersonNameComponentsFormatter alloc] init];
|
||||
[fmt setStyle: nameFormatStyle];
|
||||
[fmt _setNameOptions: nameOptions];
|
||||
return [fmt stringForObjectValue: components] ;
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
@ -90,22 +92,30 @@
|
|||
|
||||
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||
{
|
||||
return nil;
|
||||
return AUTORELEASE([[NSAttributedString alloc] initWithString:
|
||||
[self stringFromPersonNameComponents: components]]);
|
||||
}
|
||||
|
||||
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string
|
||||
{
|
||||
NSPersonNameComponents *pnc = AUTORELEASE([[NSPersonNameComponents alloc] init]);
|
||||
|
||||
return nil;
|
||||
return pnc;
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue: (id *)obj
|
||||
forString: (NSString *)string
|
||||
errorDescription: (NSString **)error
|
||||
- (BOOL) getObjectValue: (id *)obj
|
||||
forString: (NSString *)string
|
||||
errorDescription: (NSString **)error
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue: (id)obj
|
||||
{
|
||||
NSPersonNameComponents *pnc = (NSPersonNameComponents *)obj;
|
||||
return [self stringFromPersonNameComponents: pnc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// components for attributed strings;
|
||||
|
|
Loading…
Reference in a new issue