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 #include <e32std.h> |
|
24 #include "cmsqlbaseitem.h" |
|
25 #include "msdebug.h" |
|
26 |
|
27 // ======== LOCAL FUNCTIONS ======== |
|
28 // --------------------------------------------------------------------------- |
|
29 // NewL |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 EXPORT_C CCmSqlBaseItem* CCmSqlBaseItem::NewL() |
|
33 { |
|
34 CCmSqlBaseItem* self = CCmSqlBaseItem::NewLC(); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // NewLC |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C CCmSqlBaseItem* CCmSqlBaseItem::NewLC() |
|
44 { |
|
45 CCmSqlBaseItem* self = new ( ELeave ) CCmSqlBaseItem(); |
|
46 CleanupStack::PushL( self ); |
|
47 self->ConstructL(); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // Destructor |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 EXPORT_C CCmSqlBaseItem::~CCmSqlBaseItem() |
|
56 { |
|
57 delete iCdsId; |
|
58 delete iHash; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CCmSqlBaseItem::SetId |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C void CCmSqlBaseItem::SetId( const TInt64 aId ) |
|
66 { |
|
67 iId = aId; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CCmSqlBaseItem::SetCdsIdL |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 EXPORT_C void CCmSqlBaseItem::SetCdsIdL( const TDesC8& aCdsId ) |
|
75 { |
|
76 delete iCdsId; |
|
77 iCdsId = NULL; |
|
78 |
|
79 if( &aCdsId ) |
|
80 { |
|
81 iCdsId = aCdsId.AllocL(); |
|
82 } |
|
83 else |
|
84 { |
|
85 iCdsId = KNullDesC8().AllocL(); |
|
86 } |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CCmSqlBaseItem::SetHashL |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C void CCmSqlBaseItem::SetHashL( const TDesC& aHash ) |
|
94 { |
|
95 delete iHash; |
|
96 iHash = NULL; |
|
97 |
|
98 if( &aHash ) |
|
99 { |
|
100 iHash = aHash.AllocL(); |
|
101 } |
|
102 else |
|
103 { |
|
104 iHash = KNullDesC().AllocL(); |
|
105 } |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // CCmSqlBaseItem::SetSearchId |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C void CCmSqlBaseItem::SetSearchId( |
|
113 const TInt64 aSearchId ) |
|
114 { |
|
115 iSearchId = aSearchId; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CCmSqlBaseItem::Id |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C TInt64 CCmSqlBaseItem::Id() const |
|
123 { |
|
124 return iId; |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CCmSqlBaseItem::CdsId |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C TDesC8& CCmSqlBaseItem::CdsId() const |
|
132 { |
|
133 return *iCdsId; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CCmSqlBaseItem::Hash |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C TDesC& CCmSqlBaseItem::Hash() const |
|
141 { |
|
142 return *iHash; |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // CCmSqlBaseItem::SearchId |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 EXPORT_C TInt64 CCmSqlBaseItem::SearchId() const |
|
150 { |
|
151 return iSearchId; |
|
152 } |
|
153 |
|
154 // --------------------------------------------------------------------------- |
|
155 // CCmSqlBaseItem::CompareByHash |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 EXPORT_C TInt CCmSqlBaseItem::CompareByHash( |
|
159 const CCmSqlBaseItem& aFirst, const CCmSqlBaseItem& aSecond ) |
|
160 { |
|
161 return aFirst.Hash().Compare( aSecond.Hash() ); |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CCmSqlBaseItem::CompareByCdsId |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C TInt CCmSqlBaseItem::CompareByCdsId( |
|
169 const CCmSqlBaseItem& aFirst, const CCmSqlBaseItem& aSecond ) |
|
170 { |
|
171 return aFirst.CdsId().Compare( aSecond.CdsId() ); |
|
172 } |
|
173 |
|
174 // --------------------------------------------------------------------------- |
|
175 // Default constructor |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 CCmSqlBaseItem::CCmSqlBaseItem() |
|
179 { |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // ConstructL |
|
184 // --------------------------------------------------------------------------- |
|
185 // |
|
186 void CCmSqlBaseItem::ConstructL() |
|
187 { |
|
188 iCdsId = KNullDesC8().AllocL(); |
|
189 iHash = KNullDesC().AllocL(); |
|
190 } |
|
191 |
|
192 // End of file |
|
193 |
|