epoc32/include/ct/ccttokentype.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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
* CTTokenType Codes
williamr@2
    16
*
williamr@2
    17
*/
williamr@2
    18
williamr@2
    19
williamr@2
    20
williamr@2
    21
williamr@2
    22
/**
williamr@2
    23
 @file 
williamr@2
    24
 @internalTechnology
williamr@2
    25
*/
williamr@2
    26
 
williamr@2
    27
#ifndef __CCTTOKENTYPE_H__
williamr@2
    28
#define __CCTTOKENTYPE_H__
williamr@2
    29
williamr@2
    30
#include <ct/mcttokentype.h>
williamr@2
    31
williamr@2
    32
/**
williamr@2
    33
 * Abstract base class for a handler object to be called when a CCTTokenType is
williamr@2
    34
 * deleted.  The handler is called simply by being deleted.  It is called from
williamr@2
    35
 * CCTTokenType's destructor.
williamr@2
    36
 *
williamr@2
    37
 * This allows for ecom-loaded tokens to be destroyed properly without
williamr@2
    38
 * forcing clients of ctframework.dll to link against ecom.
williamr@2
    39
 *
williamr@2
    40
 * @internalTechnology
williamr@2
    41
 */
williamr@2
    42
class CCTTokenTypeDeleteHandler : public CBase
williamr@2
    43
	{
williamr@2
    44
 public:
williamr@2
    45
	IMPORT_C virtual ~CCTTokenTypeDeleteHandler();
williamr@2
    46
	};
williamr@2
    47
williamr@2
    48
/**
williamr@2
    49
 * A token type.
williamr@2
    50
 *
williamr@2
    51
 * This abstract class is instantiated using the ECom plug-in architecture 
williamr@2
    52
 * for a particular token type. This adds a delayed destruction behaviour 
williamr@2
    53
 * to MCTTokenType, which defines the majority of the interface.
williamr@2
    54
 *
williamr@2
    55
 * This class uses protected inheritance from CBase so that clients cannot
williamr@2
    56
 * inadvertantly call delete on instances of it - they should call the Release()
williamr@2
    57
 * method instead.
williamr@2
    58
 * 
williamr@2
    59
 * @publishedPartner
williamr@2
    60
 * @released
williamr@2
    61
 * @since v7.0
williamr@2
    62
 */
williamr@2
    63
class CCTTokenType : protected CBase, public MCTTokenType
williamr@2
    64
	{
williamr@2
    65
public:
williamr@2
    66
	/** Gets a file server session */
williamr@2
    67
	inline RFs& Fs();
williamr@2
    68
williamr@2
    69
protected:
williamr@2
    70
	/** Increments the reference count. 
williamr@2
    71
	* 
williamr@2
    72
	* Must be called for every token created from this interface */
williamr@2
    73
	IMPORT_C void IncReferenceCount();
williamr@2
    74
williamr@2
    75
	// From this point onwards, everything in this class is essentialy
williamr@2
    76
	// internal and of no interest to dereived classes.
williamr@2
    77
 public:
williamr@2
    78
	
williamr@2
    79
	/** Creates a CCTTokenType given its CCTTokenTypeInfo.
williamr@2
    80
	*	
williamr@2
    81
	* Static constructor function that uses the ECom 
williamr@2
    82
	* plug-in architecture to load the actual implementation.
williamr@2
    83
	*
williamr@2
    84
	* @param aInfo	Information about the token type.
williamr@2
    85
	* @param aFs	An open file server session.
williamr@2
    86
	* @return		The new token type object. */
williamr@2
    87
	IMPORT_C static CCTTokenType* NewL(const CCTTokenTypeInfo& aInfo, RFs aFs);
williamr@2
    88
williamr@2
    89
	/** Creates a CCTTokenType given the UID of the token type.	
williamr@2
    90
	*
williamr@2
    91
	* Static constructor function that uses the ECom 
williamr@2
    92
	* plug-in architecture to load the actual implementation.
williamr@2
    93
	*
williamr@2
    94
	* @param aUID	The UID of the token type.
williamr@2
    95
	* @param aFs	An open file server session.
williamr@2
    96
	* @return		The new token type object. */
williamr@2
    97
	IMPORT_C static CCTTokenType* NewL(TUid aUID, RFs aFs);
williamr@2
    98
	
williamr@2
    99
	/** Releases the token type object.
williamr@2
   100
	*
williamr@2
   101
	* To be called when you have finished with the object.
williamr@2
   102
	*
williamr@2
   103
	* The API does not allow the destructor to be directly called as this object 
williamr@2
   104
	* could remain in existence for longer to hold onto the ECom handle on the DLL; 
williamr@2
   105
	* for instance it may not be deleted until all tokens and interfaces have also 
williamr@2
   106
	* been released. */
williamr@2
   107
	IMPORT_C virtual void Release();
williamr@2
   108
williamr@2
   109
	/** Gets the UID of the token type.	
williamr@2
   110
	*
williamr@2
   111
	* @return	The UID of the token type. */
williamr@2
   112
	IMPORT_C virtual TUid Type() const;
williamr@2
   113
	
williamr@2
   114
	/** Gets the label of the token type.	
williamr@2
   115
	*
williamr@2
   116
	* @return	The label of the token type. */
williamr@2
   117
	IMPORT_C virtual const TDesC& Label() const;
williamr@2
   118
williamr@2
   119
 protected:
williamr@2
   120
	IMPORT_C CCTTokenType();
williamr@2
   121
williamr@2
   122
	/** Destructor */
williamr@2
   123
	IMPORT_C virtual ~CCTTokenType();
williamr@2
   124
williamr@2
   125
	/**
williamr@2
   126
	 * For 2 phase construction. 
williamr@2
   127
	 *
williamr@2
   128
	 * This function must be called by derived NewL() functions if and only if the 
williamr@2
   129
	 * class is being constructed without using ECom.
williamr@2
   130
	 */
williamr@2
   131
	IMPORT_C void ConstructL(TUid aUID, const TDesC& aLabel, RFs aFs);
williamr@2
   132
williamr@2
   133
 private:
williamr@2
   134
	static CCTTokenType* CreateTokenTypeLC(TUid aUid);	
williamr@2
   135
williamr@2
   136
 private:
williamr@2
   137
	/// Delete handler, called on destruction
williamr@2
   138
	CCTTokenTypeDeleteHandler* iDeleteHandler;
williamr@2
   139
	
williamr@2
   140
	/// A refedrence count
williamr@2
   141
	TInt iCount;
williamr@2
   142
williamr@2
   143
	/// The UID of the token type.
williamr@2
   144
	TUid iUID;
williamr@2
   145
williamr@2
   146
	/// The label of the token type
williamr@2
   147
	HBufC* iLabel;
williamr@2
   148
williamr@2
   149
	RFs iFs;
williamr@2
   150
	};
williamr@2
   151
williamr@2
   152
inline RFs& CCTTokenType::Fs()
williamr@2
   153
	/** Gets the file server session.
williamr@2
   154
	*
williamr@2
   155
	* @return	The file server session. */
williamr@2
   156
	{
williamr@2
   157
	return iFs;
williamr@2
   158
	}
williamr@2
   159
williamr@2
   160
// These are defined here as they need to ahve both MCTTokenType and 
williamr@2
   161
// CCTTokenType defined before they can be.
williamr@2
   162
inline MCTTokenType* MCTTokenType::NewL(const CCTTokenTypeInfo& aInfo, RFs aFs)
williamr@2
   163
	/** Creates a MCTTokenType object given it's CCTTokenTypeInfo.
williamr@2
   164
	*
williamr@2
   165
	* @param aInfo	Information about the token type.
williamr@2
   166
	* @param aFs	An open file server session.
williamr@2
   167
	* @return		A new token type object. */
williamr@2
   168
	{
williamr@2
   169
	return CCTTokenType::NewL(aInfo, aFs);
williamr@2
   170
	}
williamr@2
   171
williamr@2
   172
inline MCTTokenType* MCTTokenType::NewL(TUid aUID, RFs aFs)
williamr@2
   173
	/** Creates a MCTTokenType object given the UID of the token type. 
williamr@2
   174
	*
williamr@2
   175
	* @param aUID	The UID of the token type.
williamr@2
   176
	* @param aFs	An open file server session.
williamr@2
   177
	* @return		A new token type object. */
williamr@2
   178
	{
williamr@2
   179
	return CCTTokenType::NewL(aUID, aFs);
williamr@2
   180
	}
williamr@2
   181
williamr@2
   182
#endif //__CCTTOKENTYPE_H__