williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
/**
|
williamr@2
|
20 |
@file
|
williamr@2
|
21 |
@publishedAll
|
williamr@2
|
22 |
@released
|
williamr@2
|
23 |
*/
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#ifndef __TCTTOKENOBJECTHANDLE_H__
|
williamr@2
|
26 |
#define __TCTTOKENOBJECTHANDLE_H__
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#include <e32std.h>
|
williamr@2
|
29 |
#include <ct/tcttokenhandle.h>
|
williamr@2
|
30 |
|
williamr@2
|
31 |
|
williamr@2
|
32 |
/**
|
williamr@2
|
33 |
* Defines a handle to an object represented by a class which is a subclass of
|
williamr@2
|
34 |
* the MCTTokenObject class.
|
williamr@2
|
35 |
*
|
williamr@2
|
36 |
* The handle identifies the object, not the instance of the subclass of MCTTokenObject
|
williamr@2
|
37 |
* used to manage that object. It is guaranteed to be unique within the context
|
williamr@2
|
38 |
* of a specific device (e.g. mobile phone, etc.) at a specific point in time.
|
williamr@2
|
39 |
* This limitation in time is due to the fact that objects can be created and
|
williamr@2
|
40 |
* destroyed. We cannot guarantee that a handle will still point to the same
|
williamr@2
|
41 |
* object after we add or remove one or more objects from the store from which
|
williamr@2
|
42 |
* the object comes. However, it is guaranteed that the addition of objects to
|
williamr@2
|
43 |
* the store will not affect the validity of the handles that were obtained previously.
|
williamr@2
|
44 |
* For instance, if the object is a certificate in a certificate store, the subclass
|
williamr@2
|
45 |
* of MCTTokenObject will be CCTCertInfo and the handle will identify the certificate
|
williamr@2
|
46 |
* in the certificate store, not the instance of CCTCertInfo.
|
williamr@2
|
47 |
*
|
williamr@2
|
48 |
* The handle is especially useful for communication across process boundaries.
|
williamr@2
|
49 |
* For example: a process (A) can get a handle to an object, and then give the handle
|
williamr@2
|
50 |
* to another process (B). This process (B) can then try to get the same object using that handle.
|
williamr@2
|
51 |
*
|
williamr@2
|
52 |
* @since v7.0
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
class TCTTokenObjectHandle
|
williamr@2
|
55 |
{
|
williamr@2
|
56 |
public:
|
williamr@2
|
57 |
/**
|
williamr@2
|
58 |
* Creates an invalid handle.
|
williamr@2
|
59 |
*
|
williamr@2
|
60 |
* An invalid handle has an invalid iTokenHandle and an iObjectId equal to 0.
|
williamr@2
|
61 |
*/
|
williamr@2
|
62 |
IMPORT_C TCTTokenObjectHandle();
|
williamr@2
|
63 |
|
williamr@2
|
64 |
/**
|
williamr@2
|
65 |
* Creates a handle.
|
williamr@2
|
66 |
*
|
williamr@2
|
67 |
* @param aTokenHandle The handle that identifies the Token where the object
|
williamr@2
|
68 |
* is stored.
|
williamr@2
|
69 |
* @param aObjectId The identifier of the object within the Token.
|
williamr@2
|
70 |
*/
|
williamr@2
|
71 |
IMPORT_C TCTTokenObjectHandle(TCTTokenHandle aTokenHandle, TInt aObjectId);
|
williamr@2
|
72 |
|
williamr@2
|
73 |
/**
|
williamr@2
|
74 |
* Copy Constructor.
|
williamr@2
|
75 |
*
|
williamr@2
|
76 |
* @param aTokenHandle The handle to copy.
|
williamr@2
|
77 |
*/
|
williamr@2
|
78 |
IMPORT_C TCTTokenObjectHandle(const TCTTokenObjectHandle& aTokenHandle);
|
williamr@2
|
79 |
|
williamr@2
|
80 |
/**
|
williamr@2
|
81 |
* Equality operator.
|
williamr@2
|
82 |
*
|
williamr@2
|
83 |
* Tests whether this TCTTokenObjectHandle object is equal to the specified
|
williamr@2
|
84 |
* TCTTokenObjectHandle object.
|
williamr@2
|
85 |
*
|
williamr@2
|
86 |
* @param aTokenHandle The TCTTokenObjectHandle object to be compared.
|
williamr@2
|
87 |
* @return ETrue, if thisTCTTokenObjectHandle object is equal to
|
williamr@2
|
88 |
* the specified TCTTokenObjectHandle object; EFalse otherwise.
|
williamr@2
|
89 |
*/
|
williamr@2
|
90 |
IMPORT_C TBool operator ==(const TCTTokenObjectHandle& aTokenHandle) const;
|
williamr@2
|
91 |
|
williamr@2
|
92 |
/** Inequality operator */
|
williamr@2
|
93 |
inline TBool operator !=(const TCTTokenObjectHandle& aTokenHandle) const;
|
williamr@2
|
94 |
|
williamr@2
|
95 |
public:
|
williamr@2
|
96 |
/** The handle that identifies the Token where the object is stored. */
|
williamr@2
|
97 |
TCTTokenHandle iTokenHandle;
|
williamr@2
|
98 |
|
williamr@2
|
99 |
/**
|
williamr@2
|
100 |
* The identifier of the object within the Token.
|
williamr@2
|
101 |
*
|
williamr@2
|
102 |
* This is unique within the context of a particular Token and only at a specific
|
williamr@2
|
103 |
* point in time.
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
TInt iObjectId;
|
williamr@2
|
106 |
};
|
williamr@2
|
107 |
|
williamr@2
|
108 |
inline TBool TCTTokenObjectHandle::operator !=(const TCTTokenObjectHandle& aHandle) const
|
williamr@2
|
109 |
{
|
williamr@2
|
110 |
return !(*this == aHandle);
|
williamr@2
|
111 |
}
|
williamr@2
|
112 |
|
williamr@2
|
113 |
#endif
|