equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
62 void CStateMachine::AddStateTransistionL(TChar aChar, TInt aState, TInt aNextState) |
62 void CStateMachine::AddStateTransistionL(TChar aChar, TInt aState, TInt aNextState) |
63 { |
63 { |
64 RArray<TInt> Dummy; |
64 RArray<TInt> Dummy; |
65 TInt CharIndex = MapIndex(aChar, Dummy); |
65 TInt CharIndex = MapIndex(aChar, Dummy); |
66 Dummy.Close(); |
66 Dummy.Close(); |
67 _LIT(KBufParsingError,"Parsing syntax error"); |
67 |
68 __ASSERT_ALWAYS( CharIndex >= 0 , User::Panic(KBufParsingError, KErrSyntaxError) ); |
|
69 AddStateTransistionL(CharIndex, aState, aNextState); |
68 AddStateTransistionL(CharIndex, aState, aNextState); |
70 } |
69 } |
71 |
70 |
72 void CStateMachine::AddStateTransistionL(TInt aIndex, TInt aState, TInt aNextState) |
71 void CStateMachine::AddStateTransistionL(TInt aIndex, TInt aState, TInt aNextState) |
73 { |
72 { |
74 if(aIndex > iMaxNumberChars || aState > iMaxNumberStates || aNextState > iMaxNumberStates) |
73 if(aIndex < 0 || aIndex > iMaxNumberChars || aState > iMaxNumberStates || aNextState > iMaxNumberStates) |
75 User::Leave(KErrGeneral); |
74 User::Leave(KErrGeneral); |
76 |
75 |
77 iStateTable[static_cast<TInt>(aIndex)][static_cast<TInt>(aState)] = static_cast<TInt>(aNextState); |
76 iStateTable[static_cast<TInt>(aIndex)][static_cast<TInt>(aState)] = static_cast<TInt>(aNextState); |
78 } |
77 } |
79 |
78 |