63
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Utility class that splits a string into words
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __C_WORDS_H__
|
|
19 |
#define __C_WORDS_H__
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <bamdesca.h>
|
|
23 |
|
|
24 |
/**
|
|
25 |
* Utility class that splits a string into words
|
|
26 |
*/
|
|
27 |
NONSHARABLE_CLASS(CWords) :
|
|
28 |
public CBase,
|
|
29 |
public MDesCArray
|
|
30 |
{
|
|
31 |
public: // Constructors and destructor
|
|
32 |
/**
|
|
33 |
* Creates a new instance of this class.
|
|
34 |
* @param aText the text to separate
|
|
35 |
*/
|
|
36 |
IMPORT_C static CWords* NewLC(const TDesC& aText);
|
|
37 |
/**
|
|
38 |
* Destructor.
|
|
39 |
*/
|
|
40 |
IMPORT_C ~CWords();
|
|
41 |
|
|
42 |
public: // from MDesCArray
|
|
43 |
IMPORT_C TInt MdcaCount() const;
|
|
44 |
IMPORT_C TPtrC16 MdcaPoint(TInt aIndex) const;
|
|
45 |
|
|
46 |
private: // Implementation
|
|
47 |
CWords();
|
|
48 |
void ConstructL(const TDesC& aText);
|
|
49 |
static TBool DefaultIsWordSeparator(TChar aChar);
|
|
50 |
|
|
51 |
private:
|
|
52 |
|
|
53 |
/// Own: array of words
|
|
54 |
RArray<TPtrC> iWords;
|
|
55 |
};
|
|
56 |
|
|
57 |
#endif // C_WORDS_H
|
|
58 |
|
|
59 |
|