phonebookengines_old/contactsmodel/tsrc/cfindtext.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:29:23 +0300
changeset 40 b46a585f6909
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

// Copyright (c) 2003-2009 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:
// CFindText Test module
// 
//


#ifndef CFindText_H
#define CFindText_H

#include <e32base.h>
#include <bamdesca.h>

/**
 * Small helper class for using CContactFindView. Takes in
 * a string in constructor and breaks the string into words.
 * Implements MDesCArray interface which provides access to the words
 * found in the string.
 */
class CFindText : public CBase, public MDesCArray
    {
    public:  // Constructors and destructor
        static CFindText* NewLC(const TDesC& aText);
        ~CFindText();
        
    public:  // New functions
        const TDesC& Text() const;

    public:  // from MDesCArray
        TInt MdcaCount() const;
        TPtrC16 MdcaPoint(TInt aIndex) const;

    private:  // Implementation
        CFindText();
        void ConstructL(const TDesC& aText);

    private:
        HBufC* iText;
        RArray<TPtrC> iWords;
    };

inline CFindText::CFindText()
    {
    }

inline const TDesC& CFindText::Text() const
    {
    if (iText)
        return(*iText);
    else
        return KNullDesC;
    }

#endif