1 /* |
|
2 * Copyright (c) 2005-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: OMA DS Folder object XML parser |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __OMADSFOLDEROBJECT_H__ |
|
20 #define __OMADSFOLDEROBJECT_H__ |
|
21 |
|
22 #include <SenXmlReader.h> |
|
23 #include <MSenContentHandlerClient.h> |
|
24 #include "SmsDataProviderDefs.h" |
|
25 |
|
26 const TInt KMaxElementLength = 255; |
|
27 const TInt KMaxXmlLineLength = 1024; |
|
28 |
|
29 class COMADSFolderObject : public CBase, public MSenContentHandlerClient |
|
30 { |
|
31 public: |
|
32 |
|
33 static COMADSFolderObject* NewLC(); |
|
34 static COMADSFolderObject* NewL(); |
|
35 ~COMADSFolderObject(); |
|
36 |
|
37 // Get methods |
|
38 inline const TDesC& GetName() const {return iName;} |
|
39 inline const TDateTime& GetCreatedDate() const {return iCreatedDate;} |
|
40 inline const TDateTime& GetModifiedDate() const {return iModifiedDate;} |
|
41 |
|
42 // Set methods |
|
43 inline void SetName(const TDesC& aName) {iName.Copy(aName);} |
|
44 inline void SetCreatedDate(const TDateTime& aDateTime) {iCreatedDate = aDateTime;} |
|
45 inline void SetModifiedDate(const TDateTime& aDateTime) {iModifiedDate = aDateTime;} |
|
46 |
|
47 // Import & export |
|
48 TInt ImportFolderXml(const TDesC8& aData); |
|
49 TInt ImportFolderXml(RFs& aFs, const TDesC& aFilename); |
|
50 void ExportFolderXmlL(TDes8& aBuffer); |
|
51 void ExportFolderXmlL(CBufBase& aBuffer); |
|
52 |
|
53 // MSenContentHandlerClient virtual functionality |
|
54 TInt StartDocument(); |
|
55 TInt EndDocument(); |
|
56 TInt StartElement(const TDesC8& aURI, |
|
57 const TDesC8& aLocalName, |
|
58 const TDesC8& aName, |
|
59 const RAttributeArray& apAttrs); |
|
60 TInt EndElement(const TDesC8& aURI, |
|
61 const TDesC8& aLocalName, |
|
62 const TDesC8& aName); |
|
63 TInt Characters(const TDesC8& aBuf, TInt aStart, TInt aLength); |
|
64 TInt Error(TInt aErrorCode); |
|
65 |
|
66 private: |
|
67 |
|
68 CSenXmlReader* iXmlReader; |
|
69 void ConstructL(); |
|
70 TBuf8<KMaxElementLength> iCurrentElement; |
|
71 TBuf8<KMaxXmlLineLength> iTemp; |
|
72 |
|
73 TBuf<KMaxFolderNameLength> iName; |
|
74 TDateTime iCreatedDate; |
|
75 TDateTime iModifiedDate; |
|
76 TInt iError; |
|
77 |
|
78 void Reset(); |
|
79 TInt ParseDateString(const TDesC8& aString, TDateTime& aDateTime); |
|
80 |
|
81 CBufBase* iBuffer; |
|
82 TInt iWriteBufPosition; |
|
83 TInt iWriteBufSize; |
|
84 TDes8* iDesc; |
|
85 |
|
86 void ExportL(); |
|
87 void WriteL(const TDesC &aData); |
|
88 void WriteEncodedXmlL(const TDesC &aData); |
|
89 }; |
|
90 |
|
91 |
|
92 #endif |
|
93 |
|