|
1 /* |
|
2 * Copyright (c) 2007-2007 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 "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: Encapsulates uid and name. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "intnamepair.h" |
|
20 |
|
21 |
|
22 // ======== MEMBER FUNCTIONS ======== |
|
23 |
|
24 CIntNamePair::CIntNamePair( const TInt& aInt ) : iInt( aInt ) |
|
25 { |
|
26 } |
|
27 |
|
28 void CIntNamePair::ConstructL( const TDesC& aName ) |
|
29 { |
|
30 iName = aName.AllocL(); |
|
31 } |
|
32 |
|
33 CIntNamePair* CIntNamePair::NewL( const TInt& aInt, |
|
34 const TDesC& aName ) |
|
35 { |
|
36 CIntNamePair* self = CIntNamePair::NewLC( aInt, aName ); |
|
37 CleanupStack::Pop( self ); |
|
38 |
|
39 return self; |
|
40 } |
|
41 |
|
42 CIntNamePair* CIntNamePair::NewLC( const TInt& aInt, |
|
43 const TDesC& aName ) |
|
44 { |
|
45 CIntNamePair* self = new( ELeave ) CIntNamePair( aInt ); |
|
46 CleanupStack::PushL( self ); |
|
47 self->ConstructL( aName ); |
|
48 |
|
49 return self; |
|
50 } |
|
51 |
|
52 CIntNamePair::~CIntNamePair() |
|
53 { |
|
54 delete iName; |
|
55 } |
|
56 |
|
57 |
|
58 //----------------------------------------------------------------------------- |
|
59 // CIntNamePair::Uid |
|
60 //----------------------------------------------------------------------------- |
|
61 // |
|
62 const TInt& CIntNamePair::Int() const |
|
63 { |
|
64 return iInt; |
|
65 } |
|
66 |
|
67 //----------------------------------------------------------------------------- |
|
68 // CIntNamePair::Name |
|
69 //----------------------------------------------------------------------------- |
|
70 // |
|
71 const TDesC& CIntNamePair::Name() const |
|
72 { |
|
73 if( !iName ) |
|
74 { |
|
75 return KNullDesC; |
|
76 } |
|
77 else |
|
78 { |
|
79 return *iName; |
|
80 } |
|
81 } |