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.
     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 * CTTokenType Codes
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @publishedAll
    23  @released
    24 */
    25  
    26 #ifndef __CCTTOKENTYPE_H__
    27 #define __CCTTOKENTYPE_H__
    28 
    29 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    30 #include "cttokentypedeletehandler.h"
    31 #endif
    32 
    33 class CCTTokenTypeDeleteHandler;
    34 #include <ct/mcttokentype.h>
    35 
    36 /**
    37  * A token type.
    38  *
    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.
    42  *
    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()
    45  * method instead.
    46  * 
    47  * @since v7.0
    48  */
    49 class CCTTokenType : protected CBase, public MCTTokenType
    50 	{
    51 public:
    52 	/** Gets a file server session */
    53 	inline RFs& Fs();
    54 
    55 protected:
    56 	/** Increments the reference count. 
    57 	* 
    58 	* Must be called for every token created from this interface */
    59 	IMPORT_C void IncReferenceCount();
    60 
    61 	// From this point onwards, everything in this class is essentialy
    62 	// internal and of no interest to dereived classes.
    63  public:
    64 	
    65 	/** Creates a CCTTokenType given its CCTTokenTypeInfo.
    66 	*	
    67 	* Static constructor function that uses the ECom 
    68 	* plug-in architecture to load the actual implementation.
    69 	*
    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);
    74 
    75 	/** Creates a CCTTokenType given the UID of the token type.	
    76 	*
    77 	* Static constructor function that uses the ECom 
    78 	* plug-in architecture to load the actual implementation.
    79 	*
    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);
    84 	
    85 	/** Releases the token type object.
    86 	*
    87 	* To be called when you have finished with the object.
    88 	*
    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 
    92 	* been released. */
    93 	IMPORT_C virtual void Release();
    94 
    95 	/** Gets the UID of the token type.	
    96 	*
    97 	* @return	The UID of the token type. */
    98 	IMPORT_C virtual TUid Type() const;
    99 	
   100 	/** Gets the label of the token type.	
   101 	*
   102 	* @return	The label of the token type. */
   103 	IMPORT_C virtual const TDesC& Label() const;
   104 
   105  protected:
   106 	IMPORT_C CCTTokenType();
   107 
   108 	/** Destructor */
   109 	IMPORT_C virtual ~CCTTokenType();
   110 
   111 	/**
   112 	 * For 2 phase construction. 
   113 	 *
   114 	 * This function must be called by derived NewL() functions if and only if the 
   115 	 * class is being constructed without using ECom.
   116 	 */
   117 	IMPORT_C void ConstructL(TUid aUID, const TDesC& aLabel, RFs aFs);
   118 
   119  private:
   120 	static CCTTokenType* CreateTokenTypeLC(TUid aUid);	
   121 
   122  private:
   123 	/// Delete handler, called on destruction
   124 	CCTTokenTypeDeleteHandler* iDeleteHandler;
   125 	
   126 	/// A refedrence count
   127 	TInt iCount;
   128 
   129 	/// The UID of the token type.
   130 	TUid iUID;
   131 
   132 	/// The label of the token type
   133 	HBufC* iLabel;
   134 
   135 	RFs iFs;
   136 	};
   137 
   138 inline RFs& CCTTokenType::Fs()
   139 	/** Gets the file server session.
   140 	*
   141 	* @return	The file server session. */
   142 	{
   143 	return iFs;
   144 	}
   145 
   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.
   150 	*
   151 	* @param aInfo	Information about the token type.
   152 	* @param aFs	An open file server session.
   153 	* @return		A new token type object. */
   154 	{
   155 	return CCTTokenType::NewL(aInfo, aFs);
   156 	}
   157 
   158 inline MCTTokenType* MCTTokenType::NewL(TUid aUID, RFs aFs)
   159 	/** Creates a MCTTokenType object given the UID of the token type. 
   160 	*
   161 	* @param aUID	The UID of the token type.
   162 	* @param aFs	An open file server session.
   163 	* @return		A new token type object. */
   164 	{
   165 	return CCTTokenType::NewL(aUID, aFs);
   166 	}
   167 
   168 #endif //__CCTTOKENTYPE_H__