|
1 /* |
|
2 * Copyright (c) 2008 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: Definition of entry attribute |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CAENTRYATTRIBUTE_H__ |
|
19 #define __CAENTRYATTRIBUTE_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 //FORWARD DECLARATIONS |
|
24 class RWriteStream; |
|
25 class RReadStream; |
|
26 |
|
27 /** |
|
28 * CA entry attribute. |
|
29 * @lib .lib |
|
30 * @since S60 v5.0 |
|
31 */ |
|
32 NONSHARABLE_CLASS( CCaEntryAttribute ): public CBase |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Destructor. |
|
39 */ |
|
40 virtual ~CCaEntryAttribute(); |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * @param aName Attribute name. |
|
45 * @return The created object. |
|
46 */ |
|
47 IMPORT_C static CCaEntryAttribute* NewL( const TDesC& aName ); |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 * @param aName Attribute name. |
|
52 * @return The created object. |
|
53 */ |
|
54 IMPORT_C static CCaEntryAttribute* NewLC( const TDesC& aName ); |
|
55 |
|
56 /** |
|
57 * Get name. |
|
58 * @return Name. |
|
59 */ |
|
60 TPtrC Name() const |
|
61 { |
|
62 return iName; |
|
63 } |
|
64 |
|
65 /** |
|
66 * Get value. |
|
67 * @return Value, or NULL if attribute is not set. |
|
68 */ |
|
69 TPtrC Value() const |
|
70 { |
|
71 return iValue; |
|
72 } |
|
73 |
|
74 /** |
|
75 * Set value. Sets changed status as appropriate. |
|
76 * @param aValue Value, or NULL if attribute is not set (==remove attr). |
|
77 * Ownership taken. |
|
78 */ |
|
79 IMPORT_C void SetValueL( const TDesC& aName ); |
|
80 |
|
81 /** |
|
82 * Externalizes array to the stream |
|
83 * @param aStream a write stream |
|
84 */ |
|
85 void ExternalizeL( RWriteStream& aStream ) const; |
|
86 |
|
87 /** |
|
88 * Internalizes stream to the array |
|
89 * @param aStream a read stream |
|
90 */ |
|
91 void InternalizeL( RReadStream& aStream ); |
|
92 |
|
93 protected: |
|
94 |
|
95 /** |
|
96 * Second phased constructor. |
|
97 * @param aName Attribute name. |
|
98 */ |
|
99 void ConstructL( const TDesC& aName ); |
|
100 |
|
101 private: |
|
102 // data |
|
103 |
|
104 /* |
|
105 * Attribute name. Own |
|
106 */ |
|
107 RBuf iName; |
|
108 |
|
109 /* |
|
110 * Attribute value. Own |
|
111 */ |
|
112 RBuf iValue; |
|
113 |
|
114 }; |
|
115 |
|
116 /** |
|
117 * Attribute array. |
|
118 * @lib camenu.lib |
|
119 * @since S60 v5.0 |
|
120 */ |
|
121 NONSHARABLE_CLASS( RCaEntryAttrArray ): public RPointerArray<CCaEntryAttribute> |
|
122 { |
|
123 |
|
124 public: |
|
125 /** |
|
126 * Find attribute by name. |
|
127 * @param aId Id. |
|
128 * @param aName Name. |
|
129 * @param aAttr Attribute value. |
|
130 * @return TBool ,ETrue if attribute was found |
|
131 */ |
|
132 IMPORT_C TBool Find( const TDesC& aName, TDes& aAttrVal ); |
|
133 |
|
134 /* |
|
135 * Check if attribute exists |
|
136 * @param aId Id |
|
137 * @param aName Name |
|
138 * @return ETrue if attribute exists |
|
139 */ |
|
140 IMPORT_C TBool Exist( const TDesC& aName ); |
|
141 |
|
142 /** |
|
143 * Remove attribute |
|
144 * @param aId Id. |
|
145 * @param aAttrName Attribute name |
|
146 */ |
|
147 IMPORT_C void RemoveAttribute( const TDesC& aAttrName ); |
|
148 |
|
149 /** |
|
150 * Externalizes array to the stream |
|
151 * @param aStream a write stream |
|
152 */ |
|
153 void ExternalizeL( RWriteStream& aStream ) const; |
|
154 |
|
155 /** |
|
156 * Internalizes stream to the array |
|
157 * @param aStream a read stream |
|
158 */ |
|
159 void InternalizeL( RReadStream& aStream ); |
|
160 |
|
161 }; |
|
162 |
|
163 #endif // __CAENTRYATTRIBUTE_H__ |