QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
bespokecalendar.cpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 StatPro Italia srl
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
21#include <sstream>
22#include <utility>
23
24namespace QuantLib {
25
26 BespokeCalendar::Impl::Impl(std::string name) : name_(std::move(name)) {}
27
28 std::string BespokeCalendar::Impl::name() const {
29 return name_;
30 }
31
33 return (weekend_mask_ & (1 << w)) != 0;
34 }
35
37 return !isWeekend(date.weekday());
38 }
39
41 weekend_mask_ |= (1 << w);
42 }
43
44
46 bespokeImpl_ = ext::make_shared<BespokeCalendar::Impl>(
47 name);
49 }
50
52 bespokeImpl_->addWeekend(w);
53 }
54
55}
56
Bespoke calendar.
bool isBusinessDay(const Date &) const override
std::string name() const override
bool isWeekend(Weekday) const override
ext::shared_ptr< BespokeCalendar::Impl > bespokeImpl_
void addWeekend(Weekday)
marks the passed day as part of the weekend
BespokeCalendar(const std::string &name="")
bool isWeekend(Weekday w) const
Definition: calendar.hpp:255
std::string name() const
Returns the name of the calendar.
Definition: calendar.hpp:206
ext::shared_ptr< Impl > impl_
Definition: calendar.hpp:72
Concrete date class.
Definition: date.hpp:125
Weekday weekday() const
Definition: date.hpp:395
Definition: any.hpp:35
STL namespace.