Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: agmrptd.h
Link against: agnmodel.lib

Class CAgnRptDef

CAgnRptDef

Support

Supported from 5.1

Description

A repeat definition, including exceptions, which is owned by an agenda entry. The object is set using CAgnEntry::SetRptDefL() and is returned using CAgnBasicEntry::RptDef() (or TAgnLiteEntry::RptDef()).

The repeat definition has a type (daily, weekly etc.) and stores a set of repeat details (e.g. start and end date, interval between repeats). The repeat details are stored using an instance of a TAgnRpt - derived class. They are set using SetDaily(), SetWeekly() etc. — these functions also set the type. It may optionally store an exception list, which is a list of the dates on which the repeat should not occur.

Note

When the repeat definition is set, the entry’s start date (or due date for a to-do entry) may be changed to the repeat definition’s start date.

Derivation

CAgnRptDefA repeat definition, including exceptions, which is owned by an agenda entry
CBaseBase class for all classes to be instantiated on the heap

Defined in CAgnRptDef:
AddExceptionL(), CopyL(), Daily(), DisplayNextOnly(), EndDate(), EndDateAsAgnDate(), Exceptions(), ExternalizeL(), FindException(), FindRptEndDate(), InstanceCount(), InternalizeL(), Interval(), IsAnInstance(), IsAnUnexceptedInstance(), MonthlyByDates(), MonthlyByDays(), NewL(), NudgeNextInstance(), NudgeNextUnexceptedInstance(), NudgePreviousInstance(), NudgePreviousUnexceptedInstance(), RemoveAllExceptions(), RemoveException(), RepeatForever(), RptDef(), SetDaily(), SetDisplayNextOnly(), SetEndDate(), SetInterval(), SetMonthlyByDates(), SetMonthlyByDays(), SetRepeatForever(), SetStartDate(), SetWeekly(), SetYearlyByDate(), SetYearlyByDay(), StartDate(), StartDateAsAgnDate(), Type(), Weekly(), YearlyByDate(), YearlyByDay(), operator==(), ~CAgnRptDef()

Inherited from CBase:
operator new()


Construction and destruction


NewL()

static CAgnRptDef* NewL();

Description

Allocates and constructs a repeat definition.

Return value

CAgnRptDef*

The pointer to the created repeat definition.


~CAgnRptDef()

virtual ~CAgnRptDef();

Description

The destructor frees all resources owned by the repeat definition, prior to its destruction.

[Top]


Copy


CopyL()

void CopyL(const CAgnRptDef* aRpt);

Description

Copies the contents of a repeat definition into this object.

Parameters

const CAgnRptDef* aRpt

Pointer to the item to be copied.

[Top]


Get repeat details


Daily()

TAgnDailyRpt Daily() const;

Description

If the repeat definition is of type EDaily, returns the repeat details. Otherwise, returns the repeat details as a daily repeat.

Return value

TAgnDailyRpt

The repeat details.


Weekly()

TAgnWeeklyRpt Weekly() const;

Description

If the repeat definition is of type EWeekly, returns the repeat details. Otherwise, returns the repeat details as a weekly repeat.

Return value

TAgnWeeklyRpt

The repeat details.


MonthlyByDates()

TAgnMonthlyByDatesRpt MonthlyByDates() const;

Description

If the repeat definition is of type EMonthlyByDates, returns the repeat details. Otherwise, returns the repeat details as a monthly repeat by dates.

Return value

TAgnMonthlyByDatesRpt

The repeat details.


MonthlyByDays()

TAgnMonthlyByDaysRpt MonthlyByDays() const;

Description

If the repeat definition is of type EMonthlyByDays, returns the repeat details. Otherwise, returns the repeat details as a monthly repeat by days.

Return value

TAgnMonthlyByDaysRpt

The repeat details.


YearlyByDate()

TAgnYearlyByDateRpt YearlyByDate() const;

Description

If the repeat definition is of type EYearlyByDate, returns the repeat details. Otherwise, returns the repeat details as a yearly repeat by date.

Return value

TAgnYearlyByDateRpt

The repeat details.


YearlyByDay()

TAgnYearlyByDayRpt YearlyByDay() const;

Description

If the repeat definition is of type EYearlyByDay, returns the repeat details. Otherwise, returns the repeat details as a yearly repeat by day.

Return value

TAgnYearlyByDayRpt

The repeat details.


StartDate()

TTime StartDate() const;

Description

Returns the start date of the repeat.

Return value

TTime

The start date.


StartDateAsAgnDate()

TAgnDate StartDateAsAgnDate() const;

Description

Returns the start date of the repeat as an agenda date.

Return value

TAgnDate

The start date.


EndDate()

TTime EndDate() const;

Description

Returns the end date of the repeat. If the object has been set to repeat forever, this value is the agenda model’s maximum date.

Return value

TTime

The end date.


EndDateAsAgnDate()

TAgnDate EndDateAsAgnDate() const;

Description

Returns the end date of the repeat as an agenda date.

Return value

TAgnDate

The end date as an agenda date.


Interval()

TInt Interval() const;

Description

Returns the interval between repeats.

Return value

TInt

The interval.


RptDef()

const TAgnRpt* RptDef() const;

Description

Returns a pointer to the repeat details.

Return value

TAgnRpt*

Pointer to the repeat details.


Type()

TType Type() const;

Description

Returns the repeat definition’s type, as set by SetDaily(), SetWeekly() etc.

Return value

TType

The repeat definition’s type.


NudgeNextInstance()

TBool NudgeNextInstance(TAgnDate aDay,TAgnDate& aNext) const;

Description

Tests whether there is another repeat instance date after aDay, including excepted instances. If there is, returns ETrue and sets aNext to it. If not, returns EFalse and sets aNext to the last valid instance date. If aDay is a valid instance, then aNext is set to it, not the next instance.

Example:

If repeat instances fall on 10th Jan and 20th Jan, then aDay = 10th Jan returns ETrue and aNext = 10th Jan. aDay = 11th to 19th Jan returns ETrue and aNext = 20th Jan. aDay = 21st Jan returns EFalse and aNext = 20th Jan.

Parameters

TAgnDate aDay

The date.

TAgnDate& aNext

On return contains the date of the next instance if there is one, otherwise the last valid instance date.

Return value

TBool

True if there is a next instance, otherwise False.


NudgeNextUnexceptedInstance()

TBool NudgeNextUnexceptedInstance(TAgnDate aDay,TAgnDate& aNext) const;

Description

Tests whether there is another unexcepted repeat instance date after aDay. If there is, returns ETrue and sets aNext to it. If not, returns EFalse and sets aNext to the last valid instance date. If aDay is a valid instance, then aNext is set to it, not the next instance.

Example:

If unexcepted repeat instances fall on 10th Jan and 20th Jan, then aDay = 10th Jan returns ETrue and aNext = 10th Jan. aDay = 11th to 19th Jan returns ETrue and aNext = 20th Jan. aDay = 21st Jan returns EFalse and aNext = 20th Jan.

Parameters

TAgnDate aDay

The date.

TAgnDate& aNext

On return contains the date of the next instance if there is one, otherwise the last valid instance date.

Return value

TBool

True if there is a next instance, otherwise False.


NudgePreviousInstance()

TBool NudgePreviousInstance(TAgnDate aDay,TAgnDate& aPrev) const;

Description

Tests whether there is a repeat instance date before aDay. If there is, returns ETrue and sets aNext to it. If not, returns EFalse and sets aNext to the last valid instance date. If aDay is a valid instance, then aNext is set to it, not the next instance.

Example:

If repeat instances fall on 10th Jan and 20th Jan, then aDay = 20th Jan returns ETrue and aNext = 20th Jan. aDay = 11th to 19th Jan returns ETrue and aNext = 10th Jan. aDay = 9th Jan returns EFalse and aNext = 10th Jan.

Parameters

TAgnDate aDay

The date.

TAgnDate& aPrev

On return contains the date of the previous instance if there is one, otherwise the first valid instance date.

Return value

TBool

True if there is a previous instance, otherwise False.


NudgePreviousUnexceptedInstance()

TBool NudgePreviousUnexceptedInstance(TAgnDate aDay,TAgnDate& aPrev) const;

Description

Tests whether there is an unexcepted repeat instance date before aDay. If there is, returns ETrue and sets aNext to it. If not, returns EFalse and sets aNext to the last valid instance date. If aDay is a valid instance, then aNext is set to it, not the next instance.

Example:

If unexcepted repeat instances fall on 10th Jan and 20th Jan, then aDay = 20th Jan returns ETrue and aNext = 20th Jan. aDay = 11th to 19th Jan returns ETrue and aNext = 10th Jan. aDay = 9th Jan returns EFalse and aNext = 10th Jan.

Parameters

TAgnDate aDay

The date.

TAgnDate& aPrev

On return contains the date of the previous instance if there is one, otherwise the first valid instance date.

Return value

TBool

True if there is a previous instance, otherwise False.


InstanceCount()

TUint InstanceCount() const;

Description

Returns the number of repeat instances generated by the repeat algorithm, including excepted instances.

Return value

TUint

The number of repeat instances.

[Top]


Exception list


Exceptions()

const CAgnExceptionList* Exceptions() const;

Description

Returns a pointer to the repeat definition’s exception list.

Return value

CAgnExceptionList*

Pointer to the exception list.


FindRptEndDate()

TTime FindRptEndDate(TUint aCount) const;

Description

Calculates and returns the repeat end date, given the number of instances.

Parameters

TUint aCount

The number of instances.

Return value

TTime

The end date if within range of the agenda, otherwise a null date.


AddExceptionL()

void AddExceptionL(const TAgnException& aException);

Description

Adds an exception to the list of exceptions (first creating the exception list if necessary).

Parameters

const TAgnException& aException

The exception to add to the list.


RemoveException()

TBool RemoveException(const TAgnException& aException);

Description

Removes one exception from the exception list. If it is the last exception in the list, the list is deleted.

Parameters

const TAgnException& aException

The exception to be removed.

Return value

TBool

ETrue if the exception was found and removed, otherwise EFalse.


RemoveAllExceptions()

void RemoveAllExceptions();

Description

Removes all the exceptions from the exception list.

[Top]


Set repeat details


SetDaily()

void SetDaily(const TAgnDailyRpt& aRpt);

Description

Sets the repeat type as daily and sets the repeat details to those contained in aRpt.

Parameters

const TAgnDailyRpt& aRpt

Daily repeat details.


SetWeekly()

void SetWeekly(const TAgnWeeklyRpt& aRpt);

Description

Sets the repeat type to weekly and sets the repeat details to those contained in aRpt.

Parameters

const TAgnWeeklyRpt& aRpt

Weekly repeat details.


SetMonthlyByDates()

void SetMonthlyByDates(const TAgnMonthlyByDatesRpt& aRpt);

Description

Sets the repeat type to be monthly by dates and sets the repeat details to those contained in aRpt.

Parameters

const TAgnMonthlyByDatesRpt& aRpt

Monthly by dates repeat details.


SetMonthlyByDays()

void SetMonthlyByDays(const TAgnMonthlyByDaysRpt& aRpt);

Description

Sets the repeat type to be monthly by days and sets the repeat details to those contained in aRpt.

Parameters

const TAgnMonthlyByDaysRpt& aRpt

Monthly by days repeat details.


SetYearlyByDate()

void SetYearlyByDate(const TAgnYearlyByDateRpt& aRpt);

Description

Sets the repeat type to yearly by date and sets the repeat details to those contained in aRpt.

Parameters

const TAgnYearlyByDateRpt& aRpt

Yearly repeat details.


SetYearlyByDay()

void SetYearlyByDay(const TAgnYearlyByDayRpt& aRpt);

Description

Sets the repeat type to yearly by day and sets the repeat details to those contained in aRpt.

Parameters

const TAgnYearlyByDayRpt& aRpt

Yearly repeat details.


SetDisplayNextOnly()

void SetDisplayNextOnly(TBool aDisplayNextOnly);

Description

Sets a flag to indicate whether or not only the next occurrence of a repeat after today should appear in views.

Parameters

TBool aDisplayNextOnly

ETrue = display next only, EFalse = display all occurrences.


SetStartDate()

void SetStartDate(const TTime& aStartDate);

Description

Sets the start date for this repeat. A panic occurs if aStartDate is outside the valid agenda range.

Parameters

const TTime& aStartDate

The start date.


SetStartDate()

void SetStartDate(TAgnDate aStartDate);

Description

Sets the start date for this repeat. A panic occurs if aStartDate is outside the valid range for a TAgnDate.

Parameters

TAgnDate aStartDate

The start date.


SetEndDate()

void SetEndDate(const TTime& aEndDate);

Description

Sets the end date for the repeat. A panic occurs if aEndDate is outside the valid agenda range.

Note

When the end date is set, the ‘repeat forever’ flag (if set) is automatically unset.

Parameters

const TTime& aEndDate

The end date of the repeat.


SetEndDate()

void SetEndDate(TAgnDate aEndDate);

Description

Sets the end date for the repeat. A panic occurs if aEndDate is outside the valid range for a TAgnDate.

Note

When the end date is set, the ‘repeat forever’ flag (if set) is automatically unset.

Parameters

TAgnDate aEndDate

The end date.


SetInterval()

void SetInterval(TUint aInterval);

Description

Sets the interval for the repeat. This is a number of days for a daily repeat, a number of weeks for a weekly repeat, etc.

Parameters

TUint aInterval

The interval.


SetRepeatForever()

void SetRepeatForever(TBool aRepeatForever);

Description

Sets whether the repeat should have no end date, so that it repeats forever.

Parameters

TBool aRepeatForever

True = set the repeat end date to be the maximum date of the agenda. False = do not repeat forever

[Top]


Instance Dates


IsAnInstance()

TBool IsAnInstance(TAgnDate aDate) const;

Description

Tests whether aDate falls on an instance generated from the repeat algorithm, including excepted items.

Note

This function is not intended to be called by a view

Parameters

TAgnDate aDate

The date to be checked.

Return value

TBool

True = date falls on an instance, otherwise False.


IsAnUnexceptedInstance()

TBool IsAnUnexceptedInstance(TAgnDate aDate) const;

Description

Tests whether aDate falls on an instance generated from the repeat algorithm which is not excepted.

Parameters

TAgnDate aDate

The date to be checked.

Return value

TBool

True = the date falls on a non excepted instance, otherwise False.

[Top]


Comparison


operator==()

TBool operator==(const CAgnRptDef& aRpt) const;

Description

Compares two repeat definitions for equality (compares all repeat details, the repeat type and the exception list).

Parameters

const CAgnRptDef& aRpt

The repeat definition.

Return value

TBool

True = if complete definitions agree, otherwise False.


RepeatForever()

TBool RepeatForever() const;

Description

Tests whether the object should repeat forever, as set by SetRepeatForever().

Return value

TBool

True if object repeats forever, otherwise False.


DisplayNextOnly()

TBool DisplayNextOnly() const;

Description

Tests whether to display the next item only.

Return value

TBool

True = display the next item only, otherwise False.


FindException()

TBool FindException(const TAgnException& aException) const;

Description

Tests whether aException is in the exceptions list, using the exception date as the find key.

Parameters

const TAgnException& aException

The exception.

Return value

TBool

ETrue = present, otherwise EFalse.

[Top]


Stream Persistence


InternalizeL()

void InternalizeL(RReadStream& aStream);

Description

Internalises the repeat definition from a read stream, including type, repeat details and exception list.

Parameters

RReadStream& aStream

Stream from which the object should be internalised.

Leave codes

 

Leaves with KErrCorrupt if the repeat definition has an invalid type or if it has invalid information.


ExternalizeL()

void ExternalizeL(RWriteStream& aStream) const;

Description

Externalises the repeat definition on to a write stream.

Parameters

RWriteStream& aStream

Stream to which the object should be externalised.

Leave codes

 

The function leaves with EAgmErrBadEntry if the repeat definition contains invalid or conflicting information, for instance, if the start or end date is invalid.