menufw/hierarchynavigator/hnmetadatamodel/inc/hnsimplecondition.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 
       
    20 #ifndef C_HNSIMPLECONDITION_H
       
    21 #define C_HNSIMPLECONDITION_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32hashtab.h>
       
    25 #include <xmlengelement.h> 
       
    26 #include <liwgenericparam.h>
       
    27 #include "hnglobals.h"
       
    28 #include "hnconditioninterface.h"
       
    29 
       
    30 class CLiwGenericParamList;
       
    31 class TLiwVariant;
       
    32 
       
    33 /**
       
    34  * Simple Condition.
       
    35  * 
       
    36  * The simple condition class. This is the base class for different
       
    37  * condition classes, e.g. Greater, Has, HasNot conditions.
       
    38  *  
       
    39  * @lib hierarchynavigatorengine
       
    40  * @since S60 v3.2
       
    41  * @ingroup group_hnmetadatamodel
       
    42  */
       
    43 NONSHARABLE_CLASS(CHnSimpleCondition) : public CHnConditionInterface
       
    44     {
       
    45 public:
       
    46    
       
    47     /**
       
    48      * Standard factory function.
       
    49      * 
       
    50      * @param aElement Xml element.
       
    51      * @return Fully constructed object.
       
    52      */
       
    53     static CHnSimpleCondition* NewL( TDesC8 & aElement );
       
    54 
       
    55     /**
       
    56      * Standard C++ Destructor
       
    57      */
       
    58     ~CHnSimpleCondition();
       
    59     
       
    60     /**
       
    61      * Removes quotes.
       
    62      *
       
    63      * @since S60 v3.2
       
    64      * @param aValue String to remove quotes from.
       
    65      */
       
    66     static void RemoveQuotes( RBuf8 & aValue );
       
    67     
       
    68     /**
       
    69      * Returns result.
       
    70      *
       
    71      * @since S60 v3.2
       
    72      * @param aQueryResults Results of query.
       
    73      * @param aPos Position.
       
    74      * @return True if condition is satisfied.
       
    75      */    
       
    76     TBool ResultL( const CLiwGenericParamList& aQueryResults, TInt aPos );
       
    77         
       
    78     /**
       
    79      * Returns result.
       
    80      *
       
    81      * @since S60 v3.2
       
    82      * @param aVarLeft Left variant.
       
    83      * @param aVarRight Right variant.
       
    84      * @return True if condition is satisfied.
       
    85      */    
       
    86     virtual TBool CheckCondition( TLiwVariant& aVarLeft, TLiwVariant& aVarRight ) = 0;
       
    87 
       
    88 protected:
       
    89     
       
    90     /**
       
    91      *  Standard C++ Constructor
       
    92      */
       
    93     CHnSimpleCondition();
       
    94 
       
    95     /**
       
    96      * Standard symbian second phase constructor.
       
    97      * 
       
    98      * @param aElement Xml element.
       
    99      */
       
   100     void ConstructL( TDesC8 & aElement );
       
   101     
       
   102     /**
       
   103      * Gets positions.
       
   104      * 
       
   105      * @param aBuffer Buffer.
       
   106      * @return Position.
       
   107      */
       
   108     virtual TInt GetPositionL( const TDesC8& aBuffer ) = 0;
       
   109     
       
   110     /**
       
   111      * Gets length.
       
   112      * 
       
   113      * @return Length of an operator.
       
   114      */
       
   115     virtual TInt SignLength() = 0;
       
   116 
       
   117 private:
       
   118     
       
   119     
       
   120     /**
       
   121      * Checks if both combinations, if either of the pairs, has this 
       
   122      * sort of type configuration.
       
   123      *
       
   124      * @since S60 v3.2
       
   125      * @param aVarLeft Left variant.
       
   126      * @param aVarRight Right variant.
       
   127      * @param aType1 Variant type 1.
       
   128      * @param aType2 Variant type 2.
       
   129      */
       
   130     static TLiwVariant* CheckTypes( TLiwVariant* aVarLeft, TLiwVariant* aVarRight, 
       
   131             LIW::TVariantTypeId aType1, LIW::TVariantTypeId aType2 );
       
   132     
       
   133     /**
       
   134      * Normalizes to one sort of descriptor type.
       
   135      *
       
   136      * @since S60 v3.2
       
   137      * @param aVar Variant.
       
   138      */
       
   139     static void NormalizeVariantTypeDesL( TLiwVariant* aVar );
       
   140     
       
   141     /**
       
   142      * Tries to match types of content.
       
   143      *
       
   144      * @since S60 v3.2
       
   145      * @param aVarLeft Left variant.
       
   146      * @param aVarRight Right variant.
       
   147      */    
       
   148     static void NegotiateTypesL( TLiwVariant* aVarLeft, TLiwVariant* aVarRight );
       
   149     
       
   150     /**
       
   151      * If list is compared to a string, a decision is made, to substitute list a
       
   152      * its Count() scalar.
       
   153      *
       
   154      * @since S60 v3.2
       
   155      * @param aVar Variant.
       
   156      */    
       
   157     static void NegotiateListL( TLiwVariant & aVar );
       
   158     
       
   159     /**
       
   160      * If map is compared to a string, a decision is made, to substitute list a
       
   161      * its Count() scalar.
       
   162      *
       
   163      * @since S60 v3.2
       
   164      * @param aVar Variant.
       
   165      */    
       
   166     static void NegotiateMapL( TLiwVariant & aVar );
       
   167     
       
   168     /**
       
   169      * If tuint is compared to a string, a decision is made, to substitute 
       
   170      * it as tuint
       
   171      *
       
   172      * @since S60 v3.2
       
   173      * @param aVar Variant.
       
   174      */    
       
   175     static void NegotiateTUintL( TLiwVariant & aVar );
       
   176     
       
   177 
       
   178     /**
       
   179      * 
       
   180      * @since S60 v3.2
       
   181      * @param aVar Variant.
       
   182      */
       
   183     static void NegotiateTBoolL( TLiwVariant & aVar );
       
   184 
       
   185     
       
   186     /**
       
   187      * If tuint is compared to a string, a decision is made, to substitute 
       
   188      * it as tin32
       
   189      *
       
   190      * @since S60 v3.2
       
   191      * @param aVar Variant.
       
   192      */  
       
   193     static void NegotiateTInt32L( TLiwVariant & aVar );
       
   194     
       
   195     /**
       
   196      * If tuint is compared to a string, a decision is made, to substitute 
       
   197      * it as tin32
       
   198      *
       
   199      * @since S60 v3.2
       
   200      * @param aVar Variant.
       
   201      */  
       
   202     static void NegotiateTInt64L( TLiwVariant & aVar );
       
   203     
       
   204     /**
       
   205      * Creates implementation of CHnMenuCondition.
       
   206      * 
       
   207      * @param aElement Xml element.
       
   208      * @return Instance of CHnMenuCondition.
       
   209      */
       
   210     static CHnSimpleCondition* CreateImplementationL( TDesC8 & aElement );
       
   211 
       
   212 protected: // data
       
   213         
       
   214     /**
       
   215      * Own - Key.
       
   216      */
       
   217     RBuf8 iReferenceRight;
       
   218     
       
   219     /**
       
   220      * Own - Key.
       
   221      */
       
   222     RBuf8 iReferenceLeft;
       
   223     
       
   224     };
       
   225 
       
   226 #endif // C_HNSIMPLECONDITION_H
       
   227 
       
   228 //End of file