uigraphics/AknIcon/srvsrc/AknIconFileNameItem.cpp
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002 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 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include <e32std.h>
       
    23 
       
    24 #include "AknIconFileNameItem.h"
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // ================= MEMBER FUNCTIONS ==========================================
       
    29 
       
    30 CAknIconFileNameItem::CAknIconFileNameItem()
       
    31     {
       
    32     }
       
    33 
       
    34 CAknIconFileNameItem::CAknIconFileNameItem( const TDesC& aFileName )
       
    35     {
       
    36     // This constructor is used when the object is instantiated in stack,
       
    37     // so CBase's zero initialization is not done.
       
    38     Mem::FillZ( this, sizeof( CAknIconFileNameItem ) );
       
    39     iFileNameRef = &aFileName;    
       
    40     }
       
    41 
       
    42 CAknIconFileNameItem::~CAknIconFileNameItem()
       
    43     {
       
    44     delete iFileName;
       
    45     }
       
    46 
       
    47 CAknIconFileNameItem* CAknIconFileNameItem::NewL( const TDesC& aFileName )
       
    48     {
       
    49     CAknIconFileNameItem* item = new( ELeave ) CAknIconFileNameItem;
       
    50     CleanupStack::PushL( item );
       
    51     item->ConstructL( aFileName );
       
    52     CleanupStack::Pop();
       
    53     return item;
       
    54     }
       
    55 
       
    56 void CAknIconFileNameItem::ConstructL( const TDesC& aFileName )
       
    57     {
       
    58     iFileName = aFileName.AllocL();
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CAknIconFileNameItem::LinearOrder
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 TInt CAknIconFileNameItem::LinearOrder(
       
    66     const CAknIconFileNameItem& aFirst,
       
    67     const CAknIconFileNameItem& aSecond )
       
    68     {
       
    69     const TDesC* firstFileName = aFirst.iFileNameRef ?
       
    70         aFirst.iFileNameRef : aFirst.iFileName;
       
    71 
       
    72     const TDesC* secondFileName = aSecond.iFileNameRef ?
       
    73         aSecond.iFileNameRef : aSecond.iFileName;
       
    74 
       
    75     return firstFileName->CompareF( *secondFileName );
       
    76     }
       
    77 
       
    78 //  End of File