metadataengine/client/src/mdedatabuffer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 00:24:33 +0200
changeset 3 b73a2e62868f
parent 0 c53acadfccc6
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2007-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:  Serializard data buffer container
*
*/

#include <mdedatabuffer.h>

#include "mdcserializationbuffer.h"

EXPORT_C RMdEDataBuffer::RMdEDataBuffer() : iBuffer( NULL )
	{
	}

EXPORT_C void RMdEDataBuffer::Close()
	{
	if( iBuffer )
		{
		delete iBuffer;
		iBuffer = NULL;
		}
	}

void RMdEDataBuffer::SetBufferL(CMdCSerializationBuffer* aBuffer)
	{
	if( !iBuffer )
		{
		iBuffer = aBuffer;
		}
	else
		{
		User::Leave( KErrCorrupt );
		}
	}

CMdCSerializationBuffer* RMdEDataBuffer::GetBufferLC()
	{
	CMdCSerializationBuffer* buffer = iBuffer;
	iBuffer = NULL; // cleanup stack handles deletion, if PushL leaves
	CleanupStack::PushL( buffer );
	return buffer;
	}