1 /* |
|
2 * Copyright (c) 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 "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: Private snapshot item header |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __SNAPSHOTITEM_H__ |
|
20 #define __SNAPSHOTITEM_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <syncml/SmlDataSyncDefs.h> |
|
24 #include <hash.h> |
|
25 #include "mediadsproviderdefs.h" |
|
26 #include "songitem.h" |
|
27 #include "playlistitem.h" |
|
28 |
|
29 typedef TBuf<KMaxFolderNameLength> TFolderName; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * @brief TSnapshotItem |
|
35 * This class represents a single item in the ChangeFinder snapshot. |
|
36 * |
|
37 */ |
|
38 |
|
39 // Defines the maximum length of a hash. |
|
40 const TInt KMaxHashLength = 16; |
|
41 typedef TBuf8<KMaxHashLength> THashValue; |
|
42 |
|
43 class TSnapshotItem |
|
44 { |
|
45 public: |
|
46 |
|
47 /** |
|
48 * Constructor |
|
49 */ |
|
50 TSnapshotItem(); |
|
51 |
|
52 /** |
|
53 * Constructor |
|
54 * |
|
55 * @param aItemId IN: id of the item. |
|
56 * @param aParent IN: parent item, 0 as default. |
|
57 * @param aUnread IN: read/unread information, the default is read. |
|
58 */ |
|
59 TSnapshotItem( const TSmlDbItemUid& aItemId, |
|
60 const TSmlDbItemUid& aParent = 0 ); |
|
61 |
|
62 /** |
|
63 * Writes the item to a stream. |
|
64 * |
|
65 * @param aStream IN: a reference to a stream, where this item is to be written. |
|
66 */ |
|
67 void ExternalizeL( RWriteStream& aStream ) const; |
|
68 |
|
69 /** |
|
70 * Reads item from a stream. |
|
71 * |
|
72 * @param aStream IN: a reference to a stream, where this item is read from. |
|
73 */ |
|
74 void InternalizeL( RReadStream& aStream ); |
|
75 |
|
76 /** |
|
77 * Getter for item UID value. |
|
78 * @return const TSmlDbItemUid& item UID. |
|
79 */ |
|
80 const TSmlDbItemUid& ItemId() const; |
|
81 |
|
82 /** |
|
83 * Setter for item UID value. |
|
84 * @param aItemId item UID. |
|
85 */ |
|
86 void SetItemId( const TSmlDbItemUid& aItemId ); |
|
87 |
|
88 /** |
|
89 * Getter for parent UID value. |
|
90 * @return const TSmlDbItemUid& parent UID. |
|
91 */ |
|
92 const TSmlDbItemUid& ParentId() const; |
|
93 |
|
94 /** |
|
95 * Setter for parent UID value. |
|
96 * @param aParentId parent UID. |
|
97 */ |
|
98 void SetParentId( const TSmlDbItemUid& aParentId ); |
|
99 |
|
100 /** |
|
101 * Generate hash value from foldername |
|
102 * @param aFolderName foldername |
|
103 * @param CMD5& aHasher MD5 hasher |
|
104 */ |
|
105 void SetItemHash( const TDesC& aFolderName, CMD5& aHasher ); |
|
106 |
|
107 /** |
|
108 * Generate hash value from aSongItem content |
|
109 * @param aSongItem song item |
|
110 * @param CMD5& aHasher MD5 hasher |
|
111 */ |
|
112 void SetItemHash( const CSongItem& aSongItem, CMD5& aHasher ); |
|
113 |
|
114 /** |
|
115 * Generate hash value from aPlaylist content |
|
116 * @param aPlaylist aPlaylist |
|
117 * @param CMD5& aHasher MD5 hasher |
|
118 */ |
|
119 void SetItemHash( const CPlaylistItem& aPlaylist, CMD5& aHasher ); |
|
120 |
|
121 /** |
|
122 * Getter for generated hash value. |
|
123 * @return const TDesC8& hash value |
|
124 */ |
|
125 const TDesC8& Hash() const; |
|
126 |
|
127 private: |
|
128 TSmlDbItemUid iItemId; |
|
129 TSmlDbItemUid iParentId; |
|
130 THashValue iHash; |
|
131 }; |
|
132 |
|
133 #endif |
|