|
1 /* |
|
2 * Copyright (c) 2002 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 the License "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: |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_REGULAR_EXPRESSION_H |
|
22 #define C_REGULAR_EXPRESSION_H |
|
23 |
|
24 #include "StateMachine.h" |
|
25 |
|
26 NONSHARABLE_CLASS(CRegularExpression) : public CBase |
|
27 { |
|
28 public: |
|
29 static CRegularExpression* NewL(RPointerArray<TDesC>* aPatterns); |
|
30 static CRegularExpression* NewLC(RPointerArray<TDesC>* aPatterns); |
|
31 virtual ~CRegularExpression(); |
|
32 |
|
33 TInt Search(const TDesC& aString); |
|
34 TInt SearchFrom(TInt aIndex, const TDesC& aString); |
|
35 |
|
36 /** |
|
37 * This routine writes into a client supplied descriptor a string that is a wildcarded version of |
|
38 * one of the pattern matches in the engine. The pattern(statemachine) at index aPattenIndex is used. |
|
39 * |
|
40 * It writes characters into the supplied descriptor to a length of the maximum number of |
|
41 * characters to match. |
|
42 * |
|
43 * For each character index, if there is only one possible valid character, it puts in that |
|
44 * character. If there are more than one, then the supplied aWildcard is written in. |
|
45 * |
|
46 * @param aPattenIndex The index of the pattern in the engine to use. |
|
47 * for the N patterns supplied at construction. |
|
48 * @param aWildcardChar The character to put in the example pattern if there is no single |
|
49 * valid character at that point |
|
50 * @param aWildcardedPattern Descriptor to write the wildcarded matching pattern into |
|
51 */ |
|
52 void GetWildcardVersionOfPattern( TInt aPatternIndex, TText aWildcard, TDes& aWildcardedPattern) const; |
|
53 |
|
54 protected: |
|
55 CRegularExpression(); |
|
56 |
|
57 void ConstructL(RPointerArray<TDesC>* aPatterns); |
|
58 virtual void GenerateStateTablesL(RPointerArray<TDesC>* aPatterns); |
|
59 |
|
60 RPointerArray<CStateMachine> iStateMachines; |
|
61 }; |
|
62 |
|
63 #endif // C_REGULAR_EXPRESSION_H |
|
64 |
|
65 // End of File |