kplato

#include <kptcalendar.h>

Public Member Functions

 Calendar (TQString name, Calendar *parent=0)
 Calendar (Calendar *calendar)
TQString name () const
void setName (TQString name)
Calendar * parent () const
void setParent (Calendar *parent)
Project * project () const
void setProject (Project *project)
bool isDeleted () const
void setDeleted (bool yes)
TQString id () const
bool setId (TQString id)
void generateId ()
bool load (TQDomElement &element)
void save (TQDomElement &element) const
CalendarDay * findDay (const TQDate &date, bool skipUndefined=false) const
bool addDay (CalendarDay *day)
bool removeDay (CalendarDay *day)
CalendarDay * takeDay (CalendarDay *day)
const TQPtrList< CalendarDay > & days () const
int parentDayState (const TQDate &date) const
IntMap weekdaysMap ()
void setWeekday (IntMap::iterator it, int state)
CalendarWeekdays * weekdays ()
CalendarDay * weekday (int day) const
TQString parentId () const
void setParentId (TQString id)
bool hasParent (Calendar *cal)
Duration effort (const TQDate &date, const TQTime &start, const TQTime &end) const
Duration effort (const DateTime &start, const DateTime &end) const
TQPair< DateTime, DateTime > firstInterval (const DateTime &start, const DateTime &end) const
TQPair< TQTime, TQTime > firstInterval (const TQDate &date, const TQTime &start, const TQTime &end) const
bool hasInterval (const DateTime &start, const DateTime &end) const
bool hasInterval (const TQDate &date, const TQTime &start, const TQTime &end) const
DateTime firstAvailableAfter (const DateTime &time, const DateTime &limit)
DateTime firstAvailableBefore (const DateTime &time, const DateTime &limit)
Calendar * findCalendar () const
Calendar * findCalendar (const TQString &id) const
bool removeId ()
bool removeId (const TQString &id)
void insertId (const TQString &id)
void printDebug (TQCString indent="")

Protected Member Functions

const Calendar & copy (Calendar &calendar)
void init ()

Detailed Description

Calendar defines the working and nonworking days and hours.

A day can have the three states None (Undefined), NonWorking, or Working. A calendar can have a parent calendar that defines the days that are undefined in this calendar. If a day is still undefined, it defaults to Nonworking. A Working day has one or more work intervals to define the work hours.

The definition can consist of two parts: Weekdays and Day. Day has highest priority.

A typical calendar hierarchy could include calendars on three levels:

  1. Definition of normal weekdays and national holidays/vacation days.
  2. Definition of the company's special workdays/-time and vacation days.
  3. Definitions for groups of resources/individual resources.

Definition at line 204 of file kptcalendar.h.

Constructor & Destructor Documentation

◆ Calendar() [1/3]

KPlato::Calendar::Calendar ( )

Definition at line 502 of file kptcalendar.cpp.

◆ Calendar() [2/3]

KPlato::Calendar::Calendar ( TQString name,
Calendar * parent = 0 )

Definition at line 510 of file kptcalendar.cpp.

◆ Calendar() [3/3]

KPlato::Calendar::Calendar ( Calendar * calendar)

Definition at line 525 of file kptcalendar.cpp.

◆ ~Calendar()

KPlato::Calendar::~Calendar ( )

Definition at line 520 of file kptcalendar.cpp.

Member Function Documentation

◆ addDay()

bool KPlato::Calendar::addDay ( CalendarDay * day)
inline

Definition at line 236 of file kptcalendar.h.

◆ copy()

const Calendar & KPlato::Calendar::copy ( Calendar & calendar)
protected

Definition at line 532 of file kptcalendar.cpp.

◆ days()

const TQPtrList< CalendarDay > & KPlato::Calendar::days ( ) const
inline

Definition at line 239 of file kptcalendar.h.

◆ effort() [1/2]

Duration KPlato::Calendar::effort ( const DateTime & start,
const DateTime & end ) const

Returns the amount of 'worktime' that can be done in the interval from start to end.

Definition at line 730 of file kptcalendar.cpp.

◆ effort() [2/2]

Duration KPlato::Calendar::effort ( const TQDate & date,
const TQTime & start,
const TQTime & end ) const

Returns the amount of 'worktime' that can be done on the date date between the times start and end.

Definition at line 691 of file kptcalendar.cpp.

◆ findCalendar() [1/2]

Calendar * KPlato::Calendar::findCalendar ( ) const
inline

Definition at line 307 of file kptcalendar.h.

◆ findCalendar() [2/2]

Calendar * KPlato::Calendar::findCalendar ( const TQString & id) const

Definition at line 910 of file kptcalendar.cpp.

◆ findDay()

CalendarDay * KPlato::Calendar::findDay ( const TQDate & date,
bool skipUndefined = false ) const

Find the definition for the day date.

If skipUndefined=true the day is NOT returned if it has state None (Undefined).

Definition at line 667 of file kptcalendar.cpp.

◆ firstAvailableAfter()

DateTime KPlato::Calendar::firstAvailableAfter ( const DateTime & time,
const DateTime & limit )

Find the first available time after time before limit.

Return invalid datetime if not available.

Definition at line 854 of file kptcalendar.cpp.

◆ firstAvailableBefore()

DateTime KPlato::Calendar::firstAvailableBefore ( const DateTime & time,
const DateTime & limit )

Find the first available time backwards from time.

Search until limit. Return invalid datetime if not available.

Definition at line 868 of file kptcalendar.cpp.

◆ firstInterval() [1/2]

TQPair< DateTime, DateTime > KPlato::Calendar::firstInterval ( const DateTime & start,
const DateTime & end ) const

Returns the first 'work interval' for the interval starting at start and ending at end.

If no 'work interval' exists, returns an interval with invalid DateTime. You can also use hasInterval() to check if a 'work interval' exists.

Definition at line 775 of file kptcalendar.cpp.

◆ firstInterval() [2/2]

TQPair< TQTime, TQTime > KPlato::Calendar::firstInterval ( const TQDate & date,
const TQTime & start,
const TQTime & end ) const

Returns the first 'work interval' on date for the interval starting at start and ending at end.

If no 'work interval' exists, returns an interval with first==second. You can also use hasInterval() to check if a 'work interval' exists.

Definition at line 756 of file kptcalendar.cpp.

◆ generateId()

void KPlato::Calendar::generateId ( )

Definition at line 590 of file kptcalendar.cpp.

◆ hasInterval() [1/2]

bool KPlato::Calendar::hasInterval ( const DateTime & start,
const DateTime & end ) const

Returns true if at least a part of a 'work interval' exists for the interval starting at start and ending at end.

Definition at line 828 of file kptcalendar.cpp.

◆ hasInterval() [2/2]

bool KPlato::Calendar::hasInterval ( const TQDate & date,
const TQTime & start,
const TQTime & end ) const

Returns true if at least a part of a 'work interval' exists for the interval on date, starting at start and ending at end.

Definition at line 809 of file kptcalendar.cpp.

◆ hasParent()

bool KPlato::Calendar::hasParent ( Calendar * cal)

Definition at line 682 of file kptcalendar.cpp.

◆ id()

TQString KPlato::Calendar::id ( ) const
inline

Definition at line 224 of file kptcalendar.h.

◆ init()

void KPlato::Calendar::init ( )
protected

Definition at line 546 of file kptcalendar.cpp.

◆ insertId()

void KPlato::Calendar::insertId ( const TQString & id)

Definition at line 918 of file kptcalendar.cpp.

◆ isDeleted()

bool KPlato::Calendar::isDeleted ( ) const
inline

Definition at line 221 of file kptcalendar.h.

◆ load()

bool KPlato::Calendar::load ( TQDomElement & element)

Definition at line 604 of file kptcalendar.cpp.

◆ name()

TQString KPlato::Calendar::name ( ) const
inline

Definition at line 212 of file kptcalendar.h.

◆ parent()

Calendar * KPlato::Calendar::parent ( ) const
inline

Definition at line 215 of file kptcalendar.h.

◆ parentDayState()

int KPlato::Calendar::parentDayState ( const TQDate & date) const

Returns the state of definition for parents day date in it.

Also checks the parents recursively.

◆ parentId()

TQString KPlato::Calendar::parentId ( ) const
inline

Definition at line 252 of file kptcalendar.h.

◆ printDebug()

void KPlato::Calendar::printDebug ( TQCString indent = "")

Definition at line 1015 of file kptcalendar.cpp.

◆ project()

Project * KPlato::Calendar::project ( ) const
inline

Definition at line 218 of file kptcalendar.h.

◆ removeDay()

bool KPlato::Calendar::removeDay ( CalendarDay * day)
inline

Definition at line 237 of file kptcalendar.h.

◆ removeId() [1/2]

bool KPlato::Calendar::removeId ( )
inline

Definition at line 309 of file kptcalendar.h.

◆ removeId() [2/2]

bool KPlato::Calendar::removeId ( const TQString & id)

Definition at line 914 of file kptcalendar.cpp.

◆ save()

void KPlato::Calendar::save ( TQDomElement & element) const

Definition at line 646 of file kptcalendar.cpp.

◆ setDeleted()

void KPlato::Calendar::setDeleted ( bool yes)

Definition at line 556 of file kptcalendar.cpp.

◆ setId()

bool KPlato::Calendar::setId ( TQString id)

Definition at line 564 of file kptcalendar.cpp.

◆ setName()

void KPlato::Calendar::setName ( TQString name)
inline

Definition at line 213 of file kptcalendar.h.

◆ setParent()

void KPlato::Calendar::setParent ( Calendar * parent)
inline

Definition at line 216 of file kptcalendar.h.

◆ setParentId()

void KPlato::Calendar::setParentId ( TQString id)
inline

Definition at line 253 of file kptcalendar.h.

◆ setProject()

void KPlato::Calendar::setProject ( Project * project)

Definition at line 551 of file kptcalendar.cpp.

◆ setWeekday()

void KPlato::Calendar::setWeekday ( IntMap::iterator it,
int state )
inline

Definition at line 248 of file kptcalendar.h.

◆ takeDay()

CalendarDay * KPlato::Calendar::takeDay ( CalendarDay * day)
inline

Definition at line 238 of file kptcalendar.h.

◆ weekday()

CalendarDay * KPlato::Calendar::weekday ( int day) const
inline

Definition at line 250 of file kptcalendar.h.

◆ weekdays()

CalendarWeekdays * KPlato::Calendar::weekdays ( )
inline

Definition at line 249 of file kptcalendar.h.

◆ weekdaysMap()

IntMap KPlato::Calendar::weekdaysMap ( )
inline

Definition at line 247 of file kptcalendar.h.


The documentation for this class was generated from the following files: