|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : conditiononcentrep.cpp |
|
15 // Part of : System Startup / Condition |
|
16 // Implementation of CConditionOnCentRep and |
|
17 // CConditionOnCentRepFlag classes. |
|
18 // Version : %version: 1 % |
|
19 // This material, including documentation and any related computer |
|
20 // programs, is protected by copyright controlled by Nokia. All |
|
21 // rights are reserved. Copying, including reproducing, storing, |
|
22 // adapting or translating, any or all of this material requires the |
|
23 // prior written consent of Nokia. This material also contains |
|
24 // confidential information which may not be disclosed to others |
|
25 // without the prior written consent of Nokia. |
|
26 // Template version: 4.1 |
|
27 // Nokia Core OS * |
|
28 // File renamed from conditiononcentrep.cpp to cndcentralrepository.cpp as part of Core OS transfer. |
|
29 // |
|
30 |
|
31 |
|
32 |
|
33 #include "cndcentralrepository.h" |
|
34 #include <centralrepository.h> |
|
35 |
|
36 CCndCentralRepository::CCndCentralRepository(const TConditionCheckType aConditionCheckType, const TInt aRepositoryId, |
|
37 const TUint aKey, const TInt aCndValue): iRepositoryId(aRepositoryId), |
|
38 iKey(aKey), |
|
39 iCndValue(aCndValue), |
|
40 iConditionCheckType(aConditionCheckType) |
|
41 { |
|
42 |
|
43 } |
|
44 |
|
45 CCndCentralRepository* CCndCentralRepository::NewL(const TConditionCheckType aConditionCheckType, |
|
46 const TInt aRepositoryId, const TUint aKey, const TInt aCndValue) |
|
47 { |
|
48 CCndCentralRepository* self = new (ELeave)CCndCentralRepository(aConditionCheckType, |
|
49 aRepositoryId, aKey, aCndValue); |
|
50 return self; |
|
51 } |
|
52 |
|
53 TBool CCndCentralRepository::EvaluateL() const |
|
54 { |
|
55 CRepository* repository = CRepository::NewLC(TUid::Uid(iRepositoryId)); |
|
56 TInt value = 0; |
|
57 User::LeaveIfError(repository->Get(iKey, value)); |
|
58 TBool retVal = EFalse; |
|
59 if (iConditionCheckType == ECompareValue) |
|
60 { |
|
61 retVal = (value == iCndValue); |
|
62 } |
|
63 else |
|
64 { |
|
65 retVal = ((value & iCndValue) == iCndValue); |
|
66 } |
|
67 |
|
68 CleanupStack::PopAndDestroy(repository); |
|
69 return retVal; |
|
70 } |
|
71 |
|
72 CCndCentralRepository::~CCndCentralRepository() |
|
73 { |
|
74 } |
|
75 |