1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/stdcpp/tsrc/BC/apps/tiostreams/src/tiostreams.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,168 @@
1.4 +/*
1.5 +* Copyright (c) 2009 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 +// INCLUDE FILES
1.24 +#include <Stiftestinterface.h>
1.25 +#include "tiostreams.h"
1.26 +
1.27 +// EXTERNAL DATA STRUCTURES
1.28 +//extern ?external_data;
1.29 +
1.30 +// EXTERNAL FUNCTION PROTOTYPES
1.31 +//extern ?external_function( ?arg_type,?arg_type );
1.32 +
1.33 +// CONSTANTS
1.34 +//const ?type ?constant_var = ?constant;
1.35 +
1.36 +// MACROS
1.37 +//#define ?macro ?macro_def
1.38 +
1.39 +// LOCAL CONSTANTS AND MACROS
1.40 +//const ?type ?constant_var = ?constant;
1.41 +//#define ?macro_name ?macro_def
1.42 +
1.43 +// MODULE DATA STRUCTURES
1.44 +//enum ?declaration
1.45 +//typedef ?declaration
1.46 +
1.47 +// LOCAL FUNCTION PROTOTYPES
1.48 +//?type ?function_name( ?arg_type, ?arg_type );
1.49 +
1.50 +// FORWARD DECLARATIONS
1.51 +//class ?FORWARD_CLASSNAME;
1.52 +
1.53 +// ============================= LOCAL FUNCTIONS ===============================
1.54 +
1.55 +// -----------------------------------------------------------------------------
1.56 +// ?function_name ?description.
1.57 +// ?description
1.58 +// Returns: ?value_1: ?description
1.59 +// ?value_n: ?description_line1
1.60 +// ?description_line2
1.61 +// -----------------------------------------------------------------------------
1.62 +//
1.63 +/*
1.64 +?type ?function_name(
1.65 + ?arg_type arg, // ?description
1.66 + ?arg_type arg) // ?description
1.67 + {
1.68 +
1.69 + ?code // ?comment
1.70 +
1.71 + // ?comment
1.72 + ?code
1.73 + }
1.74 +*/
1.75 +
1.76 +// ============================ MEMBER FUNCTIONS ===============================
1.77 +
1.78 +// -----------------------------------------------------------------------------
1.79 +// Ctiostreams::Ctiostreams
1.80 +// C++ default constructor can NOT contain any code, that
1.81 +// might leave.
1.82 +// -----------------------------------------------------------------------------
1.83 +//
1.84 +Ctiostreams::Ctiostreams(
1.85 + CTestModuleIf& aTestModuleIf ):
1.86 + CScriptBase( aTestModuleIf )
1.87 + {
1.88 + }
1.89 +
1.90 +// -----------------------------------------------------------------------------
1.91 +// Ctiostreams::ConstructL
1.92 +// Symbian 2nd phase constructor can leave.
1.93 +// -----------------------------------------------------------------------------
1.94 +//
1.95 +void Ctiostreams::ConstructL()
1.96 + {
1.97 + iLog = CStifLogger::NewL( KtiostreamsLogPath,
1.98 + KtiostreamsLogFile,
1.99 + CStifLogger::ETxt,
1.100 + CStifLogger::EFile,
1.101 + EFalse );
1.102 + SendTestModuleVersion();
1.103 + }
1.104 +
1.105 +// -----------------------------------------------------------------------------
1.106 +// Ctiostreams::NewL
1.107 +// Two-phased constructor.
1.108 +// -----------------------------------------------------------------------------
1.109 +//
1.110 +Ctiostreams* Ctiostreams::NewL(
1.111 + CTestModuleIf& aTestModuleIf )
1.112 + {
1.113 + Ctiostreams* self = new (ELeave) Ctiostreams( aTestModuleIf );
1.114 +
1.115 + CleanupStack::PushL( self );
1.116 + self->ConstructL();
1.117 + CleanupStack::Pop();
1.118 +
1.119 + return self;
1.120 +
1.121 + }
1.122 +
1.123 +// Destructor
1.124 +Ctiostreams::~Ctiostreams()
1.125 + {
1.126 +
1.127 + // Delete resources allocated from test methods
1.128 + Delete();
1.129 +
1.130 + // Delete logger
1.131 + delete iLog;
1.132 +
1.133 + }
1.134 +
1.135 +// ========================== OTHER EXPORTED FUNCTIONS =========================
1.136 +
1.137 +// -----------------------------------------------------------------------------
1.138 +// LibEntryL is a polymorphic Dll entry point.
1.139 +// Returns: CScriptBase: New CScriptBase derived object
1.140 +// -----------------------------------------------------------------------------
1.141 +//
1.142 +EXPORT_C CScriptBase* LibEntryL(
1.143 + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
1.144 + {
1.145 +
1.146 + return ( CScriptBase* ) Ctiostreams::NewL( aTestModuleIf );
1.147 +
1.148 + }
1.149 +//-----------------------------------------------------------------------------
1.150 +// Ctiostreams::SendTestClassVersion
1.151 +// Method used to send version of test class
1.152 +//-----------------------------------------------------------------------------
1.153 +//
1.154 +void Ctiostreams::SendTestModuleVersion()
1.155 + {
1.156 + TVersion moduleVersion;
1.157 + moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
1.158 + moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
1.159 + moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
1.160 +
1.161 + TFileName moduleName;
1.162 + moduleName = _L("Ctiostreams.dll");
1.163 +
1.164 +
1.165 + TBool newVersionOfMethod = ETrue;
1.166 + CTestModuleIf &test=TestModuleIf();
1.167 + test.SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
1.168 + test.SetBehavior(CTestModuleIf::ETestLeaksHandles);
1.169 + }
1.170 +
1.171 +// End of File