~ubuntu-branches/ubuntu/breezy/gnustep-base/breezy

« back to all changes in this revision

Viewing changes to Headers/Foundation/NSCalendarDate.h

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (4 hoary)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Interface for NSCalendarDate for GNUStep
 
2
   Copyright (C) 1994, 1996, 1999 Free Software Foundation, Inc.
 
3
 
 
4
   This file is part of the GNUstep Base Library.
 
5
 
 
6
   This library is free software; you can redistribute it and/or
 
7
   modify it under the terms of the GNU Library General Public
 
8
   License as published by the Free Software Foundation; either
 
9
   version 2 of the License, or (at your option) any later version.
 
10
 
 
11
   This library is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
   Library General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU Library General Public
 
17
   License along with this library; if not, write to the Free
 
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
 
19
  */
 
20
 
 
21
#ifndef __NSCalendarDate_h_GNUSTEP_BASE_INCLUDE
 
22
#define __NSCalendarDate_h_GNUSTEP_BASE_INCLUDE
 
23
 
 
24
#include <Foundation/NSDate.h>
 
25
 
 
26
@class  NSTimeZone;
 
27
@class  NSTimeZoneDetail;
 
28
 
 
29
@interface NSCalendarDate : NSDate
 
30
{
 
31
  NSTimeInterval        _seconds_since_ref;
 
32
  NSString              *_calendar_format;
 
33
  NSTimeZone            *_time_zone;
 
34
}
 
35
 
 
36
// Getting an NSCalendar Date
 
37
+ (id) calendarDate;
 
38
+ (id) dateWithString: (NSString*)description
 
39
       calendarFormat: (NSString*)format;
 
40
+ (id) dateWithString: (NSString*)description
 
41
       calendarFormat: (NSString*)format
 
42
               locale: (NSDictionary*)dictionary;
 
43
+ (id) dateWithYear: (int)year
 
44
              month: (unsigned int)month
 
45
                day: (unsigned int)day
 
46
               hour: (unsigned int)hour
 
47
             minute: (unsigned int)minute
 
48
             second: (unsigned int)second
 
49
           timeZone: (NSTimeZone*)aTimeZone;
 
50
 
 
51
// Initializing an NSCalendar Date
 
52
- (id) initWithString: (NSString*)description;
 
53
- (id) initWithString: (NSString*)description
 
54
       calendarFormat: (NSString*)format;
 
55
- (id) initWithString: (NSString*)description
 
56
       calendarFormat: (NSString*)fmt
 
57
               locale: (NSDictionary*)locale;
 
58
- (id) initWithYear: (int)year
 
59
              month: (unsigned int)month
 
60
                day: (unsigned int)day
 
61
               hour: (unsigned int)hour
 
62
             minute: (unsigned int)minute
 
63
             second: (unsigned int)second
 
64
           timeZone: (NSTimeZone*)aTimeZone;
 
65
 
 
66
// Retreiving Date Elements
 
67
- (int) dayOfCommonEra;
 
68
- (int) dayOfMonth;
 
69
- (int) dayOfWeek;
 
70
- (int) dayOfYear;
 
71
- (int) hourOfDay;
 
72
- (int) minuteOfHour;
 
73
- (int) monthOfYear;
 
74
- (int) secondOfMinute;
 
75
- (int) yearOfCommonEra;
 
76
 
 
77
// Providing Adjusted Dates
 
78
- (NSCalendarDate*) addYear: (int)year
 
79
                      month: (int)month
 
80
                        day: (int)day
 
81
                       hour: (int)hour
 
82
                     minute: (int)minute
 
83
                     second: (int)second;
 
84
 
 
85
// Getting String Descriptions of Dates
 
86
- (NSString*) description;
 
87
- (NSString*) descriptionWithCalendarFormat: (NSString*)format;
 
88
- (NSString*) descriptionWithCalendarFormat: (NSString*)format
 
89
                                     locale: (NSDictionary*)locale;
 
90
- (NSString*) descriptionWithLocale: (NSDictionary*)locale;
 
91
 
 
92
// Getting and Setting Calendar Formats
 
93
- (NSString*) calendarFormat;
 
94
- (void) setCalendarFormat: (NSString*)format;
 
95
 
 
96
// Getting and Setting Time Zones
 
97
- (void) setTimeZone: (NSTimeZone*)aTimeZone;
 
98
#ifndef STRICT_OPENSTEP
 
99
- (NSTimeZone*) timeZone;
 
100
#endif
 
101
#ifndef STRICT_MACOS_X
 
102
- (NSTimeZoneDetail*) timeZoneDetail;
 
103
#endif
 
104
 
 
105
@end
 
106
 
 
107
#ifndef NO_GNUSTEP
 
108
 
 
109
/**
 
110
 *  Adds <code>-weekOfYear</code> method.
 
111
 */
 
112
@interface NSCalendarDate (GSCategories)
 
113
/**
 
114
 * The ISO standard week of the year is based on the first week of the
 
115
 * year being that week (starting on monday) for which the thursday
 
116
 * is on or after the first of january.<br />
 
117
 * This has the effect that, if january first is a friday, saturday or
 
118
 * sunday, the days of that week (up to and including the sunday) are
 
119
 * considered to be in week 53 of the preceeding year. Similarly if the
 
120
 * last day of the year is a monday tuesday or wednesday, these days are
 
121
 * part of week 1 of the next year.
 
122
 */
 
123
- (int) weekOfYear;
 
124
@end
 
125
 
 
126
@interface NSCalendarDate (GregorianDate)
 
127
 
 
128
- (int) lastDayOfGregorianMonth: (int)month year: (int)year;
 
129
- (int) absoluteGregorianDay: (int)day month: (int)month year: (int)year;
 
130
- (void) gregorianDateFromAbsolute: (int)d
 
131
                               day: (int*)day
 
132
                             month: (int*)month
 
133
                              year: (int*)year;
 
134
 
 
135
@end
 
136
 
 
137
void
 
138
GSBreakTime(NSTimeInterval when, int *year, int *month, int *day, int *hour,
 
139
  int *minute, int *second, int *mil);
 
140
NSTimeInterval
 
141
GSTime(int day, int month, int year, int hour, int minute, int second, int mil);
 
142
 
 
143
#endif
 
144
 
 
145
#ifndef STRICT_MACOS_X
 
146
@interface NSCalendarDate (OPENSTEP)
 
147
 
 
148
- (NSCalendarDate*) dateByAddingYears: (int)years
 
149
                               months: (int)months
 
150
                                 days: (int)days
 
151
                                hours: (int)hours
 
152
                              minutes: (int)minutes
 
153
                              seconds: (int)seconds;
 
154
 
 
155
- (void) years: (int*)years
 
156
        months: (int*)months
 
157
          days: (int*)days
 
158
         hours: (int*)hours
 
159
       minutes: (int*)minutes
 
160
       seconds: (int*)seconds
 
161
     sinceDate: (NSDate*)date;
 
162
@end
 
163
#endif
 
164
 
 
165
#endif  /* __NSCalendarDate_h_GNUSTEP_BASE_INCLUDE*/