os/textandloc/textrendering/textformatting/test/src/tformserver.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 * @file
    16 * @internalComponent 
    17 *
    18 */
    19 
    20 #include "tformserver.h"
    21 #include "tcustomcharmapping.h"
    22 #include "ttagmaimp.h"
    23 #include "ttmsource.h"
    24 #include "tbidicursorpos.h"
    25 #include "ttmcode.h"
    26 #include "tunique.h"
    27 #include "tundo.h"
    28 #include "tinterpreter.h"
    29 #include "tformat.h"
    30 #include "tinlinetext.h"
    31 #include "tgraphemeiterator.h"
    32 #include "tformbenchmark.h"
    33 #include "tlinepag.h"
    34 #include "tformhindi.h"
    35 
    36 _LIT(KServerName,"TFormServer");
    37 
    38 CTFormServer* CTFormServer::NewL()
    39     {
    40     CTFormServer * server = new (ELeave) CTFormServer();
    41     CleanupStack::PushL(server);
    42     // CServer base class call
    43     server->StartL(KServerName);
    44     CleanupStack::Pop(server);
    45     return server;
    46     }
    47 
    48 
    49 LOCAL_C void MainL()
    50 //
    51 // Secure variant
    52 // Much simpler, uses the new Rendezvous() call to sync with the client
    53 //
    54     {
    55 #if (defined __DATA_CAGING__)
    56     RProcess().DataCaging(RProcess::EDataCagingOn);
    57     RProcess().SecureApi(RProcess::ESecureApiOn);
    58 #endif
    59     CActiveScheduler* sched=NULL;
    60     sched=new(ELeave) CActiveScheduler;
    61     CActiveScheduler::Install(sched);
    62     CTFormServer *server = NULL;
    63     // Create the CTestServer derived server
    64     TRAPD(err,server = CTFormServer::NewL());
    65     if(!err)
    66         {
    67         // Sync with the client and enter the active scheduler
    68         RProcess::Rendezvous(KErrNone);
    69         sched->Start();
    70         }
    71     delete server;
    72     delete sched;
    73     }
    74 
    75 /** @return - Standard Epoc error code on process exit
    76     Secure variant only
    77     Process entry point. Called by client using RProcess API
    78 */
    79 GLDEF_C TInt E32Main()
    80     {
    81     __UHEAP_MARK;
    82     CTrapCleanup* cleanup = CTrapCleanup::New();
    83     if(cleanup == NULL)
    84         {
    85         return KErrNoMemory;
    86         }
    87     TRAPD(err,MainL());
    88     // This if statement is here just to shut up RVCT, which would otherwise warn
    89     // that err was set but never used
    90     if (err)
    91         {
    92         err = KErrNone;
    93         }
    94     delete cleanup;
    95     __UHEAP_MARKEND;
    96     return KErrNone;
    97     }
    98 
    99 CTestStep *CTFormServer::CreateTestStep(const TDesC& aStepName)
   100 /**
   101    @return - A CTestStep derived instance
   102    Secure and non-secure variants
   103    Implementation of CTestServer pure virtual
   104  */
   105     {
   106     if(aStepName == KTestStep_T_CustomCharMapping)
   107         {
   108         return new CTCustomCharMappingStep();
   109         }
   110     else if(aStepName == KTestStep_T_TagmaImp)
   111         {
   112         return new CTTagmaImpStep();
   113         }
   114     else if(aStepName == KTestStep_T_TmSource)
   115         {
   116         return new CTTmSourceStep();
   117         }
   118     else if(aStepName == KTestStep_T_BidiCursorPos)
   119         {
   120         return new CTBidiCursorPosStep();
   121         }
   122     else if(aStepName == KTestStep_T_TmCode)
   123         {
   124         return new CTTmCodeStep();
   125         }
   126     else if(aStepName == KTestStep_T_Unique)
   127         {
   128         return new CTUniqueStep();
   129         }
   130     else if(aStepName == KTestStep_T_Undo)
   131         {
   132         return new CTUndoStep();
   133         }
   134     else if(aStepName == KTestStep_T_Interpreter)
   135         {
   136         return new CTInterpreterStep();
   137         }
   138     else if(aStepName == KTestStep_T_Format)
   139         {
   140         return new CTFormatStep();
   141         }
   142     else if(aStepName == KTestStep_T_InLineText)
   143         {
   144         return new CTInLineTextStep();
   145         }
   146     else if(aStepName == KTestStep_T_GraphemeIterator)
   147         {
   148         return new CTGraphemeIteratorStep();
   149         }
   150     else if(aStepName == KTestStep_T_FormBenchmark)
   151         {
   152         return new CTFormBenchmarkStep();
   153         }
   154     else if(aStepName == KTestStep_T_LinePag)
   155         {
   156         return new CTLinePagStep();
   157         }
   158     else if(aStepName == KTestStep_T_FormHindi)
   159         {
   160         return new CTFormHindiStep();
   161         }
   162         
   163     
   164     return NULL;
   165     }
   166 
   167 
   168