ncdengine/engine/accesspointmanager/src/catalogsaccesspoint.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     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 implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "catalogsaccesspoint.h"
       
    20 #include "catalogsutils.h"
       
    21 
       
    22 CCatalogsAccessPoint* CCatalogsAccessPoint::NewL(
       
    23     const TDesC& aApNcdId, const TDesC& aName )
       
    24     {
       
    25     CCatalogsAccessPoint* self = NewLC( aApNcdId, aName );
       
    26     CleanupStack::Pop();
       
    27     return self;
       
    28     }
       
    29 
       
    30 CCatalogsAccessPoint* CCatalogsAccessPoint::NewL( RReadStream& aStream )
       
    31     {
       
    32     CCatalogsAccessPoint* self = NewLC( aStream );
       
    33     CleanupStack::Pop();
       
    34     return self;
       
    35     }
       
    36 
       
    37 CCatalogsAccessPoint* CCatalogsAccessPoint::NewLC(
       
    38     const TDesC& aApNcdId, const TDesC& aName )
       
    39     {
       
    40     CCatalogsAccessPoint* self = new (ELeave) CCatalogsAccessPoint();
       
    41     CleanupStack::PushL( self );
       
    42     self->ConstructL( aApNcdId, aName );    
       
    43     return self;
       
    44     }
       
    45 
       
    46 CCatalogsAccessPoint* CCatalogsAccessPoint::NewLC( RReadStream& aStream )
       
    47     {
       
    48     CCatalogsAccessPoint* self = new (ELeave) CCatalogsAccessPoint();
       
    49     CleanupStack::PushL( self );
       
    50     self->ConstructL(aStream);
       
    51     return self;
       
    52     }
       
    53 
       
    54 CCatalogsAccessPoint::~CCatalogsAccessPoint()
       
    55     {
       
    56     delete iName;
       
    57     delete iNcdAccessPointId;
       
    58     }
       
    59 
       
    60 CCatalogsAccessPoint::CCatalogsAccessPoint(): 
       
    61 							CCatalogsAccessPointSettings(),
       
    62 							iCreatedByManager( EFalse )
       
    63     {
       
    64     }
       
    65 
       
    66 void CCatalogsAccessPoint::ExternalizeL( RWriteStream& aStream )
       
    67     {
       
    68     DLTRACEIN((""));
       
    69     CCatalogsAccessPointSettings::ExternalizeL(aStream);
       
    70         
       
    71     // Externalize this classes state to the stream.
       
    72     ExternalizeDesL(*iName, aStream);
       
    73     ExternalizeDesL(*iNcdAccessPointId, aStream);
       
    74     aStream.WriteUint32L( iAccessPointId );
       
    75     aStream.WriteUint32L( static_cast<TUint32>( iCreatedByManager ) );
       
    76     DLTRACEOUT((""));
       
    77     }
       
    78 
       
    79 void CCatalogsAccessPoint::InternalizeL( RReadStream& aStream )
       
    80     {
       
    81     CCatalogsAccessPointSettings::InternalizeL(aStream);
       
    82         
       
    83     // Internalize this classes state from the stream.
       
    84     InternalizeDesL(iName, aStream);
       
    85     InternalizeDesL(iNcdAccessPointId, aStream);
       
    86     iAccessPointId = aStream.ReadUint32L();
       
    87     iCreatedByManager = static_cast<TBool>( aStream.ReadUint32L() );
       
    88     }
       
    89 
       
    90     
       
    91 void CCatalogsAccessPoint::SetNameL(const TDesC& aName) 
       
    92     {
       
    93     HBufC* tmpName = aName.AllocL();
       
    94     delete iName;
       
    95     iName = 0;
       
    96     iName = tmpName;
       
    97     }
       
    98     
       
    99 const TDesC& CCatalogsAccessPoint::Name() const 
       
   100     {
       
   101     return *iName;
       
   102     }
       
   103 
       
   104 TBool CCatalogsAccessPoint::CreatedByManager() const 
       
   105 	{
       
   106 	return iCreatedByManager;
       
   107 	}
       
   108 
       
   109 void CCatalogsAccessPoint::SetCreatedByManager()
       
   110     {
       
   111 	iCreatedByManager = ETrue;
       
   112     }
       
   113 
       
   114 TUint32 CCatalogsAccessPoint::AccessPointId() const
       
   115     {
       
   116     return iAccessPointId;
       
   117     }
       
   118     
       
   119 const TDesC& CCatalogsAccessPoint::NcdAccessPointId() const
       
   120     {
       
   121     return *iNcdAccessPointId;
       
   122     }
       
   123 
       
   124 void CCatalogsAccessPoint::SetAccessPointId( TUint32 aId )
       
   125     {
       
   126     iAccessPointId = aId;
       
   127     }
       
   128 
       
   129 void CCatalogsAccessPoint::ConstructL( const TDesC& aApNcdId, const TDesC& aName )
       
   130     {
       
   131     CCatalogsAccessPointSettings::ConstructL();
       
   132     iName = aName.AllocL();
       
   133     iNcdAccessPointId = aApNcdId.AllocL();
       
   134     }
       
   135     
       
   136 void CCatalogsAccessPoint::ConstructL( RReadStream& aStream) 
       
   137     {
       
   138     CCatalogsAccessPointSettings::ConstructL();
       
   139     InternalizeL(aStream);
       
   140     }