|
1 /* |
|
2 * Copyright (c) 2007-2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "hnstringhandler.h" |
|
20 #include "hnmdmodel.h" |
|
21 #include "hnutils.h" |
|
22 #include "hnmdlocalization.h" |
|
23 |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 void HnStringHandler::LocaliseL( RBuf& aDestination, RBuf& aSource, |
|
30 THnMdCommonPointers* aCmnPtrs ) |
|
31 { |
|
32 HnStringHandler::LocaliseL( aDestination, aSource, NULL, NULL, aCmnPtrs); |
|
33 } |
|
34 |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 void HnStringHandler::LocaliseL( RBuf& aDestination, |
|
41 RBuf& aSource, |
|
42 CDesC16Array* aDesParams, |
|
43 CArrayFix<TInt>* aIntParams, |
|
44 THnMdCommonPointers* aCmnPtrs ) |
|
45 { |
|
46 CHnMdLocalization* localization(NULL); |
|
47 if (aCmnPtrs) |
|
48 { |
|
49 localization = aCmnPtrs->iLocalization; |
|
50 } |
|
51 else |
|
52 { |
|
53 localization = THnMdCommonPointers::Static()->iLocalization; |
|
54 } |
|
55 |
|
56 HBufC* buf = localization->LoadL( aSource, aDesParams, aIntParams ); |
|
57 aDestination.Assign( buf); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 TInt HnStringHandler::CompareIgnoreCaseL( const TDesC8& aLeft, |
|
65 const TDesC8& aRight ) |
|
66 { |
|
67 TInt res( KErrGeneral ); |
|
68 |
|
69 RBuf8 left; |
|
70 CleanupClosePushL( left ); |
|
71 left.CreateL( aLeft.Length() ); |
|
72 left.CopyUC( aLeft ); |
|
73 |
|
74 RBuf8 right; |
|
75 CleanupClosePushL( right ); |
|
76 right.CreateL( aRight.Length() ); |
|
77 right.CopyUC( aRight ); |
|
78 |
|
79 res = left.Compare( right ); |
|
80 |
|
81 CleanupStack::PopAndDestroy( &left ); |
|
82 CleanupStack::PopAndDestroy( &right ); |
|
83 return res; |
|
84 |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 TInt HnStringHandler::CompareIgnoreCaseL( const TDesC& aLeft, |
|
92 const TDesC& aRight ) |
|
93 { |
|
94 TInt res( KErrGeneral ); |
|
95 |
|
96 RBuf left; |
|
97 CleanupClosePushL( left ); |
|
98 left.CreateL( aLeft.Length() ); |
|
99 left.CopyUC( aLeft ); |
|
100 |
|
101 RBuf right; |
|
102 CleanupClosePushL( right ); |
|
103 right.CreateL( aRight.Length() ); |
|
104 right.CopyUC( aRight ); |
|
105 |
|
106 res = left.Compare( right ); |
|
107 |
|
108 CleanupStack::PopAndDestroy( &right ); |
|
109 CleanupStack::PopAndDestroy( &left ); |
|
110 |
|
111 return res; |
|
112 } |
|
113 |