secureswitools/swisistools/source/sisxlibrary/sisfiledata.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 * As specified in SGL.GT0188.251
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @publishedPartner
       
    23  @released
       
    24 */
       
    25 
       
    26 #ifndef __SISFILEDATA_H__
       
    27 #define __SISFILEDATA_H__
       
    28 
       
    29 
       
    30 #include "structure.h"
       
    31 #include "siscompressed.h"
       
    32 #include "raw.h"
       
    33 
       
    34 
       
    35 class CSISFileData : public CStructure <CSISFieldRoot::ESISFileData>
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	 * Default constructor.
       
    40 	 */
       
    41 	CSISFileData ();
       
    42 	/**
       
    43 	 * Copy constructor.
       
    44 	 */
       
    45 	CSISFileData (const CSISFileData& aInitialiser);
       
    46 	/**
       
    47 	 * Class name
       
    48 	 */
       
    49 	virtual std::string Name () const;
       
    50 	/**
       
    51 	 * Load the file into memory and store it in the class.
       
    52 	 * @param aFile file name
       
    53 	 * @param aSize if specified then it will return the size of the file read.
       
    54 	 */
       
    55 	void Load (const std::wstring& aFile, TUint64* aSize = NULL);
       
    56 	/**
       
    57 	 * Return compressed size of the file.
       
    58 	 */
       
    59 	TUint64 CompressedSize () const;
       
    60 	/**
       
    61 	 * Return un-compressed size of the file.
       
    62 	 */
       
    63 	TUint64 UncompressedSize () const;
       
    64 	/**
       
    65 	 * Return pointer to the file data.
       
    66 	 */
       
    67 	const TUint8* Data () const;
       
    68 	/**
       
    69 	 * Get SID of the file.
       
    70 	 */
       
    71 	TUint32 CSISFileData::GetSid() const;
       
    72 	/**
       
    73 	 * Check whether the file is an executable or not.
       
    74 	 * An executable can be a dll or an exe.
       
    75 	 */
       
    76 	bool IsExecutable() const;
       
    77 	/**
       
    78 	 * Checks whether the file is an exe or not.
       
    79 	 */
       
    80 	bool IsExe() const;
       
    81 	/**
       
    82 	 * Checks whether the file is a dll or not.
       
    83 	 */
       
    84 	bool IsDll() const;
       
    85 	/**
       
    86 	 * Checks whether the file is an emulator based executable or not.
       
    87 	 */
       
    88 	bool IsEmulatorExecutable() const;
       
    89 
       
    90 private:
       
    91 	CSISCompressed <CRaw>	iData;
       
    92 	};
       
    93 
       
    94 
       
    95 
       
    96 inline CSISFileData::CSISFileData ()
       
    97 	{
       
    98 	InsertMember (iData); 
       
    99 	}
       
   100 
       
   101 
       
   102 inline CSISFileData::CSISFileData (const CSISFileData& aInitialiser) :
       
   103 		CStructure <CSISFieldRoot::ESISFileData> (aInitialiser),
       
   104 		iData (aInitialiser.iData)
       
   105 	{
       
   106 	InsertMember (iData); 
       
   107 	}
       
   108 
       
   109 inline std::string CSISFileData::Name () const
       
   110 	{
       
   111 	return "File Data";
       
   112 	}
       
   113 
       
   114 inline TUint64 CSISFileData::CompressedSize () const
       
   115 	{
       
   116 	return iData.CompressedSize ();
       
   117 	}
       
   118 
       
   119 
       
   120 inline TUint64 CSISFileData::UncompressedSize () const
       
   121 	{
       
   122 	return iData.UncompressedSize ();
       
   123 	}
       
   124 
       
   125 
       
   126 inline const TUint8* CSISFileData::Data () const
       
   127 	{
       
   128 	return iData.Content ().Data ();
       
   129 	}
       
   130 
       
   131 #endif // __SISFILEDATA_H__
       
   132