|
1 /* |
|
2 * Copyright (c) 2010 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 * EAP-FAST PAC store configuration data |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 3 % |
|
21 */ |
|
22 #include <QDebug> |
|
23 #include <eapqtpacstoreconfig.h> |
|
24 |
|
25 EapQtPacStoreConfig::EapQtPacStoreConfig() |
|
26 { |
|
27 } |
|
28 |
|
29 EapQtPacStoreConfig::~EapQtPacStoreConfig() |
|
30 { |
|
31 // scoped pointer deleted automatically |
|
32 } |
|
33 |
|
34 QVariant EapQtPacStoreConfig::value(const PacStoreSettings id) const |
|
35 { |
|
36 // check for valid range, otherwise memory is consumed for no reason |
|
37 if(id >= PacStoreLast) { |
|
38 qDebug("ERROR: EapQtPacStoreConfig::value - invalid id!"); |
|
39 return QVariant::Invalid; |
|
40 } |
|
41 return mPacStoreSettings[id]; |
|
42 } |
|
43 |
|
44 void EapQtPacStoreConfig::setValue( |
|
45 const PacStoreSettings id, |
|
46 const QVariant & newValue) |
|
47 { |
|
48 // check for valid range, otherwise memory is consumed for no reason |
|
49 if(id < PacStoreLast) { |
|
50 mPacStoreSettings[id] = newValue; |
|
51 } else { |
|
52 qDebug("ERROR: EapQtPacStoreConfig::setValue - invalid id!"); |
|
53 } |
|
54 } |
|
55 |
|
56 void EapQtPacStoreConfig::clear() |
|
57 { |
|
58 mPacStoreSettings.clear(); |
|
59 } |
|
60 |
|
61 bool EapQtPacStoreConfig::operator==(const EapQtPacStoreConfig & rhs ) const |
|
62 { |
|
63 bool ret = true; |
|
64 if (mPacStoreSettings.size() != rhs.mPacStoreSettings.size()) { |
|
65 qWarning("EapQtPacStoreConfig::operator==(): size: expect %d, actual %d ", |
|
66 mPacStoreSettings.size(), |
|
67 rhs.mPacStoreSettings.size() ); |
|
68 ret = false; |
|
69 } |
|
70 QHashIterator<int, QVariant> i(mPacStoreSettings); |
|
71 |
|
72 while (i.hasNext()) { |
|
73 i.next(); |
|
74 if (!rhs.mPacStoreSettings.contains(i.key())){ |
|
75 qWarning("EapQtPacStoreConfig::operator==(): key not found: %d", i.key()); |
|
76 ret = false; |
|
77 |
|
78 } |
|
79 if (i.value() != rhs.mPacStoreSettings[i.key()]){ |
|
80 qWarning("EapQtPacStoreConfig::operator==(): values not match"); |
|
81 qDebug() << "Expect: " << i.value(); |
|
82 qDebug() << "Actual: " << rhs.mPacStoreSettings[i.key()]; |
|
83 ret = false; |
|
84 } |
|
85 } |
|
86 return ret; |
|
87 } |
|
88 |
|
89 |
|
90 bool EapQtPacStoreConfig::operator=(const EapQtPacStoreConfig & rhs ) |
|
91 { |
|
92 mPacStoreSettings = rhs.mPacStoreSettings; |
|
93 } |