contextframework/cfw/inc/basicoperationsplugin/cfcontextchanged.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2004-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:  CCFContextChanged class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CFCONTEXTCHANGED_H
       
    21 #define C_CFCONTEXTCHANGED_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "cfcontextoperation.h"
       
    25 
       
    26 #include <e32base.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CCFContextObject;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  This class implements ContextChanged context object event.
       
    35 *
       
    36 *  @lib CFScriptEngine
       
    37 *  @since Series 60 2.6
       
    38 */
       
    39 NONSHARABLE_CLASS( CCFContextChanged ): public CCFContextOperation
       
    40     {
       
    41 public: // Constructors and destructor
       
    42 
       
    43     /**
       
    44     * Two-phased constructor.
       
    45     * @param aServices is the operation services interface for nodes.
       
    46     * @param aParent is parent node for this node.
       
    47     * @param aName is name of the context object this operation operates on.
       
    48     * @param aSource is the source of the context object this operation
       
    49     *   operates on.
       
    50     * @param aValue is the expected value of the context object this operation
       
    51     *   operates on. Use KNullDesC if no particular value is expected.
       
    52     */
       
    53     static CCFContextChanged* NewL( MCFOperationServices& aServices,
       
    54             CCFOperationNode* aParent,
       
    55             const TDesC& aName,
       
    56             const TDesC& aSource,
       
    57             const TDesC& aValue );
       
    58 
       
    59     /**
       
    60     * Two-phased constructor that leaves the class into CleanupStack.
       
    61     * @param aServices is the operation services interface for nodes.
       
    62     * @param aParent is parent node for this node.
       
    63     * @param aName is name of the context object this operation operates on.
       
    64     * @param aSource is the source of the context object this operation
       
    65     *   operates on.
       
    66     * @param aValue is the expected value of the context object this operation
       
    67     *   operates on. Use KNullDesC if no particular value is expected.
       
    68     */
       
    69     static CCFContextChanged* NewLC( MCFOperationServices& aServices,
       
    70             CCFOperationNode* aParent,
       
    71             const TDesC& aName,
       
    72             const TDesC& aSource,
       
    73             const TDesC& aValue );
       
    74 
       
    75     /**
       
    76     * Creates and parses a CCFContextChanged instance from an xml node.
       
    77     * @param aServices is the operation services interface for nodes.
       
    78     * @param aParent is the parent of this node or NULL if this is a root.
       
    79     *   The ownership of the parent is not transferred.
       
    80     * @param aNode is the node to be parsed.
       
    81     * @return a pointer to the created instance of CCFContextChanged, or NULL if
       
    82     *   the node is not this context changed node. May leave with any system
       
    83     *   wide error code.
       
    84     */
       
    85     static CCFContextChanged* ParseL( MCFOperationServices& aServices,
       
    86             CCFOperationNode* aParent,
       
    87             CMDXMLNode& aNode );
       
    88 
       
    89     /**
       
    90     * Destructor.
       
    91     */
       
    92     ~CCFContextChanged();
       
    93 
       
    94 private:
       
    95 
       
    96     /**
       
    97     * C++ default constructor.
       
    98     */
       
    99     CCFContextChanged( MCFOperationServices& aServices,
       
   100             CCFOperationNode* aParent,
       
   101             HBufC* aName,
       
   102             HBufC* aSource );
       
   103 
       
   104     /**
       
   105     * By default Symbian 2nd phase constructor is private.
       
   106     * @param aValue is the expected value of the context object this operation
       
   107     *   operates on. Use KNullDesC if no particular value is expected.
       
   108     */
       
   109     void ConstructL( const TDesC& aValue );
       
   110 
       
   111 protected: // From CFContextOperation
       
   112 
       
   113     /**
       
   114     * Tests if this listener requires notification of all contexts.
       
   115     * @returns ETrue if this listener is interested in all contexts,
       
   116     *   EFalse otherwise.
       
   117     */
       
   118     TBool IsAllRequired() const;
       
   119 
       
   120     /**
       
   121     * Evaluates a node with a context.
       
   122     * @param aContext is the context for evaluation.
       
   123     * @param aContextLevelDelay contains the context level delay defined by
       
   124     *  contextRef after the call.
       
   125     * @return ETrue if the operation was evaluated, EFalse otherwise.
       
   126     */
       
   127     virtual TBool Evaluate( const CCFContextObject& aContext,
       
   128             TInt& aContextLevelDelay );
       
   129 
       
   130     /**
       
   131     * Method that returns whether or not this this operation is true.
       
   132     * @returns ETrue if this operation is true, EFalse otherwise
       
   133     */
       
   134     TBool IsTrueL( const CCFContextObject& aContextObject );
       
   135 
       
   136 private: // Data
       
   137 
       
   138     // Flag for context used with previous truth check (call to isTrueL),
       
   139     // tells whether it was the referenced context or not.
       
   140     TBool iPreviousTruthCheckWithReferencedContext;
       
   141 
       
   142     // When set, the required context value for making the operation true.
       
   143     HBufC* iCmpValue;
       
   144     };
       
   145 
       
   146 #endif // C_CFCONTEXTCHANGED_H