xml/xmllibxml2parser/test/tef/xmlparser2/src/texmlparser2server.cpp
changeset 0 e35f40988205
equal deleted inserted replaced
-1:000000000000 0:e35f40988205
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file texmlparser2server.cpp
       
    18  @internalTechnology
       
    19 */
       
    20 
       
    21 #include "texmlparser2server.h"
       
    22 #include "texmlparser2step.h"
       
    23 /**
       
    24  @return - Instance of the test server
       
    25  */
       
    26 CXmlParser2TestServer* CXmlParser2TestServer::NewL()
       
    27 	{
       
    28 	CXmlParser2TestServer * server = new (ELeave) CXmlParser2TestServer();
       
    29 	CleanupStack::PushL(server);
       
    30 	server->ConstructL(KServerName);
       
    31 	CleanupStack::Pop(server);
       
    32 	return server;
       
    33 	}
       
    34 /**
       
    35  * Standard Symbian two phase constructor
       
    36  */
       
    37 void CXmlParser2TestServer::ConstructL(const TDesC& aName)
       
    38 	{
       
    39 	CTestServer::ConstructL(aName);
       
    40 	}
       
    41 
       
    42 LOCAL_C void MainL()
       
    43 	{
       
    44 
       
    45 	CActiveScheduler* sched=new(ELeave) CActiveScheduler;
       
    46 	CActiveScheduler::Install(sched);
       
    47 	CXmlParser2TestServer* server = NULL;
       
    48 	// Create the CTestServer derived server
       
    49 	TRAPD(err,server = CXmlParser2TestServer::NewL());
       
    50 	if (KErrNone == err)
       
    51 		{
       
    52 		// Sync with the client and enter the active scheduler
       
    53 		RProcess::Rendezvous(KErrNone);
       
    54 		sched->Start();
       
    55 		}
       
    56 	delete server;
       
    57 	delete sched;
       
    58 	}
       
    59 
       
    60 /**
       
    61  * Entry point
       
    62  */
       
    63 GLDEF_C TInt E32Main()
       
    64 /**
       
    65  * @return - Standard Epoc error code on exit
       
    66  */
       
    67 	{
       
    68 	__UHEAP_MARK;
       
    69 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    70 	if (cleanup == NULL)
       
    71 		{
       
    72 		return KErrNoMemory;
       
    73 		}
       
    74 	TRAPD(err,MainL())
       
    75 	;
       
    76 	delete cleanup;
       
    77 
       
    78 	__UHEAP_MARKEND;
       
    79 	return err;
       
    80 	}
       
    81 
       
    82 CTestStep* CXmlParser2TestServer::CreateTestStep(const TDesC& aStepName)
       
    83 /**
       
    84  * @return - A CTestStep derived instance
       
    85  * Implementation of CTestServer pure virtual
       
    86  */
       
    87 	{
       
    88 	CTestStep* testStep= NULL;
       
    89 
       
    90 	if (aStepName == KXmlParser2SetContentSink || aStepName
       
    91 			== KXmlParser2OOMTests || aStepName == KXmlParser2OOMTests2
       
    92 			|| aStepName == KXmlParser2OOMTests3 ||aStepName == KXmlParser2OOMTests4)
       
    93 		{
       
    94 		testStep = new CXmlParser2Step(aStepName);
       
    95 		}
       
    96 	return testStep;
       
    97 	}