Location:
e32std.h
Link against: euser.lib
User
Supported from 5.0
Set of static user functions. These functions are related to a number of System component APIs.
The majority of the functions are related to either the current
thread, or its heap. Examples in this category include
User::Exit()
, which causes the thread to terminate, and
User::Alloc()
, which allocates memory from the current thread's
heap.
Some of these functions are equivalent to functions in the
RThread
or RHeap
classes. In these cases, the
User
function is a convenient way to access the function without
first having to get a handle to the current thread.
Functions are also provided to support debugging of memory leaks. These function calls can be written explicitly or can be generated using a corresponding macro — the advantage of using a macro is that the function call is only generated for debug builds.
A final category of functions, which includes
User::BinarySearch()
and User::QuickSort()
, are just
useful functions which have no other natural home.
|
Defined in User
:
Abort()
, Adjust()
, AdjustL()
, After()
, Alloc()
, AllocL()
, AllocLC()
, AllocLen()
, AllocSize()
, At()
, Available()
, Beep()
, BinarySearch()
, Check()
, Collate()
, CompressAllHeaps()
, CountAllocCells()
, Dying()
, Exit()
, Fold()
, Free()
, FreeLogicalDevice()
, FreePhysicalDevice()
, FreeZ()
, HandleException()
, Heap()
, InactivityTime()
, InfoPrint()
, Invariant()
, IsRomAddress()
, JustInTime()
, Language()
, Leave()
, LeaveIfError()
, LeaveIfNull()
, LeaveNoMemory()
, LoadLogicalDevice()
, LoadPhysicalDevice()
, LockPeriod()
, LockedDec()
, LockedInc()
, LowerCase()
, Panic()
, QueryVersionSupported()
, QuickSort()
, ReAlloc()
, ReAllocL()
, RequestComplete()
, ResetInactivityTime()
, SetCurrencySymbol()
, SetHomeTime()
, SetJustInTime()
, SetTrapHandler()
, StringLength()
, SwitchHeap()
, TickCount()
, TitleCase()
, TrapHandler()
, UpperCase()
, ValidateName()
, Version()
, WaitForAnyRequest()
, WaitForRequest()
, __DbgMarkCheck()
, __DbgMarkEnd()
, __DbgMarkStart()
, __DbgSetAllocFail()
Inherited from UserHeap
:
ChunkHeap()
,
FixedHeap()
static TInt IsRomAddress(TBool& aBool,TAny* aPtr);
Tests whether a specified address is in the ROM.
|
|
static TInt BinarySearch(TInt aCount,const TKey& aKey,TInt& aPos);
Performs a binary search for an array element containing a
specified key. It can be used on any kind of array where elements can be
identified by key. It is used by those standard EPOC arrays having
CArrayFix
, CArrayVar
or CArrayPak
in
their class hierarchy in the implementation of the various functions for
inserting, deleting and finding elements by key. The function can be used by
other arrays.
The function returns a zero value if the search is successful and a non-zero value otherwise.
If the search is successful, the function puts the position
(i.e. the index) of the element into aPos
. If the search is
unsuccessful, then the function puts into aPos
the position of the
first element in the array whose key is greater than the search key.
If the array is empty, i.e. aCount
is zero, then
the search is unsuccessful and aPos
is not defined.
|
|
static TInt QuickSort(TInt aCount,const TKey& aKey,const TSwap& aSwap);
Quick sorts array elements. It is used by those standard EPOC
arrays having CArrayFixBase
, CArrayVarBase
or
CArrayPakBase
in their class hierarchy in the implementation of
their sort functions. The function can be used by other arrays.
The function returns KErrNone
if the operation is
successful otherwise it returns KErrGeneral
.
|
|
static void WaitForAnyRequest();
Waits for any asynchronous request to complete. The current thread waits on its request semaphore.
The function completes and control returns to the caller when the current thread's request semaphore is signalled by any of the service providers which handle these asynchronous requests.
The request status of all outstanding asynchronous requests must be examined to determine which request is complete.
static void WaitForRequest(TRequestStatus& aStatus);
Waits for a specific asynchronous request to complete. The current thread waits on its request semaphore.
The function completes and control returns to the caller when
the current thread's request semaphore is signalled by the service provider
handling the request associated with aStatus
. Before signalling,
the service provider sets an appropriate value in aStatus
—
other than KRequestPending
.
Note:
If other asynchronous requests complete before the one
associated with aStatus
, the request semaphore is adjusted so that
knowledge of their completion is not lost. In this a case, a subsequent call to
User::WaitForAnyRequest()
or User::WaitForRequest()
will complete and return immediately.
|
static void WaitForRequest(TRequestStatus& aStatus1,TRequestStatus& aStatus2);
Waits for either of two specific asynchronous requests to complete. The current thread waits on its request semaphore.
The function completes and control returns to the caller when
the current thread's request semaphore is signalled by either the service
provider handling the request associated with aStatus1
or the
service provider handling the request associated with aStatus2
.
Before signalling, the completing service provider sets an appropriate value in
the status object — other than KRequestPending
.
Note:
If other asynchronous requests complete before the ones
associated with aStatus1
and aStatus2
, the request
semaphore is adjusted so that knowledge of their completion is not lost. In
this a case, a subsequent call to User::WaitForAnyRequest()
or
User::WaitForRequest()
will complete and return
immediately.
|
static void RequestComplete(TRequestStatus*& aStatus,TInt aReason);
Signals the current thread that the asynchronous request associated with the specified request status object is complete.
This function is used to complete an asynchronous request
originating in the same thread as the code that is currently executing. If a
request originates in another thread, then executing code must use
RThread::RequestComplete()
to signal the completion of that
request.
The request is completed with the completion code passed in
aReason
. This value is copied into the request
status — pointed to by aStatus
—
before signalling the current thread's request semaphore.
The meaning of the completion code passed in
aReason
is a matter of convention to be decided between the
service requester and the service provider.
|
static TInt Beep(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration);
Makes a beep tone with a specified frequency and duration. The duration of the beep can be supplied as a positive or a negative value.
If the duration is passed as a positive value:
the calling thread waits, if the hardware responsible for producing the sound is busy.
the function completes immediately, if the hardware responsible for producing the sound is free; in this case the sound continues in background and the hardware producing it is busy until the operation completes.
If the duration is passed as a negative value, the function completes immediately, whether or not the hardware responsible for producing the sound is busy. If the hardware is busy, no sound is produced.
|
|
static void Leave(TInt aReason);
Leaves the currently executing function, unwinds the call stack, and returns from the most recently entered trap harness.
|
static TInt LeaveIfError(TInt aReason);
Leaves or returns with a specified reason code.
If the reason code is negative the function leaves, and the reason code is returned through the trap harness.
If the reason code is zero or positive, the function simply returns with the reason value.
|
|
static TAny* LeaveIfNull(TAny* aPtr);
Leaves with the reason code KErrNoMemory
, if the
specified pointer is NULL
. If the pointer is not
NULL
, the function simply returns with the value of the
pointer.
|
|
static TTrapHandler* SetTrapHandler(TTrapHandler* aHandler);
Sets the current thread's trap handler and returns a pointer to
any pre-existing trap handler. Pass a NULL
pointer to this
function to clear the trap handler.
The trap handler works with the TRAP
mechanism to
handle the effects of a leave.
Note:
TTrapHandler
is an abstract base class; a trap
handler must be implemented as a derived class.
|
|
static TTrapHandler* TrapHandler();
Gets a pointer to the current thread's trap handler.
Note:
TTrapHandler
is an abstract base class; a trap
handler must be implemented as a derived class.
|
static TInt ValidateName(const TDesC& aName);
Checks whether a specified name is a valid CObject
name. A name is deemed to be invalid, if it contains any of the characters:
"*", "?", ":" i.e. the characters: asterisk, question mark and single
colon.
|
|
static TInt StringLength(const TUint8* aString);
Gets the length of a C style, null terminated, string of single-byte valued characters. The length does not include the null terminator.
|
|
static TInt StringLength(const TUint16* aString);
Gets the length of a C style, null terminated, string of double-byte valued characters. The length does not include the null terminator.
|
|
static void SetJustInTime(const TBool aBoolean);
Sets just-in-time debugging on or off. While the function can be called by code running on both the Emulator and ARM platforms, it only has an effect on the Emulator. The function applies to the whole machine. Turning just-in-time debugging off prevents the debug Emulator closing down when a panic occurs.
By default, just-in-time debugging is on.
Note that the emulator handles panics in the nomal manner, i.e. by killing the thread.
|
static TBool JustInTime();
Tests whether just-in-time debugging is on or off. The function is used by the Kernel, on the EPOC Emulator, to decide whether to do just-in-time debugging for panics. The function applies to the whole machine.
Unless overridden by calling
User::SetJustInTime(EFalse)
, just-in-time debugging is on by
default.
|
static void Check();
Checks the validity of the current thread's heap. The function walks through the list of allocated cells and the list of free cells checking that the heap is consistent and complete.
If any corruption is found, the function raises either a USER 48 or a USER 49 panic.
static void Invariant();
Panics the current thread with a USER 0 panic. Typically, this is called when a test for a class invariant fails, i.e. when a test which checks that the internal data of an object is self-consistent, fails.
Such tests are almost always done in debug builds, commonly
using the __ASSERT_DEBUG
macro.
static TInt FreeLogicalDevice(const TDesC& aDeviceName);
Frees the logical device driver DLL associated with a specified driver name.
|
|
static TInt FreePhysicalDevice(const TDesC& aDriverName);
Frees the physical device driver DLL associated with a specified driver name.
|
|
static TInt LoadLogicalDevice(const TDesC& aFileName);
Loads the logical device driver (LDD) DLL with the specified filename.
The function searches the system path for the LDD DLL, and loads it. It then makes a Kernel server call that:
creates the LDD factory object, an instance of a
DLogicalDevice
derived class; this involves checking the first UID value to
make sure that the DLL is a valid LDD before proceeding to call the exported
function at ordinal 1, which creates the LDD factory object on the Kernel
heap
calls the LDD factory object's Install()
function to complete the installation
adds the new LDD factory object to the Kernel's list of LDD factory objects.
|
|
static TInt LoadPhysicalDevice(const TDesC& aFileName);
Loads the physical device driver (PDD) DLL with the specified filename.
The function searches the system path for the PDD DLL, and loads it. It then makes a Kernel server call that:
creates the PDD factory object, an instance of a
DPhysicalDevice
derived class; this involves checking the first UID value to
make sure that the DLL is a valid PDD before proceeding to call the exported
function at ordinal 1, which creates the PDD factory object on the Kernel
heap
calls the PDD factory object's Install()
function to complete the installation
adds the new PDD factory object to the Kernel's list of PDD factory objects.
|
|
static void Abort();
Withdrawn in 6.0
Raises an exception of type TExcType::EExcAbort
on
the current thread.
If the thread has an exception handler for this exception type, it is called to handle the exception, otherwise a USER-EXEC 3 panic is raised.
static void Dying();
Withdrawn in 6.0
Thread called by the Kernel when any thread is terminated, panicked, aborted etc. For this reason, it is a good place for setting a breakpoint when debugging. The function has an empty implementation.
static void Exit(TInt aReason);
Terminates the current thread, specifying a reason. All child threads are terminated and all resources are cleaned up.
If the current thread is the main thread in a process, the process is also terminated.
|
static void Panic(const TDesC& aCategory,TInt aReason);
Panics the current thread, specifying a category name and panic number.
Keep the length of the category name small; a length of 16 is ideal.
|
static void HandleException(TExceptionHandler* aHandler, TExcType anException);
Enables the current thread to handle an exception of type
TExcType
.
The function is called by:
the RaiseException()
member function of
RThread
.
the Kernel, if an exception occurs and the current thread has an exception handler for the specific type of exception.
|
static void __DbgMarkStart(RHeap::TDbgHeapType aHeapType);
Marks the start of heap cell checking for the current thread's heap.
If earlier calls to __DbgMarkStart()
have been
made, then this call to __DbgMarkStart()
marks the start of a new
nested level of heap cell checking.
Every call to __DbgMarkStart()
should be matched
by a later call to __DbgMarkEnd()
to verify that the number of
heap cells allocated, at the current nested level, is as expected. This
expected number of heap cells is passed to __DbgMarkEnd()
as a
parameter; however, the most common expected number is zero, reflecting the
fact that most developers check that all memory allocated since a previous call
to __DbgStartCheck()
has been freed.
Notes:
This function can be called explicitly, or generated using
the corresponding macros __UHEAP_MARK
or
__KHEAP_MARK
. Using the macros has the advantage that the function
call is only generated for debug builds.
|
static TUint32 __DbgMarkEnd(RHeap::TDbgHeapType aHeapType,TInt aCount);
Marks the end of heap cell checking at the current nested level
for the current thread's heap. The function checks that the number of heap
cells allocated, at the current nested level, is aCount
. The most
common value for aCount
is zero, reflecting the fact that most
developers check that all memory allocated since a previous call to
__DbgStartCheck()
has been freed.
A call to this function should match an earlier call to
__DbgMarkStart()
. If there are more calls to this function than
calls to __DbgMarkStart()
, then this function raises a USER 51
panic.
If the check fails for a user heap, the function raises an
ALLOC: nnnnnnnn
panic, where nnnnnnnn
is a
hexadecimal pointer to the first orphaned heap cell.
If the check fails for the Kernel heap, the Kernel server raises a KERN-SVR 17 panic.
Notes:
This function can be called explicitly, or generated using
the corresponding macros __UHEAP_MARKEND
,
__UHEAP_MARKENDC
, __KHEAP_MARK
, or
__KHEAP_MARKC
. Using the macros has the advantage that the
function call is only generated for debug builds.
|
|
static void __DbgMarkCheck(RHeap::TDbgHeapType aHeapType,TBool aCountAll,TInt aCount,const TDesC8& aFileName,TInt aLineNum);
Checks the current number of allocated heap cells for the
current thread's heap. If aCountAll
is true, the function checks
that the total number of allocated cells on the heap is the same as
aCount
. If aCountAll
is false, the function checks
that the number of allocated cells at the current nested level is the same as
aCount
.
If checking fails, the function raises a panic. Information about the failure is put into the panic category, which takes the form:
ALLOC COUNT\rExpected aaa\rAllocated bbb\rLn: ccc
ddd
Where aaa
is the value aCount
,
bbb
is the number of allocated heap cells, ccc
is a
line number, copied from aLineNum
, and ddd
is a file
name, copied from the descriptor aFileName
.
Notes:
The panic number is 1.
This function can be called explicitly, or generated using
the corresponding macros __UHEAP_CHECK
,
__UHEAP__CHECKALL
, __KHEAP_CHECK
or
__KHEAP_CHECKALL
. Using the macros has the advantage that the
function call is only generated for debug builds.
|
static void __DbgSetAllocFail(RHeap::TDbgHeapType aHeapType,RHeap::TAllocFail aType,TInt aRate);
Simulates a heap allocation failure for the current thread's
heap. The failure occurs on subsequent calls to new
or any of the
functions which allocate memory from the heap.
The timing of the allocation failure depends on the type of
allocation failure requested, i.e. on the value of aType
.
The simulation of heap allocation failure is cancelled if
aType
is given the value RHeap::ENone
.
Notes:
If the failure type is RHeap::EFailNext
, the
next attempt to allocate from the heap fails; however, no further failures will
occur.
For failure types RHeap::EFailNext
and
RHeap::ENone
, set aRate
to 1.
This function can be called explicitly, or generated using
the corresponding macros __UHEAP_SETFAIL
,
__UHEAP_FAILNEXT
, __UHEAP_RESET
,
__KHEAP_SETFAIL
, __KHEAP_FAILNEXT
, or
__KHEAP_RESET
. Using the macros has the advantage that the
function call is only generated for debug builds.
|
static TLanguage Language();
Returns the language of the current locale.
|
static TUint Collate(TUint aChar);
Converts the character to its collated form.
Collating is the process of removing differences between characters that are deemed unimportant for the purposes of ordering characters. The result of the conversion depends on the locale and on whether this is a UNICODE build or not.
Note:
For a non UNICODE build, if the binary value of the
character aChar
is greater than or equal to 0x100, then the
character returned is the same as the character passed to the function.
|
|
static TUint Fold(TUint aChar);
Folds the specified character. Folding converts the character to a form which can be used in tolerant comparisons without control over the operations performed. Tolerant comparisons are those which ignore character differences like case and accents.
The result of folding a character depends on the locale and on whether this is a UNICODE build or not.
Note:
For a non UNICODE build, if the binary value of the
character aChar
is greater than or equal to 0x100, then the
character returned is the same as the character passed to the function.
|
|
static TUint Fold(TUint aChar,TInt aFlags);
Folds the character according to a specified folding method.
In ER5, this function is only defined for UNICODE builds.
|
|
static TUint LowerCase(TUint aChar);
Converts the specified character to lower case. The result of the conversion depends on the locale and on whether this is a UNICODE build or not.
Note:
For a non UNICODE build, if the binary value of the
character aChar
is greater than or equal to 0x100, then the
character returned is the same as the character passed to the function.
|
|
static TUint UpperCase(TUint aChar);
Converts a specified character to upper case. The result of the conversion depends on the locale and on whether this is a UNICODE build or not.
Note:
For a non UNICODE build, if the binary value of the
character aChar
is greater than or equal to 0x100, then the
character returned is the same as the character passed to the function.
|
|
static TUint TitleCase(TUint aChar);
Converts a specified character to its title case version.
In ER5, this function is only defined for UNICODE builds.
|
|
static TInt LockedInc(TInt& aValue);
Increments a TInt
value by 1 when the current
thread is locked.
The increment to aValue
is done while the current
thread is locked; i.e. no other thread is permitted to run until the sequence
of instructions which increment aValue
have completed. Hence the
function gives controlled access to a TInt
variable which may be
in a memory location accessible to more than one thread.
Notes:
See also LockedDec()
, the corresponding
decrementer function.
As an example of its use, the function is used in the
implementation of critical sections; see RCrticalSection
.
|
|
static TInt LockedDec(TInt& aValue);
Decrements a TInt
value by 1 when the current
thread is locked.
The decrement from aValue
is done while the
current thread is locked; i.e. no other thread is permitted to run until the
sequence of instructions which decrement aValue
have completed.
Hence the function gives controlled access to a TInt
variable
which may be in a memory location accessible to more than one thread.
Notes:
See also LockedInc()
, the corresponding
incrementer function.
As an example of its use, the function is used in the
implementation of critical sections; see RCrticalSection
.
|
|
static TInt InfoPrint(const TDesC& aDes);
Invokes the notify server to display a text message on the screen for a short time.
|
|
static TInt SetHomeTime(const TTime& aTime);
Sets the machine's home time to a specified time value.
|
|
static void After(TTimeIntervalMicroSeconds32 anInterval);
Suspends the current thread until a specified time interval has expired.
|
static TInt At(const TTime& aTime);
Suspends the current thread until the specified absolute time. If the machine is off at that time, the machine will be turned on again.
|
|
static void SetCurrencySymbol(const TDesC& aSymbol);
Sets the system wide currency symbol.
Note:
On successful return from this function, a call to the
Set()
member function of a TCurrencySymbol
object
fetches the new currency symbol.
|
TTimeIntervalSeconds InactivityTime();
Supported from 6.0
Returns the time since the last user activity.
|
void ResetInactivityTime();
Supported from 6.0
Resets all user inactivity timers.
static TUint TickCount();
Returns the machine's current tick count.
The period between ticks is platform dependent.
|
static TTimerLockSpec LockPeriod();
Returns which of the periods the clock is currently in.
|
static RHeap& Heap();
Returns a reference to the handle to the current thread's heap.
|
static RHeap* SwitchHeap(RHeap* aHeap);
Changes the current thread's heap.
|
|
static TAny* Alloc(TInt aSize);
Allocates a cell of specified size from the current thread's
heap. If there is insufficient memory available on the heap from which to
allocate a cell of the required size the function returns
NULL
.
Note:
The maximum unsigned value of aSize
must be
less than the value of KMaxTInt
/2. Passing an unsigned value
greater than or equal to KMaxTInt
/2 causes the functions to raise
a USER 47 panic. For example, calling Alloc(-1)
causes a
panic.
The resulting size of the allocated cell may be rounded up
to a value greater than aSize
, but is guaranteed to be not less
than aSize
.
|
|
static TAny* AllocL(TInt aSize);
Allocates a cell of specified size from the current thread's heap and leaves if there is insufficient memory in the heap.
Notes:
The maximum unsigned value of aSize
must be
less than the value of KMaxTInt
/2. Passing an unsigned value
greater than or equal to KMaxTInt
/2 causes the functions to raise
a USER 47 panic. For example, calling Alloc(-1)
causes a
panic.
The resulting size of the allocated cell may be rounded up
to a value greater than aSize
, but is guaranteed to be not less
than aSize
.
|
|
static TAny* AllocLC(TInt aSize);
Allocates a cell of specified size from the current thread's heap, and if successful places a pointer to the cell on the cleanup stack. The function leaves if there is insufficient memory in the heap.
Notes:
The maximum unsigned value of aSize
must be
less than the value of KMaxTInt
/2. Passing an unsigned value
greater than or equal to KMaxTInt
/2 causes the functions to raise
a USER 47 panic. For example, calling Alloc(-1)
causes a
panic.
The resulting size of the allocated cell may be rounded up
to a value greater than aSize
, but is guaranteed to be not less
than aSize
.
|
|
static TAny* Adjust(TAny* aCell,TInt anOffset,TInt aDelta);
Stretches or shrinks an existing cell by a specified amount at a specified offset from the start of the cell.
If successful, the function returns a pointer to the adjusted
cell. The adjusted cell may be at a different location from the original cell,
i.e. the returned pointer may be different to the value of aCell
.
If adjustment fails, the content of the original cell is preserved.
Shrinking of the cell occurs when aDelta
is
negative and means the removal of (the magnitude of) aDelta
bytes
from the cell, starting at offset anOffset
from the start of the
cell.
Stretching a cell occurs when aDelta
is positive
and means the insertion of aDelta
bytes into the cell at offset
anOffset
from the start of the cell and copying the original
content of the cell at offset anOffset
to offset
anOffset+aDelta
.
If necessary, the cell is reallocated. If there is insufficient
memory available in the heap from which to reallocate the cell to the required
size the function returns NULL
.
Note:
The size of the adjusted cell may be rounded up from the specified value.
|
|
static TAny* AdjustL(TAny* aCell,TInt anOffset,TInt aDelta);
Stretches or shrinks an existing cell by a specified amount at a specified offset from the start of the cell and leaves if there is insufficient memory in the heap to adjust or reallocate the cell.
If successful, the function returns a pointer to the adjusted
cell. The returned pointer may be different to the value of aCell
since the cell is re-allocated if there is insufficient room for adjustment at
the current cell position. If adjustment fails, the content of the original
cell is preserved.
Shrinking of the cell occurs when aDelta
is
negative and means the removal of (the magnitude of) aDelta
bytes
from the cell, starting at offset anOffset
from the start of the
cell.
Stretching a cell occurs when aDelta
is positive
and means the insertion of aDelta
bytes into the cell at offset
anOffset
from the start of the cell and copying the original
content of the cell at offset anOffset
to offset
anOffset+aDelta
.
Note:
The size of the adjusted cell may be rounded up from the specified value.
|
|
static TInt AllocLen(const TAny* aCell);
Returns the length of the specified allocated heap cell. The cell is assumed to be in the current thread’s heap.
|
|
static TInt AllocSize(TInt& aTotalAllocSize);
Returns the total number of cells allocated on the current thread’s heap and the total space allocated to them.
|
|
static TInt Available(TInt& aBiggestBlock);
Returns the total free space currently available on the current thread's heap and the space available in the largest free block.
The space available represents the total space which can be allocated.
Note:
Compressing the heap may reduce the total free space available and the space available in the largest free block.
|
|
static TInt CountAllocCells();
Returns the total number of cells allocated on the current thread's heap.
If the TInt&
argument is passed, then, on
return, aFreeCount
contains the number of free cells on the
heap.
|
static TInt CountAllocCells(TInt& aFreeCount);
Returns the total number of cells allocated, and the number of free cells, on the current thread's heap.
|
|
static void Free(TAny* aCell);
Frees a specified cell and returns it to the current thread's heap.
If aCell
is not NULL
, it must point
to a valid cell, otherwise the function raises a USER 42 panic.
|
static void FreeZ(TAny*& aCell);
Frees a specified cell, returns it to the current thread's
heap, and resets the pointer to NULL
.
If aCell
is not NULL
, it must point
to a valid cell, otherwise the function raises a USER 42 panic.
|
static TAny* ReAlloc(TAny* aCell,TInt aSize);
Increases or decreases the size of an existing cell. If there
is insufficient memory available in the heap from which to reallocate the cell
to the required size the function returns NULL
.
If successful, the functions return a pointer to the
reallocated cell. The reallocated cell may be at a different location from the
original cell, i.e. the returned pointer may be different to the value of
aCell
. However, if the cell is smaller than the original, it is
guaranteed not to move.
If the location of the new cell is different to that of the original cell, the content of the original cell is copied to the reallocated cell.
If reallocation fails, the content of the original cell is preserved.
Notes:
The maximum permitted unsigned value of aSize
is defined as the unsigned value of KMaxTInt
/2. Passing an
unsigned value greater than this causes the functions to raise a USER 47 panic.
For example, calling ReAlloc(someptr,-1)
causes a panic.
The resulting size of the re-allocated cell may be rounded
up to a value greater than aSize
, but is guaranteed to be not less
than aSize
.
|
|
static TAny* ReAllocL(TAny* aCell,TInt aSize);
Increases or decreases the size of an existing cell and leaves if there is insufficient memory available in the heap from which to reallocate the cell to the required size.
If successful, the functions return a pointer to the
reallocated cell. The reallocated cell may be at a different location from the
original cell, i.e. the returned pointer may be different to the value of
aCell
. However, if the cell is smaller than the original, it is
guaranteed not to move.
If the location of the new cell is different to that of the original cell, the content of the original cell is copied to the reallocated cell.
If reallocation fails, the content of the original cell is preserved.
Notes:
The maximum permitted unsigned value of aSize
is defined as the unsigned value of KMaxTInt
/2. Passing an
unsigned value greater than this causes the functions to raise a USER 47 panic.
For example, calling ReAlloc(someptr,-1)
causes a panic.
The resulting size of the re-allocated cell may be rounded
up to a value greater than aSize
, but is guaranteed to be not less
than aSize
.
|
|
static TInt CompressAllHeaps();
Compresses all the chunks containing heaps
|
static TBool QueryVersionSupported(const TVersion& aCurrent,const TVersion& aRequested);
Compares two version objects and returns a true if the test
version is less than the current version. Version information is encapsulated
by a TVersion
type object and consists of a major version number,
a minor version number and a build number.
The function returns true if one of the following conditions is true:
the test major version is strictly less than the current major version
the test major version is equal to the current major version and the test minor version is less than or equal to the current minor version
If neither condition is true, the function returns false.
|
|
static TVersion Version();
Gets the version of the operating system.
|