charconvfw/fatfilenameconversionplugins/test/T_FatCharsetConvServer.cpp
changeset 53 11e2bb0d14ba
equal deleted inserted replaced
46:6124ff6478cc 53:11e2bb0d14ba
       
     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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "T_FatCharsetConvServer.h"
       
    22 #include "T_CP874.h"
       
    23 #include "T_CP932.h"
       
    24 #include "T_CP936.h"
       
    25 #include "T_CP949.h"
       
    26 #include "T_CP950.h"
       
    27 #include "T_CP1250.h"
       
    28 #include "T_CP1251.h"
       
    29 #include "T_CP1252.h"
       
    30 #include "T_CP1253.h"
       
    31 #include "T_CP1254.h"
       
    32 #include "T_CP1255.h"
       
    33 #include "T_CP1256.h"
       
    34 #include "T_CP1257.h"
       
    35 #include "T_CP1258.h"
       
    36 #include "T_CP54936.h"
       
    37 
       
    38 /* Path to the script
       
    39 
       
    40 c:\z:\t_TEF\t_TEF_All.script
       
    41 
       
    42 */
       
    43 
       
    44 _LIT(KServerName,"T_FatCharsetConvServer");
       
    45 
       
    46 CT_FatCharsetConvServer *CT_FatCharsetConvServer::NewL()
       
    47 /**
       
    48    @return - Instance of the test server
       
    49    Same code for Secure and non-secure variants
       
    50    Called inside the MainL() function to create and start the
       
    51    CTestServer derived server.
       
    52  */
       
    53     {
       
    54 	CT_FatCharsetConvServer * server = new (ELeave) CT_FatCharsetConvServer();
       
    55     CleanupStack::PushL(server);
       
    56     // CServer base class call
       
    57     server->StartL(KServerName);
       
    58     CleanupStack::Pop(server);
       
    59     return server;
       
    60     }
       
    61 
       
    62 
       
    63 LOCAL_C void MainL()
       
    64 //
       
    65 // Secure variant
       
    66 // Much simpler, uses the new Rendezvous() call to sync with the client
       
    67 //
       
    68     {
       
    69 #if (defined __DATA_CAGING__)
       
    70     RProcess().DataCaging(RProcess::EDataCagingOn);
       
    71     RProcess().SecureApi(RProcess::ESecureApiOn);
       
    72 #endif
       
    73     CActiveScheduler* sched=NULL;
       
    74     sched=new(ELeave) CActiveScheduler;
       
    75     CActiveScheduler::Install(sched);
       
    76     CT_FatCharsetConvServer *server = NULL;
       
    77     // Create the CTestServer derived server
       
    78     TRAPD(err,server = CT_FatCharsetConvServer::NewL());
       
    79     if(!err)
       
    80         {
       
    81         // Sync with the client and enter the active scheduler
       
    82         RProcess::Rendezvous(KErrNone);
       
    83         sched->Start();
       
    84         }
       
    85     delete server;
       
    86     delete sched;
       
    87     }
       
    88 
       
    89 /** @return - Standard Epoc error code on process exit
       
    90     Secure variant only
       
    91     Process entry point. Called by client using RProcess API
       
    92 */
       
    93 GLDEF_C TInt E32Main()
       
    94     {
       
    95     __UHEAP_MARK;
       
    96     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    97     if(cleanup == NULL)
       
    98         {
       
    99         return KErrNoMemory;
       
   100         }
       
   101     TRAPD(err,MainL());
       
   102     // This if statement is here just to shut up RVCT, which would otherwise warn
       
   103     // that err was set but never used
       
   104     if (err)
       
   105         {
       
   106         err = KErrNone;
       
   107         }
       
   108     delete cleanup;
       
   109     __UHEAP_MARKEND;
       
   110     return KErrNone;
       
   111     }
       
   112 
       
   113 CTestStep *CT_FatCharsetConvServer::CreateTestStep(const TDesC& aStepName)
       
   114 /**
       
   115    @return - A CTestStep derived instance
       
   116    Secure and non-secure variants
       
   117    Implementation of CTestServer pure virtual
       
   118  */
       
   119     {
       
   120     if(aStepName == KTestStep_T_CP874)
       
   121         {
       
   122         return new CT_CP874();
       
   123         }
       
   124     else if(aStepName == KTestStep_T_CP932)
       
   125         {
       
   126         return new CT_CP932();
       
   127         }
       
   128     else if(aStepName == KTestStep_T_CP936)
       
   129         {
       
   130         return new CT_CP936();
       
   131         }
       
   132     else if(aStepName == KTestStep_T_CP949)
       
   133         {
       
   134         return new CT_CP949();
       
   135         }
       
   136     else if(aStepName == KTestStep_T_CP950)
       
   137         {
       
   138         return new CT_CP950();
       
   139         }
       
   140     else if(aStepName == KTestStep_T_CP1250)
       
   141         {
       
   142         return new CT_CP1250();
       
   143         }
       
   144     else if(aStepName == KTestStep_T_CP1251)
       
   145         {
       
   146         return new CT_CP1251();
       
   147         }
       
   148     else if(aStepName == KTestStep_T_CP1252)
       
   149         {
       
   150         return new CT_CP1252();
       
   151         }
       
   152     else if(aStepName == KTestStep_T_CP1253)
       
   153         {
       
   154         return new CT_CP1253();
       
   155         }
       
   156     else if(aStepName == KTestStep_T_CP1254)
       
   157         {
       
   158         return new CT_CP1254();
       
   159         }
       
   160     else if(aStepName == KTestStep_T_CP1255)
       
   161         {
       
   162         return new CT_CP1255();
       
   163         }
       
   164     else if(aStepName == KTestStep_T_CP1256)
       
   165         {
       
   166         return new CT_CP1256();
       
   167         }
       
   168     else if(aStepName == KTestStep_T_CP1257)
       
   169         {
       
   170         return new CT_CP1257();
       
   171         }
       
   172     else if(aStepName == KTestStep_T_CP1258)
       
   173         {
       
   174         return new CT_CP1258();
       
   175         }
       
   176     else if(aStepName == KTestStep_T_CP54936)
       
   177         {
       
   178         return new CT_CP54936();
       
   179         }
       
   180     return NULL;
       
   181     }
       
   182