1 /* Definition of class NSISO8601DateFormatter
2    Copyright (C) 2019 Free Software Foundation, Inc.
3 
4    By: Gregory John Casamento <greg.casamento@gmail.com>
5    Date: Tue Oct 29 04:43: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 _NSISO8601DateFormatter_h_GNUSTEP_BASE_INCLUDE
26 #define _NSISO8601DateFormatter_h_GNUSTEP_BASE_INCLUDE
27 
28 #include <Foundation/NSFormatter.h>
29 
30 #if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
31 
32 #if	defined(__cplusplus)
33 extern "C" {
34 #endif
35 
36 enum
37 {
38   NSISO8601DateFormatWithYear = (1UL << 0),
39   NSISO8601DateFormatWithMonth  = (1UL << 1),
40   NSISO8601DateFormatWithWeekOfYear = (1UL << 2),
41   NSISO8601DateFormatWithDay  = (1UL << 4),
42   NSISO8601DateFormatWithTime  = (1UL << 5),
43   NSISO8601DateFormatWithTimeZone  = (1UL << 6),
44   NSISO8601DateFormatWithSpaceBetweenDateAndTime = (1UL << 7),
45   NSISO8601DateFormatWithDashSeparatorInDate  = (1UL << 8),
46   NSISO8601DateFormatWithColonSeparatorInTime   = (1UL << 9),
47   NSISO8601DateFormatWithColonSeparatorInTimeZone = (1UL << 10),
48   NSISO8601DateFormatWithFractionalSeconds  = (1UL << 11),
49   NSISO8601DateFormatWithFullDate = NSISO8601DateFormatWithYear |
50                                     NSISO8601DateFormatWithMonth |
51                                     NSISO8601DateFormatWithDay |
52                                     NSISO8601DateFormatWithDashSeparatorInDate,
53   NSISO8601DateFormatWithFullTime = NSISO8601DateFormatWithTime |
54                                     NSISO8601DateFormatWithColonSeparatorInTime |
55                                     NSISO8601DateFormatWithTimeZone |
56                                     NSISO8601DateFormatWithColonSeparatorInTimeZone,
57   NSISO8601DateFormatWithInternetDateTime = (NSISO8601DateFormatWithFullDate | NSISO8601DateFormatWithFullTime),
58 };
59 typedef NSUInteger NSISO8601DateFormatOptions;
60 
61 @class NSTimeZone, NSString, NSDate, NSDateFormatter;
62 
63 @interface NSISO8601DateFormatter : NSFormatter <NSCoding>
64 {
65   NSTimeZone *_timeZone;
66   NSISO8601DateFormatOptions _formatOptions;
67   NSDateFormatter *_formatter;
68 }
69 
70 - (NSTimeZone *) timeZone;
71 - (void) setTimeZone: (NSTimeZone *)tz;
72 
73 - (NSISO8601DateFormatOptions) formatOptions;
74 - (void) setFormatOptions: (NSISO8601DateFormatOptions)options;
75 
76 - (NSString *) stringFromDate: (NSDate *)date;
77 - (NSDate *) dateFromString: (NSString *)string;
78 
79 + (NSString *) stringFromDate: (NSDate *)date
80                      timeZone: (NSTimeZone *)timeZone
81                 formatOptions: (NSISO8601DateFormatOptions)formatOptions;
82 
83 @end
84 
85 #if	defined(__cplusplus)
86 }
87 #endif
88 
89 #endif	/* GS_API_MACOSX */
90 
91 #endif	/* _NSISO8601DateFormatter_h_GNUSTEP_BASE_INCLUDE */
92 
93