Commit 2996a461 authored by Felix Paul Kühne's avatar Felix Paul Kühne

osx/framework: allow VLCTime to handle int values

parent 390f573e
...@@ -35,13 +35,16 @@ ...@@ -35,13 +35,16 @@
/* Factories */ /* Factories */
+ (VLCTime *)nullTime; + (VLCTime *)nullTime;
+ (VLCTime *)timeWithNumber:(NSNumber *)aNumber; + (VLCTime *)timeWithNumber:(NSNumber *)aNumber;
+ (VLCTime *)timeWithInt:(int)aInt;
/* Initializers */ /* Initializers */
- (id)initWithNumber:(NSNumber *)aNumber; - (id)initWithNumber:(NSNumber *)aNumber;
- (id)initWithInt:(int)aInt;
/* Properties */ /* Properties */
@property (readonly) NSNumber * numberValue; @property (readonly) NSNumber * numberValue;
@property (readonly) NSString * stringValue; @property (readonly) NSString * stringValue;
@property (readonly) int intValue;
/* Comparitors */ /* Comparitors */
- (NSComparisonResult)compare:(VLCTime *)aTime; - (NSComparisonResult)compare:(VLCTime *)aTime;
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
return [[[VLCTime alloc] initWithNumber:aNumber] autorelease]; return [[[VLCTime alloc] initWithNumber:aNumber] autorelease];
} }
+ (VLCTime *)timeWithInt:(int)aInt
{
return [[[VLCTime alloc] initWithInt:aInt] autorelease];
}
/* Initializers */ /* Initializers */
- (id)initWithNumber:(NSNumber *)aNumber - (id)initWithNumber:(NSNumber *)aNumber
{ {
...@@ -52,6 +57,18 @@ ...@@ -52,6 +57,18 @@
return self; return self;
} }
- (id)initWithInt:(int)aInt
{
if (self = [super init])
{
if (aInt)
value = [[NSNumber numberWithInt: aInt] retain];
else
value = nil;
}
return self;
}
- (void)dealloc - (void)dealloc
{ {
[value release]; [value release];
...@@ -100,6 +117,13 @@ ...@@ -100,6 +117,13 @@
} }
} }
- (int)intValue
{
if( value )
return [value intValue];
return 0;
}
- (NSComparisonResult)compare:(VLCTime *)aTime - (NSComparisonResult)compare:(VLCTime *)aTime
{ {
if (!aTime && !value) if (!aTime && !value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment