/*
* Copyright (c) 2005 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: Operation for adding a category to a set of landmarks.
*
*
*/
#ifndef CPOSLMLOCALADDCATTOLMOP_H
#define CPOSLMLOCALADDCATTOLMOP_H
// INCLUDES
#include <EPos_Landmarks.h>
#include "EPos_CPosLmLocalModifyOp.h"
// CONSTANTS
// FORWARD DECLARATIONS
// CLASS DECLARATION
/**
* Operation for adding a category to a set of landmarks. This operation can be
* either synchronous or asynchronous.
*
* @lib eposlmlocalaccess.lib
*/
NONSHARABLE_CLASS(CPosLmLocalAddCatToLmOp) : public CPosLmLocalModifyOp
{
public: // Constructors and destructor
/**
* Two-phased constructor.
* @param aDb A landmark database.
* @param aCategoryId The category to add to the set of landmarks.
* @param aLandmarkIdArray The landmarks to add the category to.
*/
static CPosLmLocalAddCatToLmOp* NewL(
/* IN */ CPosLmLocalDatabase& aDb,
/* IN */ TPosLmItemId aCategoryId,
/* IN */ RArray<TPosLmItemId>& aLandmarkIdArray
);
/**
* Destructor.
*/
virtual ~CPosLmLocalAddCatToLmOp();
public: // Functions from base classes
/**
* From CPosLmLocalModifyOp.
*
* @param aProgress The current progress.
*/
void DoNextStepPreL(
/* OUT */ TReal32& aProgress
);
/**
* From CPosLmLocalModifyOp.
*
* @param aProgress The current progress.
* @return ETrue if a begin transaction should be made. EFalse otherwise.
*/
TBool DoNextStepPostL(
/* OUT */ TReal32& aProgress
);
/**
* From CPosLmLocalModifyOp.
*
* @return Current step size.
*/
TReal32 Step();
/**
* From CPosLmLocalModifyOp.
*
* @param aResourceId A resource id.
* @param aNoOfSubOperations A number of sub operations.
*/
void CheckResourceValue(
/* IN */ TInt aResourceId,
/* IN */ TInt aNoOfSubOperations
);
/**
* From CPosLmLocalOperation;
*
* @param aError An error code generated by NextStepL.
*/
void HandleError(
/* IN/OUT */ TInt& aError
);
private:
/**
* C++ default constructor.
* @param aDb A landmark db.
*/
CPosLmLocalAddCatToLmOp(
/* IN */ CPosLmLocalDatabase& aDb
);
/**
* By default Symbian 2nd phase constructor is private.
* @param aLandmarkIdArray The landmarks to add the category to.
* @param aCategoryId The category to add to the set of landmarks.
*/
void ConstructL(
/* IN */ RArray<TPosLmItemId>& aLandmarkIdArray,
/* IN */ TPosLmItemId aCategoryId
);
/**
* Rollback if in transaction and generate an event.
* @param aProgress Current progress.
*/
void RollbackAndGenerateEventIfNeeded(
/* IN */ TReal32 aProgress
);
/**
* Generates an event.
* @param aProgress Current progress.
* @return KErrNone if successful. Otherwise any system-wide error code.
*/
TInt GenerateEventIfNeeded(
/* IN */ TReal32 aProgress
);
// Prohibit copy constructor if not deriving from CBase.
CPosLmLocalAddCatToLmOp(const CPosLmLocalAddCatToLmOp&);
// Prohibit assigment operator if not deriving from CBase.
CPosLmLocalAddCatToLmOp& operator=(const CPosLmLocalAddCatToLmOp&);
private: // Data
// The category to add to the set of landmarks.
RArray<TPosLmItemId> iCategory;
// The landmarks to add the category to.
RArray<TPosLmItemId> iLandmarkIdArray;
// The current landmark handled in the id array.
TInt iCurrent;
};
#endif // CPOSLMLOCALADDCATTOLMOP_H
// End of File