Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: fldbase.h
Link against: field.lib

Class CTextField

CTextField

Support

Supported from 5.0

Description

The abstract base class for all fields. A field contains information which relates to a text object and is automatically updated. Examples of fields are the page number and the current date and time. Fields must implement the pure virtual functions defined in this class, including Value() which should calculate and return the field's new value, and Type() which returns the field's type UID. The type UID identifies the field type to the field factory (see class MTextFieldFactory).

Derivation

CBaseBase class for all classes to be instantiated on the heap
CTextFieldThe abstract base class for all fields

Defined in CTextField:
ExternalizeL(), InternalizeL(), RestoreL(), StoreL(), Type(), Value()

Inherited from CBase:
operator new()


Stream persistence


ExternalizeL()

virtual void ExternalizeL(RWriteStream& aStream)const;

Description

Externalises the field data. Called by StoreL().

Calling this default implementation raises a panic. Concrete field classes with persistent data must provide their own implementation of this function. Concrete field classes with no persistent data must provide a StoreL() implementation that just returns KNullStreamId.

Parameters

RWriteStream& aStream

Not used.


InternalizeL()

virtual void InternalizeL(RReadStream& aStream)=0;

Description

Internalises the field data. Pure virtual. Called by RestoreL().

Parameters

RReadStream& aStream

Stream from which the field data should be internalised.


StoreL()

virtual TStreamId StoreL(CStreamStore& aStore)const;

Description

Stores the field data to a stream store. Concrete field types with no persistent data should override this function to return KNullStreamId.

Parameters

CStreamStore& aStore

Stream store to which the field data is written.

Return value

TStreamId

The ID of the stream store.


RestoreL()

virtual void RestoreL(const CStreamStore& aStore,TStreamId aId);

Description

Restores the field data from a stream store. Concrete field types with no persistent data should override this function to do nothing.

Parameters

const CStreamStore& aStore

Stream store containing the field data to restore.

TStreamId aId

The ID of the stream store in which the field data was previously stored.

[Top]


Field type


Type()

virtual TUid Type()const=0;

Description

Returns the field's type UID.

Return value

TUid

The field's type UID.

[Top]


Evaluate field


Value()

virtual TInt Value(TPtr& aValueText)=0;

Description

Sets aValueText to the current field value if the buffer is large enough. If not, aValueText is not changed, and the function returns the length which is required to hold the field's value.

Parameters

TPtr& aValueText

Descriptor which on return contains the field's updated value.

Return value

TInt

Zero on success, otherwise, the length of the buffer which is required to hold the field's updated value.