[vlc-devel] commit: osx/framework: allow VLCTime to handle int values ( Felix Paul Kühne )

git version control git at videolan.org
Fri Oct 9 17:16:35 CEST 2009


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Oct  9 17:09:20 2009 +0200| [2996a4618e17b86ebd72ddf8a23e94b71878eac4] | committer: Felix Paul Kühne 

osx/framework: allow VLCTime to handle int values

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2996a4618e17b86ebd72ddf8a23e94b71878eac4
---

 projects/macosx/framework/Headers/Public/VLCTime.h |    3 ++
 projects/macosx/framework/Sources/VLCTime.m        |   24 ++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/projects/macosx/framework/Headers/Public/VLCTime.h b/projects/macosx/framework/Headers/Public/VLCTime.h
index e5276d7..cf1d8c5 100644
--- a/projects/macosx/framework/Headers/Public/VLCTime.h
+++ b/projects/macosx/framework/Headers/Public/VLCTime.h
@@ -35,13 +35,16 @@
 /* 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;
+ at property (readonly) int intValue;
 
 /* Comparitors */
 - (NSComparisonResult)compare:(VLCTime *)aTime;
diff --git a/projects/macosx/framework/Sources/VLCTime.m b/projects/macosx/framework/Sources/VLCTime.m
index de36bd1..76510f0 100644
--- a/projects/macosx/framework/Sources/VLCTime.m
+++ b/projects/macosx/framework/Sources/VLCTime.m
@@ -39,6 +39,11 @@
     return [[[VLCTime alloc] initWithNumber:aNumber] autorelease];
 }
 
++ (VLCTime *)timeWithInt:(int)aInt
+{
+    return [[[VLCTime alloc] initWithInt:aInt] autorelease];
+}
+
 /* Initializers */
 - (id)initWithNumber:(NSNumber *)aNumber
 {
@@ -52,6 +57,18 @@
     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];
@@ -100,6 +117,13 @@
     }
 }
 
+- (int)intValue
+{
+    if( value )
+        return [value intValue];
+    return 0;
+}
+
 - (NSComparisonResult)compare:(VLCTime *)aTime
 {
     if (!aTime && !value)




More information about the vlc-devel mailing list