2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
26 #ifndef __CCTTOKENTYPE_H__
27 #define __CCTTOKENTYPE_H__
29 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
30 #include "cttokentypedeletehandler.h"
33 class CCTTokenTypeDeleteHandler;
34 #include <ct/mcttokentype.h>
39 * This abstract class is instantiated using the ECom plug-in architecture
40 * for a particular token type. This adds a delayed destruction behaviour
41 * to MCTTokenType, which defines the majority of the interface.
43 * This class uses protected inheritance from CBase so that clients cannot
44 * inadvertantly call delete on instances of it - they should call the Release()
49 class CCTTokenType : protected CBase, public MCTTokenType
52 /** Gets a file server session */
56 /** Increments the reference count.
58 * Must be called for every token created from this interface */
59 IMPORT_C void IncReferenceCount();
61 // From this point onwards, everything in this class is essentialy
62 // internal and of no interest to dereived classes.
65 /** Creates a CCTTokenType given its CCTTokenTypeInfo.
67 * Static constructor function that uses the ECom
68 * plug-in architecture to load the actual implementation.
70 * @param aInfo Information about the token type.
71 * @param aFs An open file server session.
72 * @return The new token type object. */
73 IMPORT_C static CCTTokenType* NewL(const CCTTokenTypeInfo& aInfo, RFs aFs);
75 /** Creates a CCTTokenType given the UID of the token type.
77 * Static constructor function that uses the ECom
78 * plug-in architecture to load the actual implementation.
80 * @param aUID The UID of the token type.
81 * @param aFs An open file server session.
82 * @return The new token type object. */
83 IMPORT_C static CCTTokenType* NewL(TUid aUID, RFs aFs);
85 /** Releases the token type object.
87 * To be called when you have finished with the object.
89 * The API does not allow the destructor to be directly called as this object
90 * could remain in existence for longer to hold onto the ECom handle on the DLL;
91 * for instance it may not be deleted until all tokens and interfaces have also
93 IMPORT_C virtual void Release();
95 /** Gets the UID of the token type.
97 * @return The UID of the token type. */
98 IMPORT_C virtual TUid Type() const;
100 /** Gets the label of the token type.
102 * @return The label of the token type. */
103 IMPORT_C virtual const TDesC& Label() const;
106 IMPORT_C CCTTokenType();
109 IMPORT_C virtual ~CCTTokenType();
112 * For 2 phase construction.
114 * This function must be called by derived NewL() functions if and only if the
115 * class is being constructed without using ECom.
117 IMPORT_C void ConstructL(TUid aUID, const TDesC& aLabel, RFs aFs);
120 static CCTTokenType* CreateTokenTypeLC(TUid aUid);
123 /// Delete handler, called on destruction
124 CCTTokenTypeDeleteHandler* iDeleteHandler;
126 /// A refedrence count
129 /// The UID of the token type.
132 /// The label of the token type
138 inline RFs& CCTTokenType::Fs()
139 /** Gets the file server session.
141 * @return The file server session. */
146 // These are defined here as they need to ahve both MCTTokenType and
147 // CCTTokenType defined before they can be.
148 inline MCTTokenType* MCTTokenType::NewL(const CCTTokenTypeInfo& aInfo, RFs aFs)
149 /** Creates a MCTTokenType object given it's CCTTokenTypeInfo.
151 * @param aInfo Information about the token type.
152 * @param aFs An open file server session.
153 * @return A new token type object. */
155 return CCTTokenType::NewL(aInfo, aFs);
158 inline MCTTokenType* MCTTokenType::NewL(TUid aUID, RFs aFs)
159 /** Creates a MCTTokenType object given the UID of the token type.
161 * @param aUID The UID of the token type.
162 * @param aFs An open file server session.
163 * @return A new token type object. */
165 return CCTTokenType::NewL(aUID, aFs);
168 #endif //__CCTTOKENTYPE_H__