omaprovisioning/provisioning/ProvisioningEngine/Inc/CWPRoot.h
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Root for WAP Provisioning document.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CWPROOT_H
       
    20 #define CWPROOT_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "MWPBuilder.h"
       
    26 #include "MWPVisitor.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CWPCharacteristic;
       
    30 class CDesC16Array;
       
    31 
       
    32 //  CLASS DEFINITION
       
    33 
       
    34 /**
       
    35 *  Root for the contents of a WAP Provisioning document.
       
    36 *
       
    37 *  @lib ProvisioningEngine
       
    38 *  @since 2.0
       
    39 */
       
    40 class CWPRoot : public CBase, public MWPBuilder, private MWPVisitor 
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43         
       
    44         /**
       
    45         * Two-phased constructor.
       
    46         */
       
    47         static CWPRoot* NewL();
       
    48         
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         */
       
    52         static CWPRoot* NewLC();
       
    53         
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         ~CWPRoot();
       
    58         
       
    59     public: // New functions
       
    60 
       
    61         /**
       
    62         * Accepts a visitor for the contents of the document.
       
    63         * @param aVisitor Visitor is called for each element in the root of the document.
       
    64         */
       
    65         void AcceptL(MWPVisitor& aVisitor);
       
    66         
       
    67         /**
       
    68         * Loads a WAP Provisioning document from a stream.
       
    69         * @param aStream Stream to read the document from.
       
    70         */
       
    71         void InternalizeL(RReadStream& aStream);
       
    72         
       
    73         /**
       
    74         * Stores a WAP Provisioning document in a stream.
       
    75         * @param aStream Stream to write the document to.
       
    76         */
       
    77         void ExternalizeL(RWriteStream& aStream) const;
       
    78 
       
    79         /**
       
    80         * Insert an element to the root of the document.
       
    81         * @param aElement Element to insert. The ownership is transferred to CWPRoot.
       
    82         */
       
    83         void InsertL( CWPCharacteristic* aElement );
       
    84 
       
    85         /**
       
    86         * Creates links from logical proxy ids to logical 
       
    87         * proxies and access point ids to access points.
       
    88         * Call this before walking through the document data.
       
    89         */
       
    90         void CreateLinksL();
       
    91 
       
    92     public: // From MWPBuilder
       
    93 
       
    94         void StartCharacteristicL( TInt aType );
       
    95         void StartCharacteristicL( const TDesC& aName );
       
    96         void EndCharacteristicL();
       
    97         void ParameterL( TInt aID, const TDesC& aValue );
       
    98         void ParameterL( const TDesC& aName, const TDesC& aValue );
       
    99         
       
   100     private: // From MWPVisitor
       
   101         
       
   102         void VisitL(CWPCharacteristic& aCharacteristic);
       
   103         void VisitL(CWPParameter& aParameter);
       
   104         void VisitLinkL(CWPCharacteristic& aCharacteristic );
       
   105 
       
   106     private:
       
   107         
       
   108         /**
       
   109         * C++ default constructor.
       
   110         */
       
   111         CWPRoot();
       
   112 
       
   113         /**
       
   114         * By default Symbian 2nd phase constructor is private.
       
   115         */
       
   116         void ConstructL();
       
   117 
       
   118     private: // Data
       
   119         /// Characteristics in the root of the document. Owns.
       
   120         CArrayPtr<CWPCharacteristic>* iContents;
       
   121         
       
   122         /// Stack for MWPBuilder
       
   123         RPointerArray<CWPCharacteristic> iStack;
       
   124 
       
   125         /// Needed proxy IDs. Owns.
       
   126         CDesC16Array* iNeededIDs;
       
   127 
       
   128         /// Proxy IDs. Owns.
       
   129         CDesC16Array* iProviderIDs;
       
   130 
       
   131         /// Logical proxies. Owns.
       
   132         RPointerArray<CWPCharacteristic> iProviders;
       
   133         
       
   134         /// Characteristics needing proxy.
       
   135         RPointerArray<CWPCharacteristic> iNeeders;
       
   136 
       
   137         /// Stack
       
   138         CWPCharacteristic* iCharStack;
       
   139     };
       
   140 
       
   141 #endif  //  CWPROOT_H