|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Capsulating sql items |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CMSQLBASEITEM_H |
|
24 #define __CMSQLBASEITEM_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 #include "cmcommontypes.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CSHA1; |
|
32 |
|
33 /** |
|
34 * CCmSqlBaseItem class |
|
35 * Capsulating sql items |
|
36 * @lib cmcommon.lib |
|
37 * @since S60 v3.0 |
|
38 */ |
|
39 class CCmSqlBaseItem : public CBase |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /* Constructors and destructor. */ |
|
45 |
|
46 /** |
|
47 * Creates new CCmSqlBaseItem class. |
|
48 * @param None |
|
49 * @return pointer to CCmSqlBaseItem class |
|
50 */ |
|
51 IMPORT_C static CCmSqlBaseItem* NewL(); |
|
52 |
|
53 /** |
|
54 * Creates new CCmSqlBaseItem class and |
|
55 * leaves the instance in the cleanup stack. |
|
56 * @return pointer to CCmSqlBaseItem class |
|
57 */ |
|
58 IMPORT_C static CCmSqlBaseItem* NewLC(); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 IMPORT_C virtual ~CCmSqlBaseItem(); |
|
64 |
|
65 public: |
|
66 |
|
67 /** |
|
68 * Sets database id |
|
69 * @since Series 60 3.1 |
|
70 * @param aId, database id |
|
71 * @return None |
|
72 */ |
|
73 IMPORT_C void SetId( const TInt64 aId ); |
|
74 |
|
75 /** |
|
76 * Sets cds id ( received from media server ) |
|
77 * @since Series 60 3.1 |
|
78 * @param aCdsId, cds id |
|
79 * @return None |
|
80 */ |
|
81 IMPORT_C void SetCdsIdL( const TDesC8& aCdsId ); |
|
82 |
|
83 /** |
|
84 * Sets hash value |
|
85 * @since Series 60 3.1 |
|
86 * @param aHash, hash value |
|
87 * @return None |
|
88 */ |
|
89 IMPORT_C void SetHashL( const TDesC& aHash ); |
|
90 |
|
91 /** |
|
92 * Sets search id of item |
|
93 * @since S60 3.1 |
|
94 * @param aSearchId, search id |
|
95 * @return None |
|
96 */ |
|
97 IMPORT_C void SetSearchId( const TInt64 aSearchId ); |
|
98 |
|
99 /** |
|
100 * Gets database id |
|
101 * @since Series 60 3.1 |
|
102 * @param None |
|
103 * @return Database id |
|
104 */ |
|
105 IMPORT_C TInt64 Id() const; |
|
106 |
|
107 /** |
|
108 * Gets cds id ( received from media server ) |
|
109 * @since Series 60 3.1 |
|
110 * @param None |
|
111 * @return CdsId |
|
112 */ |
|
113 IMPORT_C TDesC8& CdsId() const; |
|
114 |
|
115 /** |
|
116 * Gets hash value |
|
117 * @since Series 60 3.1 |
|
118 * @param None |
|
119 * @return Hash value |
|
120 */ |
|
121 IMPORT_C TDesC& Hash() const; |
|
122 |
|
123 /** |
|
124 * Gets search id of item |
|
125 * @since Series 60 3.1 |
|
126 * @param None |
|
127 * @return Search id |
|
128 */ |
|
129 IMPORT_C TInt64 SearchId() const; |
|
130 |
|
131 /** |
|
132 * Compares items |
|
133 * @since Series 60 3.1 |
|
134 * @param aFirst, first item |
|
135 * @param aSecond, second item |
|
136 * @return Comparison result |
|
137 */ |
|
138 IMPORT_C static TInt CompareByHash( const CCmSqlBaseItem& aFirst, |
|
139 const CCmSqlBaseItem& aSecond ); |
|
140 |
|
141 /** |
|
142 * Compares items |
|
143 * @since Series 60 3.1 |
|
144 * @param aFirst, first item |
|
145 * @param aSecond, second item |
|
146 * @return Comparison result |
|
147 */ |
|
148 IMPORT_C static TInt CompareByCdsId( const CCmSqlBaseItem& aFirst, |
|
149 const CCmSqlBaseItem& aSecond ); |
|
150 |
|
151 protected: |
|
152 |
|
153 /** |
|
154 * Constructor. |
|
155 */ |
|
156 CCmSqlBaseItem(); |
|
157 |
|
158 /** |
|
159 * Second-phase constructor. |
|
160 */ |
|
161 void ConstructL(); |
|
162 |
|
163 |
|
164 protected: // data |
|
165 |
|
166 // Database id |
|
167 TInt64 iId; |
|
168 |
|
169 // Item id received from media server |
|
170 HBufC8* iCdsId; // owned |
|
171 |
|
172 // Calculated hash code |
|
173 HBufC* iHash; // owned |
|
174 |
|
175 // Search id |
|
176 TInt64 iSearchId; |
|
177 |
|
178 }; |
|
179 |
|
180 #endif // __CMSQLBASEITEM_H |