Commit 0450faad authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCTime: Code cleanup and use Objective-C 2.0 @property. (Patch by Enrique Osuna).

parent a5015dec
......@@ -24,19 +24,27 @@
#import <Cocoa/Cocoa.h>
/**
* Provides an object to define VLCMedia's ti me.
*/
@interface VLCTime : NSObject
{
NSNumber *value;
NSNumber * value; //< Holds, in seconds, the VLCTime value
}
/* Factories */
+ (VLCTime *)nullTime;
+ (VLCTime *)timeWithNumber:(NSNumber *)aNumber;
//+ (VLCTime *)timeWithString:(NSString *)aString;
/* Initializers */
- (id)initWithNumber:(NSNumber *)aNumber;
//- (id)initWithString:(NSString *)aString;
- (NSNumber *)numberValue;
- (NSString *)stringValue;
/* Properties */
@property (readonly) NSNumber * numberValue;
@property (readonly) NSString * stringValue;
/* Comparitors */
- (NSComparisonResult)compare:(VLCTime *)aTime;
@end
......@@ -24,11 +24,10 @@
#import <VLCTime.h>
static VLCTime *nullTime = nil;
@implementation VLCTime
+ (VLCTime *)nullTime
{
static VLCTime * nullTime = nil;
if (!nullTime)
nullTime = [[VLCTime timeWithNumber:nil] retain];
return nullTime;
......@@ -76,7 +75,7 @@ static VLCTime *nullTime = nil;
- (NSNumber *)numberValue
{
return value ? [value copy] : nil;
return value ? [[value copy] autorelease] : nil;
}
- (NSString *)stringValue
......@@ -103,11 +102,11 @@ static VLCTime *nullTime = nil;
else if (!aTime)
return NSOrderedDescending;
else
return [value compare:[aTime numberValue]];
return [value compare:aTime.numberValue];
}
- (NSString *)description
{
return [self stringValue];
return self.stringValue;
}
@end
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