internetradio2.0/datastructuressrc/irbrowsecatagoryitems.cpp
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <s32strm.h>
       
    20 
       
    21 #include "irdebug.h"
       
    22 #include "irbrowsecatagoryitems.h"
       
    23 
       
    24 // ======== LOCAL FUNCTIONS ========
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 //CIRBrowseCatagoryItems::NewL()
       
    30 //Static function
       
    31 //standard two phased constructor
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 EXPORT_C CIRBrowseCatagoryItems* CIRBrowseCatagoryItems::NewL()
       
    35 	{
       
    36 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::NewL - Entering" );
       
    37 	CIRBrowseCatagoryItems* self = CIRBrowseCatagoryItems::NewLC();
       
    38 	CleanupStack::Pop(self);
       
    39 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::NewL - Exiting." );
       
    40 	return self;
       
    41 	}
       
    42 
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 //CIRBrowseCatagoryItems::NewLC()
       
    46 //Static function
       
    47 //standard two phased constructor
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 EXPORT_C CIRBrowseCatagoryItems* CIRBrowseCatagoryItems::NewLC()
       
    51     {
       
    52 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::NewLC - Entering" );
       
    53 	CIRBrowseCatagoryItems* self = new (ELeave) CIRBrowseCatagoryItems;
       
    54 	CleanupStack::PushL(self);
       
    55 	self->ConstructL();
       
    56 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::NewLC - Exiting." );
       
    57 	return self;
       
    58 	}
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 //CIRBrowseCatagoryItems::ConstructL()
       
    63 //standard second phase constructor
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66  void CIRBrowseCatagoryItems::ConstructL() const
       
    67 	{
       
    68     IRLOG_DEBUG( "CIRBrowseCatagoryItems::ConstructL" );
       
    69 	return;
       
    70 	}
       
    71 
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 //CIRBrowseCatagoryItems::~CIRBrowseCatagoryItems()
       
    75 //standard C++ destructor
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78  CIRBrowseCatagoryItems::~CIRBrowseCatagoryItems()
       
    79 	{
       
    80 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::~CIRBrowseCatagoryItems - Entering" );
       
    81 	delete iCatName;
       
    82 	iCatName=NULL;
       
    83 	delete iCatId;
       
    84 	iCatId=NULL;
       
    85 	delete iCatGetOperation;
       
    86 	iCatGetOperation=NULL;
       
    87 	
       
    88 	delete iCatBannerUrl;
       
    89 	iCatBannerUrl=NULL;
       
    90 	
       
    91 	delete iCatClickThroughUrl;
       
    92 	iCatClickThroughUrl=NULL;
       
    93 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::~CIRBrowseCatagoryItems - Exiting." );
       
    94 	}
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 //CIRBrowseCatagoryItems::SetTextL()
       
    99 //sets the cache status informa
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 EXPORT_C void CIRBrowseCatagoryItems::SetTextL(const TDesC& aCatName,
       
   103 											   const TDesC& aCatId)
       
   104 	{
       
   105 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetTextL - Entering" );
       
   106 	iCatName = aCatName.Alloc();
       
   107 	iCatId=aCatId.Alloc();	
       
   108 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetTextL - Exiting." );
       
   109 	}
       
   110 
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 //CIRBrowseCatagoryItems::SetSize()
       
   114 //sets the size of the object iSize,after converting it from a TDesC
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 EXPORT_C  void CIRBrowseCatagoryItems::SetSize(const TDesC &aCatSize)
       
   118 	{
       
   119 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetSize - Entering" );
       
   120 	TLex var(aCatSize);
       
   121 	var.Val(iSize);
       
   122 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetSize - Exiting." );
       
   123 	}
       
   124 
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 //CIRBrowseCatagoryItems::SetGetOperation()
       
   128 //sets params for retriving data
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 EXPORT_C void CIRBrowseCatagoryItems::SetGetOperation(const TDesC& aCatGetOperation)
       
   132 	{
       
   133 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetGetOperation - Entering" );
       
   134 	iCatGetOperation = aCatGetOperation.Alloc();
       
   135 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetGetOperation - Exiting." );
       
   136 	}
       
   137 
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 //CIRBrowseCatagoryItems::ExternalizeL()
       
   141 //externalizes the data
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 EXPORT_C void CIRBrowseCatagoryItems::ExternalizeL(RWriteStream& aStream) const
       
   145 	{
       
   146 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::ExternalizeL - Entering" );
       
   147 	if( !iCatGetOperation )
       
   148 		{
       
   149 		aStream.WriteInt32L(0);
       
   150 		}
       
   151 	else
       
   152 		{
       
   153 		aStream.WriteInt32L(iCatGetOperation->Des().MaxLength());
       
   154 		aStream << *iCatGetOperation;
       
   155 		}
       
   156 	if(!iCatName)
       
   157 		{
       
   158 		aStream.WriteInt32L(0);
       
   159 		}
       
   160 	else
       
   161 		{
       
   162 	aStream.WriteInt32L(iCatName->Des().MaxLength());
       
   163 	aStream << *iCatName;
       
   164 		}
       
   165 	if(!iCatId)
       
   166 		{
       
   167 		aStream.WriteInt32L(0);			
       
   168 		}
       
   169 	else
       
   170 		{
       
   171 	aStream.WriteInt32L(iCatId->Des().MaxLength());
       
   172 	aStream << *iCatId;
       
   173 		}
       
   174 	if(iSize>0)
       
   175 		{
       
   176 		aStream.WriteInt32L(iSize);
       
   177 		}
       
   178 	else
       
   179 		{
       
   180 		aStream.WriteInt32L(0);			
       
   181 		}
       
   182 	
       
   183 	
       
   184 	if(!iCatBannerUrl)
       
   185 		{
       
   186 		aStream.WriteInt32L(0);			
       
   187 		}
       
   188 	else
       
   189 		{
       
   190 		aStream.WriteInt32L(iCatBannerUrl->Des().MaxLength());
       
   191 		aStream << *iCatBannerUrl;
       
   192 		}
       
   193 	
       
   194 	if(!iCatClickThroughUrl)
       
   195 		{
       
   196 		aStream.WriteInt32L(0);	
       
   197 		}
       
   198 	else
       
   199 		{
       
   200 		aStream.WriteInt32L(iCatClickThroughUrl->Des().MaxLength());
       
   201 		aStream << *iCatClickThroughUrl;
       
   202 		}
       
   203 	
       
   204 		
       
   205 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::ExternalizeL - Exiting." );	
       
   206 	}  
       
   207 
       
   208 
       
   209 // ---------------------------------------------------------------------------
       
   210 //CIRBrowseCatagoryItems::InternalizeL()
       
   211 //internalizes the data.
       
   212 // ---------------------------------------------------------------------------
       
   213 //
       
   214 EXPORT_C void CIRBrowseCatagoryItems::InternalizeL(RReadStream& aStream)
       
   215 	{
       
   216 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::InternalizeL - Entering" );
       
   217 	TInt maxlen;
       
   218 	maxlen=aStream.ReadInt32L();
       
   219 	if(maxlen!=0)
       
   220 		{
       
   221 		iCatGetOperation=HBufC::NewL(aStream,maxlen);
       
   222 		}
       
   223 	maxlen     = aStream.ReadInt32L();
       
   224 	if(maxlen!=0)
       
   225 		{
       
   226 		iCatName = HBufC::NewL(aStream,maxlen);			
       
   227 		}
       
   228 	maxlen     = aStream.ReadInt32L();
       
   229 	if(maxlen!=0)
       
   230 		{
       
   231 		iCatId = HBufC::NewL(aStream,maxlen);	
       
   232 		}
       
   233 	iSize  = aStream.ReadInt32L();
       
   234 	
       
   235 	maxlen = aStream.ReadInt32L();
       
   236 	if(maxlen!=0)
       
   237 		{
       
   238 		iCatBannerUrl = HBufC::NewL(aStream, maxlen);
       
   239 		}
       
   240 	
       
   241 	maxlen = aStream.ReadInt32L();
       
   242 	if(maxlen!=0)
       
   243 		{
       
   244 		iCatClickThroughUrl = HBufC::NewL(aStream, maxlen);	
       
   245 		}
       
   246 	
       
   247 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::InternalizeL - Exiting." );
       
   248 	}  
       
   249 	
       
   250 
       
   251 
       
   252 EXPORT_C void CIRBrowseCatagoryItems::SetBannerUrl(const TDesC& aBannerUrl)
       
   253 	{
       
   254 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetBannerUrl() - Entering" );
       
   255 	iCatBannerUrl = aBannerUrl.Alloc();
       
   256 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetBannerUrl - Exiting" );
       
   257 	}
       
   258 	
       
   259 	
       
   260 EXPORT_C void CIRBrowseCatagoryItems::SetClickThroughUrl(const TDesC& aClickThroughUrl)
       
   261 	{
       
   262 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetClickThroughUrl() - Entering" );
       
   263 	iCatClickThroughUrl = aClickThroughUrl.Alloc();
       
   264 	IRLOG_DEBUG( "CIRBrowseCatagoryItems::SetClickThroughUrl() - Exiting" );
       
   265 	}