1 /* |
|
2 * Copyright (c) 2005 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 <centralrepository.h> |
|
20 #include "centralrepository_stub_helper.h" |
|
21 |
|
22 TInt mFailCode = KErrNone; |
|
23 TInt mCurrentVal = 0; |
|
24 |
|
25 void CentralRepositoryStubHelper::reset() |
|
26 { |
|
27 mFailCode = KErrNone; |
|
28 mCurrentVal = 0; |
|
29 } |
|
30 void CentralRepositoryStubHelper::setFailCode(TInt err) |
|
31 { |
|
32 mFailCode = err; |
|
33 } |
|
34 void CentralRepositoryStubHelper::setCurrentVal(TInt val) |
|
35 { |
|
36 mCurrentVal = val; |
|
37 } |
|
38 TInt CentralRepositoryStubHelper::currentVal() |
|
39 { |
|
40 return mCurrentVal; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C CRepository* CRepository::NewL( TUid aRepositoryUid ) |
|
48 { |
|
49 CRepository* self = CRepository::NewLC( aRepositoryUid ); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 CRepository* CRepository::NewLC( TUid /*aRepositoryUid*/ ) |
|
60 { |
|
61 CRepository* self = new (ELeave) CRepository(); |
|
62 if (mFailCode == KErrNoMemory) { |
|
63 User::Leave(KErrNoMemory); |
|
64 } |
|
65 CleanupStack::PushL( self ); |
|
66 return self; |
|
67 } |
|
68 |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 CRepository::~CRepository() |
|
75 { |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 TInt CRepository::Get(TUint32 /*aKey*/, TInt& aValue) |
|
83 { |
|
84 aValue = mCurrentVal; |
|
85 return mFailCode; |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 TInt CRepository::Set(TUint32 /*aKey*/, TInt aValue) |
|
94 { |
|
95 if ( mFailCode == KErrNone ) |
|
96 { |
|
97 mCurrentVal = aValue; |
|
98 } |
|
99 return mFailCode; |
|
100 } |
|
101 |
|
102 |
|