diff --git a/Headers/Foundation/Foundation.h b/Headers/Foundation/Foundation.h index 94f61d107..3b66c6570 100644 --- a/Headers/Foundation/Foundation.h +++ b/Headers/Foundation/Foundation.h @@ -99,6 +99,7 @@ #import #import #import +#import #import #import #import diff --git a/Headers/Foundation/MISSING b/Headers/Foundation/MISSING index 89326db01..172bb9412 100644 --- a/Headers/Foundation/MISSING +++ b/Headers/Foundation/MISSING @@ -17,9 +17,6 @@ Missing headers: - * - * - * @@ -39,9 +36,6 @@ Missing headers: ------------------------------------------------------------- Foundation: - - - diff --git a/Headers/Foundation/NSPersonNameComponents.h b/Headers/Foundation/NSPersonNameComponents.h index 88bdd4762..9d00deab8 100644 --- a/Headers/Foundation/NSPersonNameComponents.h +++ b/Headers/Foundation/NSPersonNameComponents.h @@ -24,6 +24,7 @@ #ifndef __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE #define __NSPersonNameComponents_h_GNUSTEP_BASE_INCLUDE + #if OS_API_VERSION(MAC_OS_X_VERSION_10_7,GS_API_LATEST) #import diff --git a/Headers/Foundation/NSPersonNameComponentsFormatter.h b/Headers/Foundation/NSPersonNameComponentsFormatter.h new file mode 100644 index 000000000..489d12bfa --- /dev/null +++ b/Headers/Foundation/NSPersonNameComponentsFormatter.h @@ -0,0 +1,89 @@ +/* Definition of class NSPersonNameComponents + Copyright (C) 2019 Free Software Foundation, Inc. + + Implemented by: Gregory Casamento + 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 +#import + +#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 diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 0ecc53608..74955e3c0 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -263,6 +263,7 @@ NSOrderedSet.m \ NSPage.m \ NSPathUtilities.m \ NSPersonNameComponents.m \ +NSPersonNameComponentsFormatter.m \ NSPipe.m \ NSPointerArray.m \ NSPointerFunctions.m \ @@ -438,6 +439,7 @@ NSOperation.h \ NSOrderedSet.h \ NSPathUtilities.h \ NSPersonNameComponents.h \ +NSPersonNameComponentsFormatter.h \ NSPointerArray.h \ NSPointerFunctions.h \ NSPortCoder.h \ diff --git a/Source/NSPersonNameComponentsFormatter.m b/Source/NSPersonNameComponentsFormatter.m new file mode 100644 index 000000000..c37e91467 --- /dev/null +++ b/Source/NSPersonNameComponentsFormatter.m @@ -0,0 +1,91 @@ +/* Definition of class NSPersonNameComponents + Copyright (C) 2019 Free Software Foundation, Inc. + + Implemented by: Gregory Casamento + 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";