os/textandloc/charconvfw/fatfilenameconversionplugins/test/T_FatCharsetConvServer.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/fatfilenameconversionplugins/test/T_FatCharsetConvServer.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,182 @@
     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 +
    1.22 +
    1.23 +
    1.24 +#include "T_FatCharsetConvServer.h"
    1.25 +#include "T_CP874.h"
    1.26 +#include "T_CP932.h"
    1.27 +#include "T_CP936.h"
    1.28 +#include "T_CP949.h"
    1.29 +#include "T_CP950.h"
    1.30 +#include "T_CP1250.h"
    1.31 +#include "T_CP1251.h"
    1.32 +#include "T_CP1252.h"
    1.33 +#include "T_CP1253.h"
    1.34 +#include "T_CP1254.h"
    1.35 +#include "T_CP1255.h"
    1.36 +#include "T_CP1256.h"
    1.37 +#include "T_CP1257.h"
    1.38 +#include "T_CP1258.h"
    1.39 +#include "T_CP54936.h"
    1.40 +
    1.41 +/* Path to the script
    1.42 +
    1.43 +c:\z:\t_TEF\t_TEF_All.script
    1.44 +
    1.45 +*/
    1.46 +
    1.47 +_LIT(KServerName,"T_FatCharsetConvServer");
    1.48 +
    1.49 +CT_FatCharsetConvServer *CT_FatCharsetConvServer::NewL()
    1.50 +/**
    1.51 +   @return - Instance of the test server
    1.52 +   Same code for Secure and non-secure variants
    1.53 +   Called inside the MainL() function to create and start the
    1.54 +   CTestServer derived server.
    1.55 + */
    1.56 +    {
    1.57 +	CT_FatCharsetConvServer * server = new (ELeave) CT_FatCharsetConvServer();
    1.58 +    CleanupStack::PushL(server);
    1.59 +    // CServer base class call
    1.60 +    server->StartL(KServerName);
    1.61 +    CleanupStack::Pop(server);
    1.62 +    return server;
    1.63 +    }
    1.64 +
    1.65 +
    1.66 +LOCAL_C void MainL()
    1.67 +//
    1.68 +// Secure variant
    1.69 +// Much simpler, uses the new Rendezvous() call to sync with the client
    1.70 +//
    1.71 +    {
    1.72 +#if (defined __DATA_CAGING__)
    1.73 +    RProcess().DataCaging(RProcess::EDataCagingOn);
    1.74 +    RProcess().SecureApi(RProcess::ESecureApiOn);
    1.75 +#endif
    1.76 +    CActiveScheduler* sched=NULL;
    1.77 +    sched=new(ELeave) CActiveScheduler;
    1.78 +    CActiveScheduler::Install(sched);
    1.79 +    CT_FatCharsetConvServer *server = NULL;
    1.80 +    // Create the CTestServer derived server
    1.81 +    TRAPD(err,server = CT_FatCharsetConvServer::NewL());
    1.82 +    if(!err)
    1.83 +        {
    1.84 +        // Sync with the client and enter the active scheduler
    1.85 +        RProcess::Rendezvous(KErrNone);
    1.86 +        sched->Start();
    1.87 +        }
    1.88 +    delete server;
    1.89 +    delete sched;
    1.90 +    }
    1.91 +
    1.92 +/** @return - Standard Epoc error code on process exit
    1.93 +    Secure variant only
    1.94 +    Process entry point. Called by client using RProcess API
    1.95 +*/
    1.96 +GLDEF_C TInt E32Main()
    1.97 +    {
    1.98 +    __UHEAP_MARK;
    1.99 +    CTrapCleanup* cleanup = CTrapCleanup::New();
   1.100 +    if(cleanup == NULL)
   1.101 +        {
   1.102 +        return KErrNoMemory;
   1.103 +        }
   1.104 +    TRAPD(err,MainL());
   1.105 +    // This if statement is here just to shut up RVCT, which would otherwise warn
   1.106 +    // that err was set but never used
   1.107 +    if (err)
   1.108 +        {
   1.109 +        err = KErrNone;
   1.110 +        }
   1.111 +    delete cleanup;
   1.112 +    __UHEAP_MARKEND;
   1.113 +    return KErrNone;
   1.114 +    }
   1.115 +
   1.116 +CTestStep *CT_FatCharsetConvServer::CreateTestStep(const TDesC& aStepName)
   1.117 +/**
   1.118 +   @return - A CTestStep derived instance
   1.119 +   Secure and non-secure variants
   1.120 +   Implementation of CTestServer pure virtual
   1.121 + */
   1.122 +    {
   1.123 +    if(aStepName == KTestStep_T_CP874)
   1.124 +        {
   1.125 +        return new CT_CP874();
   1.126 +        }
   1.127 +    else if(aStepName == KTestStep_T_CP932)
   1.128 +        {
   1.129 +        return new CT_CP932();
   1.130 +        }
   1.131 +    else if(aStepName == KTestStep_T_CP936)
   1.132 +        {
   1.133 +        return new CT_CP936();
   1.134 +        }
   1.135 +    else if(aStepName == KTestStep_T_CP949)
   1.136 +        {
   1.137 +        return new CT_CP949();
   1.138 +        }
   1.139 +    else if(aStepName == KTestStep_T_CP950)
   1.140 +        {
   1.141 +        return new CT_CP950();
   1.142 +        }
   1.143 +    else if(aStepName == KTestStep_T_CP1250)
   1.144 +        {
   1.145 +        return new CT_CP1250();
   1.146 +        }
   1.147 +    else if(aStepName == KTestStep_T_CP1251)
   1.148 +        {
   1.149 +        return new CT_CP1251();
   1.150 +        }
   1.151 +    else if(aStepName == KTestStep_T_CP1252)
   1.152 +        {
   1.153 +        return new CT_CP1252();
   1.154 +        }
   1.155 +    else if(aStepName == KTestStep_T_CP1253)
   1.156 +        {
   1.157 +        return new CT_CP1253();
   1.158 +        }
   1.159 +    else if(aStepName == KTestStep_T_CP1254)
   1.160 +        {
   1.161 +        return new CT_CP1254();
   1.162 +        }
   1.163 +    else if(aStepName == KTestStep_T_CP1255)
   1.164 +        {
   1.165 +        return new CT_CP1255();
   1.166 +        }
   1.167 +    else if(aStepName == KTestStep_T_CP1256)
   1.168 +        {
   1.169 +        return new CT_CP1256();
   1.170 +        }
   1.171 +    else if(aStepName == KTestStep_T_CP1257)
   1.172 +        {
   1.173 +        return new CT_CP1257();
   1.174 +        }
   1.175 +    else if(aStepName == KTestStep_T_CP1258)
   1.176 +        {
   1.177 +        return new CT_CP1258();
   1.178 +        }
   1.179 +    else if(aStepName == KTestStep_T_CP54936)
   1.180 +        {
   1.181 +        return new CT_CP54936();
   1.182 +        }
   1.183 +    return NULL;
   1.184 +    }
   1.185 +