serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkmanageobjects.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 24 Nov 2009 08:56:33 +0200
changeset 33 50974a8b132e
parent 19 989d2f495d90
child 37 5d0ec8b709be
permissions -rw-r--r--
Revision: 200945 Kit: 200948

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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:  CLandmarkManageObjects class implementation.
 *
*/


#include "clandmarkmanageobjects.h"
#include "clandmarkcmdbase.h"

// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CLandmarkManageObjects* CLandmarkManageObjects::NewL( )
	{
	CLandmarkManageObjects* self = new (ELeave) CLandmarkManageObjects();
	return self;
	}

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::CLandmarkManageObjects()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CLandmarkManageObjects::CLandmarkManageObjects( ) :
	CActive(EPriorityNormal)
	{
	CActiveScheduler::Add (this );
	}

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::~CLandmarkManageObjects()
// Destructor.
// -----------------------------------------------------------------------------
//
CLandmarkManageObjects::~CLandmarkManageObjects( )
	{
	Cancel ( );
	iObjects.ResetAndDestroy ( );
	iObjects.Close();
	}

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::Start()
// Start asynchronous operation.
// -----------------------------------------------------------------------------
//
void CLandmarkManageObjects::Start( )
	{
	SetActive ( );
	TRequestStatus* status = &iStatus;
	User::RequestComplete (status, KErrNone );
	}

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::AppendL( CLandmarkCmdBase* aObject )
// Execute the next step.
// -----------------------------------------------------------------------------
//
void CLandmarkManageObjects::AppendL( CLandmarkCmdBase* aObject )
	{
	iObjects.AppendL (aObject );
	}

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::CancelObject()
// Execute the next step.
// -----------------------------------------------------------------------------
//
void CLandmarkManageObjects::CancelObject( TInt32 aTransactionId )
	{
	TInt count = iObjects.Count ( );
	for (TInt i = 0; i< count; ++i )
		{
		if ( iObjects[i]->TransactionId ( )== aTransactionId )
			{
			iObjects[i]->Cancel ( );
			break;
			}
		}
	}
// -----------------------------------------------------------------------------
// CLandmarkManageObjects::RunL()
// Notify Observer on completion of the asynchronous call.
// -----------------------------------------------------------------------------
//
void CLandmarkManageObjects::RunL( )
	{
	TInt count = iObjects.Count ( );
	for (TInt i = 0; i< count; ++i )
		{
		if ( !iObjects[i]->IsActive() )
			{
			delete iObjects[i];
			//Removes a node from the RPointerArray.
			iObjects.Remove (i );
			//Decrement node count.
			--count;
			//Decrement index count since the present node
			//has been deleted.
			--i;
			}
		}
	}

// -----------------------------------------------------------------------------
// CLandmarkManageObjects::DoCancel()
// Cancel asynchronous call.
// -----------------------------------------------------------------------------
//
void CLandmarkManageObjects::DoCancel( )
	{
	}
//end of file