sysresmonitoring/oommonitor/inc/oomconfigparser.h
changeset 35 13fd6fd25fe7
equal deleted inserted replaced
29:6a787171e1de 35:13fd6fd25fe7
       
     1 /*
       
     2 * Copyright (c) 2006-2010 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 OOM configuration file.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef OOMCONFIGPARSER_H_
       
    20 #define OOMCONFIGPARSER_H_
       
    21 
       
    22 #include <xml/contenthandler.h>
       
    23 
       
    24 using namespace Xml;
       
    25 
       
    26 class COomConfig;
       
    27 class COomRunPluginConfig;
       
    28 
       
    29 /**
       
    30  *  Parser for the Oom Monitor configuration file
       
    31  *
       
    32  *  @lib oommonitor.lib
       
    33  *  @since S60 v5.0
       
    34  */
       
    35 NONSHARABLE_CLASS(COomConfigParser) : public CBase, public MContentHandler 
       
    36     {
       
    37 public:
       
    38     COomConfigParser(COomConfig& aConfig, RFs& aFs);
       
    39     
       
    40     void ParseL();
       
    41 
       
    42     
       
    43     // From MContent handler
       
    44     virtual void OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode);
       
    45     virtual void OnEndDocumentL(TInt aErrorCode);
       
    46     virtual void OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, 
       
    47                                  TInt aErrorCode);
       
    48     virtual void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
       
    49     virtual void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
       
    50     virtual void OnStartPrefixMappingL(const RString& aPrefix, const RString& aUri, 
       
    51                                        TInt aErrorCode);
       
    52     virtual void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
       
    53     virtual void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
       
    54     virtual void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
       
    55     virtual void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData, 
       
    56                                           TInt aErrorCode);
       
    57     virtual void OnError(TInt aErrorCode);
       
    58     virtual TAny* GetExtendedInterface(const TInt32 aUid);
       
    59     
       
    60     
       
    61     
       
    62 private:
       
    63     
       
    64     void ConfigError(TInt aError);
       
    65     
       
    66     
       
    67     
       
    68     void StartElementL(const TDesC8& aLocalName, 
       
    69                           const RAttributeArray& aAttributes);
       
    70     
       
    71     void SetGlobalSettings(const RAttributeArray& aAttributes);
       
    72     void SetForceCheckConfigL(const RAttributeArray& aAttributes);
       
    73     void SetAppConfigL(const RAttributeArray& aAttributes);
       
    74     void SetCloseAppConfigL(const RAttributeArray& aAttributes);
       
    75     void SetAppCloseIdlePriorityConfigL(const RAttributeArray& aAttributes);
       
    76     void SetForegroundAppPriorityL(const RAttributeArray& aAttributes);
       
    77     
       
    78     void SetSystemPluginConfigL(const RAttributeArray& aAttributes);
       
    79     void SetAppPluginConfigL(const RAttributeArray& aAttributes);
       
    80     void SetPluginIdlePriorityL(const RAttributeArray& aAttributes);
       
    81     void SetPluginForegroundAppPriorityL(const RAttributeArray& aAttributes);
       
    82     
       
    83     TInt GetValueFromAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TPtrC8& aValue);
       
    84     TInt GetValueFromHexAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TUint& aValue);
       
    85     TInt GetValueFromDecimalAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TUint& aValue);
       
    86     TInt GetValueFromDecimalAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TInt& aValue);
       
    87     TInt GetValueFromBooleanAttributeList(const RAttributeArray& aAttributes, const TDesC8& aName, TBool& aValue);
       
    88     
       
    89     void SetPluginSyncMode(const RAttributeArray& aAttributes, COomRunPluginConfig& aRunPluginConfig);
       
    90 
       
    91     enum TOomParsingState
       
    92         {
       
    93         EOomParsingStateNone,
       
    94         EOomParsingStateRoot,
       
    95         EOomParsingStateGlobalSettings,
       
    96         EOomParsingStateAppSettings,
       
    97         EOomParsingStateAppCloseSettings,
       
    98         EOomParsingStateSystemPluginSettings,
       
    99         EOomParsingStateAppPluginSettings
       
   100         };    
       
   101     
       
   102     // Check that the current state is as expected
       
   103     // If not then the specified config error is generated
       
   104     void CheckState(TOomParsingState aExpectedState, TInt aError);
       
   105     
       
   106     // Check that the current state is as expected
       
   107     // If not then the specified config error is generated
       
   108     // This version checks to ensure that the current state matches either of the passed in states
       
   109     void CheckState(TOomParsingState aExpectedState1, TOomParsingState aExpectedState2, TInt aError);
       
   110     
       
   111     COomConfig& iConfig;
       
   112     
       
   113     RFs& iFs;
       
   114     
       
   115     void ChangeState(TOomParsingState aState);    
       
   116     
       
   117     TOomParsingState iState;
       
   118     
       
   119     TUint iParentUid;
       
   120     TUint iParentTargetApp;
       
   121     };
       
   122 
       
   123 #endif /*OOMCONFIGPARSER_H_*/