Skip to content

TBAMoment

Abstract superclass for date and time attributes

Unit: BoldAttributes

Declaration

TBAMoment = class(TBoldAttribute)

Hierarchy

  1. TObject
  2. TBoldMemoryManagedObject
  3. TBoldFlaggedObject
  4. TBoldSubscribableObject
  5. TBoldElement
  6. TBoldDomainElement
  7. TBoldMember
  8. TBoldAttribute
  9. TBAMoment
  10. Direct subclasses
  11. TBADate
  12. TBADateTime
  13. TBATime

Description

This is an abstract superclass of the three different classes that uses TDateTime internally to store their data (TBADateTime, TBATime, TBADate). It has no public data-properties.

Properties

Name Summary Notes
AsDate protected
AsDateTime protected
AsTime protected
Days The day part of the date protected, read-only
Hours The hour part of the time protected, read-only
Minutes The minutes part of the time protected, read-only
Months The month part of the date protected, read-only
Seconds The seconds part of the time protected, read-only
Years The year part of the date protected, read-only

AsDate

property AsDate: TDateTime;

AsDateTime

property AsDateTime: TDateTime;

AsTime

property AsTime: TDateTime;

Days

property Days: Word;

Days contains the day part of the date value. For a date 1970-03-17, Days will return 17.

See Also

Hours

property Hours: Word;

Hours contains the hours part of the time value. For a time 10:15:16, Hours will return 10.

See Also

Minutes

property Minutes: Word;

Minutes contains the minutes part of the time value. For a time 10:15:16, Minutes will return 15.

See Also

Months

property Months: Word;

Months contains the month part of the date value. For a date 1970-03-17, Months will return 3.

See Also

Seconds

property Seconds: Word;

Seconds contains the seconds part of the time value. For a time 10:15:16, Seconds will return 16.

See Also

Years

property Years: Word;

Years contains the year part of the date value. For a date 1970-03-17, Years will return 1970.

See Also

Methods

Name Summary Notes
Assign override
CanSetValue
CompareToAs override
GetAsDate protected
GetAsDateTime protected
GetAsTime protected
GetAsVariant override
MaySetValue Override to affect the result of CanSetValue . protected, virtual
SetAsDate protected
SetAsDateTime protected
SetAsTime protected
SetAsVariant override
SetEmptyValue override

Assign

procedure Assign(Source: TBoldElement); override; See also Ancestor Method

This copies the data from another TBAMoment.

CanSetValue

function CanSetValue(NewValue: TDateTime; Subscriber: TBoldSubscriber): Boolean;

Use this function to test if it is allowed to set the attribute to a specific value.

If a subscriber is sent to the function, this subscriber will be notified if the conditions have changed (so that an illegal value is now legal). It is OK to send a nilpointer instead.

CompareToAs

function CompareToAs(CompType: TBoldCompareType; BoldElement: TBoldElement): Integer; override; See also Ancestor Method

This will compare the internal value to the value of the BoldElement using the CompType as follows:

  • ctDate: Compares dates only
  • ctTime: Compares times only
  • cdDefault: Compares dates and times

The resultcodes used are:

  • self.[AsDate|AsTime|AsDateTime] < TBAMoment(BoldElement).[AsDate|AsTime|AsDateTime] returns -1
  • self.[AsDate|AsTime|AsDateTime] = TBAMoment(BoldElement).[AsDate|AsTime|AsDateTime] returns 0
  • self.[AsDate|AsTime|AsDateTime] > TBAMoment(BoldElement).[AsDate|AsTime|AsDateTime] returns 1

GetAsDate

function GetAsDate: TDateTime;

GetAsDateTime

function GetAsDateTime: TDateTime;

GetAsTime

function GetAsTime: TDateTime;

GetAsVariant

function GetAsVariant: Variant; override; See also Ancestor Method

MaySetValue

function MaySetValue(NewValue: TDateTime; Subscriber: TBoldSubscriber): Boolean; virtual;

A subclass of TBAMoment may override this method to prohibit setting the attribute to a specific value. If the result value is false, the setting will be aborted. If it is true, there may still be other reasons why the changing of the value is not allowed.

SetAsDate

procedure SetAsDate(Value: TDateTime);

SetAsDateTime

procedure SetAsDateTime(Value: TDateTime);

SetAsTime

procedure SetAsTime(Value: TDateTime);

SetAsVariant

procedure SetAsVariant(const Value: Variant); override; See also Ancestor Method

SetEmptyValue

procedure SetEmptyValue; override; See also Ancestor Method

Generated from the Bold 4.0 help (Help/BfD.chm) by Tools/chm2mkdocs.py; member lists reflect Bold 4.0, see the source for members added since.