omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h
changeset 0 b497e44ab2fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h	Thu Dec 17 09:07:52 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*     Base class for WAP setting items.
+*
+*/
+
+
+#ifndef CWPWAPITEMBASE_H
+#define CWPWAPITEMBASE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <MWPVisitor.h>
+#include "MWPWAPItemBase.h"
+
+// FORWARD DECLARATIONS
+class CCommsDatabase;
+class CApDataHandler;
+class CApAccessPointItem;
+
+// CLASS DECLARATION
+
+/**
+ * CWPWAPItemBase is a base class for browser settings.
+ *
+ * @lib WPWAPAdapter
+ * @since 2.0
+ */ 
+class CWPWAPItemBase : public CBase, private MWPVisitor, public MWPWAPItemBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        ~CWPWAPItemBase();
+
+    public:  // From MWPVisitor
+
+        void VisitL(CWPCharacteristic& aCharacteristic);
+        void VisitL(CWPParameter& aParameter);
+        void VisitLinkL(CWPCharacteristic& aCharacteristic );
+
+    public:   // From MWPWAPItemBase
+
+        const TDesC& Name() const;
+        const TDesC& Title() const;
+        const TDesC& Address() const;
+        const TDesC8& SaveData() const;
+
+    protected:   // New methods
+        /**
+        * C++ default constructor.
+        * @param aTitle Title for items
+        * @param aDefaultName Default name for items
+        * @param aCharacteristic The APPLICATION characteristic
+        * @param aCommsDb The CommsDB to use. Created if NULL.
+        * @param aAPHandler The APEngine data handler to use. Created if NULL.
+        */
+        CWPWAPItemBase( const TDesC& aTitle, 
+            const TDesC& aDefaultName, 
+            CWPCharacteristic& aCharacteristic, 
+            CCommsDatabase*& aCommsDb, 
+            CApDataHandler*& aAPHandler );
+
+        /**
+        * 2nd phase base constructor. Derived classes must call this.
+        */
+        void BaseConstructL();
+
+        /**
+        * Handles one resource item.
+        * @param aResource The RESOURCE item
+        */
+        virtual void ResourceL( CWPCharacteristic& aResource ) = 0;
+
+        /**
+        * Create CCommsDatabase and APEngine if NULL.
+        */
+        void CreateDbL();
+
+        /**
+        * Writes a home page to an access point. If access point already
+        * has a home page, create a new one.
+        * @param aItem Access point to access
+        */
+        void WriteHomePageL( CApAccessPointItem& aItem );
+
+        /**
+        * Create a valid name for the access point.
+        * @param aName The base name for access point
+        * @param aDb CommsDb instance
+        */
+        void MakeValidNameL( TDes& aName, CCommsDatabase& aDb ) const;
+
+    protected:
+        // The parent characteristic. Refs.
+        CWPCharacteristic& iCharacteristic;
+
+        // The preferred access point name
+        TPtrC iName;
+
+        // The access point address, Owns.
+        HBufC* iAddr;
+
+        // The UID of the access point
+        TUint32 iUID;
+
+        // UID of the saved item
+        TPckgBuf<TWPWAPSaveItem> iSaveItem;
+
+        // Temporary current proxy while visiting. Refs.
+        CWPCharacteristic* iLink;
+
+        // Text to return in SummaryTitle().
+        const TDesC& iTitle;
+
+        // Default name of access point.
+        const TDesC& iDefaultName;
+
+        // Comms db. Refs.
+        CCommsDatabase*& iCommsDb;
+
+        // APEngine. Refs.
+        CApDataHandler*& iAPHandler;
+    };
+
+#endif  // CWPWAPITEMBASE_H
+            
+// End of File