First public contribution.
1 // Copyright (c) 1995-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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\euser\us_ref.cpp
23 Frees the memory holding the contained object.
25 EXPORT_C void RRefBase::Free()
40 Creates a copy of an object, which is to be contained by
41 this reference object.
43 @param aPtr A pointer to memory holding a copy of the object.
44 @param aSize The size of the memory required to hold the object.
46 EXPORT_C void RRefBase::DoAlloc(const TAny *aPtr,TInt aSize)
49 __ASSERT_ALWAYS(aSize>=0,Panic(ERefAllocSizeNegative));
51 iPtr=(TInt *)User::Alloc(aSize+sizeof(TInt));
56 Mem::Copy(iPtr,aPtr,aSize);
64 Creates a copy of an object, which is to be contained by
65 this reference object, and leaves on error.
67 @param aPtr A pointer to memory holding a copy of the object.
68 @param aSize The size of the memory required to hold the object.
70 EXPORT_C void RRefBase::DoAllocL(const TAny *aPtr,TInt aSize)
74 User::LeaveIfNull(iPtr);
81 Provides an implementation for the RRef class copy
82 constructor and assignment operator.
84 @param aRef The reference object to be copied.
88 EXPORT_C void RRefBase::Copy(const RRefBase &aRef)