sl@0: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\klib\dbase.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: /** Deletes the specified DBase derived object. sl@0: sl@0: @param aPtr Pointer to the DBase derived object to be deleted. sl@0: sl@0: @pre Calling thread must be in a critical section. sl@0: @pre Interrupts must be enabled. sl@0: @pre Kernel must be unlocked. sl@0: @pre No fast mutex can be held. sl@0: @pre Call in a thread context. sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: EXPORT_C void DBase::Delete(DBase* aPtr) sl@0: { sl@0: CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"DBase::Delete"); sl@0: delete aPtr; sl@0: } sl@0: sl@0: sl@0: /** Allocates the object from the kernel heap and then initialises its contents sl@0: to binary zeros. sl@0: sl@0: @param aSize The size of the derived class. This parameter is specified sl@0: implicitly by C++ in all circumstances in which a derived class sl@0: is allocated. sl@0: sl@0: @return An untyped pointer to the allocated object. sl@0: sl@0: @pre Calling thread must be in a critical section. sl@0: @pre Interrupts must be enabled. sl@0: @pre Kernel must be unlocked. sl@0: @pre No fast mutex can be held. sl@0: @pre Call in a thread context. sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: EXPORT_C TAny* DBase::operator new(TUint aSize) __NO_THROW sl@0: { sl@0: CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"DBase::operator new(TUint aSize)"); sl@0: return Kern::AllocZ(aSize); sl@0: } sl@0: sl@0: sl@0: /** Allocates the object from the kernel heap with additional memory and then sl@0: initialises its contents to binary zeros. sl@0: sl@0: @param aSize The size of the derived class. This parameter is specified sl@0: implicitly by C++ in all circumstances in which a derived class sl@0: is allocated. sl@0: sl@0: @param anExtraSize Indicates additional size beyond the end of the base class. sl@0: sl@0: @return An untyped pointer to the allocated object. sl@0: sl@0: @pre Calling thread must be in a critical section. sl@0: @pre Interrupts must be enabled. sl@0: @pre Kernel must be unlocked. sl@0: @pre No fast mutex can be held. sl@0: @pre Call in a thread context. sl@0: @pre Can be used in a device driver. sl@0: */ sl@0: EXPORT_C TAny* DBase::operator new(TUint aSize, TUint anExtraSize) __NO_THROW sl@0: { sl@0: CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"DBase::operator new(TUint aSize, TUint anExtraSize)"); sl@0: aSize+=anExtraSize; sl@0: return Kern::AllocZ(aSize); sl@0: } sl@0: sl@0: _LIT(KLitKernLib,"KernLib"); sl@0: void KL::Panic(KL::TKernLibPanic aPanic) sl@0: { sl@0: Kern::PanicCurrentThread(KLitKernLib,aPanic); sl@0: } sl@0: sl@0: sl@0: /** Default constructor for version type sl@0: Sets version to 0.0.0 sl@0: */ sl@0: EXPORT_C TVersion::TVersion() sl@0: : iMajor(0),iMinor(0),iBuild(0) sl@0: {} sl@0: sl@0: sl@0: /** sl@0: Compares two versions and returns true if the test version is less than the sl@0: current version. sl@0: sl@0: Version information is encapsulated by a TVersion type object and consists of sl@0: a major version number, a minor version number and a build number. sl@0: sl@0: The function returns true if one of the following conditions is true: sl@0: sl@0: 1. the test major version is strictly less than the current major version sl@0: sl@0: 2. the test major version is equal to the current major version and the test sl@0: minor version is less than or equal to the current minor version. sl@0: sl@0: If neither condition is true, the function returns false. sl@0: sl@0: @param aCurrent A reference to the current version against which aRequested sl@0: is compared. sl@0: @param aRequested A reference to the test version to be compared sl@0: against aCurrent. sl@0: sl@0: @return True, if one or both conditions are true. False otherwise. sl@0: */ sl@0: EXPORT_C TBool Kern::QueryVersionSupported(const TVersion &aCurrent,const TVersion &aRequested) sl@0: { sl@0: sl@0: if (aRequested.iMajor