connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.h
branchRCL_3
changeset 20 4a793f564d72
parent 0 d0791faffa3f
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  ConML parser/generator
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __SCONXMLELEMENT_H__
       
    20 #define __SCONXMLELEMENT_H__
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // Includes
       
    24 // -----------------------------------------------------------------------------
       
    25 
       
    26 #include <e32base.h>
       
    27 #include "sconxmlstack.h"
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // Class forwards
       
    31 // -----------------------------------------------------------------------------
       
    32 class MWBXMLConMLCallback;
       
    33 struct TXMLElementParams;
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // CXMLElement - Base class for XML -elements
       
    37 // -----------------------------------------------------------------------------
       
    38 NONSHARABLE_CLASS( CXMLElement ) : public CBase
       
    39     {
       
    40 public:
       
    41     enum TAction 
       
    42         {
       
    43         ENone,
       
    44         EPop,
       
    45         EPopAndDestroy // Pop from stack, callback, delete
       
    46         };
       
    47 
       
    48     /**
       
    49     * Sets the data of an element
       
    50     * @param aData - Data of the element
       
    51     * @return none
       
    52     */
       
    53     virtual void SetDataL( const TDesC8& aData );
       
    54     
       
    55     /**
       
    56     * Returns data of an element
       
    57     * @param none
       
    58     * @return Data of the element as TPtrC8
       
    59     */
       
    60     virtual TPtrC8 Data() const;
       
    61         
       
    62     /**
       
    63     * Validates an element's instance 
       
    64     * @param none
       
    65     * @return ETrue if element current instance is valid, 
       
    66     * EFalse if not 
       
    67     */
       
    68     virtual TBool Validate();
       
    69     
       
    70     /**
       
    71     * Checks if instance needs cleanup
       
    72     * @param none
       
    73     * @return ETrue if instance pushed into 
       
    74     * parser's cleanupstack , EFalse if not
       
    75     */
       
    76     virtual TBool NeedsCleanup() const;
       
    77     
       
    78     /**
       
    79     * Offers a new element to this element
       
    80     * @param aTag - tag of the element to be started 
       
    81     * @param aParams - Element parameters
       
    82     * @return new Element instance as CXMLElement
       
    83     */
       
    84     virtual CXMLElement* BeginElementL( 
       
    85         TUint8 aTag, const TXMLElementParams& aParams );
       
    86 
       
    87     /**
       
    88     * Offers a new element to this element
       
    89     * @param aTag - tag of the element to be started 
       
    90     * @param aParams - Element parameters
       
    91     * @return new Element instance as CXMLElement
       
    92     */
       
    93     virtual TAction EndElementL( TAny* aCallbacks, TUint8 aTag );
       
    94     };
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // TElementParams
       
    98 // -----------------------------------------------------------------------------
       
    99 NONSHARABLE_STRUCT( TXMLElementParams )
       
   100     {
       
   101 public:
       
   102     inline TXMLElementParams();
       
   103     TXMLElementParams( 
       
   104         TAny* aCallbacks, 
       
   105         CXMLStack<CXMLElement>* aCmdStack = 0, 
       
   106         CXMLStack<CXMLElement>* aCleanupStack = 0 );
       
   107         
       
   108     /**
       
   109     * Returns the call back function of parameters
       
   110     * @param nonoe
       
   111     * @return call back function as TAny
       
   112     */
       
   113     inline TAny* Callbacks() const;
       
   114     
       
   115     /**
       
   116     * Returns the command stack of the parameters
       
   117     * @param none
       
   118     * @return command stack as CXMLStack
       
   119     */
       
   120     inline CXMLStack<CXMLElement>* CmdStack() const;
       
   121 
       
   122     /**
       
   123     * Returns the clean up stack of the parameters
       
   124     * @param none
       
   125     * @return clean up stack as CXMLStack
       
   126     */
       
   127     inline CXMLStack<CXMLElement>* CleanupStack() const;
       
   128 
       
   129 private:
       
   130     TAny* iCallbacks;
       
   131     CXMLStack<CXMLElement>* iCmdStack;
       
   132     CXMLStack<CXMLElement>* iCleanupStack;
       
   133     };
       
   134 
       
   135 #include "sconxmlelement.inl"
       
   136 
       
   137 #endif // __SCONXMLELEMENT_H__