|
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 property items |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CMSQLPROPERTYITEM_H |
|
24 #define __CMSQLPROPERTYITEM_H |
|
25 |
|
26 // INCLUDES |
|
27 #include <e32base.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class RWriteStream; |
|
31 class RReadStream; |
|
32 |
|
33 /** |
|
34 * CCmSqlPropertyItem class |
|
35 * Capsulating property items |
|
36 * @lib cmcommon.lib |
|
37 * @since S60 v3.0 |
|
38 */ |
|
39 class CCmSqlPropertyItem : public CBase |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /* Constructors and destructor. */ |
|
45 |
|
46 /** |
|
47 * Creates new CCmSqlPropertyItem class. |
|
48 * @param None |
|
49 * @return pointer to CCmSqlPropertyItem class |
|
50 */ |
|
51 IMPORT_C static CCmSqlPropertyItem* NewL(); |
|
52 |
|
53 /** |
|
54 * Creates new CCmSqlPropertyItem class and |
|
55 * leaves the instance in the cleanup stack. |
|
56 * @return pointer to CCmSqlPropertyItem class |
|
57 */ |
|
58 IMPORT_C static CCmSqlPropertyItem* NewLC(); |
|
59 |
|
60 IMPORT_C CCmSqlPropertyItem( const CCmSqlPropertyItem& aItem ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 IMPORT_C virtual ~CCmSqlPropertyItem(); |
|
66 |
|
67 public: |
|
68 |
|
69 /** |
|
70 * Sets database id |
|
71 * @since Series 60 3.1 |
|
72 * @param aId, database id |
|
73 * @return None |
|
74 */ |
|
75 IMPORT_C void SetId( const TInt64 aId ); |
|
76 |
|
77 /** |
|
78 * Sets value of the property in textual format |
|
79 * @since Series 60 3.1 |
|
80 * @param aName, text field |
|
81 * @return None |
|
82 */ |
|
83 IMPORT_C void SetNameL( const TDesC8& aName ); |
|
84 |
|
85 /** |
|
86 * Sets status of the item |
|
87 * @since Series 60 3.1 |
|
88 * @param aStatus, ETrue if item already in db |
|
89 * @return None |
|
90 */ |
|
91 IMPORT_C void SetStatus( const TBool aStatus ); |
|
92 |
|
93 /** |
|
94 * Gets database id |
|
95 * @since Series 60 3.1 |
|
96 * @param None |
|
97 * @return Database id |
|
98 */ |
|
99 IMPORT_C TInt64 Id() const; |
|
100 |
|
101 /** |
|
102 * Gets property text value |
|
103 * @since Series 60 3.1 |
|
104 * @param None |
|
105 * @return Property value |
|
106 */ |
|
107 IMPORT_C TDesC8& Name() const; |
|
108 |
|
109 /** |
|
110 * Gets status of the item |
|
111 * @since Series 60 3.1 |
|
112 * @param None |
|
113 * @return Status ( ETrue if item already in db ) |
|
114 */ |
|
115 IMPORT_C TBool Status() const; |
|
116 |
|
117 /** |
|
118 * Compares items |
|
119 * @since Series 60 3.1 |
|
120 * @param aFirst, first item |
|
121 * @param aSecond, second item |
|
122 * @return Comparison result |
|
123 */ |
|
124 IMPORT_C static TInt CompareItemsByName( const CCmSqlPropertyItem& aFirst, |
|
125 const CCmSqlPropertyItem& aSecond ); |
|
126 |
|
127 public: |
|
128 |
|
129 /** |
|
130 * Externalizes container information to stream. |
|
131 * Leaves in case of errors. |
|
132 * @since Series 60 3.1 |
|
133 * @param reference to RWriteStream |
|
134 * @return none |
|
135 */ |
|
136 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
137 |
|
138 /** |
|
139 * Internalizes container information from stream. |
|
140 * Leaves in case of errors. |
|
141 * @since Series 60 3.1 |
|
142 * @param reference to RReadStream |
|
143 * @return none |
|
144 */ |
|
145 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
146 |
|
147 protected: |
|
148 |
|
149 /** |
|
150 * Constructor. |
|
151 */ |
|
152 CCmSqlPropertyItem(); |
|
153 |
|
154 /** |
|
155 * Second-phase constructor. |
|
156 */ |
|
157 void ConstructL(); |
|
158 |
|
159 |
|
160 private: // data |
|
161 |
|
162 // Database id |
|
163 TInt64 iId; |
|
164 |
|
165 // Property value |
|
166 HBufC8* iName; // owned |
|
167 |
|
168 // Status value |
|
169 TBool iStatus; |
|
170 |
|
171 |
|
172 }; |
|
173 |
|
174 |
|
175 #endif // __CMSQLPROPERTYITEM_H |