www.pudn.com > wcore.rar > WebCorePageData.cpp


 
//  INCLUDES 
#include "WebCorePageData.h" 
 
 
// ----------------------------------------------------------------------------- 
// CWebCorePageDataItem::NewL 
// Two-phased constructor. 
// ----------------------------------------------------------------------------- 
// 
CWebCorePageDataItem* CWebCorePageDataItem::NewL( TPageDataItemType aItemType ) 
    { 
    CWebCorePageDataItem* self = new(ELeave) CWebCorePageDataItem( aItemType ); 
    return self; 
    } 
 
CWebCorePageDataItem::CWebCorePageDataItem( TPageDataItemType aItemType ) : 
    iItemType( aItemType ) 
    {} 
 
// Destructor 
CWebCorePageDataItem::~CWebCorePageDataItem() 
    { 
    delete iData; 
    delete iUrl; 
    delete iContentType; 
    delete iCharset; 
    } 
 
void CWebCorePageDataItem::SetDataL( const TDesC& aData ) 
    { 
     
     
    delete iData; 
    iData = NULL; 
                 
    TInt dataLength = aData.Length() * 2; 
     
    iData = HBufC8::NewL(dataLength);     
 
    TPtr8 tptr8 = iData->Des(); 
    TUint8* dataString = (TUint8*) tptr8.Ptr(); 
    memcpy( dataString, aData.Ptr(), dataLength ); 
    tptr8.SetLength( dataLength );     
     
    } 
 
void CWebCorePageDataItem::SetUrlL(const TDesC& aUrl) 
    { 
    delete iUrl; 
    iUrl = NULL; 
    iUrl = HBufC8::NewL( aUrl.Length() ); 
    iUrl->Des().Copy( aUrl ); 
    } 
 
 
void CWebCorePageDataItem::SetContentTypeL(const TDesC& aContentType) 
    { 
    delete iContentType; 
    iContentType = NULL; 
    iContentType = HBufC8::NewL( aContentType.Length() ); 
    iContentType->Des().Copy( aContentType ); 
    } 
 
 
void CWebCorePageDataItem::SetCharsetL(const TDesC& aCharset) 
  { 
  delete iCharset; 
  iCharset = NULL; 
  iCharset = HBufC8::NewL( aCharset.Length() ); 
  iCharset->Des().Copy( aCharset ); 
  } 
//end of file