os/textandloc/textandlocutils/nearestlangutils/tsrc/t_langutilsserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2  ============================================================================
     3  Name		: t_TEF.cpp
     4  Author	  : Yanchun Li
     5  Copyright   : Your copyright notice
     6  Description : Exe source file
     7  ============================================================================
     8  */
     9 
    10 //  Include Files  
    11 
    12 #include "t_langutilsserver.h"
    13 #include "t_langutils.h"
    14 #include "t_langutilsimp.h"
    15 #include "t_langutilslang.h"
    16 
    17 
    18 /* Path to the script
    19 
    20 c:\z:\t_TEF\t_TEF_All.script
    21 
    22 */
    23 
    24 _LIT(KServerName,"T_LangUtilsServer");
    25 
    26 CT_LangUtilsServer *CT_LangUtilsServer::NewL()
    27 /**
    28    @return - Instance of the test server
    29    Same code for Secure and non-secure variants
    30    Called inside the MainL() function to create and start the
    31    CTestServer derived server.
    32  */
    33     {
    34     CT_LangUtilsServer * server = new (ELeave) CT_LangUtilsServer();
    35     CleanupStack::PushL(server);
    36     // CServer base class call
    37     server->StartL(KServerName);
    38     CleanupStack::Pop(server);
    39     return server;
    40     }
    41 
    42 
    43 LOCAL_C void MainL()
    44 //
    45 // Secure variant
    46 // Much simpler, uses the new Rendezvous() call to sync with the client
    47 //
    48     {
    49 #if (defined __DATA_CAGING__)
    50     RProcess().DataCaging(RProcess::EDataCagingOn);
    51     RProcess().SecureApi(RProcess::ESecureApiOn);
    52 #endif
    53     CActiveScheduler* sched=NULL;
    54     sched=new(ELeave) CActiveScheduler;
    55     CActiveScheduler::Install(sched);
    56     CT_LangUtilsServer *server = NULL;
    57     // Create the CTestServer derived server
    58     TRAPD(err,server = CT_LangUtilsServer::NewL());
    59     if(!err)
    60         {
    61         // Sync with the client and enter the active scheduler
    62         RProcess::Rendezvous(KErrNone);
    63         sched->Start();
    64         }
    65     delete server;
    66     delete sched;
    67     }
    68 
    69 /** @return - Standard Epoc error code on process exit
    70     Secure variant only
    71     Process entry point. Called by client using RProcess API
    72 */
    73 GLDEF_C TInt E32Main()
    74     {
    75     __UHEAP_MARK;
    76     CTrapCleanup* cleanup = CTrapCleanup::New();
    77     if(cleanup == NULL)
    78         {
    79         return KErrNoMemory;
    80         }
    81     TRAPD(err,MainL());
    82     // This if statement is here just to shut up RVCT, which would otherwise warn
    83     // that err was set but never used
    84     if (err)
    85         {
    86         err = KErrNone;
    87         }
    88     delete cleanup;
    89     __UHEAP_MARKEND;
    90     return KErrNone;
    91     }
    92 
    93 CTestStep *CT_LangUtilsServer::CreateTestStep(const TDesC& aStepName)
    94 /**
    95    @return - A CTestStep derived instance
    96    Secure and non-secure variants
    97    Implementation of CTestServer pure virtual
    98  */
    99     {
   100     
   101     if(aStepName == KTestStep_T_LANGUTILS)
   102         {
   103         return new CT_LANGUTILS();
   104         }
   105     else if(aStepName == KTestStep_T_LANGUTILSIMP)
   106         {
   107         return new CT_LANGUTILSIMP();
   108         }
   109     else if(aStepName == KTestStep_T_LANGUTILSLANG)
   110         {
   111         return new CT_LANGUTILSLANG();
   112         }
   113         
   114 
   115     
   116     return NULL;
   117     }
   118