|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: An Opml parser. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef OPML_PARSER_H |
|
20 #define OPML_PARSER_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <xmlengdom.h> |
|
26 |
|
27 #include "LeakTracker.h" |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CPackedFolder; |
|
39 class CXmlUtils; |
|
40 class RXmlEngDocument; |
|
41 class TXmlEngElement; |
|
42 |
|
43 // CLASS DECLARATION |
|
44 |
|
45 /** |
|
46 * An Opml parser. |
|
47 * |
|
48 * \b Library: FeedsEngine.lib |
|
49 * |
|
50 * @since 3.0 |
|
51 */ |
|
52 class COpmlParser: public CBase |
|
53 { |
|
54 public: // Constructors and destructor |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 static COpmlParser* NewL(CXmlUtils& aXmlUtils); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~COpmlParser(); |
|
64 |
|
65 public: // New Methods |
|
66 /** |
|
67 * Returns true if this parser can process the given document. |
|
68 * |
|
69 * @since 3.0 |
|
70 * @param aDocument A libxml2 document. |
|
71 * @param aContentType The content-type. |
|
72 * @return true or false. |
|
73 */ |
|
74 TBool IsSupported(RXmlEngDocument aDocument, const TDesC& aContentType) const; |
|
75 |
|
76 /** |
|
77 * Parses the given buffer. |
|
78 * |
|
79 * @since 3.0 |
|
80 * @param aBuffer The buffer to parse. |
|
81 * @param aContentType The buffer's content-type. |
|
82 * @param aCharSet The buffer's char-set. |
|
83 * @param aImportRootFolder The root folder name |
|
84 * @return void. |
|
85 */ |
|
86 CPackedFolder* ParseL(TDesC8& aBuffer, const TDesC& aContentType, |
|
87 const TDesC& aCharSet, const TDesC& aImportRootFolder) const; |
|
88 |
|
89 private: // New Methods |
|
90 /** |
|
91 * C++ default constructor. |
|
92 */ |
|
93 COpmlParser(CXmlUtils& aXmlUtils); |
|
94 |
|
95 /** |
|
96 * By default Symbian 2nd phase constructor is private. |
|
97 */ |
|
98 void ConstructL(); |
|
99 |
|
100 /** |
|
101 * Populates the PackedFolder with the values from the given node. |
|
102 * |
|
103 * @since 3.0 |
|
104 * @param aNode A libxml2 node. |
|
105 * @param aPackedFolder The packed folder. |
|
106 * @return void. |
|
107 */ |
|
108 void ProcessFolderL(TXmlEngElement aNode, CPackedFolder& aPackedFolder) const; |
|
109 |
|
110 /** |
|
111 * Search for the feed URL from a set of feed URLs present in the current folder seperated by commas |
|
112 * |
|
113 * @since 3.2 |
|
114 * @param aURLsInCurFolder Feed URLs in the current folder |
|
115 * @param aFeedURL Feed URL to be serached |
|
116 * @param aFound Will be set to ETrue if found otherwise EFalse |
|
117 * @return void. |
|
118 */ |
|
119 void SearchURLInCurrentFolderL(HBufC* aURLsInCurFolder, HBufC* aFeedURL, TBool& aFound) const; |
|
120 |
|
121 |
|
122 private: // Data |
|
123 // WARNING!!! This class must be "Thread (ActiveObject) safe". Meaning |
|
124 // that it must not contain any member variables that can't |
|
125 // be safely shared between all "threads" using it. |
|
126 |
|
127 TLeakTracker iLeakTracker; |
|
128 |
|
129 CXmlUtils& iXmlUtils; |
|
130 }; |
|
131 |
|
132 #endif // OPML_PARSER_H |
|
133 |
|
134 // End of File |