Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlTimeUnit Class Referenceabstract

Base class representing a time unit (second, hour, year...). More...

#include <ilog/date.h>

Inheritance diagram for IlTimeUnit:
IlTimeUnitDay IlTimeUnitHour IlTimeUnitMilliSecond IlTimeUnitMinute IlTimeUnitMonth IlTimeUnitQuarter IlTimeUnitSecond IlTimeUnitWeek IlTimeUnitYear

Public Member Functions

 IlTimeUnit ()
 Constructor.
 
virtual void addTimeUnit (IlCalendar &date) const =0
 Increments the given IlCalendar date by the time unit. More...
 
virtual IlTimeUnitcopy () const =0
 Returns an IlTimeUnit of the same type as the current object. The caller is responsible to delete this object.
 
virtual IlDouble getMillis () const =0
 Returns the duration of this time unit in milliseconds. More...
 
virtual void snapToPreviousTimeUnit (IlCalendar &date) const =0
 Snaps the given IlCalendar date to the previous time unit. More...
 
virtual char * toString (IlDouble date) const =0
 Returns a string representing the date according to this unit. More...
 

Detailed Description

Base class representing a time unit (second, hour, year...).

Library: ilog

IlTimeUnit is the base class from which time unit classes are derived (seconds, minutes, days, weeks, and so on).

See also
IlvTimeScaleStepsUpdater.

Member Function Documentation

◆ addTimeUnit()

virtual void IlTimeUnit::addTimeUnit ( IlCalendar date) const
pure virtual

Increments the given IlCalendar date by the time unit.

For instance, if the unit is minutes, adds one minute to the date.

Parameters
dateThe date to modify.

Implemented in IlTimeUnitYear, IlTimeUnitQuarter, IlTimeUnitMonth, IlTimeUnitWeek, IlTimeUnitDay, IlTimeUnitHour, IlTimeUnitMinute, IlTimeUnitSecond, and IlTimeUnitMilliSecond.

◆ getMillis()

virtual IlDouble IlTimeUnit::getMillis ( ) const
pure virtual

Returns the duration of this time unit in milliseconds.

Returns
The duration of this time unit in milliseconds.

Implemented in IlTimeUnitYear, IlTimeUnitQuarter, IlTimeUnitMonth, IlTimeUnitWeek, IlTimeUnitDay, IlTimeUnitHour, IlTimeUnitMinute, IlTimeUnitSecond, and IlTimeUnitMilliSecond.

◆ snapToPreviousTimeUnit()

virtual void IlTimeUnit::snapToPreviousTimeUnit ( IlCalendar date) const
pure virtual

Snaps the given IlCalendar date to the previous time unit.

For instance, if the unit is minutes, seconds and milliseconds will be set to 0.

Parameters
dateThe date to modify.

Implemented in IlTimeUnitMinute, IlTimeUnitSecond, IlTimeUnitYear, IlTimeUnitQuarter, IlTimeUnitMonth, IlTimeUnitWeek, IlTimeUnitDay, IlTimeUnitHour, and IlTimeUnitMilliSecond.

◆ toString()

virtual char* IlTimeUnit::toString ( IlDouble  date) const
pure virtual

Returns a string representing the date according to this unit.

Returns an allocated string, which should be deleted with delete [].

Parameters
dateThe date to convert.

Implemented in IlTimeUnitYear, IlTimeUnitQuarter, IlTimeUnitMonth, IlTimeUnitWeek, IlTimeUnitDay, IlTimeUnitHour, IlTimeUnitMinute, IlTimeUnitSecond, and IlTimeUnitMilliSecond.