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