1 /* Definition of class NSDateInterval 2 Copyright (C) 2019 Free Software Foundation, Inc. 3 4 By: Gregory Casamento <greg.casamento@gmail.com> 5 Date: Wed Oct 9 16:24:13 EDT 2019 6 7 This file is part of the GNUstep Library. 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public 20 License along with this library; if not, write to the Free 21 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 Boston, MA 02110 USA. 23 */ 24 25 #ifndef _NSDateInterval_h_GNUSTEP_BASE_INCLUDE 26 #define _NSDateInterval_h_GNUSTEP_BASE_INCLUDE 27 28 #include <Foundation/NSObject.h> 29 #include <Foundation/NSDate.h> 30 31 #if defined(__cplusplus) 32 extern "C" { 33 #endif 34 35 #if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST) 36 37 @interface NSDateInterval : NSObject <NSCoding, NSCopying> 38 { 39 NSTimeInterval _duration; 40 NSDate *_startDate; 41 } 42 43 // Init 44 - (instancetype) init; 45 46 - (instancetype) initWithStartDate: (NSDate *)startDate 47 duration: (NSTimeInterval)duration; 48 49 - (instancetype) initWithStartDate: (NSDate *)startDate 50 endDate: (NSDate *)endDate; 51 52 // Access 53 - (NSDate *) startDate; 54 - (void) setStartDate: (NSDate *)startDate; 55 56 - (NSDate *) endDate; 57 - (void) setEndDate: (NSDate *)endDate; 58 59 - (NSTimeInterval)duration; 60 - (void) setDuration: (NSTimeInterval)duration; 61 62 // Compare 63 - (NSComparisonResult) compare: (NSDateInterval *)dateInterval; 64 65 - (BOOL) isEqualToDateInterval: (NSDateInterval *)dateInterval; 66 67 // Determine 68 - (BOOL) intersectsDateInterval: (NSDateInterval *)dateInterval; 69 70 - (NSDateInterval *) intersectionWithDateInterval: (NSDateInterval *)dateInterval; 71 72 // Contain 73 - (BOOL) containsDate: (NSDate *)date; 74 75 @end 76 77 #if defined(__cplusplus) 78 } 79 #endif 80 81 #endif /* GS_API_MACOSX */ 82 83 #endif /* _NSDateInterval_h_GNUSTEP_BASE_INCLUDE */ 84 85