2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: For adding content to be synchronized.
19 #ifndef __SMLDATAFORMAT_H__
20 #define __SMLDATAFORMAT_H__
25 #include <stringpool.h>
26 #include <SyncMLDef.h>
33 Used by Data Provider implementations to specify the format and capabilities of their Data Stores.
34 See also SmlDataFormat.rh and SmlDataFormat.hrh for resource definitions.
36 Used by the Sync Engine to generate SyncML DevInf.
42 A bitmask of sync types. Used to specify sync types supported by a Data Store.
44 class TSmlSyncTypeMask
47 inline TSmlSyncTypeMask() : iMask(0U) {}
48 inline void SetSupported(TSmlSyncType aType) { iMask |= TypeMask(aType); }
49 inline void SetNotSupported(TSmlSyncType aType) { iMask &= ~TypeMask(aType); }
50 inline TBool IsSupported(TSmlSyncType aType) const { return iMask & TypeMask(aType); }
52 inline TUint16 TypeMask(TSmlSyncType aType) const { return TUint16(1 << TInt(aType)); }
59 Holds data defining a property value or property parameter value.
60 This includes Name, display name, and data type - including any enumerations.
62 class CSmlDataField : public CBase
65 IMPORT_C static CSmlDataField* NewLC();
66 IMPORT_C static CSmlDataField* NewLC(const RStringPool& aStringPool, TResourceReader& aReader);
67 IMPORT_C static CSmlDataField* NewLC(const RStringPool& aStringPool, RReadStream& aStream);
68 IMPORT_C virtual ~CSmlDataField();
69 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
71 IMPORT_C RString Name() const;
72 // Method takes ownership of parameter and closes it
73 IMPORT_C void SetNameL(RString& aName);
74 IMPORT_C const TDesC& DisplayName() const;
75 // Method takes ownership of parameter and closes it
76 IMPORT_C void SetDisplayNameL(TDesC& aDisplayName);
77 IMPORT_C RString DataType() const;
78 // Method takes ownership of parameter and closes it
79 IMPORT_C void SetDataTypeL(RString& aDataType);
80 IMPORT_C TInt EnumValueCount() const;
81 IMPORT_C RString EnumValue(TInt aIndex) const;
82 // Method takes ownership of parameter and closes it
83 IMPORT_C void SetEnumValuesL(RArray<RString>& aEnumValues);
89 RArray<RString> iEnumValues;
97 class CSmlDataPropertyParam : public CBase
100 IMPORT_C static CSmlDataPropertyParam* NewLC();
101 IMPORT_C static CSmlDataPropertyParam* NewLC(const RStringPool& aStringPool, TResourceReader& aReader);
102 IMPORT_C static CSmlDataPropertyParam* NewLC(const RStringPool& aStringPool, RReadStream& aStream);
103 IMPORT_C virtual ~CSmlDataPropertyParam();
104 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
106 IMPORT_C const CSmlDataField& Field() const;
107 // Method takes ownership of data field
108 IMPORT_C void SetDataFieldL(CSmlDataField& aDataField);
111 CSmlDataField* iField;
117 A field in the Data Store.
119 class CSmlDataProperty : public CBase
129 IMPORT_C static CSmlDataProperty* NewLC();
130 IMPORT_C static CSmlDataProperty* NewLC(const RStringPool& aStringPool, TResourceReader& aReader);
131 IMPORT_C static CSmlDataProperty* NewLC(const RStringPool& aStringPool, RReadStream& aStream);
132 IMPORT_C virtual ~CSmlDataProperty();
133 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
135 IMPORT_C const CSmlDataField& Field() const;
136 // Method takes ownership of data field
137 IMPORT_C void SetDataFieldL(CSmlDataField& aDataField);
139 IMPORT_C TInt ParamCount() const;
140 IMPORT_C const CSmlDataPropertyParam& Param(TInt aIndex) const;
141 // Method takes ownership of params
142 IMPORT_C void SetPropertyParamsL(RPointerArray<CSmlDataPropertyParam>& aParams);
144 IMPORT_C TBool IsSupported(TOption aOption) const;
145 IMPORT_C void SetSupportedOptions(TUint32 aFlags);
147 IMPORT_C TBool HasMaxSize() const;
148 IMPORT_C TBool HasMaxOccur() const;
149 IMPORT_C TInt MaxSize() const;
150 IMPORT_C TInt MaxOccur() const;
151 IMPORT_C void SetMaxSize(TUint16 aMaxSize);
152 IMPORT_C void SetMaxOccur(TUint16 aMaxOccur);
155 CSmlDataField* iField;
156 RPointerArray<CSmlDataPropertyParam> iParams;
166 class CSmlFilterCapability : public CBase
169 IMPORT_C static CSmlFilterCapability* NewLC();
170 IMPORT_C static CSmlFilterCapability* NewLC(const RStringPool& aStringPool, TResourceReader& aReader);
171 IMPORT_C static CSmlFilterCapability* NewLC(const RStringPool& aStringPool, RReadStream& aStream);
172 IMPORT_C virtual ~CSmlFilterCapability();
173 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
175 IMPORT_C RStringF MimeType() const;
176 // Method takes ownership of parameter and closes it
177 IMPORT_C void SetMimeTypeL(RStringF& aMimeType);
178 IMPORT_C RStringF MimeVersion() const;
179 // Method takes ownership of parameter and closes it
180 IMPORT_C void SetMimeVersionL(RStringF& aMimeVersion);
182 IMPORT_C TInt KeywordCount() const;
183 IMPORT_C RString Keyword(TInt aIndex) const;
184 // Method takes ownership of keywords
185 IMPORT_C void SetKeyWordListL(RArray<RString>& aKeywordList);
187 IMPORT_C TInt PropertyCount() const;
188 IMPORT_C RString PropertyName(TInt aIndex) const;
189 // Method takes ownership of properties and closes them
190 IMPORT_C void SetPropertiesListL(RArray<RString>& aPropertyList);
194 RStringF iMimeVersion;
195 RArray<RString> iKeywordList;
196 RArray<RString> iPropertyList;
202 The format of a specific mime type.
204 class CSmlMimeFormat : public CBase
207 IMPORT_C static CSmlMimeFormat* NewLC();
208 IMPORT_C static CSmlMimeFormat* NewLC(const RStringPool& aStringPool, TResourceReader& aReader);
209 IMPORT_C static CSmlMimeFormat* NewLC(const RStringPool& aStringPool, RReadStream& aStream);
210 IMPORT_C virtual ~CSmlMimeFormat();
211 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
213 IMPORT_C RStringF MimeType() const;
214 // Method takes ownership of parameter and closes it
215 IMPORT_C void SetMimeTypeL(RStringF& aMimeType);
216 IMPORT_C RStringF MimeVersion() const;
217 // Method takes ownership of parameter and closes it
218 IMPORT_C void SetMimeVersionL(RStringF& aMimeVersion);
220 IMPORT_C TInt PropertyCount() const;
221 IMPORT_C const CSmlDataProperty& Property(TInt aIndex) const;
222 // Method takes ownership of properties
223 IMPORT_C void SetDataPropertiesL(RPointerArray<CSmlDataProperty>& aProperties);
225 IMPORT_C TBool FieldLevel() const;
226 IMPORT_C void SetFieldLevel(TBool aFieldLevel);
230 RStringF iMimeVersion;
231 RPointerArray<CSmlDataProperty> iProperties;
238 The format and capabilities of Data Stores of a specific type.
240 class CSmlDataStoreFormat : public CBase
250 IMPORT_C static CSmlDataStoreFormat* NewLC();
251 IMPORT_C static CSmlDataStoreFormat* NewLC(const RStringPool& aStringPool, TResourceReader& aReader);
252 IMPORT_C static CSmlDataStoreFormat* NewLC(const RStringPool& aStringPool, RReadStream& aStream);
253 IMPORT_C virtual ~CSmlDataStoreFormat();
254 IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
256 IMPORT_C const TDesC& DisplayName() const;
257 IMPORT_C void SetDisplayNameL(TDesC& aDisplayName);
259 IMPORT_C TSmlSyncTypeMask SyncTypes() const;
260 IMPORT_C void SetSyncTypeMask(TSmlSyncTypeMask aSyncTypeMask);
262 IMPORT_C TInt MimeFormatCount() const;
263 IMPORT_C const CSmlMimeFormat& MimeFormat(TInt aIndex) const;
264 // Method takes ownership of mime formats
265 IMPORT_C void SetMimeFormatsL(RPointerArray<CSmlMimeFormat>& aMimeFormats);
266 IMPORT_C TInt MimeFormatRxPref() const;
267 IMPORT_C void SetMimeFormatRxPref(TInt aRxPref);
268 IMPORT_C TInt MimeFormatTxPref() const;
269 IMPORT_C void SetMimeFormatTxPref(TInt aTxPref);
271 IMPORT_C TBool IsSupported(TOption aOption) const;
272 IMPORT_C void SetSupportedOptions(TUint32 aFlags);
274 IMPORT_C TInt FolderPropertyCount() const;
275 IMPORT_C const CSmlDataProperty& FolderProperty(TInt aIndex) const;
276 // Method takes ownership of folder properties
277 IMPORT_C void SetFolderPropertiesL(RPointerArray<CSmlDataProperty>& aFolderProperties);
279 IMPORT_C TInt FilterCapabilityCount() const;
280 IMPORT_C const CSmlFilterCapability& FilterCapability(TInt aIndex) const;
281 // Method takes ownership of filter capabilities
282 IMPORT_C void SetFilterCapabilitiesL(RPointerArray<CSmlFilterCapability>& aFilterCapabilities);
284 IMPORT_C TBool HasMaxSize() const;
285 IMPORT_C TBool HasMaxItems() const;
286 IMPORT_C TInt MaxSize() const;
287 IMPORT_C TInt MaxItems() const;
288 IMPORT_C void SetMaxSize(TUint16 aMaxSize);
289 IMPORT_C void SetMaxItems(TUint16 aMaxItems);
293 TSmlSyncTypeMask iSyncTypeMask;
294 RPointerArray<CSmlDataProperty> iFolderProperties;
295 RPointerArray<CSmlFilterCapability> iFilterCapabilities;
299 RPointerArray<CSmlMimeFormat> iMimeFormats;
305 ///////////////////////////////////////////////////////////////////////////////
306 ///////////////////////////////////////////////////////////////////////////////
307 ///////////////////////////////////////////////////////////////////////////////