|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // $Header$ |
|
15 // GT0149 Applications Protocol Integration Test Harness |
|
16 // blank application |
|
17 // This module implements the CCmdFamily class: a generic collection of |
|
18 // registered CCmdBase class derived commands. |
|
19 // Include Files |
|
20 // |
|
21 // |
|
22 |
|
23 #ifndef __CMDFAMILY_H__ |
|
24 #define __CMDFAMILY_H__ |
|
25 |
|
26 //---------------------------------------------------------------------------- |
|
27 // Forward declarations |
|
28 |
|
29 class CTEngine; |
|
30 class CCmdBase; |
|
31 |
|
32 //---------------------------------------------------------------------------- |
|
33 // Definitions |
|
34 |
|
35 class CCmdFamily : public CBase |
|
36 { |
|
37 |
|
38 public: // Data types |
|
39 |
|
40 // Switches. Please, see the iSwitch. |
|
41 enum TSwitch |
|
42 { |
|
43 EParseOnly, // Parse only |
|
44 ESwitch2, // For future use |
|
45 ESwitch3, |
|
46 ESwitch4, |
|
47 ESwitch5, |
|
48 ESwitch6, |
|
49 ESwitch7, |
|
50 ESwitch8, |
|
51 EMaxSwitches |
|
52 }; |
|
53 |
|
54 public: // Constructors and destructors |
|
55 |
|
56 // Constructors. |
|
57 static CCmdFamily* NewL ( ); |
|
58 static CCmdFamily* NewLC( ); |
|
59 |
|
60 // Destructor. |
|
61 ~CCmdFamily(); |
|
62 |
|
63 private: |
|
64 |
|
65 // Local Constructor. |
|
66 void ConstructL( ); |
|
67 |
|
68 protected: |
|
69 |
|
70 // No default constructor. |
|
71 CCmdFamily( ) {}; |
|
72 |
|
73 public: // New functions |
|
74 |
|
75 // Set and Get Test Machine context. |
|
76 void SetMachine(CTEngine *aTestMachine ); |
|
77 CTEngine * Machine( ); |
|
78 |
|
79 // Register a Command. |
|
80 void RegisterL ( CCmdBase* aCommand ); |
|
81 |
|
82 // Get Count of Commands. |
|
83 TInt Count( ) const; |
|
84 |
|
85 // Get i'th Command. Warning: legal index is a must. |
|
86 CCmdBase* At( TInt aIndex ) const; |
|
87 CCmdBase* operator[]( TInt aIndex ) const; |
|
88 |
|
89 // Get Command by command id (NULL if was not found). |
|
90 CCmdBase* Command(TInt aCommandId); |
|
91 |
|
92 // Get Command by command string (NULL if not found). |
|
93 CCmdBase* Recognize(const TDesC& aCommand); |
|
94 |
|
95 // Set a Get a switch. |
|
96 TBool Switch(const TSwitch &); |
|
97 void SetSwitch(const TSwitch &aSwitch, TBool aBoolean = ETrue); |
|
98 |
|
99 // Set and Get the StepOver flag. |
|
100 void SetStepOver(const TBool &aBoolean = ETrue); |
|
101 TBool StepOver( ); |
|
102 |
|
103 // List all the commands out |
|
104 void ListAll(CConsoleBase *); |
|
105 |
|
106 private: // Data |
|
107 |
|
108 // Tester Context. |
|
109 CTEngine *iMachine; |
|
110 |
|
111 // Registered Commands. |
|
112 CArrayPtrSeg<CCmdBase>* iCommands; |
|
113 |
|
114 // Switches. Must be long enough for all TSwitch values. |
|
115 TBool iSwitch[EMaxSwitches]; |
|
116 |
|
117 // Step over us. |
|
118 TBool iStepOver; |
|
119 |
|
120 }; |
|
121 |
|
122 //---------------------------------------------------------------------------- |
|
123 |
|
124 #endif // __CMDFAMILY_H__ |
|
125 |
|
126 //---------------------------------------------------------------------------- |
|
127 // End of File |
|
128 //---------------------------------------------------------------------------- |