contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chfactorysettingsdomparser.h
changeset 73 4bc7b118b3df
parent 66 32469d7d46ff
child 80 397d00875918
child 81 5ef31a21fdd5
equal deleted inserted replaced
66:32469d7d46ff 73:4bc7b118b3df
     1 /*
       
     2 * Copyright (c) 2008 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:  factory settings functionality for content harvester
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CHFACTORYSETTINGSDOMPARSER_H_
       
    19 #define CHFACTORYSETTINGSDOMPARSER_H_
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 #include <xmlengdomimplementation.h>
       
    25 #include <xmlengelement.h>
       
    26 #include <badesca.h>
       
    27 #include <f32file.h>
       
    28 
       
    29 class MLiwInterface;
       
    30 class CLiwDefaultMap;
       
    31 class CLiwContainer;
       
    32 class CLiwDefaultList;
       
    33 
       
    34 class CCHFactorySettingsDOMParser : public CBase
       
    35     {
       
    36     enum TTypes
       
    37         {
       
    38         EUndefined,
       
    39         EInteger,
       
    40         EUInteger,
       
    41         EDescriptor8,
       
    42         EDescriptor16,
       
    43         EMap,
       
    44         EList,
       
    45         EBool,
       
    46         EReal,
       
    47         EUid
       
    48         };
       
    49 
       
    50 public:
       
    51     // Constructors and destructor
       
    52 
       
    53     /**
       
    54      * Two-phased constructor.
       
    55      * @param aInterface Liw Interface.
       
    56      * @param aFs file session.
       
    57      */
       
    58     static CCHFactorySettingsDOMParser* NewL( MLiwInterface* aInterface,
       
    59             RFs& aFs );
       
    60 
       
    61     /**
       
    62      * Two-phased constructor.
       
    63      * @param aInterface Liw Interface.
       
    64      * @param aFs file session.
       
    65      */
       
    66     static CCHFactorySettingsDOMParser* NewLC( MLiwInterface* aInterface,
       
    67             RFs& aFs );
       
    68 
       
    69     /**
       
    70      * Destructor.
       
    71      */
       
    72     virtual ~CCHFactorySettingsDOMParser();
       
    73 
       
    74 public: // new functions
       
    75 
       
    76     /**
       
    77      * Restores all factory settings
       
    78      *
       
    79      * @param aStr Path to file.
       
    80      * @param aUnInstall mark indicating add or remove option.
       
    81      */
       
    82     TInt Restore( const TDesC& aStr, TBool aUnInstall=EFalse );
       
    83 
       
    84 private:
       
    85 
       
    86     /**
       
    87      * C++ default constructor.
       
    88      * @param aFs file session.
       
    89      */
       
    90 	CCHFactorySettingsDOMParser( RFs& aFs );
       
    91 
       
    92     /**
       
    93      * By default Symbian 2nd phase constructor is private.
       
    94      * @param aInterface Liw Interface.
       
    95      */
       
    96     void ConstructL( MLiwInterface* aInterface );
       
    97 
       
    98 private: // new functions
       
    99 
       
   100     /**
       
   101      * Parse xml files.
       
   102      * @param aFilePath Path to file.
       
   103      * @param aUnInstall mark indicating add or remove option.
       
   104      */
       
   105     void ParseFactorySettingsFileL( const TDesC& aFilePath,
       
   106             TBool aUnInstall );
       
   107 
       
   108     /**
       
   109      * Converts type from TDesC to TTypes.
       
   110      * @param aType type key as attributes.
       
   111      */
       
   112     TTypes ConvertToType( const TDesC& aType );
       
   113 
       
   114     /**
       
   115      * Removes an item from the database.
       
   116      * @param aNode A node.
       
   117      * @param aMap CLiwDefaultMap with item.
       
   118      */
       
   119     void RemoveItemL(
       
   120     		const TXmlEngElement& aNode,
       
   121     		CLiwDefaultMap* aMap );
       
   122     /**
       
   123      * Adds an item do the database.
       
   124      * @param aNode An "item" node.
       
   125      * @param aContainer container with item.
       
   126      * @param aType type of item.
       
   127      */
       
   128     void AddItemL( const TXmlEngElement& aNode,
       
   129             CLiwContainer* aContainer,
       
   130             TTypes aType );
       
   131 
       
   132     /**
       
   133      * Extracts deleted attributes from "item" node.
       
   134      * @param aNode An "item" node.
       
   135      * @param aMap CLiwDefaultMap with item.
       
   136      */
       
   137     void ExtractDeleteAttributesL(
       
   138     		const TXmlEngElement& aNode,
       
   139     		CLiwDefaultMap* aMap );
       
   140 
       
   141     /**
       
   142      * Extracts and adds attributes from "item" node to map.
       
   143      * @param aNode An "item" node.
       
   144      * @param aMap CLiwDefaultMap with item.
       
   145      */
       
   146     void ExtractAttributesAndAddL(
       
   147     		const TXmlEngElement& aNode,
       
   148     		CLiwDefaultMap* aMap );
       
   149 
       
   150     /**
       
   151      * Extracts and adds attributes from "item" node to list.
       
   152      * @param aItem An "item" node.
       
   153      * @param aList CLiwDefaultList with item.
       
   154      */
       
   155     void ExtractAttributesAndAddL(
       
   156             const TXmlEngElement& aNode,
       
   157             CLiwDefaultList* aList );
       
   158 
       
   159 private:
       
   160     // Data
       
   161 
       
   162     /**
       
   163      * CPS interface
       
   164      * Not own
       
   165      */
       
   166     MLiwInterface* iCPSInterface;
       
   167 
       
   168     /*
       
   169      * File server session.Not Own
       
   170      */
       
   171     RFs iFs;
       
   172 
       
   173     };
       
   174 
       
   175 #endif /* CHFACTORYSETTINGSDOMPARSER_H_ */