sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This file contains implementation for classes defined in tinternetdate.h sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file tinternetdate.cpp sl@0: @see tinternetdate.h sl@0: */ sl@0: sl@0: sl@0: #include "tinternetdate.h" sl@0: #include "inetprottextutils.h" sl@0: #include "tinternetdateparser.h" sl@0: sl@0: sl@0: /** sl@0: Used to set a date which is in a Internet form. sl@0: sl@0: @since 7.0 sl@0: @param aDate the text form of the date . sl@0: @leave KErrCorrupt, if the date is not in the correct format sl@0: */ sl@0: EXPORT_C void TInternetDate::SetDateL(const TDesC8& aDate) sl@0: { sl@0: TInternetDateParser dateParser; sl@0: sl@0: TPtrC8 datePtr(aDate); sl@0: // Remove the any leading and trailing whitespaces from the date. sl@0: InetProtTextUtils::RemoveWhiteSpace(datePtr, InetProtTextUtils::ERemoveBoth); sl@0: sl@0: dateParser.ConvertFromInternetFormL(datePtr, iDateTime); sl@0: } sl@0: sl@0: /** sl@0: Used to access the date/time sl@0: sl@0: @since 7.0 sl@0: @return const TDateTime& The time stored in this object sl@0: */ sl@0: EXPORT_C const TDateTime& TInternetDate::DateTime() sl@0: { sl@0: return iDateTime; sl@0: } sl@0: sl@0: /** sl@0: Used to access the date/time in a text formate sl@0: sl@0: @since 7.0 sl@0: @param aInternetDateFormat The format of the date. Only RFC1123 dates are supported sl@0: @return HBufC8* A descriptor containing the date/time in the format sl@0: specifed by the parameter aInternetDateFormat sl@0: @leave KErrNoMemory sl@0: */ sl@0: EXPORT_C HBufC8* TInternetDate::InternetDateTimeL(TInternetDateFormat /*aInternetDateFormat*/) sl@0: { sl@0: TInternetDateParser dateParser; sl@0: return dateParser.ConvertToRfc1123FormL(iDateTime); sl@0: }