|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file contains the class TInternetDate |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file tinternetdate.h |
|
20 @publishedAll |
|
21 @released |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef __TINTERNETDATE_H__ |
|
26 #define __TINTERNETDATE_H__ |
|
27 |
|
28 #include <e32std.h> |
|
29 |
|
30 /** |
|
31 Stores dates in universal time and provides parsing of internet style dates |
|
32 into TDateTime and RFC 1123 (updates RFC 822) dates. |
|
33 |
|
34 Supports parsing of the following date formats: |
|
35 Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 |
|
36 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 |
|
37 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format |
|
38 |
|
39 In case of Date Formats with offsets "Mon, 21 Jan 2002 23:00:00 +0210" , equivalent |
|
40 time in UTC can be determined by substracting the offset from the local time (RFC 3339). |
|
41 |
|
42 All dates are store relative to Universal Time and not local time. |
|
43 |
|
44 @publishedAll |
|
45 @released |
|
46 @since 7.0 |
|
47 */ |
|
48 class TInternetDate |
|
49 { |
|
50 public: |
|
51 /** |
|
52 Enum defining internet date formats. |
|
53 @publishedAll |
|
54 @released |
|
55 @since 9.1 |
|
56 */ |
|
57 enum TInternetDateFormat |
|
58 { |
|
59 /** |
|
60 Rfc 1123 Compliant date format |
|
61 */ |
|
62 ERfc1123Format |
|
63 }; |
|
64 |
|
65 inline TInternetDate(); |
|
66 |
|
67 |
|
68 inline TInternetDate(TDateTime aUniversalTime); |
|
69 |
|
70 IMPORT_C void SetDateL(const TDesC8& aDate); |
|
71 |
|
72 IMPORT_C const TDateTime& DateTime(); |
|
73 |
|
74 IMPORT_C HBufC8* InternetDateTimeL(TInternetDateFormat aInternetDateFormat); |
|
75 |
|
76 private: |
|
77 /** |
|
78 A date and time object |
|
79 */ |
|
80 TDateTime iDateTime; |
|
81 }; |
|
82 |
|
83 |
|
84 /** |
|
85 Intended Usage: Default Constructor. Used when setting dates that are in a text format using SetDateL |
|
86 |
|
87 @since 7.0 . |
|
88 */ |
|
89 inline TInternetDate::TInternetDate() |
|
90 {} |
|
91 |
|
92 /** |
|
93 Intended Usage: Constructor. Used when setting a date that you later want parsed into an internet text format |
|
94 |
|
95 @since 7.0 |
|
96 @param aUniversalTime a time that should correspond to Universal Time. |
|
97 */ |
|
98 inline TInternetDate::TInternetDate(TDateTime aUniversalTime) : |
|
99 iDateTime(aUniversalTime) |
|
100 {} |
|
101 |
|
102 |
|
103 #endif // __TINTERNETDATE_H__ |