|
1 /* |
|
2 * Copyright (c) 2002 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: msgarrays implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "MsgArrays.h" |
|
22 |
|
23 |
|
24 // CONSTANTS |
|
25 const TInt KGranularity = 4; |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // TUidNameInfo::TUidNameInfo |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C TUidNameInfo::TUidNameInfo( TUid aUid, const TDesC& aName ) |
|
35 :iUid( aUid ), |
|
36 iName( aName ) |
|
37 { |
|
38 } |
|
39 |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // TUidNameKey::TUidNameKey |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 EXPORT_C TUidNameKey::TUidNameKey( TKeyCmpText aType ) : TKeyArrayFix( KGranularity, aType, 0 ) |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // TUidNameKey::Compare |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 TInt TUidNameKey::Compare( TInt aLeft, TInt aRight ) const |
|
55 { |
|
56 TDesC* left=( ( TDesC* )At( aLeft ) ); |
|
57 TDesC* right=( ( TDesC* )At( aRight ) ); |
|
58 switch ( iCmpType ) |
|
59 { |
|
60 case ECmpFolded: |
|
61 return( left->CompareF( *right ) ); |
|
62 case ECmpCollated: |
|
63 return( left->CompareC( *right ) ); |
|
64 default: |
|
65 return( left->Compare( *right ) ); |
|
66 } |
|
67 } |
|
68 |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CUidNameArray::CUidNameArray |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 EXPORT_C CUidNameArray::CUidNameArray( TInt aGranularity ) |
|
75 :CArrayFixFlat<TUidNameInfo>( aGranularity ) |
|
76 { |
|
77 } |
|
78 |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CUidNameArray::~CUidNameArray |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C CUidNameArray::~CUidNameArray() |
|
85 { |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CUidNameArray::MdcaCount |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 EXPORT_C TInt CUidNameArray::MdcaCount() const |
|
93 { |
|
94 return Count(); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CUidNameArray::MdcaPoint |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C TPtrC CUidNameArray::MdcaPoint( TInt aIndex ) const |
|
102 { |
|
103 return At( aIndex ).iName; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CUidNameArray::Sort |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C void CUidNameArray::Sort( TKeyCmpText aTextComparisonType ) |
|
111 { |
|
112 TUidNameKey key( aTextComparisonType ); |
|
113 CArrayFixBase::Sort( key ); |
|
114 } |
|
115 |
|
116 |
|
117 // End of File |