uiacceltk/hitchcock/goommonitor/inc/goomconfigparser.h
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     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:  The parser for the GOOM configuration file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GOOMCONFIGPARSER_H_
       
    20 #define GOOMCONFIGPARSER_H_
       
    21 
       
    22 #include <xml/contenthandler.h>
       
    23 
       
    24 using namespace Xml;
       
    25 
       
    26 class CGOomConfig;
       
    27 class CGOomRunPluginConfig;
       
    28 
       
    29 NONSHARABLE_CLASS(CGOomConfigParser) : public CBase, public MContentHandler 
       
    30     {
       
    31 public:
       
    32     CGOomConfigParser(CGOomConfig& aConfig, RFs& aFs);
       
    33     
       
    34     void ParseL();
       
    35 
       
    36     
       
    37     // From MContent handler
       
    38     virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode);
       
    39     virtual void OnEndDocumentL(TInt aErrorCode);
       
    40     virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, 
       
    41                                  TInt aErrorCode);
       
    42     virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
       
    43     virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
       
    44     virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, 
       
    45                                        TInt aErrorCode);
       
    46     virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
       
    47     virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
       
    48     virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
       
    49     virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, 
       
    50                                           TInt aErrorCode);
       
    51     virtual void OnError(TInt aErrorCode);
       
    52     virtual TAny* GetExtendedInterface(const TInt32 aUid);
       
    53     
       
    54     
       
    55     
       
    56 private:
       
    57     
       
    58     void ConfigError(TInt aError);
       
    59     
       
    60     
       
    61     
       
    62     TInt StartElementL(const TDesC8& aLocalName, 
       
    63                           const RAttributeArray& aAttributes);
       
    64     
       
    65     void SetGlobalSettings(const RAttributeArray& aAttributes);
       
    66     void SetForceCheckConfigL(const RAttributeArray& aAttributes);
       
    67     void SetAppConfigL(const RAttributeArray& aAttributes);
       
    68     void SetCloseAppConfigL(const RAttributeArray& aAttributes);
       
    69     void SetAppCloseIdlePriorityConfigL(const RAttributeArray& aAttributes);
       
    70     void SetForegroundAppPriorityL(const RAttributeArray& aAttributes);
       
    71     
       
    72     void SetSystemPluginConfigL(const RAttributeArray& aAttributes);
       
    73     void SetAppPluginConfigL(const RAttributeArray& aAttributes);
       
    74     void SetPluginIdlePriorityL(const RAttributeArray& aAttributes);
       
    75     void SetPluginForegroundAppPriorityL(const RAttributeArray& aAttributes);
       
    76     
       
    77     TInt GetValueFromAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TPtrC8& aValue);
       
    78     TInt GetValueFromHexAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TUint& aValue);
       
    79     TInt GetValueFromDecimalAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TUint& aValue);
       
    80     TInt GetValueFromDecimalAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TInt& aValue);
       
    81     
       
    82     void SetPluginSyncMode(const RAttributeArray& aAttributes, CGOomRunPluginConfig& aRunPluginConfig);
       
    83 
       
    84     enum TGOomParsingState
       
    85         {
       
    86         EGOomParsingStateNone,
       
    87         EGOomParsingStateRoot,
       
    88         EGOomParsingStateGlobalSettings,
       
    89         EGOomParsingStateAppSettings,
       
    90         EGOomParsingStateAppCloseSettings,
       
    91         EGOomParsingStateSystemPluginSettings,
       
    92         EGOomParsingStateAppPluginSettings
       
    93         };    
       
    94     
       
    95     // Check that the current state is as expected
       
    96     // If not then the specified config error is generated
       
    97     void CheckState(TGOomParsingState aExpectedState, TInt aError);
       
    98     
       
    99     // Check that the current state is as expected
       
   100     // If not then the specified config error is generated
       
   101     // This version checks to ensure that the current state matches either of the passed in states
       
   102     void CheckState(TGOomParsingState aExpectedState1, TGOomParsingState aExpectedState2, TInt aError);
       
   103     
       
   104     CGOomConfig& iConfig;
       
   105     
       
   106     RFs& iFs;
       
   107     
       
   108     void ChangeState(TGOomParsingState aState);    
       
   109     
       
   110     TGOomParsingState iState;
       
   111     
       
   112     TUint iParentUid;
       
   113     TUint iParentTargetApp;
       
   114     };
       
   115 
       
   116 #endif /*GOOMCONFIGPARSER_H_*/