secureswitools/swisistools/source/sisxlibrary/sisproperty.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  @internalComponent
       
    26  @released
       
    27 */
       
    28 
       
    29 #ifndef __SISPROPERTY_H__
       
    30 #define __SISPROPERTY_H__
       
    31 
       
    32 #include "structure.h"
       
    33 #include "numeric.h"
       
    34 
       
    35 
       
    36 class CSISProperty : public CStructure <CSISFieldRoot::ESISProperty>
       
    37 
       
    38 	{
       
    39 public:
       
    40 	typedef TUint32 TKey;
       
    41 	typedef TUint32 TValue;
       
    42 
       
    43 private:
       
    44 	void InsertMembers ();
       
    45 
       
    46 public:
       
    47 	CSISProperty ();
       
    48 	CSISProperty (const CSISProperty& aInitialiser);
       
    49 	CSISProperty (const TKey aKey, const TValue aValue);
       
    50 
       
    51 	virtual std::string Name () const;
       
    52 #ifdef GENERATE_ERRORS
       
    53 	virtual void CreateDefects ();
       
    54 #endif // GENERATE_ERRORS
       
    55 	
       
    56 	void AddPackageEntry(std::wostream& aStream, bool aVerbose) const;
       
    57 	
       
    58 	inline TKey Key() const;
       
    59 	inline TValue Value() const;
       
    60 
       
    61 private:
       
    62 	CSISInt32	iKey;
       
    63 	CSISInt32	iValue;
       
    64 
       
    65 	};
       
    66 
       
    67 
       
    68 
       
    69 inline void CSISProperty::InsertMembers ()
       
    70 	{
       
    71 	InsertMember (iKey);
       
    72 	InsertMember (iValue);
       
    73 	}
       
    74 
       
    75 
       
    76 inline CSISProperty::CSISProperty ()
       
    77 	{
       
    78 	InsertMembers ();
       
    79 	}
       
    80 
       
    81 
       
    82 inline CSISProperty::CSISProperty (const CSISProperty& aInitialiser) :
       
    83 		CStructure <CSISFieldRoot::ESISProperty> (aInitialiser),
       
    84 		iKey (aInitialiser.iKey),
       
    85 		iValue (aInitialiser.iValue)
       
    86 	{
       
    87 	InsertMembers ();
       
    88 	}
       
    89 
       
    90 
       
    91 inline CSISProperty::CSISProperty (const TKey aKey, const TValue aValue) :
       
    92 		iKey (aKey),
       
    93 		iValue (aValue)
       
    94 	{
       
    95 	InsertMembers ();
       
    96 	}
       
    97 
       
    98 
       
    99 inline std::string CSISProperty::Name () const
       
   100 	{
       
   101 	return "Property";
       
   102 	}
       
   103 
       
   104 #ifdef GENERATE_ERRORS
       
   105 inline void CSISProperty::CreateDefects ()
       
   106 	{
       
   107 	if (CSISFieldRoot::IsBugToBeCreated (CSISFieldRoot::EBugInvalidValues))
       
   108 		{
       
   109 		iKey = rand ();
       
   110 		}
       
   111 	if (CSISFieldRoot::IsBugToBeCreated (CSISFieldRoot::EBugInvalidValues))
       
   112 		{
       
   113 		iValue = rand ();
       
   114 		}
       
   115 	}
       
   116 #endif // GENERATE_ERRORS
       
   117 
       
   118 inline void CSISProperty::AddPackageEntry(std::wostream& aStream, bool aVerbose) const
       
   119 	{
       
   120 	(void)aVerbose;
       
   121 	aStream << iKey << L"=" << iValue;
       
   122 	}
       
   123 
       
   124 inline CSISProperty::TKey CSISProperty::Key() const
       
   125 	{
       
   126 	return iKey;
       
   127 	}
       
   128 
       
   129 inline CSISProperty::TValue CSISProperty::Value() const
       
   130 	{
       
   131 	return iValue;
       
   132 	}
       
   133 
       
   134 
       
   135 
       
   136 #endif // __SISPROPERTY_H__
       
   137