From 4a3de6cb476f1712746ed9f0f94453ecb67d48dc Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Tue, 5 Nov 2019 19:59:03 -0500 Subject: [PATCH] Implement simple methods --- Headers/Foundation/NSOrthography.h | 6 +++++- Source/NSOrthography.m | 28 +++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Headers/Foundation/NSOrthography.h b/Headers/Foundation/NSOrthography.h index 1fd2581c3..77a7b9f3d 100644 --- a/Headers/Foundation/NSOrthography.h +++ b/Headers/Foundation/NSOrthography.h @@ -36,7 +36,11 @@ extern "C" { @class NSDictionary, NSString, NSArray; @interface NSOrthography : NSObject - +{ + NSDictionary *_languageMap; + NSString *_dominantScript; +} + - (instancetype) initWithDominantScript: (NSString *)script languageMap: (NSDictionary *)map; diff --git a/Source/NSOrthography.m b/Source/NSOrthography.m index 64fce9bf8..c0510a7f6 100644 --- a/Source/NSOrthography.m +++ b/Source/NSOrthography.m @@ -29,17 +29,30 @@ - (instancetype) initWithDominantScript: (NSString *)script languageMap: (NSDictionary *)map { - return nil; + self = [super init]; + if(self != nil) + { + ASSIGNCOPY(_dominantScript, script); + ASSIGNCOPY(_languageMap, map); + } + return self; +} + +- (oneway void) release +{ + RELEASE(_dominantScript); + RELEASE(_languageMap); + [super release]; } - (NSString *) dominantScript { - return nil; + return _dominantScript; } - (NSDictionary *) languationMap { - return nil; + return _languageMap; } - (NSArray *) languagesForScript: (NSString *)script @@ -74,7 +87,10 @@ + (instancetype) orthographyWithDominantScript: (NSString *)script languageMap: (NSDictionary *)map { - return nil; + NSOrthography *result = [[NSOrthography alloc] initWithDominantScript: script + languageMap: map]; + AUTORELEASE(result); + return result; } - (instancetype) initWithCoder: (NSCoder *)coder @@ -88,7 +104,9 @@ - (instancetype) copyWithZone: (NSZone *)zone { - return nil; + return [[[self class] allocWithZone: zone] + initWithDominantScript: _dominantScript + languageMap: _languageMap]; } @end