secureswitools/swisistools/source/sisxlibrary/sisdataunit.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 __SISDATAUNIT_H__
       
    27 #define __SISDATAUNIT_H__
       
    28 
       
    29 
       
    30 #include "structure.h"
       
    31 #include "sisfiledata.h"
       
    32 #include "sisarray.h"
       
    33 #include "siscompressed.h"
       
    34 
       
    35 
       
    36 
       
    37 class CSISDataUnit : public CStructure <CSISFieldRoot::ESISDataUnit>
       
    38 	{
       
    39 public:
       
    40 	/**
       
    41 	 * Default constructor
       
    42 	 */
       
    43 	CSISDataUnit ();
       
    44 	/**
       
    45 	 * Copy constructor
       
    46 	 */
       
    47 	CSISDataUnit (const CSISDataUnit& aInitialiser);
       
    48 	/**
       
    49 	 * Class name
       
    50 	 */
       
    51 	virtual std::string Name () const;
       
    52 	/**
       
    53 	 * Load the given file into memory. And add it into the list of
       
    54 	 * file data.
       
    55 	 * @param aFile file name of file.
       
    56 	 * @param aSize size of data read from the file.
       
    57 	 */
       
    58 	TUint32 LoadFile (const std::wstring& aFile, TUint64* aSize = NULL);
       
    59 	/**
       
    60 	 * Compressed size of last file in the file list.
       
    61 	 */
       
    62 	TUint64 CompressedSize () const;
       
    63 	/**
       
    64 	 * Un-compressed size of last file in the file list.
       
    65 	 */
       
    66 	TUint64 UncompressedSize () const;
       
    67 	/**
       
    68 	 * Retrieve file data of the specified file.
       
    69 	 * @param aFileIndex Index of the file to be accessed.
       
    70 	 */
       
    71 	const CSISFileData& FileData (const TUint32 aFileIndex) const;
       
    72 	/**
       
    73 	 * Number of files present in this data unit.
       
    74 	 */
       
    75 	TUint32 FileCount() const;
       
    76 
       
    77 private:
       
    78 	CSISArray <CSISFileData, CSISFieldRoot::ESISFileData> iFileData;
       
    79 
       
    80 	};
       
    81 
       
    82 
       
    83 
       
    84 inline CSISDataUnit::CSISDataUnit ()
       
    85 	{
       
    86 	InsertMember (iFileData); 
       
    87 	}
       
    88 
       
    89 
       
    90 inline CSISDataUnit::CSISDataUnit (const CSISDataUnit& aInitialiser) :
       
    91 		CStructure <CSISFieldRoot::ESISDataUnit> (aInitialiser),
       
    92 		iFileData (aInitialiser.iFileData)
       
    93 	{
       
    94 	InsertMember (iFileData); 
       
    95 	}
       
    96 
       
    97 
       
    98 inline TUint32 CSISDataUnit::LoadFile (const std::wstring& aFile, TUint64* aSize)
       
    99 	{
       
   100 	iFileData.Push ();
       
   101 	iFileData.Last ().Load (aFile, aSize);
       
   102 	return iFileData.size () - 1;
       
   103 	}
       
   104 
       
   105 
       
   106 inline std::string CSISDataUnit::Name () const
       
   107 	{
       
   108 	return "Data Unit";
       
   109 	}
       
   110 
       
   111 
       
   112 inline TUint64 CSISDataUnit::CompressedSize () const
       
   113 	{
       
   114 	return iFileData.Last ().CompressedSize ();
       
   115 	}
       
   116 
       
   117 inline TUint64 CSISDataUnit::UncompressedSize () const
       
   118 	{
       
   119 	return iFileData.Last ().UncompressedSize ();
       
   120 	}
       
   121 
       
   122 
       
   123 inline const CSISFileData& CSISDataUnit::FileData (const TUint32 aIndex) const
       
   124 	{
       
   125 	return iFileData [aIndex];
       
   126 	}
       
   127 
       
   128 inline TUint32 CSISDataUnit::FileCount () const
       
   129 	{
       
   130 	return iFileData.size();
       
   131 	}
       
   132 
       
   133 #endif // __SISDATAUNIT_H__
       
   134