wvuing/ImUtils/Inc/CAArrayUtils.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     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:  Helper class for arrays
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CAARRAYUTILS_H
       
    21 #define CAARRAYUTILS_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <badesca.h>
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 /**
       
    30  *  This class gives some helper functions
       
    31  *
       
    32  *  @lib chat.app
       
    33  *  @since 1.2s
       
    34  */
       
    35 // This is not a C-class although it begins with a CA
       
    36 class CAArrayUtils // CSI: 51 #see above
       
    37     {
       
    38     public: // New functions
       
    39 
       
    40         /**
       
    41          * This method compares two arrays and if there are same data selection
       
    42          * array contains indexes that are same
       
    43          * @since
       
    44          * @param aSource1 Array that contains values that are compared to
       
    45          * aSource2
       
    46          * @param aSource2 Array that contains values that are compared to
       
    47          * aSource1
       
    48          * @return Integer array that contains indexes of selected items
       
    49          */
       
    50         IMPORT_C static CArrayFixFlat<TInt>* SetSelectionsLC( const CDesCArray& aSource1,
       
    51                                                               const CDesCArray& aSource2 );
       
    52 
       
    53         /**
       
    54         * Creates the CDesCArray from the source.
       
    55         * Ownership is transferred to caller!
       
    56         * @since
       
    57         * @param aSource Array to be copied
       
    58         * @return Array containing the same elements as source array
       
    59         */
       
    60         IMPORT_C static CDesCArray* CloneArrayLC( const MDesCArray& aSource );
       
    61 
       
    62         /**
       
    63         * Creates the CDesCArray containing the items from arrayDiff that
       
    64         * are not on arrayTest
       
    65         * Ownership is transferred to caller!
       
    66         * @since
       
    67         * @param aArrayDiff Array whose differences are copied
       
    68         * @param aArrayTest Array to be tested on
       
    69         * @return Array containing the differences
       
    70         */
       
    71         IMPORT_C static CDesCArray* CreateDiffLC( const CDesCArray& aArrayDiff,
       
    72                                                   const CDesCArray& aArrayTest );
       
    73         /**
       
    74         * Appends aSource array to aDest
       
    75         * @since
       
    76         * @param aSource Source array
       
    77         * @param aDest Destination array
       
    78         */
       
    79         IMPORT_C static void AppendArrayL( const CDesCArray& aSource, CDesCArray& aDest );
       
    80 
       
    81         /**
       
    82          * Appends aPtr to aDest array, if aPtr not found from aDest array
       
    83          * @since
       
    84          * @param aDest Destination array
       
    85          * @param aPtr  to be added text
       
    86          * @return ETrue if aPtr was appended ( not found ), else EFalse
       
    87          */
       
    88         IMPORT_C static TBool AppendIfNotFoundL( CDesCArray& aDest, const TDesC& aPtr );
       
    89 
       
    90         /**
       
    91          * Removes aPtr from aDest array, if aPtr found from aDest array
       
    92          * @since
       
    93          * @param aDest Destination array
       
    94          * @param aPtr  to be removed text
       
    95          * @return ETrue if aPtr was removed ( found ), else EFalse
       
    96          */
       
    97         IMPORT_C static TBool DeleteIfFound( CDesCArray& aDest, const TDesC& aPtr );
       
    98 
       
    99 
       
   100     };
       
   101 
       
   102 #endif      // CAARRAYUTILS_H
       
   103 
       
   104 // End of File