1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericservices/httputils/internetdateutils/tinternetdate.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,71 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// This file contains implementation for classes defined in tinternetdate.h
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file tinternetdate.cpp
1.23 + @see tinternetdate.h
1.24 +*/
1.25 +
1.26 +
1.27 +#include "tinternetdate.h"
1.28 +#include "inetprottextutils.h"
1.29 +#include "tinternetdateparser.h"
1.30 +
1.31 +
1.32 +/**
1.33 + Used to set a date which is in a Internet form.
1.34 +
1.35 + @since 7.0
1.36 + @param aDate the text form of the date .
1.37 + @leave KErrCorrupt, if the date is not in the correct format
1.38 +*/
1.39 +EXPORT_C void TInternetDate::SetDateL(const TDesC8& aDate)
1.40 + {
1.41 + TInternetDateParser dateParser;
1.42 +
1.43 + TPtrC8 datePtr(aDate);
1.44 + // Remove the any leading and trailing whitespaces from the date.
1.45 + InetProtTextUtils::RemoveWhiteSpace(datePtr, InetProtTextUtils::ERemoveBoth);
1.46 +
1.47 + dateParser.ConvertFromInternetFormL(datePtr, iDateTime);
1.48 + }
1.49 +
1.50 +/**
1.51 + Used to access the date/time
1.52 +
1.53 + @since 7.0
1.54 + @return const TDateTime& The time stored in this object
1.55 +*/
1.56 +EXPORT_C const TDateTime& TInternetDate::DateTime()
1.57 + {
1.58 + return iDateTime;
1.59 + }
1.60 +
1.61 +/**
1.62 + Used to access the date/time in a text formate
1.63 +
1.64 + @since 7.0
1.65 + @param aInternetDateFormat The format of the date. Only RFC1123 dates are supported
1.66 + @return HBufC8* A descriptor containing the date/time in the format
1.67 + specifed by the parameter aInternetDateFormat
1.68 + @leave KErrNoMemory
1.69 +*/
1.70 +EXPORT_C HBufC8* TInternetDate::InternetDateTimeL(TInternetDateFormat /*aInternetDateFormat*/)
1.71 + {
1.72 + TInternetDateParser dateParser;
1.73 + return dateParser.ConvertToRfc1123FormL(iDateTime);
1.74 + }