charconvfw/numbergrouping/Inc/RegularExpression.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 16:55:07 +0300
changeset 16 56cd22a7a1cb
parent 0 1fb32624e06b
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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: 
*    
*
*/



#ifndef C_REGULAR_EXPRESSION_H
#define C_REGULAR_EXPRESSION_H

#include "StateMachine.h"

NONSHARABLE_CLASS(CRegularExpression) : public CBase
{
public:
	static CRegularExpression* NewL(RPointerArray<TDesC>* aPatterns);
	static CRegularExpression* NewLC(RPointerArray<TDesC>* aPatterns);
	virtual ~CRegularExpression();

	TInt	Search(const TDesC& aString);
	TInt	SearchFrom(TInt aIndex, const TDesC& aString);

    /**
    * This routine writes into a client supplied descriptor a string that is a wildcarded version of
    * one of the pattern matches in the engine. The pattern(statemachine) at index aPattenIndex is used.
    *
    * It writes characters into the supplied descriptor to a length of the maximum number of 
    * characters to match. 
    *
    * For each character index, if there is only one possible valid character, it puts in that 
    * character.  If there are more than one, then the supplied aWildcard is written in.
    * 
    * @param    aPattenIndex        The index of the pattern in the engine to use.
    *                               for the N patterns supplied at construction.
    * @param    aWildcardChar       The character to put in the example pattern if there is no single 
    *                               valid character at that point
    * @param    aWildcardedPattern     Descriptor to write the wildcarded matching pattern into
    */
    void    GetWildcardVersionOfPattern( TInt aPatternIndex, TText aWildcard, TDes& aWildcardedPattern) const;

protected:
	CRegularExpression();
	
	void			ConstructL(RPointerArray<TDesC>* aPatterns);
	virtual void	GenerateStateTablesL(RPointerArray<TDesC>* aPatterns);
	
	RPointerArray<CStateMachine>	iStateMachines;
};

#endif // C_REGULAR_EXPRESSION_H

// End of File