diff -r 000000000000 -r 8e480a14352b messagingfw/wappushfw/MiscPushMsgUtils/src/Cmultipartpushmsgentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/wappushfw/MiscPushMsgUtils/src/Cmultipartpushmsgentry.cpp Mon Jan 18 20:36:02 2010 +0200 @@ -0,0 +1,183 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#include + +GLDEF_C TPtrC16 LimitStringSize(const TPtrC16& aString, TInt aMaxSize) + { + if (aString.Length() < aMaxSize) + return aString; + else + return aString.Left(aMaxSize); + } + + +/** +Allocates and constructs a new multipart WAP Push message object. + +@return +New multipart WAP Push message object. +*/ +EXPORT_C CMultiPartPushMsgEntry* CMultiPartPushMsgEntry::NewL() + { + CMultiPartPushMsgEntry* self = new (ELeave) CMultiPartPushMsgEntry(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +/** +Allocates and constructs a new multipart WAP Push message object, +specifying the AppURI as a string. + +@param aAppURI +AppURI value as a string. + +@return +New multipart WAP Push message object. +*/ +EXPORT_C CMultiPartPushMsgEntry* CMultiPartPushMsgEntry::NewL(const TPtrC8& aAppURI) + { + CMultiPartPushMsgEntry* self = new (ELeave) CMultiPartPushMsgEntry(); + CleanupStack::PushL(self); + self->ConstructL(aAppURI); + CleanupStack::Pop(); + return self; + } + + +/** +Allocates and constructs a new multipart WAP Push message object, +specifying the AppId as a number. + +@param aAppID +AppId value as a number. + +@return +New multipart WAP Push message object. +*/ +EXPORT_C CMultiPartPushMsgEntry* CMultiPartPushMsgEntry::NewL(TInt& aAppID) + { + CMultiPartPushMsgEntry* self = new (ELeave) CMultiPartPushMsgEntry(); + CleanupStack::PushL(self); + self->ConstructL(aAppID); + CleanupStack::Pop(); + return self; + } + + +/** +Destructor. +*/ +EXPORT_C CMultiPartPushMsgEntry::~CMultiPartPushMsgEntry() + { + delete iContentType; + } + + +/** +Sets the Content Type of the message. + +@param aContentType +The Content Type of the message. +*/ +EXPORT_C void CMultiPartPushMsgEntry::SetContentTypeL(const TDesC& aContentType) + { + HBufC* tempBuf = aContentType.AllocL(); + + delete iContentType; + iContentType = tempBuf; + } + + +/** +Constructor. +*/ +CMultiPartPushMsgEntry::CMultiPartPushMsgEntry() + { + } + + +/** +Gets the push message type. + +For this class, the message type UID is KUidWapPushMsgMultiPart. + +@return +Push message type. +*/ +TInt32 CMultiPartPushMsgEntry::PushMsgType() const + { + return KUidWapPushMsgMultiPart.iUid; + } + + +/** +Sets the push message type UID. + +For this class, the message type UID is KUidWapPushMsgMultiPart. +*/ +void CMultiPartPushMsgEntry::SetPushMsgType() + { + iEntry.iBioType = KUidWapPushMsgMultiPart.iUid; + } + + +/** +Externalises Push message data to a write stream. + +Apart from the data stored by the base class, other data stored are Content Type and Time Sent. + +@param aStream +The stream to which the data should be externalised. + +@see CPushMsgEntryBase::ExternalizeL() +*/ +void CMultiPartPushMsgEntry::ExternalizeL(RMsvWriteStream& aStream) + { + CPushMsgEntryBase::ExternalizeL(aStream); + + aStream<> timeSent; + iTimeSent = timeSent; + }