mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmmanager_shim.cpp
changeset 46 adbe7d5ba2f5
child 67 72c709219fcd
equal deleted inserted replaced
28:c48470be1ba7 46:adbe7d5ba2f5
       
     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:   CmManagerShim stub
       
    15 * 
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "cmmanager_shim.h"
       
    20 #include "cmconnectionmethod_shim.h"
       
    21 #include <qlist.h>
       
    22 
       
    23 int CmManagerShim::mDestructorCount = 0;
       
    24 int CmManagerShim::mConnectionMethodThrowsAtId = -1;
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // CmManagerShim
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CmManagerShim::CmManagerShim() 
       
    31 {
       
    32 }
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CmManagerShim
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 CmManagerShim::~CmManagerShim()
       
    39 {
       
    40     mDestructorCount++;
       
    41     clear();
       
    42 }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // connectionMethod
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CmConnectionMethodShim* CmManagerShim::connectionMethod(uint connectionMethodId) const
       
    49 {
       
    50     if(mConnectionMethodThrowsAtId == connectionMethodId)
       
    51     {
       
    52         throw std::exception();
       
    53     }
       
    54     
       
    55     return mConnectionMethods.value(connectionMethodId, 0);
       
    56 }
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // connectionMethod
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 void CmManagerShim::connectionMethod(
       
    63     QList<uint> &cmArray,
       
    64     bool legacyOnly) const
       
    65 {
       
    66     Q_UNUSED(legacyOnly);
       
    67     cmArray.append(mConnectionMethods.keys());
       
    68 }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // clear
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 void CmManagerShim::clear()
       
    75 {
       
    76     foreach(uint key, mConnectionMethods.keys())
       
    77     {
       
    78         delete mConnectionMethods[key];
       
    79         mConnectionMethods[key] = 0;
       
    80     }
       
    81     
       
    82     mConnectionMethods.clear();
       
    83 }