serviceproviders/sapi_landmarks/landmarksservice/src/clandmarkmanageobjects.cpp
changeset 19 989d2f495d90
child 37 5d0ec8b709be
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:  CLandmarkManageObjects class implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "clandmarkmanageobjects.h"
       
    20 #include "clandmarkcmdbase.h"
       
    21 
       
    22 // ============================ MEMBER FUNCTIONS ===============================
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CLandmarkManageObjects::NewL()
       
    26 // Two-phased constructor.
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CLandmarkManageObjects* CLandmarkManageObjects::NewL( )
       
    30 	{
       
    31 	CLandmarkManageObjects* self = new (ELeave) CLandmarkManageObjects();
       
    32 	return self;
       
    33 	}
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CLandmarkManageObjects::CLandmarkManageObjects()
       
    37 // C++ default constructor can NOT contain any code, that might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CLandmarkManageObjects::CLandmarkManageObjects( ) :
       
    41 	CActive(EPriorityNormal)
       
    42 	{
       
    43 	CActiveScheduler::Add (this );
       
    44 	}
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CLandmarkManageObjects::~CLandmarkManageObjects()
       
    48 // Destructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CLandmarkManageObjects::~CLandmarkManageObjects( )
       
    52 	{
       
    53 	Cancel ( );
       
    54 	iObjects.ResetAndDestroy ( );
       
    55 	iObjects.Close();
       
    56 	}
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CLandmarkManageObjects::Start()
       
    60 // Start asynchronous operation.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 void CLandmarkManageObjects::Start( )
       
    64 	{
       
    65 	SetActive ( );
       
    66 	TRequestStatus* status = &iStatus;
       
    67 	User::RequestComplete (status, KErrNone );
       
    68 	}
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CLandmarkManageObjects::AppendL( CLandmarkCmdBase* aObject )
       
    72 // Execute the next step.
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 void CLandmarkManageObjects::AppendL( CLandmarkCmdBase* aObject )
       
    76 	{
       
    77 	iObjects.AppendL (aObject );
       
    78 	}
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CLandmarkManageObjects::CancelObject()
       
    82 // Execute the next step.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CLandmarkManageObjects::CancelObject( TInt32 aTransactionId )
       
    86 	{
       
    87 	TInt count = iObjects.Count ( );
       
    88 	for (TInt i = 0; i< count; ++i )
       
    89 		{
       
    90 		if ( iObjects[i]->TransactionId ( )== aTransactionId )
       
    91 			{
       
    92 			iObjects[i]->Cancel ( );
       
    93 			break;
       
    94 			}
       
    95 		}
       
    96 	}
       
    97 // -----------------------------------------------------------------------------
       
    98 // CLandmarkManageObjects::RunL()
       
    99 // Notify Observer on completion of the asynchronous call.
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CLandmarkManageObjects::RunL( )
       
   103 	{
       
   104 	TInt count = iObjects.Count ( );
       
   105 	for (TInt i = 0; i< count; ++i )
       
   106 		{
       
   107 		if ( !iObjects[i]->IsActive() )
       
   108 			{
       
   109 			delete iObjects[i];
       
   110 			//Removes a node from the RPointerArray.
       
   111 			iObjects.Remove (i );
       
   112 			//Decrement node count.
       
   113 			--count;
       
   114 			//Decrement index count since the present node
       
   115 			//has been deleted.
       
   116 			--i;
       
   117 			}
       
   118 		}
       
   119 	}
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CLandmarkManageObjects::DoCancel()
       
   123 // Cancel asynchronous call.
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void CLandmarkManageObjects::DoCancel( )
       
   127 	{
       
   128 	}
       
   129 //end of file