messagingappbase/msgavkon/muiu_domain/msgarrays/src/msgarrays.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 09:37:26 +0300
branchRCL_3
changeset 20 94cccd85bd25
parent 0 72b543305e3a
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: msgarrays implementation
*
*/



// INCLUDE FILES
#include "MsgArrays.h"


// CONSTANTS
const TInt KGranularity = 4;


// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// TUidNameInfo::TUidNameInfo
// -----------------------------------------------------------------------------
//	
EXPORT_C TUidNameInfo::TUidNameInfo( TUid aUid, const TDesC& aName )
:iUid( aUid ), 
iName( aName )
    {
    }


// -----------------------------------------------------------------------------
// TUidNameKey::TUidNameKey
// -----------------------------------------------------------------------------
//
EXPORT_C TUidNameKey::TUidNameKey( TKeyCmpText aType ) : TKeyArrayFix( KGranularity, aType, 0 ) 
    {
    }


// -----------------------------------------------------------------------------
// TUidNameKey::Compare
// -----------------------------------------------------------------------------
//
TInt TUidNameKey::Compare( TInt aLeft, TInt aRight ) const
    {
    TDesC* left=( ( TDesC* )At( aLeft ) );
    TDesC* right=( ( TDesC* )At( aRight ) );
    switch ( iCmpType )
        {
        case ECmpFolded:
            return( left->CompareF( *right ) );
        case ECmpCollated:
            return( left->CompareC( *right ) );
        default:
            return( left->Compare( *right ) );
        }
    }


// -----------------------------------------------------------------------------
// CUidNameArray::CUidNameArray
// -----------------------------------------------------------------------------
//
EXPORT_C CUidNameArray::CUidNameArray( TInt aGranularity )
:CArrayFixFlat<TUidNameInfo>( aGranularity ) 
    {
    }


// -----------------------------------------------------------------------------
// CUidNameArray::~CUidNameArray
// -----------------------------------------------------------------------------
//	
EXPORT_C CUidNameArray::~CUidNameArray()
    {
    }

// -----------------------------------------------------------------------------
// CUidNameArray::MdcaCount
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CUidNameArray::MdcaCount() const
    {
    return Count();
    }

// -----------------------------------------------------------------------------
// CUidNameArray::MdcaPoint
// -----------------------------------------------------------------------------
//
EXPORT_C TPtrC CUidNameArray::MdcaPoint( TInt aIndex ) const 
    { 
    return At( aIndex ).iName;
    }

// -----------------------------------------------------------------------------
// CUidNameArray::Sort
// -----------------------------------------------------------------------------
//
EXPORT_C void CUidNameArray::Sort( TKeyCmpText aTextComparisonType )
    {
    TUidNameKey key( aTextComparisonType );
    CArrayFixBase::Sort( key );
    }


// End of File