secureswitools/swisistools/source/rscparser/uidtype.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
child 27 e8965914fac7
equal deleted inserted replaced
25:7333d7932ef7 26: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 /** 
       
    15 * @file uidtype.cpp
       
    16 *
       
    17 * @internalComponent
       
    18 * @released
       
    19 */
       
    20 #include <cassert>
       
    21 #include "uidtype.h"
       
    22 using namespace rscparser;
       
    23 // Class TUid
       
    24 
       
    25 TBool TUid::operator==(const TUid& aUid) const
       
    26 /**
       
    27 Compares two UIDs for equality.
       
    28 
       
    29 @param aUid The UID to be compared with this UID.
       
    30 
       
    31 @return True, if the two UIDs are equal; false otherwise. 
       
    32 */
       
    33 	{
       
    34 
       
    35 	return(iUid==aUid.iUid);
       
    36 	}
       
    37 
       
    38 TBool TUid::operator!=(const TUid& aUid) const
       
    39 /**
       
    40 Compares two UIDs for inequality.
       
    41 
       
    42 @param aUid The UID to be compared with this UID.
       
    43 
       
    44 @return True, if the two UIDs are unequal; false otherwise. 
       
    45 */
       
    46 	{
       
    47 
       
    48 	return(iUid!=aUid.iUid);
       
    49 	}
       
    50 
       
    51 /**
       
    52 Get  UID.
       
    53 
       
    54 @param Void
       
    55 
       
    56 @return UID. 
       
    57 */
       
    58 TUint32 TUid::GetUid()
       
    59 {
       
    60 	return iUid;
       
    61 }
       
    62 
       
    63 TUidType::TUidType()
       
    64 /**
       
    65 Default constructor.
       
    66 
       
    67 Creates a UID type, and sets all three component UIDs to NullUid.
       
    68 */
       
    69     {
       
    70 
       
    71 	memset(this,0,sizeof(TUidType));
       
    72     }
       
    73 
       
    74 TUidType::TUidType(TUid aUid1,TUid aUid2,TUid aUid3)
       
    75 /**
       
    76 Constructor that creates a UID type and sets all three UID components
       
    77 to the specified values.
       
    78 
       
    79 @param aUid1 Value for UID1.
       
    80 @param aUid2 Value for UID2.
       
    81 @param aUid3 Value for UID3.
       
    82 */
       
    83     {
       
    84 
       
    85 
       
    86     iUid[0]=aUid1;
       
    87     iUid[1]=aUid2;
       
    88     iUid[2]=aUid3;
       
    89     }
       
    90 
       
    91 
       
    92 const TUid& TUidType::operator[](TInt aIndex) const
       
    93 /**
       
    94 Gets the UID component as identified by the specified index.
       
    95 
       
    96 @param aIndex Index value indicating which UID component to return.
       
    97                0 specifies UID1,
       
    98                1 specifies UID2,
       
    99                2 specifies UID3.
       
   100 
       
   101 @return A reference to the required UID component.
       
   102 
       
   103 @panic USER 37 if aIndex is not in the range 0 to 2, inclusive.
       
   104 */
       
   105     {
       
   106 
       
   107 	assert(aIndex>=0 && aIndex<KMaxCheckedUid);
       
   108 	return(iUid[aIndex]);
       
   109     }
       
   110 
       
   111 TBool TUidType::operator==(const TUidType& aUidType) const
       
   112 /**
       
   113 Compares this UID type for equality with the specified UID type.
       
   114 
       
   115 @param aUidType The UID type to be compared. 
       
   116 
       
   117 @return True, if each component UID is equal to the corresponding component 
       
   118         UID in the specified UID type; false, otherwise.
       
   119 */
       
   120     {
       
   121 
       
   122     return(iUid[0]==aUidType.iUid[0] &&
       
   123            iUid[1]==aUidType.iUid[1] &&
       
   124            iUid[2]==aUidType.iUid[2]);
       
   125     }
       
   126 
       
   127 TCheckedUid::TCheckedUid()
       
   128 //
       
   129 // Constructor
       
   130 //
       
   131 	{
       
   132 
       
   133 	memset(this,0,sizeof(TCheckedUid));
       
   134 	}
       
   135 
       
   136 TCheckedUid::TCheckedUid(const TUidType& aUidType)
       
   137 //
       
   138 // Constructor
       
   139 //
       
   140 	{
       
   141 
       
   142 	Set(aUidType);
       
   143 	}
       
   144 
       
   145 void TCheckedUid::Set(const TUidType& aUidType)
       
   146 //
       
   147 // Set from a aUidType
       
   148 //
       
   149 	{
       
   150 	iType=aUidType;
       
   151 	}
       
   152 
       
   153 const TUidType&  TCheckedUid::UidType() const
       
   154 {
       
   155 	return (iType);
       
   156 }
       
   157 
       
   158 void TCheckedUid::Set(const TUint8* aDes, TInt aLen)
       
   159     {
       
   160    	assert(aLen == sizeof(TCheckedUid));
       
   161     memcpy(this,aDes,aLen);
       
   162     }
       
   163 
       
   164 TCheckedUid::TCheckedUid(const TUint8* aDes, TInt aLen)
       
   165     {
       
   166     memset(this,0,sizeof(TCheckedUid));
       
   167     Set(aDes, aLen);
       
   168     }