/src/quantlib/ql/time/weekday.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl |
5 | | Copyright (C) 2003, 2004, 2005, 2006 StatPro Italia srl |
6 | | Copyright (C) 2004, 2005, 2006 Ferdinando Ametrano |
7 | | Copyright (C) 2006 Katiuscia Manzoni |
8 | | Copyright (C) 2006 Toyin Akin |
9 | | |
10 | | This file is part of QuantLib, a free-software/open-source library |
11 | | for financial quantitative analysts and developers - http://quantlib.org/ |
12 | | |
13 | | QuantLib is free software: you can redistribute it and/or modify it |
14 | | under the terms of the QuantLib license. You should have received a |
15 | | copy of the license along with this program; if not, please email |
16 | | <quantlib-dev@lists.sf.net>. The license is also available online at |
17 | | <http://quantlib.org/license.shtml>. |
18 | | |
19 | | This program is distributed in the hope that it will be useful, but WITHOUT |
20 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
21 | | FOR A PARTICULAR PURPOSE. See the license for more details. |
22 | | */ |
23 | | |
24 | | /*! \file weekday.hpp |
25 | | \brief Weekday enumeration |
26 | | */ |
27 | | |
28 | | #ifndef quantlib_weekday_hpp |
29 | | #define quantlib_weekday_hpp |
30 | | |
31 | | #include <ql/qldefines.hpp> |
32 | | #include <iosfwd> |
33 | | |
34 | | namespace QuantLib { |
35 | | |
36 | | /*! Day's serial number MOD 7; |
37 | | WEEKDAY Excel function is the same except for Sunday = 7. |
38 | | |
39 | | \ingroup datetime |
40 | | */ |
41 | | enum Weekday { Sunday = 1, |
42 | | Monday = 2, |
43 | | Tuesday = 3, |
44 | | Wednesday = 4, |
45 | | Thursday = 5, |
46 | | Friday = 6, |
47 | | Saturday = 7, |
48 | | Sun = 1, |
49 | | Mon = 2, |
50 | | Tue = 3, |
51 | | Wed = 4, |
52 | | Thu = 5, |
53 | | Fri = 6, |
54 | | Sat = 7 |
55 | | }; |
56 | | |
57 | | /*! \relates Weekday */ |
58 | | std::ostream& operator<<(std::ostream&, const Weekday&); |
59 | | |
60 | | namespace detail { |
61 | | |
62 | | struct long_weekday_holder { |
63 | 0 | explicit long_weekday_holder(Weekday d) : d(d) {} |
64 | | Weekday d; |
65 | | }; |
66 | | std::ostream& operator<<(std::ostream&, const long_weekday_holder&); |
67 | | |
68 | | struct short_weekday_holder { |
69 | 0 | explicit short_weekday_holder(Weekday d) : d(d) {} |
70 | | Weekday d; |
71 | | }; |
72 | | std::ostream& operator<<(std::ostream&, const short_weekday_holder&); |
73 | | |
74 | | struct shortest_weekday_holder { |
75 | 0 | explicit shortest_weekday_holder(Weekday d) : d(d) {} |
76 | | Weekday d; |
77 | | }; |
78 | | std::ostream& operator<<(std::ostream&, |
79 | | const shortest_weekday_holder&); |
80 | | |
81 | | } |
82 | | |
83 | | namespace io { |
84 | | |
85 | | //! output weekdays in long format |
86 | | /*! \ingroup manips */ |
87 | | detail::long_weekday_holder long_weekday(Weekday); |
88 | | |
89 | | //! output weekdays in short format (three letters) |
90 | | /*! \ingroup manips */ |
91 | | detail::short_weekday_holder short_weekday(Weekday); |
92 | | |
93 | | //! output weekdays in shortest format (two letters) |
94 | | /*! \ingroup manips */ |
95 | | detail::shortest_weekday_holder shortest_weekday(Weekday); |
96 | | |
97 | | } |
98 | | |
99 | | } |
100 | | |
101 | | #endif |