taskswitcher/utils/src/tsentrykey.cpp
changeset 127 7b66bc3c6dc9
parent 116 305818acdca4
--- a/taskswitcher/utils/src/tsentrykey.cpp	Wed Oct 13 12:59:22 2010 +0300
+++ b/taskswitcher/utils/src/tsentrykey.cpp	Mon Oct 18 10:44:15 2010 +0300
@@ -19,28 +19,104 @@
 #include "tsentrykey.h"
 
 // -----------------------------------------------------------------------------
-//
+/**
+ * @return amount of memory ( number of bytes ) required to store key.
+ */
+TInt TTsEntryKey::Size()
+    {
+    return sizeof( TInt ) * 2;
+    }
+// -----------------------------------------------------------------------------
+/**
+ * Default constructor. Key members are initialized with 0
+ */
+TTsEntryKey::TTsEntryKey()
+:
+    iKey( 0 ),
+    iRoot( 0 )
+    {
+    //No implementation required
+    }
+
 // -----------------------------------------------------------------------------
-//
-TTsEntryKey::TTsEntryKey(TInt parentId)
+/**
+ * Constructor. Initialize members with provided values.
+ * @param aKey - key value
+ * @param aRoot - root value
+ */
+TTsEntryKey::TTsEntryKey( TTsKey aKey, TInt aRoot )
 :
-    mParentId(parentId)
-{}
+    iKey( aKey ),
+    iRoot( aRoot )
+    {
+    //No implementation required
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Copy constructor
+ * @param aKey - key value that need to be duplicated
+ */
+TTsEntryKey::TTsEntryKey( const TTsEntryKey& aKey )
+:
+    iKey( aKey.iKey ),
+    iRoot( aKey.iRoot )
+    {
+    //No implementation required
+    }
 
 // -----------------------------------------------------------------------------
-//
+/**
+ * Assignment operator. Initialize members with new values
+ * @param aKey - key value that need to be duplicated
+ * @return reference to key instance
+ */
+TTsEntryKey& TTsEntryKey::operator =( const TTsEntryKey& aKey )
+    {
+    iKey = aKey.iKey;
+    iRoot = aKey.iRoot;
+    return (*this);
+    }
+
 // -----------------------------------------------------------------------------
-//
-TBool TTsEntryKey::operator ==(const TTsEntryKey& key) const
-{
-    return (mParentId == key.mParentId);
-}
+/**
+ * Comparison operator
+ * @param aKey - compared value
+ * @return EFalse if values are not equal, other value if they match
+ */
+TBool TTsEntryKey::operator == ( const TTsEntryKey aKey ) const
+    {
+    return ( iKey == aKey.iKey && iRoot == aKey.iRoot );
+    }
 
 // -----------------------------------------------------------------------------
-//
+/**
+ * Enable access to key value
+ * @return key value
+ */
+TInt TTsEntryKey::Key() const
+    {
+    return iKey;
+    }
+
 // -----------------------------------------------------------------------------
-//
-TInt TTsEntryKey::WindowGroupId() const
-{
-    return mParentId;
-}
+/**
+ * Serialize key into data stream
+ * @param aStream - destination binary stream
+ */
+void TTsEntryKey::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iKey );
+    aStream.WriteInt32L( iRoot );
+    }
+
+// -----------------------------------------------------------------------------
+/**
+ * Deserialize key from data stream
+ * @param aStream - source binary stream
+ */
+void TTsEntryKey::InternalizeL( RReadStream& aStream )
+    {
+    iKey = aStream.ReadInt32L();
+    iRoot = aStream.ReadInt32L();
+    }