authorisation/userpromptservice/policies/source/cliententity.cpp
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ups/cliententity.h>
       
    20 #include <ups/upserr.h>
       
    21 
       
    22 using namespace UserPromptService;
       
    23 
       
    24 
       
    25 EXPORT_C CClientEntity* CClientEntity::NewL(const TDesC8& aName)
       
    26 /**
       
    27 Creates a new client entity object.
       
    28 @param aName	A name that uniquely identifies the entity within the context
       
    29 				of the client process.
       
    30 @return			A pointer to the new client entity object.						 
       
    31 */
       
    32 	{
       
    33 	CClientEntity* self = CClientEntity::NewLC(aName);
       
    34 	CleanupStack::Pop(self);
       
    35 	return self;
       
    36 	}
       
    37 
       
    38 EXPORT_C CClientEntity* CClientEntity::NewLC(const TDesC8& aName)
       
    39 /**
       
    40 Creates a new client entity object and places the pointer on the cleanup stack.
       
    41 @param aName	A name that uniquely identifies the entity within the context
       
    42 				of the client process.
       
    43 @return			A pointer to the new client entity object.						 
       
    44 */
       
    45 	{
       
    46 	CClientEntity* self = new(ELeave) CClientEntity();
       
    47 	CleanupStack::PushL(self);
       
    48 	self->ConstructL(aName);
       
    49 	return self;
       
    50 	}
       
    51 
       
    52 void CClientEntity::ConstructL(const TDesC8& aName)
       
    53 /**
       
    54 Second phase constructor
       
    55 @param aClientEntityName A descriptor containing the name of the client entity.
       
    56 */
       
    57 	{	
       
    58 	if (aName.Length() > KUpsMaxClientEntityLength)
       
    59 		{
       
    60 		User::Leave(KErrUpsBadClientEntityLength);
       
    61 		}
       
    62 	iName = aName.AllocL();
       
    63 	}
       
    64 	
       
    65 EXPORT_C const TDesC8& CClientEntity::Name() const
       
    66 /**
       
    67 Gets the unique name for the client entity.
       
    68 @return A descriptor containing the client entity name.
       
    69 */
       
    70 	{
       
    71 	return *iName;
       
    72 	}
       
    73 
       
    74 CClientEntity::CClientEntity()
       
    75 /**
       
    76 Constructor
       
    77 */
       
    78 	{	
       
    79 	}
       
    80 	
       
    81 CClientEntity::~CClientEntity()
       
    82 /**
       
    83 Destructor
       
    84 */
       
    85 	{
       
    86 	delete iName;
       
    87 	}