TResourceReader Class Reference

class TResourceReader

Interprets resource data read from a resource file.

To use an instance of this class, pass the buffer containing the resource data to it by calling SetBuffer().

The buffer containing the resource data is created by RResourceFile::AllocReadLC() or RResourceFile::AllocReadL() which reads the specified resource into it.

The current position within the buffer is always maintained and any request for data is always supplied from the current position. The current position is always updated .

TResourceReader::SetBuffer()

RResourceFile::AllocReadL()

RResourceFile::AllocReadLC()

Public Member Functions
IMPORT_C voidAdvance(TInt)
IMPORT_C const TAny *Ptr()
IMPORT_C voidRead(TAny *, TInt)
IMPORT_C CDesC16ArrayFlat *ReadDesC16ArrayL()
IMPORT_C CDesC8ArrayFlat *ReadDesC8ArrayL()
CDesCArrayFlat *ReadDesCArrayL()
IMPORT_C HBufC16 *ReadHBufC16L()
IMPORT_C HBufC8 *ReadHBufC8L()
HBufC *ReadHBufCL()
IMPORT_C TIntReadInt16()
IMPORT_C TIntReadInt32()
IMPORT_C TIntReadInt8()
IMPORT_C TReal64ReadReal64()
TPtrC ReadTPtrC()
TPtrC ReadTPtrC(TInt, const TDesC8 *)
IMPORT_C TPtrC16ReadTPtrC16()
IMPORT_C TPtrC16ReadTPtrC16(TInt, const TDesC8 *)
IMPORT_C TPtrC8ReadTPtrC8()
IMPORT_C TPtrC8ReadTPtrC8(TInt, const TDesC8 *)
IMPORT_C TUintReadUint16()
IMPORT_C TUintReadUint32()
IMPORT_C TUintReadUint8()
IMPORT_C voidRewind(TInt)
IMPORT_C voidSetBuffer(const TDesC8 *)
Private Member Functions
voidCreateImpl()
TResourceReaderImpl *Impl()
const TResourceReaderImpl *Impl()
TInt ReadInt16L()
TInt ReadInt32L()
TInt ReadInt8L()
TReal64 ReadReal64L()
TPtrC16 ReadTPtrC16L()
TPtrC16 ReadTPtrC16L(TInt, const TDesC8 *)
TPtrC8 ReadTPtrC8L()
TPtrC8 ReadTPtrC8L(TInt, const TDesC8 *)
TUint ReadUint16L()
TUint ReadUint32L()
TUint ReadUint8L()
Private Member Enumerations
enumanonymous { KRsReaderSize = 12 }
Private Attributes
TUint8 iImpl

Member Functions Documentation

Advance(TInt)

IMPORT_C voidAdvance(TIntaLength)

Parameters

TInt aLength

CreateImpl()

voidCreateImpl()[private]

Impl()

TResourceReaderImpl *Impl()[private]

Impl()

const TResourceReaderImpl *Impl()const [private]

Ptr()

IMPORT_C const TAny *Ptr()

Read(TAny *, TInt)

IMPORT_C voidRead(TAny *aPtr,
TIntaLength
)

Parameters

TAny * aPtr
TInt aLength

ReadDesC16ArrayL()

IMPORT_C CDesC16ArrayFlat *ReadDesC16ArrayL()

ReadDesC8ArrayL()

IMPORT_C CDesC8ArrayFlat *ReadDesC8ArrayL()

ReadDesCArrayL()

CDesCArrayFlat *ReadDesCArrayL()[inline]

Interprets the data at the current buffer position as an array of leading byte count data and constructs a build independent flat array of descriptors.

Each descriptor in the descriptor array corresponds to an element of the resource array.

At the current buffer position, the buffer is expected to contain an array of data elements preceded by a TInt16 value defining the number of elements within that array.

Each element of the array is interpreted as:

a byte value defining the number of text characters or the length of binary data

followed by:

the text characters or binary data. This resource data is interpreted as either 8-bit or 16-bit, depending on the build.

The current position within the resource buffer is updated. If the resulting position lies beyond the end of the resource buffer, then the function raises a BAFL 4 panic.

Use this build independent variant when the elements contain text. If the elements contain binary data, use the explicit 8-bit variant ReadDesC8ArrayL().

A pointer to a build independent flat descriptor array.

ReadHBufC16L()

IMPORT_C HBufC16 *ReadHBufC16L()

ReadHBufC8L()

IMPORT_C HBufC8 *ReadHBufC8L()

ReadHBufCL()

HBufC *ReadHBufCL()[inline]

Interprets the data at the current buffer position as leading byte count data and constructs a build independent heap descriptor containing a copy of this data.

The data is interpreted as:

a byte value defining the number of text characters or the length of binary data

followed by:

the text characters or binary data. This resource data is interpreted as either 8-bit or 16-bit, depending on the build.

If the value of the leading byte is zero, the function assumes that no data follows the leading byte and returns a NULL pointer.

The current position within the resource buffer is updated. If the resulting position lies beyond the end of the resource buffer, then the function raises a BAFL 4 panic.

Use this build independent variant when the resource contains text. If the resource contains binary data, use the explicit 8-bit variant ReadHBufC8L().

A pointer to the heap descriptor containing a copy of the data following the leading byte count at the current position within the resource buffer. The pointer can be NULL.

ReadInt16()

IMPORT_C TIntReadInt16()

ReadInt16L()

TInt ReadInt16L()[private]

ReadInt32()

IMPORT_C TIntReadInt32()

ReadInt32L()

TInt ReadInt32L()[private]

ReadInt8()

IMPORT_C TIntReadInt8()

ReadInt8L()

TInt ReadInt8L()[private]

ReadReal64()

IMPORT_C TReal64ReadReal64()

ReadReal64L()

TReal64 ReadReal64L()[private]

ReadTPtrC()

TPtrC ReadTPtrC()[inline]

Interprets the data at the current buffer position as leading byte count data and constructs a non modifiable pointer descriptor to represent this data.

The data is interpreted as:

a byte value defining the number of text characters or the length of binary data

followed by:

the text characters or binary data. This resource data is interpreted as either 8-bit or 16-bit, depending on the build.

If the value of the leading byte is zero, calling Length() on the returned TPtrC returns zero.

The current position within the resource buffer is updated. If the resulting position lies beyond the end of the resource buffer, then the function raises a BAFL 4 panic.

Use this build independent variant when the resource contains text. If the resource contains binary data, use the explicit 8-bit variant ReadTPtrC8().

A non modifiable pointer descriptor representing the data following the leading byte count at the current position within the resource buffer.

ReadTPtrC(TInt, const TDesC8 *)

TPtrC ReadTPtrC(TIntaIndex,
const TDesC8 *aBuffer
)[inline]

Interprets the data within the specified resource buffer as an array of leading byte count data and constructs a non modifiable pointer descriptor to represent an element within this array.

The function sets the buffer containing the resource data and sets the current position to the start of this buffer. Any buffer set by a previous call to SetBuffer() etc, is lost.

The buffer is expected to contain an array of data elements preceded by a TInt16 value defining the number of elements within that array.

Each element of the array is interpreted as:

a byte value defining the number of text characters or the length of binary data

followed by:

the text characters or binary data. This resource data is interpreted as either 8-bit or 16-bit, depending on the build.

If the value of the leading byte is zero, calling Length() on the returned TPtrC returns zero.

The current position within the resource buffer is updated. If the resulting position lies beyond the end of the resource buffer, then the function raises a BAFL 4 panic.

Use this build independent variant when the elements contain text. If the elements contain binary data, use the explicit 8-bit variant ReadTPtrC8(TInt,const TDesC8*).

A non modifiable pointer descriptor representing the data following the leading byte count of the element at the specified position within the array.

Parameters

TInt aIndexThe position of the element within the array. This value is relative to zero.
const TDesC8 * aBufferThe buffer containing the resource data.

ReadTPtrC16()

IMPORT_C TPtrC16ReadTPtrC16()

ReadTPtrC16(TInt, const TDesC8 *)

IMPORT_C TPtrC16ReadTPtrC16(TIntaIndex,
const TDesC8 *aBuffer
)

Parameters

TInt aIndex
const TDesC8 * aBuffer

ReadTPtrC16L()

TPtrC16 ReadTPtrC16L()[private]

ReadTPtrC16L(TInt, const TDesC8 *)

TPtrC16 ReadTPtrC16L(TIntaIndex,
const TDesC8 *aBuffer
)[private]

Parameters

TInt aIndex
const TDesC8 * aBuffer

ReadTPtrC8()

IMPORT_C TPtrC8ReadTPtrC8()

ReadTPtrC8(TInt, const TDesC8 *)

IMPORT_C TPtrC8ReadTPtrC8(TIntaIndex,
const TDesC8 *aBuffer
)

Parameters

TInt aIndex
const TDesC8 * aBuffer

ReadTPtrC8L()

TPtrC8 ReadTPtrC8L()[private]

ReadTPtrC8L(TInt, const TDesC8 *)

TPtrC8 ReadTPtrC8L(TIntaIndex,
const TDesC8 *aBuffer
)[private]

Parameters

TInt aIndex
const TDesC8 * aBuffer

ReadUint16()

IMPORT_C TUintReadUint16()

ReadUint16L()

TUint ReadUint16L()[private]

ReadUint32()

IMPORT_C TUintReadUint32()

ReadUint32L()

TUint ReadUint32L()[private]

ReadUint8()

IMPORT_C TUintReadUint8()

ReadUint8L()

TUint ReadUint8L()[private]

Rewind(TInt)

IMPORT_C voidRewind(TIntaLength)

Parameters

TInt aLength

SetBuffer(const TDesC8 *)

IMPORT_C voidSetBuffer(const TDesC8 *aBuffer)

Parameters

const TDesC8 * aBuffer

Member Enumerations Documentation

Enum anonymous

Enumerators

KRsReaderSize = 12

Member Data Documentation

TUint8 iImpl

TUint8 iImpl[private]