|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // ineturiproperties.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __URILISTINITIALIZER_H__ |
|
19 #define __URILISTINITIALIZER_H__ |
|
20 |
|
21 #include <xml/contenthandler.h> |
|
22 #include <xml/parser.h> |
|
23 |
|
24 class CUriListInterface; |
|
25 class CInetUriImpl; |
|
26 |
|
27 /** |
|
28 This class initializes the database from a pre-configured XML file. The XML file takes the following form |
|
29 |
|
30 */ |
|
31 |
|
32 NONSHARABLE_CLASS ( CUriListInitializer ) : public CBase, |
|
33 public Xml::MContentHandler |
|
34 { |
|
35 public: |
|
36 |
|
37 enum TParserState |
|
38 { |
|
39 EInitial, |
|
40 EStartOfServicetype, |
|
41 EEndOfServicetype, |
|
42 EStartOfListtype, |
|
43 EEndOfListtype, |
|
44 EStartOfRecord, |
|
45 EEndOfRecord, |
|
46 EStartOfUri, |
|
47 EEndOfUri, |
|
48 EStartOfPermission, |
|
49 EEndOfPermission, |
|
50 EStartOfFavouriteName, |
|
51 EEndOfFavouriteName |
|
52 }; |
|
53 |
|
54 static CUriListInitializer* NewL ( CUriListInterface& aListInterface ); |
|
55 ~CUriListInitializer (); |
|
56 |
|
57 void ParseDocumentL ( const TDesC& aFile ); |
|
58 |
|
59 // Virtual functions from MContentHandler |
|
60 void OnStartDocumentL ( const Xml::RDocumentParameters &aDocParam, TInt aErrorCode ); |
|
61 void OnEndDocumentL ( TInt aErrorCode ); |
|
62 void OnStartElementL ( const Xml::RTagInfo &aElement, const Xml::RAttributeArray &aAttributes, TInt aErrorCode ); |
|
63 void OnEndElementL ( const Xml::RTagInfo &aElement, TInt aErrorCode ); |
|
64 void OnContentL ( const TDesC8 &aBytes, TInt aErrorCode ); |
|
65 inline void OnStartPrefixMappingL ( const RString &aPrefix, const RString &aUri, TInt aErrorCode ); |
|
66 inline void OnEndPrefixMappingL ( const RString &aPrefix, TInt aErrorCode ); |
|
67 inline void OnIgnorableWhiteSpaceL ( const TDesC8 &aBytes, TInt aErrorCode ); |
|
68 inline void OnSkippedEntityL ( const RString &aName, TInt aErrorCode ); |
|
69 inline void OnProcessingInstructionL ( const TDesC8 &aTarget, const TDesC8 &aData, TInt aErrorCode ); |
|
70 inline void OnError ( TInt aErrorCode ); |
|
71 inline TAny* GetExtendedInterface ( const TInt32 aUid ); |
|
72 |
|
73 private: |
|
74 CUriListInitializer ( CUriListInterface& aListInterface ); |
|
75 void ConstructL (); |
|
76 |
|
77 TInt ConvertToInteger ( const TDesC8& aValue ); |
|
78 void SetParserState ( TParserState aNewState ); |
|
79 TParserState ParserStateL ( const RString& aTag, TBool aEndElement =EFalse ); |
|
80 void SetServiceType ( TInt aIndex ); |
|
81 void SetListType ( TInt aIndex ); |
|
82 void SetValueL ( const TDesC8& aValue ); |
|
83 |
|
84 private: |
|
85 CUriListInterface& iListInterface; |
|
86 CInetUriImpl* iInetUriImpl; |
|
87 RStringPool iStringPool; |
|
88 TParserState iParserState; |
|
89 RBuf8 iContent; |
|
90 }; |
|
91 |
|
92 #include "urilistinitializer.inl" |
|
93 |
|
94 #endif // __URILISTINITIALIZER_H__ |