williamr@2: /* williamr@2: * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef __TCTTOKENOBJECTHANDLE_H__ williamr@2: #define __TCTTOKENOBJECTHANDLE_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: williamr@2: /** williamr@2: * Defines a handle to an object represented by a class which is a subclass of williamr@2: * the MCTTokenObject class. williamr@2: * williamr@2: * The handle identifies the object, not the instance of the subclass of MCTTokenObject williamr@2: * used to manage that object. It is guaranteed to be unique within the context williamr@2: * of a specific device (e.g. mobile phone, etc.) at a specific point in time. williamr@2: * This limitation in time is due to the fact that objects can be created and williamr@2: * destroyed. We cannot guarantee that a handle will still point to the same williamr@2: * object after we add or remove one or more objects from the store from which williamr@2: * the object comes. However, it is guaranteed that the addition of objects to williamr@2: * the store will not affect the validity of the handles that were obtained previously. williamr@2: * For instance, if the object is a certificate in a certificate store, the subclass williamr@2: * of MCTTokenObject will be CCTCertInfo and the handle will identify the certificate williamr@2: * in the certificate store, not the instance of CCTCertInfo. williamr@2: * williamr@2: * The handle is especially useful for communication across process boundaries. williamr@2: * For example: a process (A) can get a handle to an object, and then give the handle williamr@2: * to another process (B). This process (B) can then try to get the same object using that handle. williamr@2: * williamr@2: * @since v7.0 williamr@2: */ williamr@2: class TCTTokenObjectHandle williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Creates an invalid handle. williamr@2: * williamr@2: * An invalid handle has an invalid iTokenHandle and an iObjectId equal to 0. williamr@2: */ williamr@2: IMPORT_C TCTTokenObjectHandle(); williamr@2: williamr@2: /** williamr@2: * Creates a handle. williamr@2: * williamr@2: * @param aTokenHandle The handle that identifies the Token where the object williamr@2: * is stored. williamr@2: * @param aObjectId The identifier of the object within the Token. williamr@2: */ williamr@2: IMPORT_C TCTTokenObjectHandle(TCTTokenHandle aTokenHandle, TInt aObjectId); williamr@2: williamr@2: /** williamr@2: * Copy Constructor. williamr@2: * williamr@2: * @param aTokenHandle The handle to copy. williamr@2: */ williamr@2: IMPORT_C TCTTokenObjectHandle(const TCTTokenObjectHandle& aTokenHandle); williamr@2: williamr@2: /** williamr@2: * Equality operator. williamr@2: * williamr@2: * Tests whether this TCTTokenObjectHandle object is equal to the specified williamr@2: * TCTTokenObjectHandle object. williamr@2: * williamr@2: * @param aTokenHandle The TCTTokenObjectHandle object to be compared. williamr@2: * @return ETrue, if thisTCTTokenObjectHandle object is equal to williamr@2: * the specified TCTTokenObjectHandle object; EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool operator ==(const TCTTokenObjectHandle& aTokenHandle) const; williamr@2: williamr@2: /** Inequality operator */ williamr@2: inline TBool operator !=(const TCTTokenObjectHandle& aTokenHandle) const; williamr@2: williamr@2: public: williamr@2: /** The handle that identifies the Token where the object is stored. */ williamr@2: TCTTokenHandle iTokenHandle; williamr@2: williamr@2: /** williamr@2: * The identifier of the object within the Token. williamr@2: * williamr@2: * This is unique within the context of a particular Token and only at a specific williamr@2: * point in time. williamr@2: */ williamr@2: TInt iObjectId; williamr@2: }; williamr@2: williamr@2: inline TBool TCTTokenObjectHandle::operator !=(const TCTTokenObjectHandle& aHandle) const williamr@2: { williamr@2: return !(*this == aHandle); williamr@2: } williamr@2: williamr@2: #endif