1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/texthandling/ttext/TETextServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,175 @@
1.4 +/*
1.5 +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#include "TETextServer.h"
1.22 +#include "T_FIELD1.h"
1.23 +#include "T_ROMAN.h"
1.24 +#include "T_STREAM.h"
1.25 +#include "T_RICHOOM.h"
1.26 +#include "TRTCOPY.h"
1.27 +#include "TRTCUSTM.h"
1.28 +#include "TTIMES1.h"
1.29 +#include "T_CONVRT.h"
1.30 +#include "T_CONVS.h"
1.31 +#include "T_CONVS1.h"
1.32 +#include "T_CPLAIN.h"
1.33 +#include "T_CUTPST.h"
1.34 +#include "T_FMT.h"
1.35 +#include "T_FMT1.h"
1.36 +#include "T_IMPORT.h"
1.37 +#include "T_INDTER.h"
1.38 +#include "T_LAYDOC.h"
1.39 +#include "T_PARSE_for_TEF.h"
1.40 +#include "T_PICRES.h"
1.41 +#include "T_RICH1A.h"
1.42 +#include "T_RTCLIP.h"
1.43 +#include "T_SCANDC.h"
1.44 +#include "T_STYLE.h"
1.45 +#include "T_TIMES.h"
1.46 +#include "T_TRAN.h"
1.47 +#include "TEtextDefect.h"
1.48 +
1.49 +_LIT(KServerName, "TETextServer");
1.50 +
1.51 +CTETextServer *CTETextServer::NewL()
1.52 +/**
1.53 + @return - Instance of the test server
1.54 + Same code for Secure and non-secure variants
1.55 + Called inside the MainL() function to create and start the
1.56 + CTestServer derived server.
1.57 + */
1.58 + {
1.59 + CTETextServer * server = new (ELeave) CTETextServer();
1.60 + CleanupStack::PushL(server);
1.61 + // CServer base class call
1.62 + server->StartL(KServerName);
1.63 + CleanupStack::Pop(server);
1.64 + return server;
1.65 + }
1.66 +
1.67 +
1.68 +LOCAL_C void MainL()
1.69 +//
1.70 +// Secure variant
1.71 +// Much simpler, uses the new Rendezvous() call to sync with the client
1.72 +//
1.73 + {
1.74 +#if (defined __DATA_CAGING__)
1.75 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.76 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.77 +#endif
1.78 + CActiveScheduler* sched=NULL;
1.79 + sched=new(ELeave) CActiveScheduler;
1.80 + CActiveScheduler::Install(sched);
1.81 + CTETextServer *server = NULL;
1.82 + // Create the CTestServer derived server
1.83 + TRAPD(err,server = CTETextServer::NewL());
1.84 + if(!err)
1.85 + {
1.86 + // Sync with the client and enter the active scheduler
1.87 + RProcess::Rendezvous(KErrNone);
1.88 + sched->Start();
1.89 + }
1.90 + delete server;
1.91 + delete sched;
1.92 + }
1.93 +
1.94 +/** @return - Standard Epoc error code on process exit
1.95 + Secure variant only
1.96 + Process entry point. Called by client using RProcess API
1.97 +*/
1.98 +GLDEF_C TInt E32Main()
1.99 + {
1.100 + __UHEAP_MARK;
1.101 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.102 + if(cleanup == NULL)
1.103 + {
1.104 + return KErrNoMemory;
1.105 + }
1.106 + TRAPD(err,MainL());
1.107 + // This if statement is here just to shut up RVCT, which would otherwise warn
1.108 + // that err was set but never used
1.109 + if (err)
1.110 + {
1.111 + err = KErrNone;
1.112 + }
1.113 + delete cleanup;
1.114 + __UHEAP_MARKEND;
1.115 + return KErrNone;
1.116 + }
1.117 +
1.118 +CTestStep *CTETextServer::CreateTestStep(const TDesC& aStepName)
1.119 +/**
1.120 + @return - A CTestStep derived instance
1.121 + Secure and non-secure variants
1.122 + Implementation of CTestServer pure virtual
1.123 + */
1.124 + {
1.125 + if (aStepName == KTestStep_T_FIELD1)
1.126 + return new CT_FIELD1();
1.127 + else if (aStepName == KTestStep_T_ROMAN)
1.128 + return new CT_ROMAN();
1.129 + else if (aStepName == KTestStep_T_STREAM)
1.130 + return new CT_STREAM();
1.131 + else if (aStepName == KTestStep_T_RICHOOM)
1.132 + return new CT_RICHOOM();
1.133 + else if (aStepName == KTestStep_T_TRTCOPY)
1.134 + return new CT_TRTCOPY();
1.135 + else if (aStepName == KTestStep_T_TRTCUSTM)
1.136 + return new CT_TRTCUSTM();
1.137 + else if (aStepName == KTestStep_T_TTIMES1)
1.138 + return new CT_TTIMES1();
1.139 + else if (aStepName == KTestStep_T_CONVRT)
1.140 + return new CT_CONVRT();
1.141 + else if (aStepName == KTestStep_T_CONVS)
1.142 + return new CT_CONVS();
1.143 + else if (aStepName == KTestStep_T_CONVS1)
1.144 + return new CT_CONVS1();
1.145 + else if (aStepName == KTestStep_T_CPLAIN)
1.146 + return new CT_CPLAIN();
1.147 + else if (aStepName == KTestStep_T_CUTPST)
1.148 + return new CT_CUTPST();
1.149 + else if (aStepName == KTestStep_T_FMT)
1.150 + return new CT_FMT();
1.151 + else if (aStepName == KTestStep_T_FMT1)
1.152 + return new CT_FMT1();
1.153 + else if (aStepName == KTestStep_T_IMPORT)
1.154 + return new CT_IMPORT();
1.155 + else if (aStepName == KTestStep_T_INDTER)
1.156 + return new CT_INDTER();
1.157 + else if (aStepName == KTestStep_T_LAYDOC)
1.158 + return new CT_LAYDOC();
1.159 + else if (aStepName == KTestStep_T_PARSE)
1.160 + return new CT_PARSE();
1.161 + else if (aStepName == KTestStep_T_PICRES)
1.162 + return new CT_PICRES();
1.163 + else if (aStepName == KTestStep_T_RICH1A)
1.164 + return new CT_RICH1A();
1.165 + else if (aStepName == KTestStep_T_RTCLIP)
1.166 + return new CT_RTCLIP();
1.167 + else if (aStepName == KTestStep_T_SCANDC)
1.168 + return new CT_SCANDC();
1.169 + else if (aStepName == KTestStep_T_STYLE)
1.170 + return new CT_STYLE();
1.171 + else if (aStepName == KTestStep_T_TIMES)
1.172 + return new CT_TIMES();
1.173 + else if (aStepName == KTestStep_T_TRAN)
1.174 + return new CT_TRAN();
1.175 + else if (aStepName == KTestStep_TEtextDefect)
1.176 + return new CTEtextDefect();
1.177 + return NULL;
1.178 + }