phonebookengines/contactsmodel/tsrc/cfindtext.h
author Dario Sestito <darios@symbian.org>
Fri, 17 Sep 2010 15:40:13 +0100
branchRCL_3
changeset 69 3fd1376e5235
parent 0 e686773b3f54
child 24 0ba2181d7c28
permissions -rw-r--r--
DEADHEAD

// 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