phonebookengines_old/contactsmodel/tsrc/cfindtext.h
branchGCC_SURGE
changeset 41 d11de32a5e6f
parent 40 b46a585f6909
equal deleted inserted replaced
38:11319788d38f 41:d11de32a5e6f
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // CFindText Test module
       
    15 // 
       
    16 //
       
    17 
       
    18 
       
    19 #ifndef CFindText_H
       
    20 #define CFindText_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <bamdesca.h>
       
    24 
       
    25 /**
       
    26  * Small helper class for using CContactFindView. Takes in
       
    27  * a string in constructor and breaks the string into words.
       
    28  * Implements MDesCArray interface which provides access to the words
       
    29  * found in the string.
       
    30  */
       
    31 class CFindText : public CBase, public MDesCArray
       
    32     {
       
    33     public:  // Constructors and destructor
       
    34         static CFindText* NewLC(const TDesC& aText);
       
    35         ~CFindText();
       
    36         
       
    37     public:  // New functions
       
    38         const TDesC& Text() const;
       
    39 
       
    40     public:  // from MDesCArray
       
    41         TInt MdcaCount() const;
       
    42         TPtrC16 MdcaPoint(TInt aIndex) const;
       
    43 
       
    44     private:  // Implementation
       
    45         CFindText();
       
    46         void ConstructL(const TDesC& aText);
       
    47 
       
    48     private:
       
    49         HBufC* iText;
       
    50         RArray<TPtrC> iWords;
       
    51     };
       
    52 
       
    53 inline CFindText::CFindText()
       
    54     {
       
    55     }
       
    56 
       
    57 inline const TDesC& CFindText::Text() const
       
    58     {
       
    59     if (iText)
       
    60         return(*iText);
       
    61     else
       
    62         return KNullDesC;
       
    63     }
       
    64 
       
    65 #endif
       
    66