taskswitcher/utils/src/tsentrykey.cpp
changeset 127 7b66bc3c6dc9
parent 116 305818acdca4
equal deleted inserted replaced
126:efda7c0771b9 127:7b66bc3c6dc9
    17 
    17 
    18 
    18 
    19 #include "tsentrykey.h"
    19 #include "tsentrykey.h"
    20 
    20 
    21 // -----------------------------------------------------------------------------
    21 // -----------------------------------------------------------------------------
    22 //
    22 /**
       
    23  * @return amount of memory ( number of bytes ) required to store key.
       
    24  */
       
    25 TInt TTsEntryKey::Size()
       
    26     {
       
    27     return sizeof( TInt ) * 2;
       
    28     }
    23 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    24 //
    30 /**
    25 TTsEntryKey::TTsEntryKey(TInt parentId)
    31  * Default constructor. Key members are initialized with 0
       
    32  */
       
    33 TTsEntryKey::TTsEntryKey()
    26 :
    34 :
    27     mParentId(parentId)
    35     iKey( 0 ),
    28 {}
    36     iRoot( 0 )
       
    37     {
       
    38     //No implementation required
       
    39     }
    29 
    40 
    30 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    31 //
    42 /**
    32 // -----------------------------------------------------------------------------
    43  * Constructor. Initialize members with provided values.
    33 //
    44  * @param aKey - key value
    34 TBool TTsEntryKey::operator ==(const TTsEntryKey& key) const
    45  * @param aRoot - root value
    35 {
    46  */
    36     return (mParentId == key.mParentId);
    47 TTsEntryKey::TTsEntryKey( TTsKey aKey, TInt aRoot )
    37 }
    48 :
       
    49     iKey( aKey ),
       
    50     iRoot( aRoot )
       
    51     {
       
    52     //No implementation required
       
    53     }
    38 
    54 
    39 // -----------------------------------------------------------------------------
    55 // -----------------------------------------------------------------------------
    40 //
    56 /**
       
    57  * Copy constructor
       
    58  * @param aKey - key value that need to be duplicated
       
    59  */
       
    60 TTsEntryKey::TTsEntryKey( const TTsEntryKey& aKey )
       
    61 :
       
    62     iKey( aKey.iKey ),
       
    63     iRoot( aKey.iRoot )
       
    64     {
       
    65     //No implementation required
       
    66     }
       
    67 
    41 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    42 //
    69 /**
    43 TInt TTsEntryKey::WindowGroupId() const
    70  * Assignment operator. Initialize members with new values
    44 {
    71  * @param aKey - key value that need to be duplicated
    45     return mParentId;
    72  * @return reference to key instance
    46 }
    73  */
       
    74 TTsEntryKey& TTsEntryKey::operator =( const TTsEntryKey& aKey )
       
    75     {
       
    76     iKey = aKey.iKey;
       
    77     iRoot = aKey.iRoot;
       
    78     return (*this);
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 /**
       
    83  * Comparison operator
       
    84  * @param aKey - compared value
       
    85  * @return EFalse if values are not equal, other value if they match
       
    86  */
       
    87 TBool TTsEntryKey::operator == ( const TTsEntryKey aKey ) const
       
    88     {
       
    89     return ( iKey == aKey.iKey && iRoot == aKey.iRoot );
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 /**
       
    94  * Enable access to key value
       
    95  * @return key value
       
    96  */
       
    97 TInt TTsEntryKey::Key() const
       
    98     {
       
    99     return iKey;
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 /**
       
   104  * Serialize key into data stream
       
   105  * @param aStream - destination binary stream
       
   106  */
       
   107 void TTsEntryKey::ExternalizeL( RWriteStream& aStream ) const
       
   108     {
       
   109     aStream.WriteInt32L( iKey );
       
   110     aStream.WriteInt32L( iRoot );
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 /**
       
   115  * Deserialize key from data stream
       
   116  * @param aStream - source binary stream
       
   117  */
       
   118 void TTsEntryKey::InternalizeL( RReadStream& aStream )
       
   119     {
       
   120     iKey = aStream.ReadInt32L();
       
   121     iRoot = aStream.ReadInt32L();
       
   122     }