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