ncdengine/engine/src/catalogsbigdes.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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "catalogsconstants.h"
       
    20 #include "catalogsbigdes.h"
       
    21 
       
    22 CCatalogsBigDes* CCatalogsBigDes::NewL()
       
    23     {
       
    24     CCatalogsBigDes* s = NewLC();
       
    25     CleanupStack::Pop();
       
    26     return s;
       
    27     }
       
    28 
       
    29 CCatalogsBigDes* CCatalogsBigDes::NewLC()
       
    30     {
       
    31     CCatalogsBigDes* self = new(ELeave) CCatalogsBigDes();
       
    32     CleanupStack::PushL( self );
       
    33     self->ConstructL();
       
    34     return self;
       
    35     }
       
    36 
       
    37 void CCatalogsBigDes::ConstructL()
       
    38     {
       
    39     iArray = new(ELeave) CDesCArrayFlat( KListGranularity );
       
    40     }
       
    41 
       
    42 CCatalogsBigDes::CCatalogsBigDes()
       
    43     {
       
    44     }
       
    45 
       
    46 CCatalogsBigDes::~CCatalogsBigDes()
       
    47     {
       
    48     delete iArray;
       
    49     }
       
    50 
       
    51 
       
    52 void CCatalogsBigDes::AppendL( const TDesC& aDes )
       
    53     {
       
    54     iArray->AppendL( aDes );
       
    55     }
       
    56 
       
    57 // CCatalogsBigDes& CCatalogsBigDes::operator+=( const TDesC& aDes )
       
    58 // {
       
    59 //     AppendL( aDes );
       
    60 //     return *this;
       
    61 // }
       
    62 
       
    63 HBufC* CCatalogsBigDes::DesLC() const
       
    64     {
       
    65     TInt length = 0;
       
    66     TInt i;
       
    67     TInt count = iArray->Count();
       
    68     for ( i = 0; i < count; i++ )
       
    69         {
       
    70         length += ( *iArray )[i].Length();
       
    71         }
       
    72     HBufC* buf = HBufC::NewLC( length );
       
    73     for ( i = 0; i < count; i++ )
       
    74         {
       
    75         buf->Des().Append( ( *iArray )[i] );
       
    76         }
       
    77     return buf;
       
    78     }
       
    79 
       
    80 HBufC* CCatalogsBigDes::DesL() const
       
    81     {
       
    82     HBufC* b = DesLC();
       
    83     CleanupStack::Pop();
       
    84     return b;
       
    85     }
       
    86