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