|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "TETextServer.h" |
|
19 #include "T_FIELD1.h" |
|
20 #include "T_ROMAN.h" |
|
21 #include "T_STREAM.h" |
|
22 #include "T_RICHOOM.h" |
|
23 #include "TRTCOPY.h" |
|
24 #include "TRTCUSTM.h" |
|
25 #include "TTIMES1.h" |
|
26 #include "T_CONVRT.h" |
|
27 #include "T_CONVS.h" |
|
28 #include "T_CONVS1.h" |
|
29 #include "T_CPLAIN.h" |
|
30 #include "T_CUTPST.h" |
|
31 #include "T_FMT.h" |
|
32 #include "T_FMT1.h" |
|
33 #include "T_IMPORT.h" |
|
34 #include "T_INDTER.h" |
|
35 #include "T_LAYDOC.h" |
|
36 #include "T_PARSE_for_TEF.h" |
|
37 #include "T_PICRES.h" |
|
38 #include "T_RICH1A.h" |
|
39 #include "T_RTCLIP.h" |
|
40 #include "T_SCANDC.h" |
|
41 #include "T_STYLE.h" |
|
42 #include "T_TIMES.h" |
|
43 #include "T_TRAN.h" |
|
44 #include "TEtextDefect.h" |
|
45 |
|
46 _LIT(KServerName, "TETextServer"); |
|
47 |
|
48 CTETextServer *CTETextServer::NewL() |
|
49 /** |
|
50 @return - Instance of the test server |
|
51 Same code for Secure and non-secure variants |
|
52 Called inside the MainL() function to create and start the |
|
53 CTestServer derived server. |
|
54 */ |
|
55 { |
|
56 CTETextServer * server = new (ELeave) CTETextServer(); |
|
57 CleanupStack::PushL(server); |
|
58 // CServer base class call |
|
59 server->StartL(KServerName); |
|
60 CleanupStack::Pop(server); |
|
61 return server; |
|
62 } |
|
63 |
|
64 |
|
65 LOCAL_C void MainL() |
|
66 // |
|
67 // Secure variant |
|
68 // Much simpler, uses the new Rendezvous() call to sync with the client |
|
69 // |
|
70 { |
|
71 #if (defined __DATA_CAGING__) |
|
72 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
73 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
74 #endif |
|
75 CActiveScheduler* sched=NULL; |
|
76 sched=new(ELeave) CActiveScheduler; |
|
77 CActiveScheduler::Install(sched); |
|
78 CTETextServer *server = NULL; |
|
79 // Create the CTestServer derived server |
|
80 TRAPD(err,server = CTETextServer::NewL()); |
|
81 if(!err) |
|
82 { |
|
83 // Sync with the client and enter the active scheduler |
|
84 RProcess::Rendezvous(KErrNone); |
|
85 sched->Start(); |
|
86 } |
|
87 delete server; |
|
88 delete sched; |
|
89 } |
|
90 |
|
91 /** @return - Standard Epoc error code on process exit |
|
92 Secure variant only |
|
93 Process entry point. Called by client using RProcess API |
|
94 */ |
|
95 GLDEF_C TInt E32Main() |
|
96 { |
|
97 __UHEAP_MARK; |
|
98 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
99 if(cleanup == NULL) |
|
100 { |
|
101 return KErrNoMemory; |
|
102 } |
|
103 TRAPD(err,MainL()); |
|
104 // This if statement is here just to shut up RVCT, which would otherwise warn |
|
105 // that err was set but never used |
|
106 if (err) |
|
107 { |
|
108 err = KErrNone; |
|
109 } |
|
110 delete cleanup; |
|
111 __UHEAP_MARKEND; |
|
112 return KErrNone; |
|
113 } |
|
114 |
|
115 CTestStep *CTETextServer::CreateTestStep(const TDesC& aStepName) |
|
116 /** |
|
117 @return - A CTestStep derived instance |
|
118 Secure and non-secure variants |
|
119 Implementation of CTestServer pure virtual |
|
120 */ |
|
121 { |
|
122 if (aStepName == KTestStep_T_FIELD1) |
|
123 return new CT_FIELD1(); |
|
124 else if (aStepName == KTestStep_T_ROMAN) |
|
125 return new CT_ROMAN(); |
|
126 else if (aStepName == KTestStep_T_STREAM) |
|
127 return new CT_STREAM(); |
|
128 else if (aStepName == KTestStep_T_RICHOOM) |
|
129 return new CT_RICHOOM(); |
|
130 else if (aStepName == KTestStep_T_TRTCOPY) |
|
131 return new CT_TRTCOPY(); |
|
132 else if (aStepName == KTestStep_T_TRTCUSTM) |
|
133 return new CT_TRTCUSTM(); |
|
134 else if (aStepName == KTestStep_T_TTIMES1) |
|
135 return new CT_TTIMES1(); |
|
136 else if (aStepName == KTestStep_T_CONVRT) |
|
137 return new CT_CONVRT(); |
|
138 else if (aStepName == KTestStep_T_CONVS) |
|
139 return new CT_CONVS(); |
|
140 else if (aStepName == KTestStep_T_CONVS1) |
|
141 return new CT_CONVS1(); |
|
142 else if (aStepName == KTestStep_T_CPLAIN) |
|
143 return new CT_CPLAIN(); |
|
144 else if (aStepName == KTestStep_T_CUTPST) |
|
145 return new CT_CUTPST(); |
|
146 else if (aStepName == KTestStep_T_FMT) |
|
147 return new CT_FMT(); |
|
148 else if (aStepName == KTestStep_T_FMT1) |
|
149 return new CT_FMT1(); |
|
150 else if (aStepName == KTestStep_T_IMPORT) |
|
151 return new CT_IMPORT(); |
|
152 else if (aStepName == KTestStep_T_INDTER) |
|
153 return new CT_INDTER(); |
|
154 else if (aStepName == KTestStep_T_LAYDOC) |
|
155 return new CT_LAYDOC(); |
|
156 else if (aStepName == KTestStep_T_PARSE) |
|
157 return new CT_PARSE(); |
|
158 else if (aStepName == KTestStep_T_PICRES) |
|
159 return new CT_PICRES(); |
|
160 else if (aStepName == KTestStep_T_RICH1A) |
|
161 return new CT_RICH1A(); |
|
162 else if (aStepName == KTestStep_T_RTCLIP) |
|
163 return new CT_RTCLIP(); |
|
164 else if (aStepName == KTestStep_T_SCANDC) |
|
165 return new CT_SCANDC(); |
|
166 else if (aStepName == KTestStep_T_STYLE) |
|
167 return new CT_STYLE(); |
|
168 else if (aStepName == KTestStep_T_TIMES) |
|
169 return new CT_TIMES(); |
|
170 else if (aStepName == KTestStep_T_TRAN) |
|
171 return new CT_TRAN(); |
|
172 else if (aStepName == KTestStep_TEtextDefect) |
|
173 return new CTEtextDefect(); |
|
174 return NULL; |
|
175 } |