1 /* |
|
2 * Copyright (c) 2005-2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_AIPROPERTYEXTENSION_H |
|
20 #define M_AIPROPERTYEXTENSION_H |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 /** |
|
25 * Maximum length for Content publisher name |
|
26 */ |
|
27 const TInt KAiPublisherNameMaxLength = 128; |
|
28 |
|
29 /** |
|
30 * Maximum length for Content publisher namespace |
|
31 */ |
|
32 const TInt KAiPublisherNamespaceMaxLength = 32; |
|
33 |
|
34 /** |
|
35 * Content publisher name buffer |
|
36 */ |
|
37 typedef TBuf<KAiPublisherNameMaxLength> TAiPublisherName; |
|
38 |
|
39 /** |
|
40 * Content publisher namespace buffer |
|
41 */ |
|
42 typedef TBuf8<KAiPublisherNamespaceMaxLength> TAiPublisherNamespace; |
|
43 |
|
44 /** |
|
45 * Contains information about Content publisher plug-in. |
|
46 */ |
|
47 struct TAiPublisherInfo |
|
48 { |
|
49 TAiPublisherInfo() |
|
50 : iUid( TUid::Null() ), |
|
51 iName( KNullDesC ), |
|
52 iNamespace( KNullDesC8 ) |
|
53 { |
|
54 } |
|
55 |
|
56 inline TAiPublisherInfo& operator= (const TAiPublisherInfo& aInfo) |
|
57 { |
|
58 iUid = TUid::Uid( aInfo.iUid.iUid ); |
|
59 iName.Copy( aInfo.iName ); |
|
60 iNamespace.Copy( aInfo.iNamespace ); |
|
61 return *this; |
|
62 } |
|
63 |
|
64 inline TBool operator== (const TAiPublisherInfo& aInfo) const |
|
65 { |
|
66 if( iUid == aInfo.iUid && |
|
67 iName == aInfo.iName && |
|
68 iNamespace == aInfo.iNamespace ) |
|
69 { |
|
70 return ETrue; |
|
71 } |
|
72 |
|
73 return EFalse; |
|
74 } |
|
75 |
|
76 TUid iUid; |
|
77 TAiPublisherName iName; |
|
78 TAiPublisherNamespace iNamespace; |
|
79 }; |
|
80 |
|
81 /** |
|
82 * Defines set of properties supported by plug-in. |
|
83 * |
|
84 * Example how to provide and set the properties. |
|
85 * @code |
|
86 * void CMyAiPlugin::ConstructL() |
|
87 * { |
|
88 * iInfo = new (ELeave) TAiPublisherInfo; |
|
89 * iContent = AiUtility::CreateContentItemArrayIteratorL( KMyAiPluginContent ); |
|
90 * iResources = AiUtility::CreateContentItemArrayIteratorL( KMyAiPluginResources ); |
|
91 * iEvents = AiUtility::CreateContentItemArrayIteratorL( KMyAiPluginEvents ); |
|
92 * } |
|
93 * |
|
94 * void CMyAiPlugin::SetPropertyL( TInt aProperty, TAny* aValue ) |
|
95 * { |
|
96 * if( !aValue ) return; |
|
97 * |
|
98 * switch( aProperty ) |
|
99 * { |
|
100 * case EAiPublisherInfo: |
|
101 * { |
|
102 * const TAiPublisherInfo* info = |
|
103 * static_cast<const TAiPublisherInfo*>(aValue); |
|
104 * iInfo->iUid.iUid = info->iUid.iUid; |
|
105 * iInfo->iName.Copy( info->iName ); |
|
106 * break; |
|
107 * } |
|
108 * } |
|
109 * } |
|
110 * |
|
111 * TAny* CMyAiPlugin::GetPropertyL( TInt aProperty ) |
|
112 * { |
|
113 * switch( aProperty ) |
|
114 * { |
|
115 * case EAiPublisherInfo: |
|
116 * return iInfo; |
|
117 * |
|
118 * case EAiPublisherContent: |
|
119 * return iContent; |
|
120 * |
|
121 * case EAiPublisherResources: |
|
122 * return iResources; |
|
123 * |
|
124 * case EAiPublisherEvents: |
|
125 * return iEvents; |
|
126 * } |
|
127 * return NULL; |
|
128 * } |
|
129 * @endcode |
|
130 */ |
|
131 enum TAiPublisherProperty |
|
132 { |
|
133 /** |
|
134 * Enables read-only access to Plug-in information. GetProperty MUST return |
|
135 * instance of struct TAiPublisherInfo via TAny* . |
|
136 */ |
|
137 EAiPublisherInfo = 0x0001, |
|
138 |
|
139 /** |
|
140 * Enables read-only access to iterator of content selectors. GetProperty |
|
141 * MUST return instance of MAiContentItemIterator for content selectors. |
|
142 */ |
|
143 EAiPublisherContent, |
|
144 |
|
145 /** |
|
146 * Enables read-only access to iterator of content references. GetProperty |
|
147 * MUST return instance of MAiContentItemIterator for content references. |
|
148 */ |
|
149 EAiPublisherResources, |
|
150 |
|
151 /** |
|
152 * Enables read-only access to iterator of events supported by plug-in. |
|
153 * GetProperty MUST return instance of MAiContentItemIterator for events. |
|
154 */ |
|
155 EAiPublisherEvents, |
|
156 |
|
157 /** |
|
158 * Provides access to MAiContentRequest interface for refreshing a content |
|
159 * item. |
|
160 * @see EAiPublisherContent |
|
161 */ |
|
162 EAiContentRequest, |
|
163 |
|
164 /** |
|
165 * Provides access to MAiContentRequest interface for refreshing a resource |
|
166 * item. |
|
167 * @see EAiPublisherResources |
|
168 */ |
|
169 EAiResourceRequest, |
|
170 |
|
171 /** |
|
172 * Provides access to localized plugin name if supported. HBufC* |
|
173 * @see EAiPublisherResources |
|
174 */ |
|
175 EAiPluginName |
|
176 }; |
|
177 |
|
178 |
|
179 /** |
|
180 * Property extension interface for CAiContentPublisher. |
|
181 * |
|
182 * @see CAiContentPublisher::Extension |
|
183 * @since S60 3.2 |
|
184 */ |
|
185 class MAiPropertyExtension |
|
186 { |
|
187 public: // New functions |
|
188 |
|
189 /** |
|
190 * Read property of publisher plug-in. |
|
191 * |
|
192 * @param aProperty - identification of property. |
|
193 * @return Pointer to property value. |
|
194 */ |
|
195 virtual TAny* GetPropertyL(TInt aProperty) = 0; |
|
196 |
|
197 /** |
|
198 * Helper function for accessing the Publisher Info Property. |
|
199 */ |
|
200 inline const TAiPublisherInfo* PublisherInfoL(); |
|
201 |
|
202 /** |
|
203 * Write property value. |
|
204 * |
|
205 * @param aProperty - identification of property. |
|
206 * @param aValue - contains pointer to property value. |
|
207 */ |
|
208 virtual void SetPropertyL(TInt aProperty, TAny* aValue) = 0; |
|
209 |
|
210 protected: |
|
211 /** |
|
212 * Protected destructor prevents deletion through this interface. |
|
213 */ |
|
214 ~MAiPropertyExtension() { } |
|
215 }; |
|
216 |
|
217 #include <aipropertyextension.inl> |
|
218 |
|
219 #endif // M_AIPROPERTYEXTENSION_H |
|