wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig_stub.cpp
changeset 56 de27cc8389dd
parent 50 d4198dcb9983
child 58 301aeb18ae47
equal deleted inserted replaced
50:d4198dcb9983 56:de27cc8389dd
     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: 2 %
       
    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(PacStoreSettings id)
       
    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(PacStoreSettings id, QVariant newValue)
       
    45 {
       
    46     // check for valid range, otherwise memory is consumed for no reason
       
    47     if(id < PacStoreLast) {
       
    48         mPacStoreSettings[id] = newValue;
       
    49     } else {
       
    50         qDebug("ERROR: EapQtPacStoreConfig::setValue - invalid id!");
       
    51     }
       
    52 }
       
    53 
       
    54 void EapQtPacStoreConfig::clear() {
       
    55     mPacStoreSettings.clear();
       
    56 }
       
    57 
       
    58 bool EapQtPacStoreConfig::operator==(const EapQtPacStoreConfig & rhs ) const
       
    59 {
       
    60     bool ret = true;
       
    61     if (mPacStoreSettings.size() != rhs.mPacStoreSettings.size()) {
       
    62         qWarning("EapQtPacStoreConfig::operator==(): size: expect %d, actual %d ",
       
    63             mPacStoreSettings.size(),
       
    64             rhs.mPacStoreSettings.size() );
       
    65         ret = false;
       
    66     }
       
    67     QHashIterator<int, QVariant> i(mPacStoreSettings);
       
    68     
       
    69     while (i.hasNext()) {
       
    70         i.next();
       
    71         if (!rhs.mPacStoreSettings.contains(i.key())){
       
    72             qWarning("EapQtPacStoreConfig::operator==(): key not found: %d", i.key());
       
    73             ret = false;
       
    74             
       
    75         }
       
    76         if (i.value() != rhs.mPacStoreSettings[i.key()]){
       
    77             qWarning("EapQtPacStoreConfig::operator==(): values not match");
       
    78             qDebug() << "Expect: " << i.value();
       
    79             qDebug() << "Actual: " << rhs.mPacStoreSettings[i.key()];
       
    80             ret = false;
       
    81         }
       
    82     }
       
    83     return ret;
       
    84 }
       
    85 
       
    86 
       
    87 bool EapQtPacStoreConfig::operator=(const EapQtPacStoreConfig & rhs )
       
    88 {
       
    89     mPacStoreSettings = rhs.mPacStoreSettings;
       
    90 }