mediasettings/videosettingsplugin/tsrc/testaccesspointentry/stub/src/cmmanager_shim.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:14:16 +0300
changeset 46 adbe7d5ba2f5
child 67 72c709219fcd
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   CmManagerShim stub
* 
*/

// INCLUDE FILES
#include "cmmanager_shim.h"
#include "cmconnectionmethod_shim.h"
#include <qlist.h>

int CmManagerShim::mDestructorCount = 0;
int CmManagerShim::mConnectionMethodThrowsAtId = -1;

// ---------------------------------------------------------------------------
// CmManagerShim
// ---------------------------------------------------------------------------
//
CmManagerShim::CmManagerShim() 
{
}

// ---------------------------------------------------------------------------
// CmManagerShim
// ---------------------------------------------------------------------------
//
CmManagerShim::~CmManagerShim()
{
    mDestructorCount++;
    clear();
}

// ---------------------------------------------------------------------------
// connectionMethod
// ---------------------------------------------------------------------------
//
CmConnectionMethodShim* CmManagerShim::connectionMethod(uint connectionMethodId) const
{
    if(mConnectionMethodThrowsAtId == connectionMethodId)
    {
        throw std::exception();
    }
    
    return mConnectionMethods.value(connectionMethodId, 0);
}

// ---------------------------------------------------------------------------
// connectionMethod
// ---------------------------------------------------------------------------
//
void CmManagerShim::connectionMethod(
    QList<uint> &cmArray,
    bool legacyOnly) const
{
    Q_UNUSED(legacyOnly);
    cmArray.append(mConnectionMethods.keys());
}

// ---------------------------------------------------------------------------
// clear
// ---------------------------------------------------------------------------
//
void CmManagerShim::clear()
{
    foreach(uint key, mConnectionMethods.keys())
    {
        delete mConnectionMethods[key];
        mConnectionMethods[key] = 0;
    }
    
    mConnectionMethods.clear();
}