contextframework/cfw/inc/basicoperationsplugin/cfclausenode.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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:  CCFClauseNode class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CFCLAUSENODE_H
       
    21 #define C_CFCLAUSENODE_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <cfkeyvaluepair.h>
       
    26 #include <cfoperationnode.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CMDXMLNode;
       
    30 class CCFScriptAction;
       
    31 class CCFContextSourceCommandParameter;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  This class implements abstract clause node as a base class for XML clause
       
    37 *  nodes (like if, elseif, and else) on Context Framework Scripts.
       
    38 *
       
    39 *  @lib CFScriptEngine
       
    40 *  @since S60 v5.0
       
    41 */
       
    42 NONSHARABLE_CLASS( CCFClauseNode ): public CCFOperationNode
       
    43     {
       
    44 public: // Constructors and destructor
       
    45 
       
    46     /**
       
    47     * Destructor.
       
    48     */
       
    49     virtual ~CCFClauseNode();
       
    50 
       
    51 public: // New functions
       
    52 
       
    53     /**
       
    54     * Fires actions of the node.
       
    55     * @return None.
       
    56     */
       
    57     virtual void FireActionsL() = 0;
       
    58 
       
    59 public: // Functions from CCFOperationNode
       
    60 
       
    61     /**
       
    62     * Activates this node, e.g. subscribes contexts or restores values
       
    63     * from persistent storage. Depending on the goal of the node, it should
       
    64     * pass the activate call to its' children.
       
    65     */
       
    66     virtual void ActivateL() = 0;
       
    67 
       
    68     /**
       
    69     * Deactivates this node, e.g. removes subscriptions. Depending on the
       
    70     * goal of the node, it should pass the deactivate call to its' children.
       
    71     */
       
    72     virtual void Deactivate() = 0;
       
    73 
       
    74     /**
       
    75     * Asks this node to check its security (via services interface). For
       
    76     * example, the security of contexts to be subscribed or actions to be
       
    77     * performed.
       
    78     * @return KErrNone if security check passed, otherwise any of the system
       
    79     *   wide error codes.
       
    80     */
       
    81     virtual TInt CheckSecurity() = 0;
       
    82 
       
    83     /**
       
    84     * Called by child node, to ask the parent to re-evaluate its value,
       
    85     * since the child's value has changed.
       
    86     * @return None.
       
    87     */
       
    88     virtual void Evaluate() = 0;
       
    89 
       
    90 protected:
       
    91 
       
    92     /**
       
    93     * C++ default constructor.
       
    94     * @param aServices is the operation services interface for nodes.
       
    95     * @param aParent is parent node for this node. The ownership of the parent
       
    96     *   is not transffered.
       
    97     */
       
    98     CCFClauseNode( MCFOperationServices& aServices, CCFOperationNode* aParent );
       
    99 
       
   100 protected: // New functions
       
   101 
       
   102     /**
       
   103     * Parses actions from an xml node.
       
   104     * @param aNode is the node to be parsed, root action node.
       
   105     * @param aActions is the array where parsed actions are stored.
       
   106     * @return None, may leave with any system wide error code.
       
   107     */
       
   108     void ParseActionsL( CMDXMLNode& aNode,
       
   109             RPointerArray< CCFScriptAction >& aActions );
       
   110 
       
   111 private: // New functions
       
   112 
       
   113     /**
       
   114     * Parses a notify action from an xml node and returns a pointer to
       
   115     * CCFScriptAction instance.
       
   116     * @param aNode is the node to be parsed.
       
   117     * @return a ptr to CCFScriptAction instance parsed from the given node,
       
   118     *   Note that the ownership is transferred. Leaves with code
       
   119     *   KErrNotSupported if the node cannot be parsed.
       
   120     */
       
   121     CCFScriptAction* ParseNotifyActionL( CMDXMLNode& aNode );
       
   122 
       
   123     /**
       
   124     * Parses a publish context action from an xml node and returns a pointer to
       
   125     * CCFScriptAction instance.
       
   126     * @param aNode is the node to be parsed.
       
   127     * @return a ptr to CCFScriptAction instance parsed from the given node,
       
   128     *   Note that the ownership is transferred. Leaves with code
       
   129     *   KErrNotSupported if the node cannot be parsed.
       
   130     */
       
   131     CCFScriptAction* ParsePublishContextActionL( CMDXMLNode& aNode );
       
   132 
       
   133     /**
       
   134     * Parses a source command action from an xml node and returns a pointer to
       
   135     * CCFScriptAction instance.
       
   136     * @param aNode is the node to be parsed.
       
   137     * @return a ptr to CCFScriptAction instance parsed from the given node,
       
   138     *   Note that the ownership is transferred. Leaves with code
       
   139     *   KErrNotSupported if the node cannot be parsed.
       
   140     */
       
   141     CCFScriptAction* ParseSourceCommandActionL( CMDXMLNode& aNode );
       
   142 
       
   143     /**
       
   144     * Gets attributes from an xml node as key value pairs.
       
   145     * @param aNode is the node to be parsed for attributes.
       
   146     * @param aAttributes is the array for the attributes as key value pairs.
       
   147     * @return None.
       
   148     */
       
   149     void GetAttributesL( CMDXMLNode& aNode, RKeyValueArray& aAttributes );
       
   150 
       
   151     /**
       
   152     * Gets nested source command parameters containing optional nested
       
   153     * parameters (via recursive calls to itself) from an xml node.
       
   154     * @param aNode is the node to be parsed for the parameter.
       
   155     * @param aParent is the parent parameter.
       
   156     * @return None.
       
   157     */
       
   158     void GetNestedSourceCommandParametersL( CMDXMLNode& aNode,
       
   159             CCFContextSourceCommandParameter& aParent );
       
   160 
       
   161 private: // Data
       
   162 
       
   163     };
       
   164 
       
   165 
       
   166 #endif // C_CFCLAUSENODE_H