]> git.sesse.net Git - vlc/commitdiff
osx/framework: allow VLCTime to handle int values
authorFelix Paul Kühne <fkuehne@videolan.org>
Fri, 9 Oct 2009 15:09:20 +0000 (17:09 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Fri, 9 Oct 2009 15:16:33 +0000 (17:16 +0200)
projects/macosx/framework/Headers/Public/VLCTime.h
projects/macosx/framework/Sources/VLCTime.m

index e5276d7e09485d1b7a82f59fe7e50fd9900e32f7..cf1d8c5e10b12b3f48ceb99ce7dae8a8996b69a1 100644 (file)
 /* Factories */
 + (VLCTime *)nullTime;
 + (VLCTime *)timeWithNumber:(NSNumber *)aNumber;
++ (VLCTime *)timeWithInt:(int)aInt;
 
 /* Initializers */
 - (id)initWithNumber:(NSNumber *)aNumber;
+- (id)initWithInt:(int)aInt;
 
 /* Properties */
 @property (readonly) NSNumber * numberValue;
 @property (readonly) NSString * stringValue;
+@property (readonly) int intValue;
 
 /* Comparitors */
 - (NSComparisonResult)compare:(VLCTime *)aTime;
index de36bd14f3ab2648a75aa58b8e671d94dd9089d0..76510f000ff20820b18440fee09381fabfe67aca 100644 (file)
     return [[[VLCTime alloc] initWithNumber:aNumber] autorelease];
 }
 
++ (VLCTime *)timeWithInt:(int)aInt
+{
+    return [[[VLCTime alloc] initWithInt:aInt] autorelease];
+}
+
 /* Initializers */
 - (id)initWithNumber:(NSNumber *)aNumber
 {
     return self;
 }
 
+- (id)initWithInt:(int)aInt
+{
+    if (self = [super init])
+    {
+        if (aInt)
+            value = [[NSNumber numberWithInt: aInt] retain];
+        else
+            value = nil;
+    }
+    return self;
+}
+
 - (void)dealloc
 {
     [value release];
     }
 }
 
+- (int)intValue
+{
+    if( value )
+        return [value intValue];
+    return 0;
+}
+
 - (NSComparisonResult)compare:(VLCTime *)aTime
 {
     if (!aTime && !value)