ncdengine/engine/accesspointmanager/inc/catalogsaccesspoint.h
changeset 4 32704c33136d
equal deleted inserted replaced
-1:000000000000 4:32704c33136d
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Class CCatalogsAccessPoint declation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CATALOGSACCESSPOINT_H
       
    20 #define C_CATALOGSACCESSPOINT_H
       
    21 
       
    22 #include <s32strm.h>
       
    23 #include "catalogsaccesspointsettings.h"
       
    24 
       
    25 class CCatalogsAccessPoint: public CCatalogsAccessPointSettings
       
    26     {
       
    27 public:
       
    28 
       
    29     /**
       
    30      * Two phase constructor.
       
    31      * 
       
    32      * @param aApNcdId The id of the access point (obtained from CDB).
       
    33      * @return A pointer to the created object.
       
    34      */
       
    35     static CCatalogsAccessPoint* NewL(const TDesC& aApNcdId, const TDesC& aName);
       
    36     
       
    37     /**
       
    38      * Two phase constructor. Object is constructed from a stream.
       
    39      * 
       
    40      * @param aSettings Stream which can be used to initialize object's state.
       
    41      * 
       
    42      * @return A pointer to the created object.
       
    43      */
       
    44     static CCatalogsAccessPoint* NewL( RReadStream& aStream );
       
    45 
       
    46     /**
       
    47      * Seconds phase constructor.
       
    48      * 
       
    49      * @param aApNcdId The id of the access point (obtained from CDB).
       
    50      * @return A pointer to the created object. Object is in cleanupstack.
       
    51      */
       
    52     static CCatalogsAccessPoint* NewLC(const TDesC& aApNcdId, const TDesC& aName);
       
    53     
       
    54     /**
       
    55      * Seconds phase constructor. Object is constructed from a stream.
       
    56      * 
       
    57      * @param aSettings Stream which can be used to initialize object's state.
       
    58      * 
       
    59      * @return A pointer to the created object. Object is in cleanupstack.
       
    60      */
       
    61     static CCatalogsAccessPoint* NewLC( RReadStream& aStream );
       
    62     
       
    63     /**
       
    64      * Destructor.
       
    65      */
       
    66     virtual ~CCatalogsAccessPoint();
       
    67     
       
    68     /**
       
    69      * Writes objects state to a stream.
       
    70      * 
       
    71      * @param aStream Opened write stream.
       
    72      */
       
    73     void ExternalizeL( RWriteStream& aStream );
       
    74     
       
    75     /**
       
    76      * Initializes objects state from a stream. 
       
    77      * 
       
    78      * @param aStream Opened read stream.
       
    79      */
       
    80     void InternalizeL( RReadStream& aStream );
       
    81         
       
    82     /**
       
    83      * Sets the name of the access point.
       
    84      *
       
    85      * @param aName The name.
       
    86      */
       
    87     void SetNameL(const TDesC& aName);
       
    88     
       
    89     /**
       
    90      * Get the name of the access point.
       
    91      *
       
    92      * @return The name.
       
    93      */
       
    94     const TDesC& Name() const;
       
    95     
       
    96     /**
       
    97      * Get accesspoint's id in the commsdatabase.
       
    98      * 
       
    99      * @return Id of the accesspoint.
       
   100      */
       
   101     TUint32 AccessPointId() const;
       
   102     
       
   103     /**
       
   104      * Get the accesspoint's id used in NCD (given by CDB).
       
   105      *
       
   106      * @return NCD id of the accesspoint.
       
   107      */
       
   108     const TDesC& NcdAccessPointId() const;
       
   109     
       
   110     /**
       
   111      * Set accesspoints id in the commsdatabase
       
   112      * 
       
   113      * @param aId    Id of the accesspoint.
       
   114      */
       
   115     void SetAccessPointId( TUint32 aId );
       
   116 
       
   117     /**
       
   118      * Get accesspoint's iCreatedByManager flag. If true, accesspoint is deleted in the manager's destructor.
       
   119      * 
       
   120      * @return Boolean flag value.
       
   121      */
       
   122     TBool CreatedByManager () const;
       
   123     
       
   124     /**
       
   125      * Set accesspoint's iCreatedByManager flag to true, so that it gets deleted in the manager's destructor.
       
   126      */
       
   127     void SetCreatedByManager();
       
   128     
       
   129 protected:
       
   130 
       
   131     /**
       
   132      * Constructor.
       
   133      */
       
   134     CCatalogsAccessPoint();
       
   135 
       
   136     /**
       
   137      * Performs seconds phase construction.
       
   138      */
       
   139     void ConstructL(const TDesC& aApNcdId, const TDesC& aName);
       
   140     
       
   141     /**
       
   142      * Constructs the object from the given stream data.
       
   143      *
       
   144      * @param aStream The stream.
       
   145      */
       
   146     void ConstructL(RReadStream& aStream);
       
   147 
       
   148     /**
       
   149      * Compare two accesspoints.
       
   150      * 
       
   151      * @param aAccessPoint
       
   152      *               A Reference to another accesspoint.
       
   153      * 
       
   154      * @return ETrue if settings are same, EFalse otherwise.
       
   155      */
       
   156     TBool MatchingAccessPoint( const CCatalogsAccessPoint& aAccessPoint );
       
   157 
       
   158 private:
       
   159 
       
   160     HBufC*  iName;
       
   161     HBufC*  iNcdAccessPointId;
       
   162     TUint32 iAccessPointId;
       
   163        
       
   164     // Boolean flag to avoid deleting pre-existing access points in ~CCatalogsAccessPointManager().
       
   165     // Fix for [#PRECLI-1596]
       
   166     TBool iCreatedByManager;
       
   167     };
       
   168 
       
   169 
       
   170 
       
   171 #endif
       
   172