secureswitools/swisistools/source/sisxlibrary/sisversion.h
changeset 0 ba25891c3a9e
child 26 04d4a7bbc3e0
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 * Note: This file may contain code to generate corrupt files for test purposes.
       
    16 * Such code is excluded from production builds by use of compiler defines;
       
    17 * it is recommended that such code should be removed if this code is ever published publicly.
       
    18 * As specified in SGL.GT0188.251
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 /**
       
    24  @file 
       
    25  @publishedPartner
       
    26  @released
       
    27 */
       
    28 
       
    29 #ifndef __SISVERSION_H__
       
    30 #define __SISVERSION_H__
       
    31 
       
    32 #include "numeric.h"
       
    33 #include "structure.h"
       
    34 #include "version.h"
       
    35 
       
    36 class CSISVersion : public CStructure <CSISFieldRoot::ESISVersion>
       
    37 	{
       
    38 public:
       
    39 	typedef TInt32	TMajor;
       
    40 	typedef TInt32	TMinor;
       
    41 	typedef TInt32	TBuild;
       
    42 
       
    43 public:
       
    44 	/**
       
    45 	 * Default constructor.
       
    46 	 */
       
    47 	explicit CSISVersion (const bool aRequired = false);
       
    48 	/**
       
    49 	 * Creates an instance of this class.
       
    50 	 * @param aRequired Whether this field is an optional field or not.
       
    51 	 * @param aPermitAny Allow any ((*,*,*) or (-1, -1, -1) version number. 
       
    52 	 */
       
    53 	CSISVersion (const bool aRequired, const bool aPermitAny);
       
    54 	/**
       
    55 	 * Copy constructor.
       
    56 	 */
       
    57 	CSISVersion (const CSISVersion& aInitialiser);
       
    58 	/**
       
    59 	 * Verify the structure. In case of any invalid data function
       
    60 	 * will throw an exception.
       
    61 	 * @param aLanguages Language count.
       
    62 	 */
       
    63 	virtual void Verify (const TUint32 aLanguages) const;
       
    64 	/**
       
    65 	 * Check whether the class is used or not.
       
    66 	 */
       
    67 	virtual bool WasteOfSpace () const;
       
    68 	/**
       
    69 	 * Class name
       
    70 	 */
       
    71 	virtual std::string Name () const;
       
    72 #ifdef GENERATE_ERRORS
       
    73 	virtual void CreateDefects ();
       
    74 #endif // GENERATE_ERRORS
       
    75 	/**
       
    76 	 * Check if the version is specified or not.
       
    77 	 */
       
    78 	bool Specified () const;
       
    79 	/**
       
    80 	 * Get the major version number
       
    81 	 */
       
    82 	TMajor	Major () const; 
       
    83 	/**
       
    84 	 * Get the minor version number
       
    85 	 */
       
    86 	TMinor	Minor () const; 
       
    87 	/**
       
    88 	 * Get the build number
       
    89 	 */
       
    90 	TBuild	Build () const;
       
    91 	/**
       
    92 	 * Set a new value for version.
       
    93 	 */
       
    94 	void SetVersion (const TVersion& aVersion);
       
    95 	/**
       
    96 	 * Adds the write the package details into the stream.
       
    97 	 * @param aStream - Stream in which the package entries need to be written.
       
    98 	 * @param aVerbose - If this option is set then detail description of pkg
       
    99 	 * 			will be written into the stream.
       
   100 	 */
       
   101 	void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
   102 
       
   103 private:
       
   104 	void InsertMembers ();
       
   105 
       
   106 private:
       
   107 	const bool	iPermitAny;
       
   108 	CSISInt32	iMajor;
       
   109 	CSISInt32	iMinor;
       
   110 	CSISInt32	iBuild;
       
   111 
       
   112 	};
       
   113 
       
   114 
       
   115 
       
   116 bool operator == (const CSISVersion& aLHS, const CSISVersion& aRHS);
       
   117 bool operator < (const CSISVersion& aLHS, const CSISVersion& aRHS);
       
   118 
       
   119 
       
   120 
       
   121 
       
   122 inline bool CSISVersion::Specified () const
       
   123 	{ 
       
   124 	return (iMajor != KIrrelevant); 
       
   125 	}
       
   126 
       
   127 inline CSISVersion::TMajor CSISVersion::Major () const
       
   128 	{ 
       
   129 	return iMajor;
       
   130 	} 
       
   131 
       
   132 inline CSISVersion::TMinor CSISVersion::Minor () const
       
   133 	{
       
   134 	return iMinor;
       
   135 	} 
       
   136 
       
   137 inline CSISVersion::TBuild CSISVersion::Build () const
       
   138 	{
       
   139 	return iBuild;
       
   140 	} 
       
   141 
       
   142 inline void CSISVersion::SetVersion (const TVersion& aVersion)
       
   143 	{
       
   144 	iMajor = aVersion.Major (); 
       
   145 	iMinor = aVersion.Minor (); 
       
   146 	iBuild = aVersion.Build (); 
       
   147 	}
       
   148 
       
   149 inline bool CSISVersion::WasteOfSpace () const
       
   150 	{
       
   151 	return ! Required () && ! Specified (); 
       
   152 	}
       
   153 
       
   154 
       
   155 inline std::string CSISVersion::Name () const
       
   156 	{
       
   157 	return "Version";
       
   158 	}
       
   159 
       
   160 
       
   161 
       
   162 
       
   163 #endif // __SISVERSION_H__
       
   164