secureswitools/swisistools/source/sisxlibrary/sisdependency.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 __SISDEPENDENCY_H__
       
    27 #define __SISDEPENDENCY_H__
       
    28 
       
    29 
       
    30 #include "sisuid.h"
       
    31 #include "sisversionrange.h"
       
    32 #include "stringarray.h"
       
    33 
       
    34 
       
    35 class CSISDependency : public CStructure <CSISFieldRoot::ESISDependency>
       
    36 	{
       
    37 public:
       
    38 	enum TDependencyType
       
    39 		{
       
    40 		EPkgDependency,
       
    41 		ETargetDependency
       
    42 		};
       
    43 public:
       
    44 	/**
       
    45 	 * Default constructor.
       
    46 	 */
       
    47 	CSISDependency ();
       
    48 	/**
       
    49 	 * Copy constructor.
       
    50 	 */
       
    51 	CSISDependency (const CSISDependency& aInitialiser);
       
    52 	/**
       
    53 	 * Create a CSISDependency object from UID and version range of 
       
    54 	 * the dependency.
       
    55 	 * @param aUID UID of the dependency.
       
    56 	 * @param aFrom From part of version range
       
    57 	 * @param aFrom To part of version range
       
    58 	 */
       
    59 	CSISDependency (const CSISUid::TUid aUID, const TVersion& aFrom, const TVersion& aTo);
       
    60 	/**
       
    61 	 * Sanity check for the class. This class will call Verify 
       
    62 	 * on all its members. For each language a separate dependency 
       
    63 	 * name should be provided. Therefor language count and 
       
    64 	 * dependency name count should match.
       
    65 	 * 
       
    66 	 * @param aLanguages Number of languages in the sis.
       
    67 	 */
       
    68 	virtual void Verify (const TUint32 aLanguages) const;
       
    69 	/**
       
    70 	 * class name
       
    71 	 */
       
    72 	virtual std::string Name () const;
       
    73 	/**
       
    74 	 * Add a new dependency name into the existing list of names.
       
    75 	 * @param aName new dependency name
       
    76 	 */
       
    77 	void AddDependencyName (const std::wstring& aName);
       
    78 	/**
       
    79 	 * Check whether the given uid matches with the dependency
       
    80 	 * UID.
       
    81 	 * @param aUID UID to check.
       
    82 	 */
       
    83 	bool HasUID (const CSISUid& aUID) const;
       
    84 	/**
       
    85 	 * Get the language count from the dependency name count.
       
    86 	 * For each language a separate dependency name should be provided.
       
    87 	 * Therefor language count and dependency name count should match.
       
    88 	 */
       
    89 	TUint32 LanguageCount () const;
       
    90 	/**
       
    91 	 * Adds the write the package details into the stream.
       
    92 	 * @param aStream - Stream in which the package entries need to be written.
       
    93 	 * @param aVerbose - If this option is set then detail description of pkg
       
    94 	 * 			will be written into the stream.
       
    95 	 */
       
    96 	void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
    97 	/**
       
    98 	 * Set whether the dependency is a target(device) or package dependency.
       
    99 	 * @param aDependencyType new dependency type.
       
   100 	 */
       
   101 	inline void SetDependencyType(TDependencyType aDependencyType) const;
       
   102 	/**
       
   103 	 * Get the UID of the dependency.
       
   104 	 */
       
   105 	inline const CSISUid& SisUID() const;
       
   106 	/**
       
   107 	 * Get the version range of the dependency
       
   108 	 */
       
   109 	inline const CSISVersionRange& VersionRange() const;
       
   110 
       
   111 private:
       
   112 	void InsertMembers ();
       
   113 
       
   114 private:
       
   115 	CSISUid				iUid;
       
   116 	CSISVersionRange	iVersionRange;
       
   117 	CSISArrayOfStrings	iDependencyNames;
       
   118 	mutable TDependencyType		iDependencyType;
       
   119 	};
       
   120 
       
   121 
       
   122 
       
   123 inline CSISDependency::CSISDependency () :
       
   124 		iVersionRange (true),
       
   125 		iDependencyType(EPkgDependency)
       
   126 	{
       
   127 	InsertMembers (); 
       
   128 	}
       
   129 
       
   130 
       
   131 inline void CSISDependency::AddDependencyName (const std::wstring& aName)
       
   132 	{ 
       
   133 	iDependencyNames.Push (CSISString (aName)); 
       
   134 	}
       
   135 
       
   136 
       
   137 inline bool CSISDependency::HasUID (const CSISUid& aUID) const
       
   138 	{ 
       
   139 	return iUid == aUID; 
       
   140 	}
       
   141 
       
   142 
       
   143 inline TUint32 CSISDependency::LanguageCount () const
       
   144 	{ 
       
   145 	return iDependencyNames.size (); 
       
   146 	}
       
   147 
       
   148 inline void CSISDependency::SetDependencyType(TDependencyType aDependencyType) const
       
   149 	{
       
   150 	iDependencyType = aDependencyType;
       
   151 	}
       
   152 
       
   153 inline const CSISUid& CSISDependency::SisUID() const
       
   154 	{
       
   155 	return iUid;
       
   156 	}
       
   157 
       
   158 inline const CSISVersionRange& CSISDependency::VersionRange() const
       
   159 	{
       
   160 	return iVersionRange;
       
   161 	}
       
   162 
       
   163 #endif // __SISDEPENDENCY_H__
       
   164