Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: fldbltin.h
Link against: field.lib

Class CDateTimeField

CDateTimeField

Support

Supported from 5.0

Description

A date/time field. This is a field which may contain any or all components of the date and time, and can be formatted in a variety of ways. The class stores a format string, which is used by the Value() function to format the current date/time. For information on date/time formatting, see the documentation of TTime::FormatL().

Derivation

CBaseBase class for all classes to be instantiated on the heap
CDateTimeFieldA date/time field
CTextFieldThe abstract base class for all fields

Defined in CDateTimeField:
CDateTimeField(), ExternalizeL(), FormatString(), InternalizeL(), SetFormat(), Type(), Value()

Inherited from CBase:
operator new()

Inherited from CTextField:
RestoreL(), StoreL()


Construction


CDateTimeField()

CDateTimeField();

Description

The default C++ constructor initialises the object's date/time format string to %D%M%Y%/0%1%/1%2%/2%3%/3. This produces fields in the format "31/05/2000" (with no time component, and using the current locale's date separators).

[Top]


Stream persistence


InternalizeL()

virtual void InternalizeL(RReadStream& aStream);

Description

Internalises the format string from a read stream. The presence of this function means that the standard templated operator>>() (defined in s32strm.h) is available to internalise objects of this class.

Parameters

RReadStream& aStream

Stream from which the format string should be internalised.


ExternalizeL()

virtual void ExternalizeL(RWriteStream& aStream)const;

Description

Externalises the format string to a write stream. The presence of this function means that the standard templated operator<<() (defined in s32strm.h) is available to externalise objects of this class.

Parameters

RWriteStream& aStream

Stream to which the format string should be externalised.

[Top]


Field type


Type()

TUid Type()const;

Description

Gets the field's type UID.

Return value

TUid

KDateTimeFieldUid.

[Top]


Evaluate field


Value()

virtual TInt Value(TPtr& aValueText);

Description

Gets the current date/time, then formats it according to the field's format string. aValueText is set to the formatted date/time string if the buffer is large enough to contain it. If not, the function returns the length which is required to contain the formatted date/time string.

Parameters

TPtr& aValueText

Descriptor which on return contains the current date/time, formatted according to the format string.

Return value

TInt

Zero if aValueText is long enough to hold the formatted date/time string. Otherwise, the length of the buffer which is required to hold the string.

[Top]


Format string


FormatString()

const TDesC& FormatString()const;

Description

Gets the field's date/time format string.

Return value

TDesC&

The date/time format string.


SetFormat()

void SetFormat(const TDesC& aFormat);

Description

Sets the date/time format string. For information on the format string, see the documentation of TTime::FormatL().

Parameters

const TDesC& aFormat

The new date/time format string.