installationservices/swi/inc/sisregistryfiledescription.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 * CSisRegistryFileDescription interface
       
    16 * This class is based on Sis::CFileDescription class but allows 
       
    17 * also to be internalised/externalised
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 /**
       
    23  @file 
       
    24  @released
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef __SISREGISTRYFILEDESCRIPTION_H__
       
    29 #define __SISREGISTRYFILEDESCRIPTION_H__
       
    30 
       
    31 #include <hash.h>
       
    32 #include <e32base.h>
       
    33 #include "sisfieldtypes.h"
       
    34 
       
    35 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
    36 #include "scrhelperutil.h"
       
    37 #endif
       
    38 
       
    39 class RReadStream;
       
    40 class RWriteStream;
       
    41 
       
    42 namespace Swi
       
    43 {
       
    44 
       
    45 namespace Sis
       
    46 	{
       
    47 	class CFileDescription;
       
    48 	}
       
    49 	
       
    50 class CHashContainer;
       
    51 	
       
    52 class CSisRegistryFileDescription : public CBase
       
    53 	{
       
    54 public:
       
    55 	/**
       
    56 	 * Creates a new CSisRegistryFileDescription object based on a Sis::CFileDescription object.
       
    57 	 *
       
    58 	 * @param aFileDescription the file description object used to initialise the new object
       
    59 	 * @param aDrive the user selected drive for this installation
       
    60 	 * @return the new object 
       
    61 	 */
       
    62 	IMPORT_C static CSisRegistryFileDescription* NewL(const Sis::CFileDescription& aFileDescription, TChar aDrive, TBool aIsStub = EFalse);
       
    63 
       
    64 	/**
       
    65 	 * Creates a new CSisRegistryFileDescription based on a Sis::CFileDescription  object.
       
    66 	 *
       
    67 	 * @param aFileDescription the file description object used to initialise the new object
       
    68 	 * @param aDrive the user selected drive for this installation
       
    69 	 * @return the new object on the cleanup stack
       
    70 	 */
       
    71 	IMPORT_C static CSisRegistryFileDescription* NewLC(const Sis::CFileDescription& aFileDescription, TChar aDrive, TBool aIsStub = EFalse);
       
    72 
       
    73 	/**
       
    74 	 * Creates a copy of an existing CSisRegistryFileDescription.
       
    75 	 *
       
    76 	 * @param aFileDescription the file description to base this object on
       
    77 	 * @return the new object 
       
    78 	 */
       
    79 	IMPORT_C static CSisRegistryFileDescription* NewL(const CSisRegistryFileDescription& aFileDescription);
       
    80 
       
    81 	/**
       
    82 	 * This method creates a copy of an existing CSisRegistryFileDescription.
       
    83 	 *
       
    84 	 * @param aFileDescription the file description to base this object on
       
    85 	 * @return the new object on the cleanup stack
       
    86 	 */
       
    87 	IMPORT_C static CSisRegistryFileDescription* NewLC(const CSisRegistryFileDescription& aFileDescription);
       
    88 
       
    89 	/**
       
    90 	 * This method creates a new CSisRegistryFileDescription from a stream
       
    91 	 *
       
    92 	 * @param aStream the stream to read from
       
    93 	 * @return the new object 
       
    94 	 */
       
    95 	IMPORT_C static CSisRegistryFileDescription* NewL(RReadStream& aStream);
       
    96 
       
    97 	/**
       
    98 	 * This creates a new CSisRegistryFileDescription from a stream
       
    99 	 *
       
   100 	 * @param aStream the stream to read from
       
   101 	 * @return the new object on the cleanup stack
       
   102 	 */
       
   103 	IMPORT_C static CSisRegistryFileDescription* NewLC(RReadStream& aStream);
       
   104 	
       
   105 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   106 	/**
       
   107 	 * This method creates a new CSisRegistryFileDescription from a stream
       
   108 	 *	 
       
   109 	 * @return the new object 
       
   110 	 */
       
   111 	IMPORT_C static CSisRegistryFileDescription* NewL();
       
   112 
       
   113 	/**
       
   114 	 * This creates a new CSisRegistryFileDescription from a stream
       
   115 	 *	 
       
   116 	 * @return the new object on the cleanup stack
       
   117 	 */
       
   118 	IMPORT_C static CSisRegistryFileDescription* NewLC();
       
   119 #endif
       
   120 	
       
   121 	/** Create a file description based upon supplied parameters. This is used to create
       
   122 	    a file description for removable media SIS stub files. So they can be removed
       
   123 	    if an uninstall occurs
       
   124 	@param aHash The hash of the file
       
   125 	@param aTarget The location of hte file
       
   126 	@param aMimeType The mime type of the file
       
   127 	@param aOperation The operation performed on this file during installation
       
   128 	@param aOperationOptions The options applied to the Operation
       
   129 	@param aUncomressedLength Size of the file
       
   130 	@param aIndex 
       
   131 	@param aSid
       
   132 	*/
       
   133 	IMPORT_C static CSisRegistryFileDescription* NewL(CHashContainer& aHash,
       
   134 														const TDesC& aTarget,
       
   135 														const TDesC& aMimeType,
       
   136 														const Sis::TSISFileOperation aOperation,
       
   137 														const Sis::TSISFileOperationOptions aOperationOptions,
       
   138 														const TInt64 aUncompressedLength,
       
   139 														const TUint32 aIndex,
       
   140 														const TUid aSid );
       
   141 
       
   142 	IMPORT_C virtual ~CSisRegistryFileDescription();
       
   143 
       
   144 	/**
       
   145 	 * Write the object to a stream 
       
   146 	 *
       
   147 	 * @param aStream The stream to write to
       
   148 	 */
       
   149 	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
       
   150 
       
   151 	/**
       
   152 	 * Read the object from a stream
       
   153 	 *
       
   154 	 * @param aStream the stream to read from
       
   155 	 */
       
   156 	IMPORT_C void InternalizeL(RReadStream& aStream);
       
   157 	
       
   158 	const TDesC& Target() const;
       
   159 
       
   160 	const TDesC& MimeType() const;
       
   161 
       
   162 	const CHashContainer& Hash() const;
       
   163 
       
   164 	Sis::TSISFileOperation Operation() const;
       
   165 
       
   166 	Sis::TSISFileOperationOptions OperationOptions() const;
       
   167 
       
   168 	TInt64 UncompressedLength() const;
       
   169 
       
   170 	TUint32 Index() const;
       
   171 	
       
   172 	TUid Sid() const;
       
   173 	
       
   174 	void SetSid(TUid aUid);
       
   175 	const HBufC8* CapabilitiesData() const;
       
   176 
       
   177 	
       
   178 	IMPORT_C TUint32 SerializedSize() const;
       
   179 
       
   180 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   181 public: // Friend Functions
       
   182 	friend void ScrHelperUtil::ReadFromScrL(Usif::RSoftwareComponentRegistry& aScrSession, const Usif::TComponentId aCompId, CSisRegistryFileDescription*& aFileDescription, const TDesC& aFileName, TBool aWildcardedFile);
       
   183 #endif
       
   184 
       
   185 private:
       
   186 	/**
       
   187 	 * Constructor
       
   188 	 */
       
   189 	CSisRegistryFileDescription();
       
   190 	
       
   191 	/**
       
   192 	 * The second-phase constructor.
       
   193 	 *
       
   194 	 * @param aFileDescription the file description.
       
   195 	 * @param aDrive the user selected drive for this installation
       
   196 	 */
       
   197 	void ConstructL(const Sis::CFileDescription& aFileDescription, TChar aDrive, TBool aIsStub);
       
   198 
       
   199 	/**
       
   200 	 * The second-phase constructor.
       
   201 	 *
       
   202 	 * @param aFileDescription the file description.
       
   203 	 */
       
   204 	void ConstructL(const CSisRegistryFileDescription& aFileDescription);
       
   205 	
       
   206 	/**
       
   207 	 * The second-phase constructor.
       
   208 	 *
       
   209 	 * @param aStream the stream to read the file description from.
       
   210 	 */
       
   211 	void ConstructL(RReadStream& aStream);
       
   212     
       
   213 
       
   214 	void ConstructL(CHashContainer& aHash,
       
   215 					const TDesC& aTarget,
       
   216 					const TDesC& aMimeType,
       
   217 					const Sis::TSISFileOperation aOperation,
       
   218 					const Sis::TSISFileOperationOptions aOperationOptions,
       
   219 					const TInt64 aUncompressedLength,
       
   220 					const TUint32 aIndex,
       
   221 					const TUid aSid);
       
   222 private:
       
   223 	HBufC* iTarget;
       
   224 	
       
   225 	HBufC* iMimeType;
       
   226 
       
   227 	CHashContainer* iHash;
       
   228 	
       
   229 	Sis::TSISFileOperation iOperation;
       
   230 	
       
   231 	Sis::TSISFileOperationOptions iOperationOptions;
       
   232 	
       
   233 	TInt64 iUncompressedLength;
       
   234 	
       
   235 	TUint32 iIndex;
       
   236 	
       
   237 	TUid iSid;
       
   238 	
       
   239 	HBufC8* iCapabilitiesData;
       
   240 	};
       
   241 
       
   242 // inline functions from CSisRegistryFileDescription
       
   243 
       
   244 inline const TDesC& CSisRegistryFileDescription::Target() const
       
   245 	{
       
   246 	return *iTarget;	
       
   247 	}
       
   248 
       
   249 inline const TDesC& CSisRegistryFileDescription::MimeType() const
       
   250 	{
       
   251 	return *iMimeType;	
       
   252 	}
       
   253 	
       
   254 inline const CHashContainer& CSisRegistryFileDescription::Hash() const
       
   255 	{
       
   256 	return *iHash;	
       
   257 	}
       
   258 
       
   259 inline Sis::TSISFileOperation CSisRegistryFileDescription::Operation() const
       
   260 	{
       
   261 	return iOperation;	
       
   262 	}
       
   263 
       
   264 inline Sis::TSISFileOperationOptions CSisRegistryFileDescription::OperationOptions() const
       
   265 	{
       
   266 	return iOperationOptions;	
       
   267 	}
       
   268 
       
   269 inline TInt64 CSisRegistryFileDescription::UncompressedLength() const
       
   270 	{
       
   271 	return iUncompressedLength;
       
   272 	}
       
   273 
       
   274 inline TUint32 CSisRegistryFileDescription::Index() const
       
   275 	{
       
   276 	return iIndex;
       
   277 	}
       
   278 
       
   279 inline TUid CSisRegistryFileDescription::Sid() const
       
   280 	{
       
   281 	return iSid;
       
   282 	}	
       
   283 
       
   284 inline void CSisRegistryFileDescription::SetSid(TUid aSid)
       
   285 	{
       
   286 	iSid = aSid;
       
   287 	}	
       
   288 inline const HBufC8* CSisRegistryFileDescription::CapabilitiesData() const
       
   289  	{
       
   290  	return iCapabilitiesData;
       
   291  	}
       
   292 
       
   293 } //namespace Swi
       
   294 #endif