author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:54:53 +0300 | |
branch | RCL_3 |
changeset 21 | 9da50d567e3c |
parent 20 | f4a778e096c2 |
permissions | -rw-r--r-- |
20 | 1 |
/* |
2 |
* Copyright (c) 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: Represents a pool element in the contacts cache. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "CPcsDebug.h" |
|
21 |
#include "CPcsPoolElement.h" |
|
22 |
#include "CPsData.h" |
|
23 |
#include "CPcsAlgorithm1Utils.h" |
|
24 |
||
25 |
// ============================== MEMBER FUNCTIONS ============================ |
|
26 |
||
27 |
// ---------------------------------------------------------------------------- |
|
28 |
// CPcsPoolElement::NewL |
|
29 |
// Two Phase Construction |
|
30 |
// ---------------------------------------------------------------------------- |
|
31 |
CPcsPoolElement* CPcsPoolElement::NewL(CPsData& aPsData) |
|
32 |
{ |
|
33 |
CPcsPoolElement* self = new ( ELeave ) CPcsPoolElement(); |
|
34 |
CleanupStack::PushL( self ); |
|
35 |
self->ConstructL(aPsData); |
|
36 |
CleanupStack::Pop( self ); |
|
37 |
return self; |
|
38 |
} |
|
39 |
||
40 |
// ---------------------------------------------------------------------------- |
|
41 |
// CPcsPoolElement::CPcsPoolElement |
|
42 |
// Constructor |
|
43 |
// ---------------------------------------------------------------------------- |
|
44 |
CPcsPoolElement::CPcsPoolElement() |
|
45 |
{ |
|
46 |
} |
|
47 |
||
48 |
// ---------------------------------------------------------------------------- |
|
49 |
// CPcsPoolElement::ConstructL |
|
50 |
// 2nd Phase Constructer |
|
51 |
// ---------------------------------------------------------------------------- |
|
52 |
void CPcsPoolElement::ConstructL(CPsData& aPsData) |
|
53 |
{ |
|
54 |
iPsData = &aPsData; |
|
55 |
} |
|
56 |
||
57 |
// ---------------------------------------------------------------------------- |
|
58 |
// CPcsPoolElement::~CPcsPoolElement |
|
59 |
// Destructor |
|
60 |
// ---------------------------------------------------------------------------- |
|
61 |
CPcsPoolElement::~CPcsPoolElement() |
|
62 |
{ |
|
63 |
// Do not delete the PsData in the destructor |
|
64 |
// It is deleted separately, since it is used at multiple locations |
|
65 |
} |
|
66 |
||
67 |
// ---------------------------------------------------------------------------- |
|
68 |
// CPcsPoolElement::GetPsData |
|
69 |
// |
|
70 |
// ---------------------------------------------------------------------------- |
|
71 |
CPsData* CPcsPoolElement::GetPsData() |
|
72 |
{ |
|
73 |
return iPsData; |
|
74 |
} |
|
75 |
||
76 |
// ---------------------------------------------------------------------------- |
|
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
77 |
// CPcsPoolElement::CompareByDataL |
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
78 |
// |
20 | 79 |
// ---------------------------------------------------------------------------- |
21
9da50d567e3c
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
20
diff
changeset
|
80 |
TInt CPcsPoolElement::CompareByDataL ( const CPcsPoolElement& aObject1, const CPcsPoolElement& aObject2 ) |
20 | 81 |
{ |
82 |
CPsData *data1 = const_cast<CPcsPoolElement&> (aObject1).GetPsData(); |
|
83 |
CPsData *data2 = const_cast<CPcsPoolElement&> (aObject2).GetPsData(); |
|
84 |
return (CPcsAlgorithm1Utils::CompareDataBySortOrderL(*(data1), *(data2))); |
|
85 |
} |
|
86 |
||
87 |
// ---------------------------------------------------------------------------- |
|
88 |
// CPcsPoolElement::IsDataMatch |
|
89 |
// |
|
90 |
// ---------------------------------------------------------------------------- |
|
91 |
TBool CPcsPoolElement::IsDataMatch(TInt aIndex) |
|
92 |
{ |
|
93 |
__ASSERT_DEBUG( aIndex < 8, User::Panic( _L("CPcsPoolElement"), KErrOverflow ) ); |
|
94 |
TUint8 val = 1 << aIndex; |
|
95 |
return (iDataMatchAttribute & val); |
|
96 |
} |
|
97 |
||
98 |
// ---------------------------------------------------------------------------- |
|
99 |
// CPcsPoolElement::SetDataMatch |
|
100 |
// |
|
101 |
// ---------------------------------------------------------------------------- |
|
102 |
void CPcsPoolElement::SetDataMatch(TInt aIndex) |
|
103 |
{ |
|
104 |
__ASSERT_DEBUG( aIndex < 8, User::Panic( _L("CPcsPoolElement"), KErrOverflow ) ); |
|
105 |
TUint8 val = 1 << aIndex; |
|
106 |
iDataMatchAttribute |= val; |
|
107 |
} |
|
108 |
||
109 |
// ---------------------------------------------------------------------------- |
|
110 |
// CPcsPoolElement::ClearDataMatchAttribute |
|
111 |
// |
|
112 |
// ---------------------------------------------------------------------------- |
|
113 |
void CPcsPoolElement::ClearDataMatchAttribute() |
|
114 |
{ |
|
115 |
iDataMatchAttribute = 0x0; |
|
116 |
} |
|
117 |
||
118 |
||
119 |
// End of file |
|
120 |