28#ifndef quantlib_calendar_hpp
29#define quantlib_calendar_hpp
67 virtual std::string
name()
const = 0;
88 std::string
name()
const;
126 bool includeWeekEnds =
false)
const;
129 const Date& to)
const;
158 bool includeFirst =
true,
159 bool includeLast =
false)
const;
208 return impl_->name();
214 return impl_->addedHolidays;
220 return impl_->removedHolidays;
226#ifdef QL_HIGH_RESOLUTION_DATE
227 const Date _d(
d.dayOfMonth(),
d.month(),
d.year());
232 if (!
impl_->addedHolidays.empty() &&
233 impl_->addedHolidays.find(_d) !=
impl_->addedHolidays.end())
236 if (!
impl_->removedHolidays.empty() &&
237 impl_->removedHolidays.find(_d) !=
impl_->removedHolidays.end())
240 return impl_->isBusinessDay(_d);
244 return (
d.month() !=
adjust(
d+1).month());
257 return impl_->isWeekend(w);
270 return out << c.
name();
BusinessDayConvention enumeration.
abstract base class for calendar implementations
virtual bool isBusinessDay(const Date &) const =0
std::set< Date > addedHolidays
virtual bool isWeekend(Weekday) const =0
virtual std::string name() const =0
std::set< Date > removedHolidays
partial calendar implementation
static Day easterMonday(Year)
expressed relative to first day of year
bool isWeekend(Weekday) const override
partial calendar implementation
static Day easterMonday(Year)
expressed relative to first day of year
bool isWeekend(Weekday) const override
const std::set< Date > & removedHolidays() const
bool isWeekend(Weekday w) const
std::string name() const
Returns the name of the calendar.
Date::serial_type businessDaysBetween(const Date &from, const Date &to, bool includeFirst=true, bool includeLast=false) const
void removeHoliday(const Date &)
bool isEndOfMonth(const Date &d) const
bool empty() const
Returns whether or not the calendar is initialized.
bool isBusinessDay(const Date &d) const
void addHoliday(const Date &)
Date adjust(const Date &, BusinessDayConvention convention=Following) const
std::vector< Date > holidayList(const Date &from, const Date &to, bool includeWeekEnds=false) const
bool isHoliday(const Date &d) const
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
ext::shared_ptr< Impl > impl_
void resetAddedAndRemovedHolidays()
const std::set< Date > & addedHolidays() const
std::vector< Date > businessDayList(const Date &from, const Date &to) const
Date endOfMonth(const Date &d) const
last business day of the month to which the given date belongs
static Date endOfMonth(const Date &d)
last day of the month to which the given date belongs
std::int_fast32_t serial_type
serial number type
date- and time-related classes, typedefs and enumerations
Classes and functions for error handling.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
TimeUnit
Units used to describe time periods.
BusinessDayConvention
Business Day conventions.
QL_INTEGER Integer
integer number
bool operator==(const Currency &c1, const Currency &c2)
std::ostream & operator<<(std::ostream &out, GFunctionFactory::YieldCurveModel type)
bool operator!=(const Currency &c1, const Currency &c2)
Maps shared_ptr to either the boost or std implementation.