28#ifndef quantlib_calendar_hpp
29#define quantlib_calendar_hpp
67 virtual std::string
name()
const = 0;
88 std::string
name()
const;
132 bool includeWeekEnds =
false)
const;
135 const Date& to)
const;
164 bool includeFirst =
true,
165 bool includeLast =
false)
const;
214 return impl_->name();
220 return impl_->addedHolidays;
226 return impl_->removedHolidays;
232#ifdef QL_HIGH_RESOLUTION_DATE
233 const Date _d(
d.dayOfMonth(),
d.month(),
d.year());
238 if (!
impl_->addedHolidays.empty() &&
239 impl_->addedHolidays.find(_d) !=
impl_->addedHolidays.end())
242 if (!
impl_->removedHolidays.empty() &&
243 impl_->removedHolidays.find(_d) !=
impl_->removedHolidays.end())
246 return impl_->isBusinessDay(_d);
271 return impl_->isWeekend(w);
284 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
bool isStartOfMonth(const Date &d) 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
Date startOfMonth(const Date &d) const
first business day of the month to which the given date belongs
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
static Date startOfMonth(const Date &d)
first day of the month to which the given date belongs
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.