blackberry.com
BlackBerry Dynamics
Runtime library for iOS applications
from the application developer portal
Public Member Functions | Properties

GDVersion Class Reference

BlackBerry Dynamics entitlement version. More...

#import <GDVersion.h>

List of all members.

Public Member Functions

Properties


Detailed Description

Objects of this class are used to represent BlackBerry Dynamics entitlement versions.

BlackBerry Dynamics entitlement versions are sequences of numbers. The first number is the major version number and is the most significant. Numbers later in the sequence are of decreasing significance. By convention, there are four numbers in an entitlement version.

In the BlackBerry Dynamics management console, and in other administrative user interfaces, entitlement versions are represented by "dotted string" values, in which the numbers are separated by full stops (periods).

Objects of this class are used in the getEntitlementVersionsFor: (GDiOS) results list.

Interface Usage

 #import <GD/GDVersion.h>

 // Initialize from dotted string representation.
 GDVersion *gdVersionA = [[GDVersion alloc] initWithString:@"1.2.0.3"];
 
 NSUInteger length = [gdVersionA numberOfVersionParts];
  // length == 4

 NSUInteger majorVersion = [gdVersionA versionPartAt:0];
 // majorVersion == 1

 // Initialize from array of numbers.
 GDVersion *gdVersionB = [[GDVersion alloc] initWithArray:@[1, 3] ];
 
 length = [gdVersionB numberOfVersionParts];
 // length == 2

 NSInteger comparison = [gdVersionA compare:gdVersionB];
 // comparison == NSOrderedAscending

 comparison = [gdVersionB compare:gdVersionA];
 // comparison == NSOrderedDescending

 GDVersion *gdVersionC = [[GDVersion alloc] initWithString:@"1.3"];

 comparison = [gdVersionB compare:gdVersionC];
 // comparison == NSOrderedSame

 BOOL isOrder = [gdVersionA isEqualToVersion:gdVersionB];
 // isOrder == NO

 isOrder = [gdVersionA isGreaterThanVersion:gdVersionB];
 // isOrder == NO

 isOrder = [gdVersionA isLessThanVersion:gdVersionB];
 // isOrder == YES

 NSString *dottedString = [gdVersionB stringValue];
 // [dottedString isEqualToString:@"1.3"] == YES

The code snippet above illustrates the programming interface.


Member Function Documentation

- (instancetype) initWithString: (NSString *)  versionString
Returns:
GDVersion object with constituent version numbers read from a dotted string representation.
- (instancetype) initWithArray: (NSArray *)  array
Returns:
GDVersion object with constituent version numbers initialized from an array of NSNumber objects.
- (NSUInteger) numberOfVersionParts
Returns:
NSUInteger representation of the count of how many constituent numbers there are in the version.
- (NSUInteger) versionPartAt: (NSUInteger)  position

Call this function to get one of the constituent numbers in the version, specified by a numeric position. Position zero is the major version number, which is the most significant.

Returns:
The constituent version number at the specified position.
- (NSComparisonResult) compare: (GDVersion *)  anotherVersion
Returns:
NSComparisonResult representing the relative value of this version compared to the other version.
- (BOOL) isEqualToVersion: (GDVersion *)  anotherVersion
Returns:
YES if the two versions are the same.
NO Otherwise.
- (BOOL) isGreaterThanVersion: (GDVersion *)  anotherVersion
Returns:
YES if this version is more than the specified version.
NO Otherwise.
- (BOOL) isLessThanVersion: (GDVersion *)  anotherVersion
Returns:
YES if this version is less than the specified version.
NO Otherwise.

Property Documentation

- (NSString*) stringValue [read, assign]
Returns:
Dotted string representation of this version.

The documentation for this class was generated from the following file: