secureswitools/swisistools/source/sisxlibrary/sisuid.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 * 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 __SISUID_H__
       
    30 #define __SISUID_H__
       
    31 
       
    32 #include "structure.h"
       
    33 #include "numeric.h"
       
    34 
       
    35 static const TUint32 KNullUid = 0x00000000;
       
    36 
       
    37 
       
    38 class CSISUid : public CStructure <CSISFieldRoot::ESISUid>
       
    39 	{
       
    40 public:
       
    41 	typedef TUint32 TUid;
       
    42 
       
    43 public:
       
    44 	/**
       
    45 	 * Default constructor
       
    46 	 */
       
    47 	CSISUid ();
       
    48 	/**
       
    49 	 * Copy constructor
       
    50 	 */
       
    51 	CSISUid (const CSISUid& aInitialiser);
       
    52 	/**
       
    53 	 * Retrieve the UID value.
       
    54 	 */
       
    55 	CSISUid::TUid UID1 () const;
       
    56 	/**
       
    57 	 * Class name
       
    58 	 */
       
    59 	virtual std::string Name () const;
       
    60 #ifdef GENERATE_ERRORS
       
    61 	virtual void CreateDefects ();
       
    62 #endif // GENERATE_ERRORS
       
    63 	/**
       
    64 	 * Set a new value for UID.
       
    65 	 * @param aUID UIDs new value
       
    66 	 */
       
    67 	void SetUID (const CSISUid::TUid aUID);
       
    68 	/**
       
    69 	 * Check whether two UIDs are same or not.
       
    70 	 */
       
    71 	bool operator == (const CSISUid& aCompare) const;
       
    72 	/**
       
    73 	 * Adds the write the package details into the stream.
       
    74 	 * @param aStream - Stream in which the package entries need to be written.
       
    75 	 * @param aVerbose - If this option is set then detail description of pkg
       
    76 	 * 			will be written into the stream.
       
    77 	 */
       
    78 	inline void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
    79 
       
    80 private:
       
    81 	CSISUInt32 iUID;
       
    82 
       
    83 	};
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 inline CSISUid::CSISUid ()
       
    89 	{
       
    90 	InsertMember (iUID);
       
    91 	}
       
    92 
       
    93 
       
    94 inline CSISUid::CSISUid (const CSISUid& aInitialiser) :
       
    95 		CStructure <CSISFieldRoot::ESISUid> (aInitialiser),
       
    96 		iUID (aInitialiser.iUID)
       
    97 	{
       
    98 	InsertMember (iUID);
       
    99 	}
       
   100 
       
   101 
       
   102 inline CSISUid::TUid CSISUid::UID1 () const
       
   103 	{
       
   104 	return iUID;
       
   105 	}
       
   106 
       
   107 
       
   108 inline void CSISUid::SetUID (const CSISUid::TUid aUID)
       
   109 	{ 
       
   110 	iUID = aUID; 
       
   111 	}
       
   112 
       
   113 
       
   114 inline bool CSISUid::operator == (const CSISUid& aCompare) const
       
   115 	{
       
   116 	return	(iUID == aCompare.iUID);
       
   117 	}
       
   118 
       
   119 
       
   120 inline std::string CSISUid::Name () const
       
   121 	{
       
   122 	return "Uid";
       
   123 	}
       
   124 
       
   125 inline void CSISUid::AddPackageEntry(std::wostream& aStream, bool aVerbose) const
       
   126 	{
       
   127 	aStream << L"0x" << std::hex << iUID << std::dec;
       
   128 	}
       
   129 
       
   130 #ifdef GENERATE_ERRORS
       
   131 inline void CSISUid::CreateDefects ()
       
   132 	{
       
   133 	if (CSISFieldRoot::IsBugToBeCreated (CSISFieldRoot::EBugInvalidValues))
       
   134 		{
       
   135 		iUID = rand ();
       
   136 		}
       
   137 	}
       
   138 #endif // GENERATE_ERRORS
       
   139 
       
   140 #endif // __SISXTYPE_H__
       
   141