messagingfw/biomsgfw/wappsrc/CWappBookmark.cpp
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "CWappBookmark.h"
       
    17 #include <ipaddr.h>
       
    18 
       
    19 CWappBookmark* CWappBookmark::NewL()
       
    20 	{
       
    21 	CWappBookmark* self = CWappBookmark::NewLC();
       
    22 	CleanupStack::Pop();
       
    23 	return self;
       
    24 	}
       
    25 
       
    26 CWappBookmark* CWappBookmark::NewLC()
       
    27 	{
       
    28 	CWappBookmark* self = new (ELeave) CWappBookmark;
       
    29 	CleanupStack::PushL(self);
       
    30 	self->ConstructL();
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 void CWappBookmark::ConstructL()
       
    35 	{
       
    36 	SetNameL(KNullDesC);
       
    37 	SetUrlL(KNullDesC);
       
    38 	}
       
    39 
       
    40 CWappBookmark::~CWappBookmark()
       
    41 	{
       
    42 	delete iBmkName;
       
    43 	delete iBmkUrl;
       
    44 	}
       
    45 
       
    46 const TDesC& CWappBookmark::Name() const
       
    47 	{
       
    48 	return *iBmkName; //return a constant pointer descriptor
       
    49 	}
       
    50 
       
    51 //	
       
    52 const TDesC& CWappBookmark::Url() const
       
    53 	{
       
    54 	return iBmkUrl->Addr();
       
    55 	}
       
    56 
       
    57 //	SetNameL()	- Allocate memory and set Name field, delete 
       
    58 //				  any currently allocated memory, 				  
       
    59 //
       
    60 void CWappBookmark::SetNameL(const TDesC& aDes)
       
    61 	{
       
    62 	HBufC* name = aDes.AllocL();
       
    63 	delete iBmkName;
       
    64 	iBmkName = name;
       
    65 	}
       
    66 
       
    67 //	SetUrlL()	- Sets URL field, deleting any currently allocated memory, setting  
       
    68 //				  pointer to newly allocated HBufC
       
    69 //
       
    70 void CWappBookmark::SetUrlL(const TDesC& aDes)
       
    71 	{
       
    72 	CIpAddress* tempAddr = CIpAddress::NewL(aDes);
       
    73 	delete iBmkUrl;
       
    74 	iBmkUrl = tempAddr;
       
    75 	}