1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/textformatting/test/src/tformserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,168 @@
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 +* @file
1.19 +* @internalComponent
1.20 +*
1.21 +*/
1.22 +
1.23 +#include "tformserver.h"
1.24 +#include "tcustomcharmapping.h"
1.25 +#include "ttagmaimp.h"
1.26 +#include "ttmsource.h"
1.27 +#include "tbidicursorpos.h"
1.28 +#include "ttmcode.h"
1.29 +#include "tunique.h"
1.30 +#include "tundo.h"
1.31 +#include "tinterpreter.h"
1.32 +#include "tformat.h"
1.33 +#include "tinlinetext.h"
1.34 +#include "tgraphemeiterator.h"
1.35 +#include "tformbenchmark.h"
1.36 +#include "tlinepag.h"
1.37 +#include "tformhindi.h"
1.38 +
1.39 +_LIT(KServerName,"TFormServer");
1.40 +
1.41 +CTFormServer* CTFormServer::NewL()
1.42 + {
1.43 + CTFormServer * server = new (ELeave) CTFormServer();
1.44 + CleanupStack::PushL(server);
1.45 + // CServer base class call
1.46 + server->StartL(KServerName);
1.47 + CleanupStack::Pop(server);
1.48 + return server;
1.49 + }
1.50 +
1.51 +
1.52 +LOCAL_C void MainL()
1.53 +//
1.54 +// Secure variant
1.55 +// Much simpler, uses the new Rendezvous() call to sync with the client
1.56 +//
1.57 + {
1.58 +#if (defined __DATA_CAGING__)
1.59 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.60 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.61 +#endif
1.62 + CActiveScheduler* sched=NULL;
1.63 + sched=new(ELeave) CActiveScheduler;
1.64 + CActiveScheduler::Install(sched);
1.65 + CTFormServer *server = NULL;
1.66 + // Create the CTestServer derived server
1.67 + TRAPD(err,server = CTFormServer::NewL());
1.68 + if(!err)
1.69 + {
1.70 + // Sync with the client and enter the active scheduler
1.71 + RProcess::Rendezvous(KErrNone);
1.72 + sched->Start();
1.73 + }
1.74 + delete server;
1.75 + delete sched;
1.76 + }
1.77 +
1.78 +/** @return - Standard Epoc error code on process exit
1.79 + Secure variant only
1.80 + Process entry point. Called by client using RProcess API
1.81 +*/
1.82 +GLDEF_C TInt E32Main()
1.83 + {
1.84 + __UHEAP_MARK;
1.85 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.86 + if(cleanup == NULL)
1.87 + {
1.88 + return KErrNoMemory;
1.89 + }
1.90 + TRAPD(err,MainL());
1.91 + // This if statement is here just to shut up RVCT, which would otherwise warn
1.92 + // that err was set but never used
1.93 + if (err)
1.94 + {
1.95 + err = KErrNone;
1.96 + }
1.97 + delete cleanup;
1.98 + __UHEAP_MARKEND;
1.99 + return KErrNone;
1.100 + }
1.101 +
1.102 +CTestStep *CTFormServer::CreateTestStep(const TDesC& aStepName)
1.103 +/**
1.104 + @return - A CTestStep derived instance
1.105 + Secure and non-secure variants
1.106 + Implementation of CTestServer pure virtual
1.107 + */
1.108 + {
1.109 + if(aStepName == KTestStep_T_CustomCharMapping)
1.110 + {
1.111 + return new CTCustomCharMappingStep();
1.112 + }
1.113 + else if(aStepName == KTestStep_T_TagmaImp)
1.114 + {
1.115 + return new CTTagmaImpStep();
1.116 + }
1.117 + else if(aStepName == KTestStep_T_TmSource)
1.118 + {
1.119 + return new CTTmSourceStep();
1.120 + }
1.121 + else if(aStepName == KTestStep_T_BidiCursorPos)
1.122 + {
1.123 + return new CTBidiCursorPosStep();
1.124 + }
1.125 + else if(aStepName == KTestStep_T_TmCode)
1.126 + {
1.127 + return new CTTmCodeStep();
1.128 + }
1.129 + else if(aStepName == KTestStep_T_Unique)
1.130 + {
1.131 + return new CTUniqueStep();
1.132 + }
1.133 + else if(aStepName == KTestStep_T_Undo)
1.134 + {
1.135 + return new CTUndoStep();
1.136 + }
1.137 + else if(aStepName == KTestStep_T_Interpreter)
1.138 + {
1.139 + return new CTInterpreterStep();
1.140 + }
1.141 + else if(aStepName == KTestStep_T_Format)
1.142 + {
1.143 + return new CTFormatStep();
1.144 + }
1.145 + else if(aStepName == KTestStep_T_InLineText)
1.146 + {
1.147 + return new CTInLineTextStep();
1.148 + }
1.149 + else if(aStepName == KTestStep_T_GraphemeIterator)
1.150 + {
1.151 + return new CTGraphemeIteratorStep();
1.152 + }
1.153 + else if(aStepName == KTestStep_T_FormBenchmark)
1.154 + {
1.155 + return new CTFormBenchmarkStep();
1.156 + }
1.157 + else if(aStepName == KTestStep_T_LinePag)
1.158 + {
1.159 + return new CTLinePagStep();
1.160 + }
1.161 + else if(aStepName == KTestStep_T_FormHindi)
1.162 + {
1.163 + return new CTFormHindiStep();
1.164 + }
1.165 +
1.166 +
1.167 + return NULL;
1.168 + }
1.169 +
1.170 +
1.171 +