phonebookui/Phonebook/Engine/inc/PbkContactNameFormattingUtil.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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 *      Phonebook contact name formatting utility class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __PbkContactNameFormattingUtil_H__
       
    21 #define __PbkContactNameFormattingUtil_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include "PbkFields.hrh"
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MPbkFieldDataArray;
       
    30 class RContactViewSortOrder;
       
    31 
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  * Phonebook contact name formatting utility class.
       
    37  */
       
    38 NONSHARABLE_CLASS(PbkContactNameFormattingUtil)
       
    39     {
       
    40     public: // static helper functions
       
    41         /**
       
    42          * Returns text of first field matching a field id.
       
    43          *
       
    44          * @param aContactData  field data array to search from.
       
    45          * @param aFieldId      field id to search for.
       
    46          * @return  matching field's text or empty string if
       
    47          *          field is not found or it does not contain any text.
       
    48          */     
       
    49         static TPtrC FieldText
       
    50             (const MPbkFieldDataArray& aContactData, TPbkFieldId aFieldId);
       
    51 
       
    52         /**
       
    53          * Returns true if first character of aText is space.
       
    54          * @precond aText.Length() > 0
       
    55          */
       
    56         static TBool FirstCharIsSpace(const TDesC& aText);
       
    57 
       
    58         /**
       
    59          * Returns true if last character of aText is space.
       
    60          * @precond aText.Length() > 0
       
    61          */
       
    62         static TBool LastCharIsSpace(const TDesC& aText);
       
    63 
       
    64         /**
       
    65          * Gets the phonebook field id corresponding to aIndex
       
    66          * in the sort order array.
       
    67          */
       
    68         static TPbkFieldId GetPbkFieldIdAt
       
    69             (const RContactViewSortOrder& aSortOrder, TInt aIndex);
       
    70 
       
    71     };
       
    72 
       
    73 #endif // __PbkContactNameFormattingUtil_H__
       
    74 
       
    75 // End of File