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