authorisation/userpromptservice/policies/source/cliententity.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 10 Sep 2009 14:01:51 +0300
changeset 8 35751d3474b7
permissions -rw-r--r--
Revision: 200935

/*
* 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 the License "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 <ups/cliententity.h>
#include <ups/upserr.h>

using namespace UserPromptService;


EXPORT_C CClientEntity* CClientEntity::NewL(const TDesC8& aName)
/**
Creates a new client entity object.
@param aName	A name that uniquely identifies the entity within the context
				of the client process.
@return			A pointer to the new client entity object.						 
*/
	{
	CClientEntity* self = CClientEntity::NewLC(aName);
	CleanupStack::Pop(self);
	return self;
	}

EXPORT_C CClientEntity* CClientEntity::NewLC(const TDesC8& aName)
/**
Creates a new client entity object and places the pointer on the cleanup stack.
@param aName	A name that uniquely identifies the entity within the context
				of the client process.
@return			A pointer to the new client entity object.						 
*/
	{
	CClientEntity* self = new(ELeave) CClientEntity();
	CleanupStack::PushL(self);
	self->ConstructL(aName);
	return self;
	}

void CClientEntity::ConstructL(const TDesC8& aName)
/**
Second phase constructor
@param aClientEntityName A descriptor containing the name of the client entity.
*/
	{	
	if (aName.Length() > KUpsMaxClientEntityLength)
		{
		User::Leave(KErrUpsBadClientEntityLength);
		}
	iName = aName.AllocL();
	}
	
EXPORT_C const TDesC8& CClientEntity::Name() const
/**
Gets the unique name for the client entity.
@return A descriptor containing the client entity name.
*/
	{
	return *iName;
	}

CClientEntity::CClientEntity()
/**
Constructor
*/
	{	
	}
	
CClientEntity::~CClientEntity()
/**
Destructor
*/
	{
	delete iName;
	}