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