mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 00:30:49 +00:00
Add person name components formatter
This commit is contained in:
parent
74124bf7b1
commit
981fecc39b
6 changed files with 184 additions and 6 deletions
|
@ -99,6 +99,7 @@
|
||||||
#import <Foundation/NSOrderedSet.h>
|
#import <Foundation/NSOrderedSet.h>
|
||||||
#import <Foundation/NSPathUtilities.h>
|
#import <Foundation/NSPathUtilities.h>
|
||||||
#import <Foundation/NSPersonNameComponents.h>
|
#import <Foundation/NSPersonNameComponents.h>
|
||||||
|
#import <Foundation/NSPersonNameComponentsFormatter.h>
|
||||||
#import <Foundation/NSPointerArray.h>
|
#import <Foundation/NSPointerArray.h>
|
||||||
#import <Foundation/NSPointerFunctions.h>
|
#import <Foundation/NSPointerFunctions.h>
|
||||||
#import <Foundation/NSPortCoder.h>
|
#import <Foundation/NSPortCoder.h>
|
||||||
|
|
|
@ -17,9 +17,6 @@ Missing headers:
|
||||||
<NSAppleEventDescriptor.h>
|
<NSAppleEventDescriptor.h>
|
||||||
<NSAppleEventManager.h>
|
<NSAppleEventManager.h>
|
||||||
<NSAppleScript.h>
|
<NSAppleScript.h>
|
||||||
<NSFileCoordinator.h>*
|
|
||||||
<NSFilePresenter.h>*
|
|
||||||
<NSFileVersion.h>*
|
|
||||||
<NSHFSFileTypes.h>
|
<NSHFSFileTypes.h>
|
||||||
<NSLinguisticTagger.h>
|
<NSLinguisticTagger.h>
|
||||||
<NSObjectScripting.h>
|
<NSObjectScripting.h>
|
||||||
|
@ -39,9 +36,6 @@ Missing headers:
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
Foundation:
|
Foundation:
|
||||||
<NSOrthography.h>
|
<NSOrthography.h>
|
||||||
<NSFileCoordinator.h>
|
|
||||||
<NSFilePresenter.h>
|
|
||||||
<NSFileVersion.h>
|
|
||||||
<NSLinguisticTagger.h>
|
<NSLinguisticTagger.h>
|
||||||
<NSAppleEventDescriptor.h>
|
<NSAppleEventDescriptor.h>
|
||||||
<NSAppleEventManager.h>
|
<NSAppleEventManager.h>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#ifndef __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE
|
#ifndef __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE
|
||||||
#define __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE
|
#define __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE
|
||||||
|
|
||||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST)
|
||||||
|
|
||||||
#import <Foundation/NSObject.h>
|
#import <Foundation/NSObject.h>
|
||||||
|
|
89
Headers/Foundation/NSPersonNameComponentsFormatter.h
Normal file
89
Headers/Foundation/NSPersonNameComponentsFormatter.h
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/* Definition of class NSPersonNameComponents
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||||
|
Date: Sep 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 __NSPersonNameComponentsFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||||
|
#define __NSPersonNameComponentsFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||||
|
|
||||||
|
|
||||||
|
#import <Foundation/NSFormatter.h>
|
||||||
|
#import <Foundation/NSPersonNameComponents.h>
|
||||||
|
|
||||||
|
#if OS_API_VERSION(MAC_OS_X_VERSION_10_11,GS_API_LATEST)
|
||||||
|
|
||||||
|
// Style...
|
||||||
|
enum {
|
||||||
|
NSPersonNameComponentsFormatterStyleDefault = 0,
|
||||||
|
NSPersonNameComponentsFormatterStyleShort,
|
||||||
|
NSPersonNameComponentsFormatterStyleMedium,
|
||||||
|
NSPersonNameComponentsFormatterStyleLong,
|
||||||
|
NSPersonNameComponentsFormatterStyleAbbreviated
|
||||||
|
};
|
||||||
|
typedef NSUInteger NSPersonNameComponentsFormatterStyle;
|
||||||
|
|
||||||
|
// Options...
|
||||||
|
enum { NSPersonNameComponentsFormatterPhonetic = (1UL << 1) };
|
||||||
|
typedef NSUInteger NSPersonNameComponentsFormatterOptions;
|
||||||
|
|
||||||
|
@class NSString;
|
||||||
|
|
||||||
|
@interface NSPersonNameComponentsFormatter : NSFormatter
|
||||||
|
{
|
||||||
|
@private
|
||||||
|
BOOL _phonetic;
|
||||||
|
NSPersonNameComponentsFormatterStyle style;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Designated init...
|
||||||
|
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||||
|
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
||||||
|
options: (NSPersonNameComponentsFormatterOptions)nameOptions;
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
- (NSPersonNameComponentsFormatterStyle) style;
|
||||||
|
- (void) setStyle: (NSPersonNameComponentsFormatterStyle)style;
|
||||||
|
- (BOOL) isPhonetic;
|
||||||
|
- (void) setPhonetic: (BOOL)flag;
|
||||||
|
|
||||||
|
// Convenience methods...
|
||||||
|
- (NSString *) stringFromPersonNameComponents: (NSPersonNameComponents *)components;
|
||||||
|
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components;
|
||||||
|
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string;
|
||||||
|
- (BOOL)getObjectValue: (id *)obj
|
||||||
|
forString: (NSString *)string
|
||||||
|
errorDescription: (NSString **)error;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
// components for attributed strings;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentKey;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentGivenName;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentFamilyName;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentMiddleName;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentPrefix;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentSuffix;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentNickname;
|
||||||
|
GS_EXPORT NSString * const NSPersonNameComponentDelimiter;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -263,6 +263,7 @@ NSOrderedSet.m \
|
||||||
NSPage.m \
|
NSPage.m \
|
||||||
NSPathUtilities.m \
|
NSPathUtilities.m \
|
||||||
NSPersonNameComponents.m \
|
NSPersonNameComponents.m \
|
||||||
|
NSPersonNameComponentsFormatter.m \
|
||||||
NSPipe.m \
|
NSPipe.m \
|
||||||
NSPointerArray.m \
|
NSPointerArray.m \
|
||||||
NSPointerFunctions.m \
|
NSPointerFunctions.m \
|
||||||
|
@ -438,6 +439,7 @@ NSOperation.h \
|
||||||
NSOrderedSet.h \
|
NSOrderedSet.h \
|
||||||
NSPathUtilities.h \
|
NSPathUtilities.h \
|
||||||
NSPersonNameComponents.h \
|
NSPersonNameComponents.h \
|
||||||
|
NSPersonNameComponentsFormatter.h \
|
||||||
NSPointerArray.h \
|
NSPointerArray.h \
|
||||||
NSPointerFunctions.h \
|
NSPointerFunctions.h \
|
||||||
NSPortCoder.h \
|
NSPortCoder.h \
|
||||||
|
|
91
Source/NSPersonNameComponentsFormatter.m
Normal file
91
Source/NSPersonNameComponentsFormatter.m
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/* Definition of class NSPersonNameComponents
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Implemented by: Gregory Casamento <greg.casamento@gmail.com>
|
||||||
|
Date: Sep 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "Foundation/NSPersonNameComponentsFormatter.h"
|
||||||
|
#import "Foundation/NSString.h"
|
||||||
|
#import "Foundation/NSPersonNameComponents.h"
|
||||||
|
|
||||||
|
@implementation NSPersonNameComponentsFormatter
|
||||||
|
|
||||||
|
// Designated init...
|
||||||
|
+ (NSString *) localizedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||||
|
style: (NSPersonNameComponentsFormatterStyle)nameFormatStyle
|
||||||
|
options: (NSPersonNameComponentsFormatterOptions)nameOptions
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setters
|
||||||
|
- (NSPersonNameComponentsFormatterStyle) style
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setStyle: (NSPersonNameComponentsFormatterStyle)style
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) isPhonetic
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) setPhonetic: (BOOL)flag
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convenience methods...
|
||||||
|
- (NSString *) stringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSAttributedString *) annotatedStringFromPersonNameComponents: (NSPersonNameComponents *)components
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSPersonNameComponents *) personNameComponentsFromString: (NSString *)string
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)getObjectValue: (id *)obj
|
||||||
|
forString: (NSString *)string
|
||||||
|
errorDescription: (NSString **)error
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
// components for attributed strings;
|
||||||
|
NSString * const NSPersonNameComponentKey = @"NSPersonNameComponentKey";
|
||||||
|
NSString * const NSPersonNameComponentGivenName = @"NSPersonNameComponentGivenName";
|
||||||
|
NSString * const NSPersonNameComponentFamilyName = @"NSPersonNameComponentFamilyName";
|
||||||
|
NSString * const NSPersonNameComponentMiddleName = @"NSPersonNameComponentMiddleName";
|
||||||
|
NSString * const NSPersonNameComponentPrefix = @"NSPersonNameComponentPrefix";
|
||||||
|
NSString * const NSPersonNameComponentSuffix = @"NSPersonNameComponentSuffix";
|
||||||
|
NSString * const NSPersonNameComponentNickname = @"NSPersonNameComponentNickname";
|
||||||
|
NSString * const NSPersonNameComponentDelimiter = @"NSPersonNameComponentDelimiter";
|
Loading…
Reference in a new issue