Browse Source

VLCTime: improve comparison API (close #15404)

Felix Paul Kühne 10 years ago
parent
commit
39b34319c9
3 changed files with 19 additions and 0 deletions
  1. 2 0
      Headers/Public/VLCTime.h
  2. 4 0
      NEWS
  3. 13 0
      Sources/VLCTime.m

+ 2 - 0
Headers/Public/VLCTime.h

@@ -48,5 +48,7 @@
 
 /* Comparators */
 - (NSComparisonResult)compare:(VLCTime *)aTime;
+- (BOOL)isEqual:(id)object;
+- (NSUInteger)hash;
 
 @end

+ 4 - 0
NEWS

@@ -19,6 +19,10 @@ New APIs:
                      parseWithOptions:
   - added enums: VLCMediaType, VLCMediaParsingOptions
 
+- VLCTime
+  - added selectors: isEqual:
+                     hash
+
 Deprecated APIs:
 - VLCMediaPlayer
   - titles, chaptersForTitleIndex:, countOfTitles

+ 13 - 0
Sources/VLCTime.m

@@ -145,4 +145,17 @@
             NSOrderedSame;
 }
 
+- (BOOL)isEqual:(id)object
+{
+    if (![object isKindOfClass:[VLCTime class]])
+        return NO;
+
+    return [[self description] isEqual:[object description]];
+}
+
+- (NSUInteger)hash
+{
+    return [[self description] hash];
+}
+
 @end