wlanutilities/wlanwizard/t_wlanwizard/stubs/stub_wlanqtutilsap.cpp
changeset 39 7b3e49e4608a
parent 36 682dd021f9be
child 43 72ebcbb64834
equal deleted inserted replaced
36:682dd021f9be 39:7b3e49e4608a
     1 /*
       
     2  * Copyright (c) 2009 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  * This is the source file for WlanQtUtilsAp class.
       
    16  */
       
    17 
       
    18 #include <QString>
       
    19 #include <QHash>
       
    20 #include <QVariant>
       
    21 #include <QDebug>
       
    22 #include "wlanqtutilscommon.h"
       
    23 #include "wlanqtutilsap.h"
       
    24 
       
    25 class WlanQtUtilsApPrivate
       
    26 {
       
    27     friend class WlanQtUtilsAp;
       
    28 
       
    29 private:
       
    30     QHash<int, QVariant> mConfigurations;
       
    31 };
       
    32 
       
    33 WlanQtUtilsAp::WlanQtUtilsAp() :
       
    34     d_ptr(new WlanQtUtilsApPrivate())
       
    35 {
       
    36 }
       
    37 
       
    38 WlanQtUtilsAp::WlanQtUtilsAp(const WlanQtUtilsAp &ref) :
       
    39     d_ptr(new WlanQtUtilsApPrivate())
       
    40 {
       
    41     d_ptr->mConfigurations = ref.d_ptr->mConfigurations;
       
    42 }
       
    43 
       
    44 WlanQtUtilsAp::~WlanQtUtilsAp()
       
    45 {
       
    46     d_ptr->mConfigurations.clear();
       
    47     delete d_ptr;
       
    48 }
       
    49 
       
    50 QVariant WlanQtUtilsAp::value(int identifier) const
       
    51 {
       
    52     return d_ptr->mConfigurations[identifier];
       
    53 }
       
    54 
       
    55 void WlanQtUtilsAp::setValue(int identifier, QVariant value)
       
    56 {
       
    57     d_ptr->mConfigurations[identifier] = value;
       
    58 }
       
    59 
       
    60 bool WlanQtUtilsAp::operator==(const WlanQtUtilsAp & rhs ) const
       
    61 {
       
    62     bool ret = true;
       
    63     if (d_ptr->mConfigurations.size() != rhs.d_ptr->mConfigurations.size()) {
       
    64         qWarning("WlanQtUtilsAp::operator==(): size: expect %d, actual %d ",
       
    65             d_ptr->mConfigurations.size(),
       
    66             rhs.d_ptr->mConfigurations.size() );
       
    67         ret = false;
       
    68     }
       
    69     QHashIterator<int, QVariant> i(d_ptr->mConfigurations);
       
    70     
       
    71     while (i.hasNext()) {
       
    72         i.next();
       
    73         if (!rhs.d_ptr->mConfigurations.contains(i.key())){
       
    74             qWarning("WlanQtUtilsAp::operator==(): key not found: %d", i.key());
       
    75             ret = false;
       
    76             
       
    77         }
       
    78         if (i.value() != rhs.d_ptr->mConfigurations[i.key()]){
       
    79             qWarning("WlanQtUtilsAp::operator==(): values not match");
       
    80             qDebug() << "Expect: " << i.value();
       
    81             qDebug() << "Actual: " << i.value();
       
    82             ret = false;
       
    83         }
       
    84     }
       
    85     return ret;
       
    86 }
       
    87 
       
    88