epoc32/include/ct/tcttokenobjecthandle.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 /*
     2 * Copyright (c) 2001-2009 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: 
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 /**
    22  @file
    23  @publishedAll
    24  @released
    25 */
    26 
    27 #ifndef __TCTTOKENOBJECTHANDLE_H__
    28 #define __TCTTOKENOBJECTHANDLE_H__
    29 
    30 #include <e32std.h>
    31 #include <ct/tcttokenhandle.h>
    32 
    33 
    34 /** 
    35  * Defines a handle to an object represented by a class which is a subclass of 
    36  * the MCTTokenObject class.
    37  * 
    38  * The handle identifies the object, not the instance of the subclass of MCTTokenObject 
    39  * used to manage that object. It is guaranteed to be unique within the context 
    40  * of a specific device (e.g. mobile phone, etc.) at a specific point in time. 
    41  * This limitation in time is due to the fact that objects can be created and 
    42  * destroyed. We cannot guarantee that a handle will still point to the same 
    43  * object after we add or remove one or more objects from the store from which 
    44  * the object comes. However, it is guaranteed that the addition of objects to 
    45  * the store will not affect the validity of the handles that were obtained previously. 
    46  * For instance, if the object is a certificate in a certificate store, the subclass 
    47  * of MCTTokenObject will be CCTCertInfo and the handle will identify the certificate 
    48  * in the certificate store, not the instance of CCTCertInfo.
    49  * 
    50  * The handle is especially useful for communication across process boundaries. 
    51  * For example: a process (A) can get a handle to an object, and then give the handle 
    52  * to another process (B). This process (B) can then try to get the same object using that handle. 
    53  *
    54  * @since v7.0 
    55  */
    56 class TCTTokenObjectHandle
    57 	{
    58 public:
    59 	/** 
    60 	 * Creates an invalid handle.
    61 	 *
    62 	 * An invalid handle has an invalid iTokenHandle and an iObjectId equal to 0. 
    63 	 */
    64 	IMPORT_C TCTTokenObjectHandle();
    65 	
    66 	/** 
    67 	 * Creates a handle.
    68 	 *
    69 	 * @param aTokenHandle	The handle that identifies the Token where the object 
    70 	 * 						is stored.
    71 	 * @param aObjectId		The identifier of the object within the Token. 
    72 	 */
    73 	IMPORT_C TCTTokenObjectHandle(TCTTokenHandle aTokenHandle, TInt aObjectId);
    74 	
    75 	/** 
    76 	 * Copy Constructor.
    77 	 *
    78 	 * @param aTokenHandle	The handle to copy. 
    79 	 */
    80 	IMPORT_C TCTTokenObjectHandle(const TCTTokenObjectHandle& aTokenHandle);
    81 	
    82 	/** 
    83 	 * Equality operator.
    84 	 *
    85 	 * Tests whether this TCTTokenObjectHandle object is equal to the specified 
    86 	 * TCTTokenObjectHandle object.	
    87 	 *
    88 	 * @param aTokenHandle	The TCTTokenObjectHandle object to be compared.
    89 	 * @return				ETrue, if thisTCTTokenObjectHandle object is equal to 
    90 	 * 						the specified TCTTokenObjectHandle object; EFalse otherwise. 
    91 	 */
    92 	IMPORT_C TBool operator ==(const TCTTokenObjectHandle& aTokenHandle) const;
    93 	
    94 	/** Inequality operator */
    95 	inline TBool operator !=(const TCTTokenObjectHandle& aTokenHandle) const;
    96  
    97  public:
    98 	/** The handle that identifies the Token where the object is stored. */
    99 	TCTTokenHandle iTokenHandle;
   100 	
   101 	/** 
   102 	 * The identifier of the object within the Token.
   103 	 *
   104 	 * This is unique within the context of a particular Token and only at a specific 
   105 	 * point in time. 
   106 	 */
   107 	TInt iObjectId;
   108 	};
   109 
   110 inline TBool TCTTokenObjectHandle::operator !=(const TCTTokenObjectHandle& aHandle) const
   111 	{
   112 	return !(*this == aHandle);
   113 	}
   114 
   115 #endif