sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: sl@0: using namespace UserPromptService; sl@0: sl@0: sl@0: EXPORT_C CClientEntity* CClientEntity::NewL(const TDesC8& aName) sl@0: /** sl@0: Creates a new client entity object. sl@0: @param aName A name that uniquely identifies the entity within the context sl@0: of the client process. sl@0: @return A pointer to the new client entity object. sl@0: */ sl@0: { sl@0: CClientEntity* self = CClientEntity::NewLC(aName); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CClientEntity* CClientEntity::NewLC(const TDesC8& aName) sl@0: /** sl@0: Creates a new client entity object and places the pointer on the cleanup stack. sl@0: @param aName A name that uniquely identifies the entity within the context sl@0: of the client process. sl@0: @return A pointer to the new client entity object. sl@0: */ sl@0: { sl@0: CClientEntity* self = new(ELeave) CClientEntity(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aName); sl@0: return self; sl@0: } sl@0: sl@0: void CClientEntity::ConstructL(const TDesC8& aName) sl@0: /** sl@0: Second phase constructor sl@0: @param aClientEntityName A descriptor containing the name of the client entity. sl@0: */ sl@0: { sl@0: if (aName.Length() > KUpsMaxClientEntityLength) sl@0: { sl@0: User::Leave(KErrUpsBadClientEntityLength); sl@0: } sl@0: iName = aName.AllocL(); sl@0: } sl@0: sl@0: EXPORT_C const TDesC8& CClientEntity::Name() const sl@0: /** sl@0: Gets the unique name for the client entity. sl@0: @return A descriptor containing the client entity name. sl@0: */ sl@0: { sl@0: return *iName; sl@0: } sl@0: sl@0: CClientEntity::CClientEntity() sl@0: /** sl@0: Constructor sl@0: */ sl@0: { sl@0: } sl@0: sl@0: CClientEntity::~CClientEntity() sl@0: /** sl@0: Destructor sl@0: */ sl@0: { sl@0: delete iName; sl@0: }