NAP
Classes | Public Member Functions | Public Attributes | List of all members
CalendarItem Class Referenceabstract

#include <calendaritem.h>

Classes

struct  Point
 
struct  Time
 

Public Member Functions

 CalendarItem ()=default
 
 CalendarItem (const Point &point, const std::string &title)
 
bool init (utility::ErrorState &errorState) override
 
virtual bool active (SystemTimeStamp timeStamp) const =0
 
void setTitle (const std::string &title)
 
const std::string & getTitle () const
 
void setDescription (const std::string &description)
 
const std::string & getDescription () const
 
bool setPoint (const Point &point)
 
const PointgetPoint () const
 
bool setTime (const Time &time)
 
const TimegetTime () const
 
void setDuration (const Time &duration)
 
const TimegetDuration () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

std::string mTitle = ""
 Property: 'Title' item title. More...
 
Point mPoint
 Property; 'Point' point in time together with duration. More...
 
std::string mDescription = ""
 Property: 'Description' item description. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Base class of all calendar items. Every item has a start time and duration. The title and description are optional. Calendar item resolution is minutes (by default).

Derived classes must override active(). That method defines if the item currently 'occurs' based on the given timestamp.

Inheritance diagram for CalendarItem:
[legend]
Collaboration diagram for CalendarItem:
[legend]

Constructor & Destructor Documentation

◆ CalendarItem() [1/2]

CalendarItem ( )
default

◆ CalendarItem() [2/2]

CalendarItem ( const Point point,
const std::string &  title 
)

Member Function Documentation

◆ active()

virtual bool active ( SystemTimeStamp  timeStamp) const
pure virtual

Returns if the current item is active based on the specified 'Time', 'Duration' and other properties of this item. Must be implemented in derived classes.

Parameters
timeStamptime to validate, for example the current system time
Returns
if the current item is active.

Implemented in DailyCalendarItem, WeeklyCalendarItem, MonthlyCalendarItem, YearlyCalendarItem, and UniqueCalendarItem.

◆ getDescription()

const std::string& getDescription ( ) const
Returns
item description

◆ getDuration()

const Time& getDuration ( ) const
Returns
item duration (hours, minutes)

◆ getPoint()

const Point& getPoint ( ) const
Returns
item time and duration

◆ getTime()

const Time& getTime ( ) const
Returns
item time

◆ getTitle()

const std::string& getTitle ( ) const
Returns
item title

◆ init()

bool init ( utility::ErrorState errorState)
overridevirtual

Initializes the calendar item, always call this in derived classes. Ensures the given time is valid.

Returns
If initialization succeeded.

Reimplemented from Object.

Reimplemented in DailyCalendarItem, WeeklyCalendarItem, MonthlyCalendarItem, YearlyCalendarItem, and UniqueCalendarItem.

◆ setDescription()

void setDescription ( const std::string &  description)

Updates item description

Parameters
descriptionnew item description

◆ setDuration()

void setDuration ( const Time duration)

Updates item duration.

Parameters
durationnew duration
Returns
if the duration is updated

◆ setPoint()

bool setPoint ( const Point point)

Updates item time and duration and ensures new settings are valid.

Parameters
pointnew time and duration
Returns
if time and duration have been updated

◆ setTime()

bool setTime ( const Time time)

Updates time and ensures it is valid.

Parameters
timenew time
Returns
if the time is updated

◆ setTitle()

void setTitle ( const std::string &  title)

Updates item title

Parameters
titlenew item title

Member Data Documentation

◆ mDescription

std::string mDescription = ""

Property: 'Description' item description.

◆ mPoint

Point mPoint

Property; 'Point' point in time together with duration.

◆ mTitle

std::string mTitle = ""

Property: 'Title' item title.