menufw/hierarchynavigator/hnutilities/inc/hnmdbasekey.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_HNMDBASEKEY_H
       
    20 #define C_HNMDBASEKEY_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32hashtab.h>
       
    24 #include <xmlengdom.h>
       
    25 
       
    26 class CLiwDefaultMap;
       
    27 class CLiwGenericParamList;
       
    28 class TLiwVariant;
       
    29 class CHnMdBaseKey;
       
    30 
       
    31 /**
       
    32  *  Abstract Class representing keys used in XML configuration.
       
    33  *  These keys can become parameters for LIW requests for example.
       
    34  *  Deriving classes defines particular key types like integers or strings.
       
    35  *
       
    36  *  @lib hierarchynavigatorengine
       
    37  *  @since S60 v5.0
       
    38  *  @ingroup group_hnutilities
       
    39  */
       
    40 NONSHARABLE_CLASS( CHnMdBaseKey ) : public CBase
       
    41     {
       
    42     friend class HnMdKeyFactory; 
       
    43     
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Standard destructor.
       
    48      */
       
    49     virtual ~CHnMdBaseKey();
       
    50     
       
    51     /**
       
    52      * Factory method.
       
    53      *
       
    54      * since S60 v5.0
       
    55      * @return Fully constructed object.
       
    56      */
       
    57     virtual CHnMdBaseKey* CopyLC() = 0;
       
    58     
       
    59     /**
       
    60      * Getter - key name.
       
    61      * since S60 v5.0
       
    62      * 
       
    63      * @return Key name.
       
    64      */     
       
    65     const TDesC8& KeyName() const;
       
    66     
       
    67     /**
       
    68      * Getter - key content.
       
    69      * since S60 v5.0
       
    70      * 
       
    71      * @return Key content.
       
    72      */ 
       
    73     virtual const TDesC& KeyContent() const;
       
    74     
       
    75     /**
       
    76      * Getter - sub keys.
       
    77      * 
       
    78      * @since S60 v5.0
       
    79      * @return Sub keys array.
       
    80      */
       
    81     const RPointerArray<CHnMdBaseKey>& SubKeys() const;
       
    82     
       
    83     /**
       
    84      * Getter - key content.
       
    85      *
       
    86      * @since S60 v5.0
       
    87      * @param aContent Output content.
       
    88      */
       
    89     virtual void GetKeyContent( TInt& aContent ) const;
       
    90     
       
    91     /**
       
    92      * Getter - key content.
       
    93      *
       
    94      * @since S60 v5.0
       
    95      * @param aContent Output content.
       
    96      */
       
    97     virtual void GetKeyContent( TInt64& aContent ) const;
       
    98      
       
    99     /**
       
   100      * Evaluates key - sets params.
       
   101      * 
       
   102      * @since S60 v5.0
       
   103      * @param aParamList List of parameters.
       
   104      * @param aPos Position of the item in the items group.
       
   105      * 
       
   106      */
       
   107     IMPORT_C CHnMdBaseKey* EvaluateLC(
       
   108         const CLiwGenericParamList& aParamList,
       
   109         TInt aPos = 0 );
       
   110   
       
   111     /**
       
   112      * Change to variant.
       
   113      * 
       
   114      * @since S60 v5.0
       
   115      * @param aRet Output variant.
       
   116      * 
       
   117      */
       
   118     IMPORT_C virtual void ToVariantL( TLiwVariant& aRet ) const;
       
   119      
       
   120     /**
       
   121      * Change to generic param list.
       
   122      * 
       
   123      * @since S60 v5.0
       
   124      * @param aRet Output generic param list.
       
   125      * 
       
   126      */
       
   127     IMPORT_C virtual void ToGenericParamListL( CLiwGenericParamList & aRet ) const;
       
   128         
       
   129     /**
       
   130      * Adds a sub key.
       
   131      * 
       
   132      * @since S60 v5.0
       
   133      * @param aKey New key.
       
   134      */
       
   135     IMPORT_C void AddSubKeyL( CHnMdBaseKey* aKey );
       
   136     
       
   137     
       
   138 protected:
       
   139 
       
   140     /**
       
   141      * Standard constructor.
       
   142      * 
       
   143      * @since S60 v5.0
       
   144      */
       
   145     CHnMdBaseKey();
       
   146        
       
   147     /**
       
   148      * Symbian constructor for performing 2nd stage construction.
       
   149      * 
       
   150      * @since S60 v5.0
       
   151      * @param aElement XML DOM Element.
       
   152      */
       
   153     void BaseConstructL( TXmlEngElement aElement );
       
   154     
       
   155     /**
       
   156      * Symbian constructor for performing 2nd stage construction.
       
   157      * 
       
   158      * @since S60 v5.0
       
   159      * @param aKey Key.
       
   160      */
       
   161     void BaseConstructL( const CHnMdBaseKey* aKey );
       
   162         
       
   163     /**
       
   164      * Sets key name.
       
   165      * 
       
   166      * @since S60 v5.0
       
   167      * @param aName Name of new key.
       
   168      */
       
   169     void SetKeyNameL( const TXmlEngAttr& aName );
       
   170     
       
   171     /**
       
   172      * Sets key content.
       
   173      *
       
   174      * @since S60 v5.0
       
   175      * @param aContent XML Attribute.
       
   176      */
       
   177     void SetKeyContentL( const TXmlEngAttr& aContent );
       
   178 
       
   179     /**
       
   180      * Sets sub keys.
       
   181      *
       
   182      * @since S60 v5.0
       
   183      * @param aElement XML DOM Element.
       
   184      */
       
   185     void SetSubKeysL( const TXmlEngElement& aElement );
       
   186     
       
   187     /**
       
   188       * Sets sub keys.
       
   189       *
       
   190       * @since S60 v5.0
       
   191       * @param aKey New key.
       
   192       */
       
   193     void SetSubKeysL( const CHnMdBaseKey* aKey );
       
   194     
       
   195     /**
       
   196      * Sets value.
       
   197      *
       
   198      * @since S60 v5.0
       
   199      * @param aElement XML DOM Element.
       
   200      */
       
   201     void SetValueL( const TXmlEngElement& aElement );
       
   202     
       
   203     /**
       
   204      * Sets value.
       
   205      *
       
   206      * @since S60 v5.0
       
   207      * @param aValue New value.
       
   208      */
       
   209     void SetValueL( const TDesC8& aValue );
       
   210 
       
   211 	    /**
       
   212      * Sets value.
       
   213      *
       
   214      * @since S60 v5.0
       
   215      * @param aValue New value.
       
   216      */
       
   217     void SetValueL( const TDesC& aValue );
       
   218 	
       
   219     /**
       
   220      * Sets key or name.
       
   221      *
       
   222      * @since S60 v5.0
       
   223      * @param aElement XML DOM Element.
       
   224      */
       
   225     void SetKeyOrNameL( const TXmlEngElement& aElement );
       
   226     
       
   227     /**
       
   228      * Sets key name.
       
   229      * 
       
   230      * @since S60 v5.0
       
   231      * @param aName New key name.
       
   232      */
       
   233     void SetKeyNameL( const TDesC8& aName );
       
   234     
       
   235     /**
       
   236      * Evaluates key - sets params.
       
   237      * 
       
   238      * @since S60 v5.0
       
   239      * @param aParamList List of parameters.
       
   240      * @param aPos Position in the param list. Default is 0.
       
   241      */
       
   242     void DoEvaluateL( const CLiwGenericParamList& aParamList,
       
   243                         TInt aPos = 0 );
       
   244     
       
   245     /**
       
   246      * Evaluates the key value.
       
   247      * 
       
   248      * @since S60 v5.0
       
   249      * @param aParamList List of parameters.
       
   250      * @param aPos Position in the param list. Default is 0.
       
   251      */
       
   252     virtual void EvaluateKeyValueL( const CLiwGenericParamList& aParamList,
       
   253                         TInt aPos = 0 );
       
   254     
       
   255 protected: // data
       
   256     
       
   257     /**
       
   258      * Key name (8-bit descriptor).
       
   259      * Own. 
       
   260      */
       
   261     RBuf8 iKeyName;
       
   262 
       
   263     /**
       
   264      * Key content.
       
   265      * Own. 
       
   266      */
       
   267     RBuf iContent;
       
   268        
       
   269    /**
       
   270     * Subkeys (i.e. to handle with actions).
       
   271     * Own. 
       
   272     */
       
   273     RPointerArray<CHnMdBaseKey> iSubKeys;
       
   274 
       
   275     };
       
   276 
       
   277 #endif // C_HNMDBASEKEY_H