Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
TBufC< S > Class Template Reference

A build-independent non-modifiable buffer descriptor. More...

#include <e32cmn.h>

Inheritance diagram for TBufC< S >:

Public Member Functions

 TBufC ()
 Constructs an empty build independent non-modifiable buffer descriptor.
 
 TBufC (const TText *aString)
 Constructs a build independent non-modifiable buffer descriptor from a zero terminated string.
 
 TBufC (const TDesC &aDes)
 Constructs a build-independent non-modifiable buffer descriptor from any existing build independent descriptor.
 
TBufC< S > & operator= (const TText *aString)
 Copies data into this descriptor, replacing any existing data.
 
TBufC< S > & operator= (const TDesC &aDes)
 Copies data into this descriptor, replacing any existing data.
 
TPtr Des ()
 Creates and returns a build-independent modifiable pointer descriptor for the data represented by this build-independent non-modifiable buffer descriptor.
 

Detailed Description

template<TInt S>
class TBufC< S >

A build-independent non-modifiable buffer descriptor.

This is a descriptor class which provides a buffer of fixed length for containing and accessing TUint16 or TUint8 data, depending on the build.

The class intended for instantiation. The 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.

This class derives from TBufCBase16 for a Unicode, non-kernel build, but derives from TBufCBase8 for a non-Unicode build.

See also
TDesC
TDesC8
TDesC16
TPtr
TPtr8
TPtr16
TBufC8
TBufC16
API status
Published to all clients. Released API.

Definition at line 1521 of file e32cmn.h.

Constructor & Destructor Documentation

◆ TBufC() [1/3]

template<TInt S>
TBufC< S >::TBufC ( )
inline

Constructs an empty build independent 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.

TBufC::operator=

(generated from Symbian Developer Library)

◆ TBufC() [2/3]

template<TInt S>
TBufC< S >::TBufC ( const TText *  aString)
inline

Constructs a build independent 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
aStringA pointer to a zero terminated string.

Panic condition: USER 8, if the length of the string, excluding the zero terminator, is greater than the value of the integer template parameter for the 16-bit build variant.

Panic condition: USER 20, if the length of the string, excluding the zero terminator, is greater than the value of the integer template parameter for the 8-bit build variant.

(generated from Symbian Developer Library)

◆ TBufC() [3/3]

template<TInt S>
TBufC< S >::TBufC ( const TDesC &  aDes)
inline

Constructs a build-independent non-modifiable buffer descriptor from any existing build independent 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.

The length of the source descriptor must not be greater than the value of the integer template parameter, otherwise the constructor raises a USER 20 panic for an 8 bit build variant or a USER 8 panic for a 16 bit (Unicode) build variant.

Parameters
aDesThe source build independent non-modifiable descriptor.

Panic condition: USER 8, if the length of the source descriptor is greater than the value of the integer template parameter for the 16-bit build variant.

Panic condition: USER 20, if the length of the source descriptor is greater than the value of the integer template parameter for the 8-bit build variant.

(generated from Symbian Developer Library)

Member Function Documentation

◆ Des()

template<TInt S>
TPtr TBufC< S >::Des ( )
inline

Creates and returns a build-independent modifiable pointer descriptor for the data represented by this build-independent 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.

(generated from Symbian Developer Library)

◆ operator=() [1/2]

template<TInt S>
TBufC< S > & TBufC< S >::operator= ( const TDesC &  aDes)
inline

Copies data into this descriptor, replacing any existing data.

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

Parameters
aDesA build independent non-modifiable descriptor.

Panic condition: USER 11, if the length of the descriptor aDes is greater than the maximum length of this (target) descriptor for the 16-bit build variant.

Panic condition: USER 23, if the length of the descriptor aDes is greater than the maximum length of this (target) descriptor for the 8-bit build variant.

(generated from Symbian Developer Library)

◆ operator=() [2/2]

template<TInt S>
TBufC< S > & TBufC< S >::operator= ( const TText *  aString)
inline

Copies data into this descriptor, replacing any existing data.

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

Parameters
aStringA pointer to a zero-terminated string.

Panic condition: USER 11, if the length of the string, excluding the zero terminator, is greater than the maximum length of this (target) descriptor for the 16-bit build variant.

Panic condition: USER 23, if the length of the string, excluding the zero terminator, is greater than the maximum length of this (target) descriptor for the 8-bit build variant.

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: