messagingfw/msgsrvnstore/server/src/CMsvAttachmentRename.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2005-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 //
       
    15 
       
    16 #include <s32strm.h>
       
    17 
       
    18 #include "CMsvAttachmentRename.h"
       
    19 
       
    20 CMsvAttachmentRename* CMsvAttachmentRename::NewLC(const TDesC& aOldName, const TDesC& aNewName)
       
    21 	{
       
    22 	CMsvAttachmentRename* self = new(ELeave) CMsvAttachmentRename();
       
    23 	CleanupStack::PushL(self);
       
    24 	self->ConstructL(aOldName, aNewName);
       
    25 	return self;
       
    26 	}
       
    27 	
       
    28 CMsvAttachmentRename* CMsvAttachmentRename::NewLC()
       
    29 	{
       
    30 	CMsvAttachmentRename* self = new(ELeave) CMsvAttachmentRename();
       
    31 	CleanupStack::PushL(self);
       
    32 	return self;
       
    33 	}
       
    34 
       
    35 CMsvAttachmentRename::CMsvAttachmentRename()
       
    36 	{
       
    37 	}
       
    38 	
       
    39 void CMsvAttachmentRename::ConstructL(const TDesC& aOldName, const TDesC& aNewName)
       
    40 	{
       
    41 	iOldName = aOldName.AllocL();
       
    42 	iNewName = aNewName.AllocL();
       
    43 	}
       
    44 	
       
    45 CMsvAttachmentRename::~CMsvAttachmentRename()
       
    46 	{
       
    47 	delete iOldName;
       
    48 	delete iNewName;
       
    49 	}
       
    50 
       
    51 const TDesC& CMsvAttachmentRename::OldName() const
       
    52 	{
       
    53 	__ASSERT_DEBUG(iOldName!=NULL, User::Invariant());
       
    54 	
       
    55 	return *iOldName;
       
    56 	}
       
    57 	
       
    58 const TDesC& CMsvAttachmentRename::NewName() const
       
    59 	{
       
    60 	__ASSERT_DEBUG(iNewName!=NULL, User::Invariant());
       
    61 	
       
    62 	return *iNewName;
       
    63 	}
       
    64 
       
    65 void CMsvAttachmentRename::InternalizeL(RReadStream& aStream)
       
    66 	{
       
    67 	delete iOldName;
       
    68 	iOldName = NULL;
       
    69 	iOldName = HBufC::NewL(aStream, KMaxTInt);
       
    70 	delete iNewName;
       
    71 	iNewName = NULL;
       
    72 	iNewName = HBufC::NewL(aStream, KMaxTInt);
       
    73 	}
       
    74 	
       
    75 void CMsvAttachmentRename::ExternalizeL(RWriteStream& aStream) const
       
    76 	{
       
    77 	__ASSERT_DEBUG(iOldName!=NULL, User::Invariant());
       
    78 	aStream << *iOldName;
       
    79 	__ASSERT_DEBUG(iNewName!=NULL, User::Invariant());
       
    80 	aStream << *iNewName;
       
    81 	}
       
    82