Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32std.h
Link against: euser.lib

Class TBuf

template <TInt S>
#ifdef _UNICODE
class TBuf : public TBufBase16
#else
class TBuf : public TBufBase8
#endif

Support

Supported from 5.0

Description

Build-independent modifiable buffer descriptor. This is a descriptor class which provides a buffer of fixed length for containing, accessing and manipulating TText data.

The class is 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 determines the size of the data area created as part of the buffer descriptor object; this is also the maximum length of the descriptor.

The data is intended to be both accessed and modified. The base classes provide the functions through which the data is accessed.

NOTE: The derivation of this class is dependent on the build. The chart shown here is for 16-bit (Unicode) builds only. For 8-bit builds, read an "8" for each "16". TBufBase16 is an intermediate class derived from TDes16.

Derivation

TBufBuild-independent modifiable buffer descriptor
TDes16Modifiable 16 bit descriptor; abstract class
TDesC16Abstract base class for 16 bit descriptors

Defined in TBuf:
TBuf(), operator=

Inherited from TDes16:
Append(), AppendFill(), AppendFormat(), AppendFormatList(), AppendJustify(), AppendNum(), AppendNumFixedWidth(), AppendNumFixedWidthUC(), AppendNumUC(), Capitalize(), Collate(), Copy(), CopyC(), CopyCP(), CopyF(), CopyLC(), CopyUC(), Delete(), Fill(), FillZ(), Fold(), Format(), FormatList(), Insert(), Justify(), LowerCase(), MaxLength(), MaxSize(), Num(), NumFixedWidth(), NumFixedWidthUC(), NumUC(), PtrZ(), Repeat(), Replace(), SetLength(), SetMax(), Swap(), Trim(), TrimAll(), TrimLeft(), TrimRight(), UpperCase(), Zero(), ZeroTerminate(), operator+=(), operator[]()

Inherited from TDesC16:
Alloc(), AllocL(), AllocLC(), Compare(), CompareC(), CompareF(), Find(), FindC(), FindF(), Left(), Length(), Locate(), LocateF(), LocateReverse(), LocateReverseF(), Match(), MatchC(), MatchF(), Mid(), Ptr(), Right(), Size(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=()

See also:


Construction


TBuf()

TBuf()

Description

Constructor. Creates a build-independent modifiable buffer descriptor which contains no data.

The integer template parameter determines the size of the data area created as part of the object and defines the descriptor's maximum length.


TBuf()

TBuf(const TBuf<S>& aBuf);

Description

Copy constructor. Creates the build-independent modifiable buffer descriptor from an existing build indepnedent modifiable buffer descriptor having the same template value.

The integer template parameter determines the size of the data area created as part of the object and defines the descriptor's maximum length.

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

Parameters

const TBuf<S>& aBuf

The source build independent modifiable buffer descriptor with the same template length as this descriptor.


TBuf()

TBuf(TInt aLength);

Description

Constructor specifying length. Constructs an empty build independent modifiable buffer descriptor and sets the its length to the specified value. No data is assigned to the descriptor.

The integer template parameter determines the size of the data area created as part of the object and defines the descriptor's maximum length.

Parameters

TInt aLength

The length of this modifiable buffer descriptor. This value must be non-negative and must not be greater than the maximum length (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.


TBuf()

TBuf(const TDesC& aDes);

Description

Construction from any build independent descriptor. Constructs the build-independent modifiable buffer descriptor from any existing build-independent descriptor.

The integer template parameter determines the size of the data area created as part of this object and defines the descriptor's maximum length.

Data is copied from the source descriptor into this modifiable buffer descriptor and the length of this modifiable 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 23 panic for an 8 bit build variant or a USER 11 panic for a 16 bit (Unicode) build variant.

Parameters

const TDesC& aDes

The source build independent non-modifiable descriptor.


TBuf()

TBuf(const TText* aString);

Description

Construction from a C-style string. Constructs the build-independent 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.

The length of the string, excluding the zero terminator, must not be greater than the value of the integer template parameter, otherwise the constructor raises a USER 23 panic for an 8 bit build variant or a USER 11 panic for a 16 bit (Unicode) build variant.

Parameters

const TText* aString

A pointer to a zero terminated string.

[Top]


Copying data, replacing existing data


operator=

TBuf<S>& operator=(const TBuf<S>& aBuf);
TBuf<S>& operator=(const TDesC& aDes);
TBuf<S>& operator=(const TUint* aString);

Description

Copies data into this build independent modifiable buffer descriptor replacing any existing data. The length of this descriptor is set to reflect the new data.

Parameters

const TBuf<S>& aBuf

The source build independent modifiable buffer descriptor with the same template value.

const TDesC& aDes

A build independent non-modifiable descriptor. The length of the data cannot be greater than the maximum length of the target descriptor otherwise the function raises a USER 23 panic for an 8 bit build variant or a USER 11 panic for a 16 bit (Unicode) build variant.

const TText* aString

A pointer to a zero-terminated string. The length of the string, excluding the zero terminator, must not be greater than the maximum length of the target descriptor, otherwise the function raises a USER 23 panic for an 8 bit build variant or a USER 11 panic for a 16 bit (Unicode) build variant.

Return value

TBuf<S>&

A reference to this build independent modifiable buffer descriptor.