installationservices/swi/source/sisregistry/common/sisregistrytoken.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2004-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 * CSisRegistryToken class declaration
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @released
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #ifndef __SISREGISTRYTOKEN_H__
       
    27 #define __SISREGISTRYTOKEN_H__
       
    28 
       
    29 #include <e32base.h>
       
    30 #include "sisregistrypackage.h"
       
    31 
       
    32 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
    33 #include "scrhelperutil.h"
       
    34 #endif
       
    35 
       
    36 class RReadStream;
       
    37 class RWriteStream;
       
    38 
       
    39 namespace Swi
       
    40 {
       
    41 class CControllerInfo;
       
    42 
       
    43 class CSisRegistryToken : public CSisRegistryPackage
       
    44 	{
       
    45 public:
       
    46 	IMPORT_C static CSisRegistryToken* NewL();
       
    47 	IMPORT_C static CSisRegistryToken* NewLC();
       
    48 
       
    49 	/**
       
    50 	 * Constructs a entry from a given existing stream. 
       
    51 	 */
       
    52 	IMPORT_C static CSisRegistryToken* NewL(RReadStream& aStream);
       
    53 	IMPORT_C static CSisRegistryToken* NewLC(RReadStream& aStream);
       
    54 	
       
    55 	/**
       
    56 	 * Constructs a entry from a given existing other CSisRegistryToken entry 
       
    57 	 * 
       
    58 	 */
       
    59 	IMPORT_C static CSisRegistryToken* NewL(const CSisRegistryToken& aToken);
       
    60 	IMPORT_C static CSisRegistryToken* NewLC(const CSisRegistryToken& aToken);
       
    61 
       
    62 	virtual ~CSisRegistryToken();
       
    63 	
       
    64 	/**
       
    65 	 * Write the object to a stream 
       
    66 	 *
       
    67 	 * @param aStream The stream to write to
       
    68 	 */
       
    69 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
    70 	
       
    71 	/**
       
    72 	 * Read the object from a stream
       
    73 	 *
       
    74 	 * @param aStream The stream to read from
       
    75 	 */
       
    76 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
    77 	
       
    78 	/**
       
    79 	 * Return an array of executable SIDs belonging to (installed as a part of) this package.
       
    80 	 *
       
    81 	 * @param aSids an array of executable SIDs
       
    82 	 *
       
    83 	 */
       
    84 	const RArray<TUid>& Sids() const;
       
    85 
       
    86 	/**
       
    87 	 * Information about the controller(s) associated with this application
       
    88 	 *
       
    89 	 * @return an array of CControllerInfo object pointers
       
    90 	 */
       
    91 	const RPointerArray<CControllerInfo>& ControllerInfo() const;
       
    92 	
       
    93 	/**
       
    94 	 * Returns the version of this package
       
    95 	 *
       
    96 	 * @return The version
       
    97 	 */
       
    98 	inline TVersion Version() const;
       
    99 
       
   100 	/** 
       
   101 	 * Returns a bitmask of all drives used by the package 
       
   102 	 * at the moment of installation. The drives are encoded with 1 if present/required
       
   103 	 * and 0 if otherwise. Since potentially there can be uto 26 drives a 32 bit integer 
       
   104 	 * is sufficient, 1<<i; i=0 encodes drive A as present
       
   105 	 *
       
   106 	 * @return drives bitmap 
       
   107 	 */
       
   108 	inline TUint Drives() const;
       
   109 	
       
   110 	/**
       
   111 	 *
       
   112 	 * Sets the current drives status, for initialisation purposes
       
   113 	 * @param aDrives The drive bitmap of drives currently present in the system
       
   114 	 */
       
   115 	 
       
   116 	inline void SetCurrentDrives(TUint aDrives);
       
   117 	
       
   118 	/**
       
   119 	 * Returns what drive the user selected for files in the Sisx file that
       
   120 	 * did not specify drive.
       
   121 	 *
       
   122 	 * @return TChar The drive selected
       
   123 	 */
       
   124 	inline TChar SelectedDrive() const;
       
   125 
       
   126 	/**
       
   127 	 * Returns the installed language for this package
       
   128 	 *
       
   129 	 * @return The language
       
   130 	 */
       
   131 	inline TLanguage Language() const;
       
   132 	
       
   133 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
       
   134 	/**
       
   135 	 * Indicates whether or not the supplied executable belongs to this token
       
   136 	 *
       
   137 	 * @param aSid The executable's SID
       
   138 	 * @return TBool - ETrue if it is part of the package denoted by 
       
   139 	 * this token
       
   140 	 *
       
   141 	 */
       
   142 	TBool SidPresent(TUid aSid) const;
       
   143 	
       
   144 	/** 
       
   145 	 * Updates internal state from provided flags which drives are fixed 
       
   146 	 *
       
   147 	 * @param aFixedDrives TUint drives map of fixed drives
       
   148 	 */
       
   149     IMPORT_C void SetFixedDrives(TUint aFixedDrives); 
       
   150     
       
   151     /** 
       
   152 	 * Returns whether all required drives are present
       
   153 	 *
       
   154 	 * @return ETrue if all drives spanned by the package  are present
       
   155 	 *         EFalse otherwise.
       
   156 	 */
       
   157 	inline TBool PresentState() const;
       
   158 	
       
   159 	IMPORT_C void AddRemovableDrive(TInt aDrive);
       
   160 	IMPORT_C void RemoveRemovableDrive(TInt aDrive);
       
   161 #endif
       
   162 
       
   163 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   164 public: // Friend Functions.	
       
   165 	friend void ScrHelperUtil::ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, Usif::CComponentEntry* aComponentEntry, CSisRegistryToken& aToken, RPointerArray<Usif::CPropertyEntry>* aPropertyArray);
       
   166 #endif
       
   167 
       
   168 protected:
       
   169 	CSisRegistryToken();
       
   170 	
       
   171 	void ConstructL();
       
   172 	void ConstructL(const CSisRegistryToken& aToken);
       
   173 	void ConstructL(RReadStream& aReadStream);
       
   174 		
       
   175 protected:
       
   176 	// The array of SIDs of executable owned by this package
       
   177 	RArray<TUid> iSids;
       
   178 
       
   179 	// a bitmap of drives
       
   180 	TUint iDrives;
       
   181 
       
   182 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   183 	// [- These variables unused. Included for BC
       
   184 	TBool iCompletelyPresent;
       
   185 	TUint iPresentRemovableDrives;
       
   186 	// End unused section -]
       
   187 	
       
   188 	TUint iCurrentDrives;
       
   189 #endif
       
   190 
       
   191 	// controller info
       
   192 	RPointerArray<CControllerInfo> iControllerInfo;
       
   193 	// version
       
   194 	TVersion iVersion;
       
   195 	// language
       
   196 	TLanguage iLanguage;
       
   197 	// drive choosen for user selectable files
       
   198 	TChar iSelectedDrive;
       
   199 
       
   200 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   201 	TInt iUnused1;
       
   202 	TInt iUnused2; 
       
   203 #endif
       
   204 	};
       
   205 	
       
   206 
       
   207 inline TUint CSisRegistryToken::Drives() const 
       
   208 	{
       
   209 	return iDrives;
       
   210 	}
       
   211 
       
   212 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   213 inline TBool CSisRegistryToken::PresentState() const
       
   214 	{
       
   215 	return ((iDrives ^ iCurrentDrives) == 0);
       
   216 	}
       
   217 
       
   218 inline TBool CSisRegistryToken::SidPresent(TUid aSid) const
       
   219 	{
       
   220 	return (iSids.Find(aSid) != KErrNotFound)? ETrue:EFalse;
       
   221 	}
       
   222 #endif
       
   223 inline  TLanguage CSisRegistryToken::Language() const
       
   224 	{
       
   225 	return iLanguage;
       
   226 	}
       
   227 	
       
   228 inline  TChar CSisRegistryToken::SelectedDrive() const
       
   229 	{
       
   230 	return iSelectedDrive;
       
   231 	}
       
   232 
       
   233 inline const RArray<TUid>& CSisRegistryToken::Sids() const
       
   234 	{
       
   235 	return iSids;
       
   236 	}
       
   237 
       
   238 inline const RPointerArray<CControllerInfo>& CSisRegistryToken::ControllerInfo() const
       
   239 	{
       
   240 	return iControllerInfo;
       
   241 	}
       
   242 
       
   243 
       
   244 inline TVersion CSisRegistryToken::Version() const
       
   245 	{
       
   246 	return iVersion;
       
   247 	}
       
   248 
       
   249 } // namespace
       
   250 #endif //__SISREGISTRYTOKEN_H__