OpenStudioCore:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
openstudio::Date Class Reference

#include <Date.hpp>

Public Types

typedef std::shared_ptr< ImplTypeImplPtr
 
typedef boost::gregorian::date ImplType
 impl type is boost::gregorian::date More...
 

Public Member Functions

int assumedBaseYear () const
 assumed base year More...
 
boost::optional< intbaseYear () const
 user provided base year More...
 
void baseYear (int baseYear)
 set base year More...
 
 Date ()
 default constructor More...
 
 Date (const ImplType &impl)
 from impl More...
 
 Date (MonthOfYear monthOfYear, unsigned dayOfMonth)
 Date from month, day of month. More...
 
 Date (MonthOfYear monthOfYear, unsigned dayOfMonth, int year)
 Date from month, day of month, year. More...
 
 Date (MonthOfYear monthOfYear, unsigned dayOfMonth, const YearDescription &yearDescription)
 Date from YearDescription, month, and day of month. More...
 
 Date (const std::string &string)
 constructor from string More...
 
 Date (tm t_tm)
 Date from a system tm structure. More...
 
 Date (const Date &other)
 copy constructor More...
 
unsigned dayOfMonth () const
 day of month More...
 
DayOfWeek dayOfWeek () const
 day of the week More...
 
unsigned dayOfYear () const
 day of year More...
 
bool isLeapYear () const
 is assumed year a leap year More...
 
MonthOfYear monthOfYear () const
 month of year More...
 
bool operator!= (const Date &other) const
 non-equality operator More...
 
Date operator+ (const Time &time) const
 addition operator More...
 
Dateoperator+= (const Time &time)
 assignment by addition operator More...
 
Date operator- (const Time &time) const
 difference operator More...
 
Time operator- (const Date &date) const
 time duration More...
 
Dateoperator-= (const Time &time)
 assignment by difference operator More...
 
bool operator< (const Date &rhs) const
 less than operator More...
 
bool operator<= (const Date &rhs) const
 less than equals operator More...
 
Dateoperator= (const Date &other)
 assignment operator More...
 
bool operator== (const Date &other) const
 equality operator More...
 
bool operator> (const Date &rhs) const
 greater than operator More...
 
bool operator>= (const Date &rhs) const
 greater than equals operator More...
 
int year () const
 year More...
 
 ~Date ()
 destructor More...
 

Static Public Member Functions

static Date currentDate ()
 get current Date More...
 
static Date fromDayOfYear (unsigned dayOfYear)
 Day of year generators. More...
 
static Date fromDayOfYear (unsigned dayOfYear, int year)
 
static Date fromDayOfYear (unsigned dayOfYear, const YearDescription &yearDescription)
 
static Date fromNthDayOfMonth (NthDayOfWeekInMonth n, DayOfWeek dayOfWeek, MonthOfYear monthOfYear)
 nth weekday of month generators More...
 
static Date fromNthDayOfMonth (NthDayOfWeekInMonth n, DayOfWeek dayOfWeek, MonthOfYear monthOfYear, int year)
 
static bool isLeapYear (int year)
 is year a leap year More...
 
static openstudio::LogChannel logChannel ()
 

Friends

std::ostream & operator<< (std::ostream &os, const Date &date)
 
std::ostream & operator<< (std::ostream &os, const DateTime &dateTime)
 

Detailed Description

Date is an absolute unit of time, resolution to the day Date is simple wrapper around boost::gregorian::date.

Member Typedef Documentation

typedef std::shared_ptr<ImplType> openstudio::Date::ImplPtr
typedef boost::gregorian::date openstudio::Date::ImplType

impl type is boost::gregorian::date

Constructor & Destructor Documentation

openstudio::Date::Date ( )

default constructor

openstudio::Date::~Date ( )
inline

destructor

openstudio::Date::Date ( const ImplType impl)

from impl

openstudio::Date::Date ( MonthOfYear  monthOfYear,
unsigned  dayOfMonth 
)

Date from month, day of month.

openstudio::Date::Date ( MonthOfYear  monthOfYear,
unsigned  dayOfMonth,
int  year 
)

Date from month, day of month, year.

openstudio::Date::Date ( MonthOfYear  monthOfYear,
unsigned  dayOfMonth,
const YearDescription yearDescription 
)

Date from YearDescription, month, and day of month.

openstudio::Date::Date ( const std::string &  string)

constructor from string

openstudio::Date::Date ( tm  t_tm)

Date from a system tm structure.

openstudio::Date::Date ( const Date other)

copy constructor

Member Function Documentation

int openstudio::Date::assumedBaseYear ( ) const

assumed base year

boost::optional<int> openstudio::Date::baseYear ( ) const

user provided base year

void openstudio::Date::baseYear ( int  baseYear)

set base year

static Date openstudio::Date::currentDate ( )
static

get current Date

unsigned openstudio::Date::dayOfMonth ( ) const

day of month

DayOfWeek openstudio::Date::dayOfWeek ( ) const

day of the week

unsigned openstudio::Date::dayOfYear ( ) const

day of year

static Date openstudio::Date::fromDayOfYear ( unsigned  dayOfYear)
static

Day of year generators.

static Date openstudio::Date::fromDayOfYear ( unsigned  dayOfYear,
int  year 
)
static
static Date openstudio::Date::fromDayOfYear ( unsigned  dayOfYear,
const YearDescription yearDescription 
)
static
static Date openstudio::Date::fromNthDayOfMonth ( NthDayOfWeekInMonth  n,
DayOfWeek  dayOfWeek,
MonthOfYear  monthOfYear 
)
static

nth weekday of month generators

static Date openstudio::Date::fromNthDayOfMonth ( NthDayOfWeekInMonth  n,
DayOfWeek  dayOfWeek,
MonthOfYear  monthOfYear,
int  year 
)
static
static bool openstudio::Date::isLeapYear ( int  year)
static

is year a leap year

bool openstudio::Date::isLeapYear ( ) const

is assumed year a leap year

static openstudio::LogChannel openstudio::Date::logChannel ( )
inlinestatic
MonthOfYear openstudio::Date::monthOfYear ( ) const

month of year

bool openstudio::Date::operator!= ( const Date other) const

non-equality operator

Date openstudio::Date::operator+ ( const Time time) const

addition operator

Date& openstudio::Date::operator+= ( const Time time)

assignment by addition operator

Date openstudio::Date::operator- ( const Time time) const

difference operator

Time openstudio::Date::operator- ( const Date date) const

time duration

Date& openstudio::Date::operator-= ( const Time time)

assignment by difference operator

bool openstudio::Date::operator< ( const Date rhs) const

less than operator

bool openstudio::Date::operator<= ( const Date rhs) const

less than equals operator

Date& openstudio::Date::operator= ( const Date other)

assignment operator

bool openstudio::Date::operator== ( const Date other) const

equality operator

bool openstudio::Date::operator> ( const Date rhs) const

greater than operator

bool openstudio::Date::operator>= ( const Date rhs) const

greater than equals operator

int openstudio::Date::year ( ) const

year

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Date date 
)
friend
std::ostream& operator<< ( std::ostream &  os,
const DateTime dateTime 
)
friend