IOSAD-72 NSNumber+PEPRating
authorDirk Zimmermann <dirk@pep-project.org>
Fri, 13 Apr 2018 10:58:33 +0200
changeset 569093fba08455c
parent 568 d3c705c9c077
child 570 be19873c1c5b
IOSAD-72 NSNumber+PEPRating
pEpObjCAdapter.xcodeproj/project.pbxproj
pEpObjCAdapter/NSNumber+PEPRating.h
pEpObjCAdapter/NSNumber+PEPRating.m
     1.1 --- a/pEpObjCAdapter.xcodeproj/project.pbxproj	Thu Apr 12 10:09:58 2018 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/project.pbxproj	Fri Apr 13 10:58:33 2018 +0200
     1.3 @@ -32,6 +32,7 @@
     1.4  		433E28911FA741DE00E359B3 /* PEPIdentity.m in Sources */ = {isa = PBXBuildFile; fileRef = 433E28901FA741DE00E359B3 /* PEPIdentity.m */; };
     1.5  		434226811D4F60000083ED79 /* PepTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 434226801D4F60000083ED79 /* PepTests.m */; };
     1.6  		434ED6D6207E27B8000A7590 /* PEPAutoPointer.m in Sources */ = {isa = PBXBuildFile; fileRef = 434ED6D5207E27B8000A7590 /* PEPAutoPointer.m */; };
     1.7 +		435665CC2080A6CB00EC5B10 /* NSNumber+PEPRating.m in Sources */ = {isa = PBXBuildFile; fileRef = 435665CB2080A6CB00EC5B10 /* NSNumber+PEPRating.m */; };
     1.8  		435796E31FB5E51A00395A9E /* PEPMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 435796E21FB5E51A00395A9E /* PEPMessage.m */; };
     1.9  		43676B661C57EA1A00233933 /* B623F674_sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 43676B641C57EA1A00233933 /* B623F674_sec.asc */; };
    1.10  		43D27DE61F5DA7B700795687 /* NSDictionary+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D27DE51F5DA7B700795687 /* NSDictionary+Extension.m */; };
    1.11 @@ -159,6 +160,8 @@
    1.12  		434226801D4F60000083ED79 /* PepTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PepTests.m; sourceTree = "<group>"; };
    1.13  		434ED6D4207E27B8000A7590 /* PEPAutoPointer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPAutoPointer.h; sourceTree = "<group>"; };
    1.14  		434ED6D5207E27B8000A7590 /* PEPAutoPointer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPAutoPointer.m; sourceTree = "<group>"; };
    1.15 +		435665CA2080A6CB00EC5B10 /* NSNumber+PEPRating.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSNumber+PEPRating.h"; sourceTree = "<group>"; };
    1.16 +		435665CB2080A6CB00EC5B10 /* NSNumber+PEPRating.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSNumber+PEPRating.m"; sourceTree = "<group>"; };
    1.17  		435796E11FB5E51A00395A9E /* PEPMessage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPMessage.h; sourceTree = "<group>"; };
    1.18  		435796E21FB5E51A00395A9E /* PEPMessage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPMessage.m; sourceTree = "<group>"; };
    1.19  		43676B631C57EA1A00233933 /* 0xB623F674.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = 0xB623F674.asc; sourceTree = "<group>"; };
    1.20 @@ -305,6 +308,8 @@
    1.21  				43DED785203C25E200D45CD6 /* NSError+PEP.m */,
    1.22  				434ED6D4207E27B8000A7590 /* PEPAutoPointer.h */,
    1.23  				434ED6D5207E27B8000A7590 /* PEPAutoPointer.m */,
    1.24 +				435665CA2080A6CB00EC5B10 /* NSNumber+PEPRating.h */,
    1.25 +				435665CB2080A6CB00EC5B10 /* NSNumber+PEPRating.m */,
    1.26  			);
    1.27  			path = pEpObjCAdapter;
    1.28  			sourceTree = "<group>";
    1.29 @@ -482,6 +487,7 @@
    1.30  				43209B3D1ECC2DA7007E7E2E /* NSArray+Extension.m in Sources */,
    1.31  				43209B3E1ECC2DAB007E7E2E /* PEPCSVScanner.m in Sources */,
    1.32  				43209B421ECC2DBC007E7E2E /* PEPQueue.m in Sources */,
    1.33 +				435665CC2080A6CB00EC5B10 /* NSNumber+PEPRating.m in Sources */,
    1.34  				15206CC71F8E078B003FF880 /* PEPSession.m in Sources */,
    1.35  			);
    1.36  			runOnlyForDeploymentPostprocessing = 0;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/pEpObjCAdapter/NSNumber+PEPRating.h	Fri Apr 13 10:58:33 2018 +0200
     2.3 @@ -0,0 +1,21 @@
     2.4 +//
     2.5 +//  NSNumber+PEPRating.h
     2.6 +//  pEpObjCAdapter
     2.7 +//
     2.8 +//  Created by Dirk Zimmermann on 13.04.18.
     2.9 +//  Copyright © 2018 p≡p. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +#import <Foundation/Foundation.h>
    2.13 +
    2.14 +#import "message_api.h"
    2.15 +
    2.16 +/**
    2.17 + Extension for handling the engine's PEP_rating inside a NSNumber.
    2.18 + */
    2.19 +@interface NSNumber (Extension)
    2.20 +
    2.21 +- initWithPEPRating:(PEP_rating)pEpRating;
    2.22 +- (PEP_rating)pEpRating;
    2.23 +
    2.24 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/pEpObjCAdapter/NSNumber+PEPRating.m	Fri Apr 13 10:58:33 2018 +0200
     3.3 @@ -0,0 +1,23 @@
     3.4 +//
     3.5 +//  NSNumber+PEPRating.m
     3.6 +//  pEpObjCAdapter
     3.7 +//
     3.8 +//  Created by Dirk Zimmermann on 13.04.18.
     3.9 +//  Copyright © 2018 p≡p. All rights reserved.
    3.10 +//
    3.11 +
    3.12 +#import "NSNumber+PEPRating.h"
    3.13 +
    3.14 +@implementation NSNumber (Extension)
    3.15 +
    3.16 +- initWithPEPRating:(PEP_rating)pEpRating
    3.17 +{
    3.18 +    return [self initWithInt:pEpRating];
    3.19 +}
    3.20 +
    3.21 +- (PEP_rating)pEpRating
    3.22 +{
    3.23 +    return self.intValue;
    3.24 +}
    3.25 +
    3.26 +@end