secureswitools/swisistools/source/rscparser/uidtype.h
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
child 70 e8965914fac7
equal deleted inserted replaced
65:7333d7932ef7 66:8b7f4e561641
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // uidtype.h
       
    15 //
       
    16 
       
    17 /** 
       
    18 * @file uidtype.h
       
    19 *
       
    20 * @internalComponent
       
    21 * @released
       
    22 */
       
    23 
       
    24 #ifndef __UIDTYPE_H__
       
    25 #define __UIDTYPE_H__
       
    26 
       
    27 #include <iostream>
       
    28 #include "symbiantypes.h"
       
    29 
       
    30 namespace rscparser
       
    31 {
       
    32 /**
       
    33 Defines a Null UID value.
       
    34 */
       
    35 const TInt KNullUidValue=0;
       
    36 
       
    37 /**
       
    38 Defines the number of TUids that form a TUidType.
       
    39 */
       
    40 const TInt KMaxCheckedUid=3;
       
    41 
       
    42 /**
       
    43 A globally unique 32-bit number.
       
    44 */
       
    45 class TUid
       
    46 	{
       
    47 public:
       
    48 	TBool operator==(const TUid& aUid) const;
       
    49 	TBool operator!=(const TUid& aUid) const;
       
    50 	static inline TUid Uid(TInt aUid);
       
    51 	static inline TUid Null();
       
    52 	TUint32 GetUid();
       
    53 	
       
    54 public:
       
    55 	/**
       
    56 	The 32-bit integer UID value.
       
    57 	*/
       
    58 	TUint32 iUid;
       
    59 	};
       
    60 
       
    61 
       
    62 /**
       
    63 Defines a null UID
       
    64 */
       
    65 #define NullUid TUid::Null()
       
    66 
       
    67 /**
       
    68 Constructs a Null-valued TUid object.
       
    69 
       
    70 @return The constructed Null-valued TUid object.
       
    71 */
       
    72 inline TUid TUid::Null()
       
    73 	{TUid uid={KNullUidValue};return uid;}
       
    74 
       
    75 /**
       
    76 Constructs the TUid object from a 32-bit integer.
       
    77 
       
    78 @param aUid The 32-bit integer value from which the TUid object is to be
       
    79             constructed.
       
    80 
       
    81 @return The constructed TUid object.
       
    82 */
       
    83 inline TUid TUid::Uid(TInt aUid)
       
    84 	{TUid uid={aUid};return uid;}
       
    85 	
       
    86 /**
       
    87 Encapsulates a set of three unique identifiers (UIDs) which, in combination, 
       
    88 identify a system object such as a GUI application or a DLL. The three
       
    89 component UIDs are referred to as UID1, UID2 and UID3.
       
    90 
       
    91 An object of this type is referred to as a compound identifier or a UID type.
       
    92 */
       
    93 class TUidType
       
    94 	{
       
    95 public:
       
    96 
       
    97 	 TUidType();
       
    98 	 TUidType(TUid aUid1,TUid aUid2,TUid aUid3);
       
    99 	 TBool operator==(const TUidType& aUidType) const;
       
   100 	 const TUid& operator[](TInt anIndex) const;
       
   101 	
       
   102 private:
       
   103 	TUid iUid[KMaxCheckedUid];
       
   104 	};
       
   105 
       
   106 /**
       
   107 Packages a Uid type together with a checksum.
       
   108 */
       
   109 class TCheckedUid
       
   110      {
       
   111  public:
       
   112      TCheckedUid();
       
   113      TCheckedUid(const TUidType& aUidType);
       
   114 	 TCheckedUid(const TUint8* aDes, TInt aLen);
       
   115      void Set(const TUidType& aUidType);
       
   116 	 void Set(const TUint8* aDes, TInt aLen);
       
   117      const TUidType&  UidType() const;
       
   118 private:
       
   119     TUidType iType;
       
   120 	TUint32 iCheck;
       
   121     };
       
   122 }
       
   123 #endif