1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/authorisation/userpromptservice/policies/source/cliententity.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,87 @@
1.4 +/*
1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include <ups/cliententity.h>
1.23 +#include <ups/upserr.h>
1.24 +
1.25 +using namespace UserPromptService;
1.26 +
1.27 +
1.28 +EXPORT_C CClientEntity* CClientEntity::NewL(const TDesC8& aName)
1.29 +/**
1.30 +Creates a new client entity object.
1.31 +@param aName A name that uniquely identifies the entity within the context
1.32 + of the client process.
1.33 +@return A pointer to the new client entity object.
1.34 +*/
1.35 + {
1.36 + CClientEntity* self = CClientEntity::NewLC(aName);
1.37 + CleanupStack::Pop(self);
1.38 + return self;
1.39 + }
1.40 +
1.41 +EXPORT_C CClientEntity* CClientEntity::NewLC(const TDesC8& aName)
1.42 +/**
1.43 +Creates a new client entity object and places the pointer on the cleanup stack.
1.44 +@param aName A name that uniquely identifies the entity within the context
1.45 + of the client process.
1.46 +@return A pointer to the new client entity object.
1.47 +*/
1.48 + {
1.49 + CClientEntity* self = new(ELeave) CClientEntity();
1.50 + CleanupStack::PushL(self);
1.51 + self->ConstructL(aName);
1.52 + return self;
1.53 + }
1.54 +
1.55 +void CClientEntity::ConstructL(const TDesC8& aName)
1.56 +/**
1.57 +Second phase constructor
1.58 +@param aClientEntityName A descriptor containing the name of the client entity.
1.59 +*/
1.60 + {
1.61 + if (aName.Length() > KUpsMaxClientEntityLength)
1.62 + {
1.63 + User::Leave(KErrUpsBadClientEntityLength);
1.64 + }
1.65 + iName = aName.AllocL();
1.66 + }
1.67 +
1.68 +EXPORT_C const TDesC8& CClientEntity::Name() const
1.69 +/**
1.70 +Gets the unique name for the client entity.
1.71 +@return A descriptor containing the client entity name.
1.72 +*/
1.73 + {
1.74 + return *iName;
1.75 + }
1.76 +
1.77 +CClientEntity::CClientEntity()
1.78 +/**
1.79 +Constructor
1.80 +*/
1.81 + {
1.82 + }
1.83 +
1.84 +CClientEntity::~CClientEntity()
1.85 +/**
1.86 +Destructor
1.87 +*/
1.88 + {
1.89 + delete iName;
1.90 + }