From b1c868bbcb85757067eca193c04dea390ea44da3 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sat, 12 Oct 2019 12:42:18 -0400 Subject: [PATCH] Add NSDateInterval.[hm] files. --- Headers/Foundation/Foundation.h | 1 + Headers/Foundation/NSDateInterval.h | 81 ++++++++++++++ Headers/Foundation/NSDateIntervalFormatter.h | 48 +++++++++ Source/GNUmakefile | 2 + Source/NSDateInterval.m | 106 +++++++++++++++++++ Source/NSDateIntervalFormatter.m | 31 ++++++ 6 files changed, 269 insertions(+) create mode 100644 Headers/Foundation/NSDateInterval.h create mode 100644 Headers/Foundation/NSDateIntervalFormatter.h create mode 100644 Source/NSDateInterval.m create mode 100644 Source/NSDateIntervalFormatter.m diff --git a/Headers/Foundation/Foundation.h b/Headers/Foundation/Foundation.h index c924faae1..d27814223 100644 --- a/Headers/Foundation/Foundation.h +++ b/Headers/Foundation/Foundation.h @@ -55,6 +55,7 @@ #import #import #import +#import #import #import #import diff --git a/Headers/Foundation/NSDateInterval.h b/Headers/Foundation/NSDateInterval.h new file mode 100644 index 000000000..672f2ebc2 --- /dev/null +++ b/Headers/Foundation/NSDateInterval.h @@ -0,0 +1,81 @@ + +/* Definition of class NSDateInterval + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Wed Oct 9 16:24:13 EDT 2019 + + This file is part of the GNUstep Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef _NSDateInterval_h_GNUSTEP_BASE_INCLUDE +#define _NSDateInterval_h_GNUSTEP_BASE_INCLUDE + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST) + +@interface NSDateInterval : NSObject + +// Init +- (instancetype) init; + +- (instancetype) initWithStartDate: (NSDate *)startDate + duration: (NSTimeInterval)duration; + +- (instancetype) initWithStartDate: (NSDate *)startDate + endDate: (NSDate *)endDate; + +// Access +- (NSDate *) startDate; +- (void) setStartDate: (NSDate *)startDate; + +- (NSDate *) endDate; +- (void) setEndDate: (NSDate *)endDate; + +- (NSTimeInterval)duration; +- (void) setDuration: (NSTimeInterval)duration; + +// Compare +- (NSComparisonResult) compare: (NSDateInterval *)dateInterval; + +- (BOOL) isEqualToDateInterval: (NSDateInterval *)dateInterval; + +// Determine +- (BOOL) intersectsDateInterval: (NSDateInterval *)dateInterval; + +- (NSDateInterval *) intersectionWithDateInterval: (NSDateInterval *)dateInterval; + +// Contain +- (BOOL) containsDate: (NSDate *)date; + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* GS_API_MACOSX */ + +#endif /* _NSDateInterval_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/Headers/Foundation/NSDateIntervalFormatter.h b/Headers/Foundation/NSDateIntervalFormatter.h new file mode 100644 index 000000000..c04fc1b62 --- /dev/null +++ b/Headers/Foundation/NSDateIntervalFormatter.h @@ -0,0 +1,48 @@ + +/* Definition of class NSDateIntervalFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Wed Oct 9 16:23:55 EDT 2019 + + This file is part of the GNUstep Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#ifndef _NSDateIntervalFormatter_h_GNUSTEP_BASE_INCLUDE +#define _NSDateIntervalFormatter_h_GNUSTEP_BASE_INCLUDE + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) + +@interface NSDateIntervalFormatter : NSFormatter + +@end + +#if defined(__cplusplus) +} +#endif + +#endif /* GS_API_MACOSX */ + +#endif /* _NSDateIntervalFormatter_h_GNUSTEP_BASE_INCLUDE */ + diff --git a/Source/GNUmakefile b/Source/GNUmakefile index b2835e1d7..541d30f64 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -213,6 +213,7 @@ NSConnection.m \ NSData.m \ NSDate.m \ NSDateFormatter.m \ +NSDateInterval.m \ NSDebug.m \ NSDecimal.m \ NSDecimalNumber.m \ @@ -407,6 +408,7 @@ NSCompoundPredicate.h \ NSConnection.h \ NSData.h \ NSDateFormatter.h \ +NSDateInterval.h \ NSDate.h \ NSDebug.h \ NSDecimal.h \ diff --git a/Source/NSDateInterval.m b/Source/NSDateInterval.m new file mode 100644 index 000000000..989dc367c --- /dev/null +++ b/Source/NSDateInterval.m @@ -0,0 +1,106 @@ + +/* Implementation of class NSDateInterval + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Wed Oct 9 16:24:13 EDT 2019 + + This file is part of the GNUstep Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#include + +@implementation NSDateInterval + +// Init +- (instancetype)init +{ +} + +- (instancetype)initWithStartDate:(NSDate *)startDate + duration:(NSTimeInterval)duration +{ +} + +- (instancetype)initWithStartDate:(NSDate *)startDate + endDate:(NSDate *)endDate +{ +} + +- (instancetype) initWithCoder: (NSCoder *)coder +{ +} + +- (void) encodeWithCoder: (NSCoder *)coder +{ +} + +- (id) copyWithZone: (NSZone *)zone +{ +} + +// Access +- (NSDate *) startDate +{ +} + +- (void) setStartDate: (NSDate *)startDate +{ +} + +- (NSDate *) endDate +{ +} + +- (void) setEndDate: (NSDate *)endDate +{ +} + +- (NSTimeInterval) duration +{ +} + +- (void) setDuration: (NSTimeInterval)duration +{ +} + +// Compare +- (NSComparisonResult) compare: (NSDateInterval *)dateInterval +{ +} + +- (BOOL) isEqualToDateInterval: (NSDateInterval *)dateInterval +{ +} + +// Determine +- (BOOL) intersectsDateInterval: (NSDateInterval *)dateInterval +{ +} + +- (NSDateInterval *) intersectionWithDateInterval: (NSDateInterval *)dateInterval +{ +} + +// Contain +- (BOOL) containsDate: (NSDate *)date +{ +} + +@end + diff --git a/Source/NSDateIntervalFormatter.m b/Source/NSDateIntervalFormatter.m new file mode 100644 index 000000000..0ca18904f --- /dev/null +++ b/Source/NSDateIntervalFormatter.m @@ -0,0 +1,31 @@ + +/* Implementation of class NSDateIntervalFormatter + Copyright (C) 2019 Free Software Foundation, Inc. + + By: heron + Date: Wed Oct 9 16:23:55 EDT 2019 + + This file is part of the GNUstep Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02111 USA. +*/ + +#include + +@implementation NSDateIntervalFormatter + +@end +