Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <e32des16.h>

Class TBufC16

class TBufC16 : public TBufCBase16;

Description

16-bit non-modifiable buffer descriptor.

This is a descriptor class which provides a buffer of fixed length for containing and accessing TUint16 data.

The class intended for instantiation. The 16-bit data that the descriptor represents is part of the descriptor object itself.

The class is templated, based on an integer value which defines the size of the descriptor's data area.

The data is intended to be accessed, but not modified; however, it can be completely replaced using the assignment operators of this class. The base class provides the functions through which the data is accessed.

Derivation

Members

Defined in TBufC16:

See also:


Construction and destruction


TBufC16()

inline TBufC16();

Description

Constructs an empty 16-bit non-modifiable buffer descriptor.

It contains no data.

The integer template parameter determines the size of the data area which is created as part of the buffer descriptor object.

Data can, subsequently, be assigned into this buffer descriptor using the assignment operators.


TBufC16(const TUint16 *)

inline TBufC16(const TUint16 *aString);

Description

Constructs the 16-bit non-modifiable buffer descriptor from a zero terminated string.

The integer template parameter determines the size of the data area which is created as part of this object.

The string, excluding the zero terminator, is copied into this buffer descriptor's data area. The length of this buffer descriptor is set to the length of the string, excluding the zero terminator.

Parameters

const TUint16 *aString

A pointer to a zero terminated string.

Panic codes

USER

8, if the length of the string, excluding the zero terminator, is greater than the value of the integer template parameter.


TBufC16(const TDesC16 &)

inline TBufC16(const TDesC16 &aDes);

Description

Constructs the 16-bit non-modifiable buffer descriptor from any existing descriptor.

The integer template parameter determines the size of the data area which is created as part of this object.

Data is copied from the source descriptor into this buffer descriptor and the length of this buffer descriptor is set to the length of the source descriptor.

Parameters

const TDesC16 &aDes

The source 16-bit non-modifiable descriptor.

Panic codes

USER

8, if the length of the source descriptor is greater than the value of the integer template parameter.

[Top]


Member functions


operator=(const TUint16 *)

inline TBufC16< S >& operator=(const TUint16 *aString);

Description

Copies data into this descriptor replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters

const TUint16 *aString

A pointer to a zero-terminated string.

Return value

TBufC16< S > &

A reference to this descriptor.

Panic codes

USER

11, if the length of the string, excluding the zero terminator, is greater than the maximum length of this (target) descriptor.


operator=(const TDesC16 &)

inline TBufC16< S >& operator=(const TDesC16 &aDes);

Description

Copies data into this descriptor, replacing any existing data.

The length of this descriptor is set to reflect the new data.

Parameters

const TDesC16 &aDes

A 16-bit non-modifiable descriptor.

Return value

TBufC16< S > &

A reference to this descriptor.

Panic codes

USER

11, if the length of the descriptor aDes is greater than the maximum length of this (target) descriptor.


Des()

inline TPtr16 Des();

Description

Creates and returns a 16-bit modifiable pointer descriptor for the data represented by this 16-bit non-modifiable buffer descriptor.

The content of a non-modifiable buffer descriptor normally cannot be altered, other than by complete replacement of the data. Creating a modifiable pointer descriptor provides a way of changing the data.

The modifiable pointer descriptor is set to point to this non-modifiable buffer descriptor's data.

The length of the modifiable pointer descriptor is set to the length of this non-modifiable buffer descriptor.

The maximum length of the modifiable pointer descriptor is set to the value of the integer template parameter.

When data is modified through this new pointer descriptor, the lengths of both it and this constant buffer descriptor are changed.

Return value

TPtr16

A 16-bit modifiable pointer descriptor representing the data in this 16-bit non-modifiable buffer descriptor.

[Top]


Member data


iBuf

protected: TUint16 iBuf[((((S)+(sizeof(TInt)/sizeof(TInt16))-1)/(sizeof(TInt)/sizeof(TInt16)))*(sizeof(TInt)/sizeof(TInt16)))];

Description