QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
region.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 Chris Kenyon
5 Copyright (C) 2014 StatPro Italia srl
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_region_hpp
26#define quantlib_region_hpp
27
28#include <ql/qldefines.hpp>
29#include <ql/shared_ptr.hpp>
30#include <string>
31#include <utility>
32
33namespace QuantLib {
34
36 class Region {
37 public:
39
40 const std::string& name() const;
41 const std::string& code() const;
43 protected:
44 Region() = default;
45 struct Data;
46 ext::shared_ptr<Data> data_;
47 };
48
49 struct Region::Data {
50 std::string name;
51 std::string code;
52 Data(std::string name, std::string code) : name(std::move(name)), code(std::move(code)) {}
53 };
54
56 bool operator==(const Region&, const Region&);
57
59 bool operator!=(const Region&, const Region&);
60
61
63
67 class CustomRegion : public Region {
68 public:
69 CustomRegion(const std::string& name,
70 const std::string& code);
71 };
72
73
75 class AustraliaRegion : public Region {
76 public:
78 };
79
81 class EURegion : public Region {
82 public:
83 EURegion();
84 };
85
87 class FranceRegion : public Region {
88 public:
90 };
91
93 class UKRegion : public Region {
94 public:
95 UKRegion();
96 };
97
99 class USRegion : public Region {
100 public:
101 USRegion();
102 };
103
105 class ZARegion : public Region {
106 public:
107 ZARegion();
108 };
109
110
111 // inline definitions
112
113 inline const std::string& Region::name() const {
114 return data_->name;
115 }
116
117 inline const std::string& Region::code() const {
118 return data_->code;
119 }
120
121 inline bool operator==(const Region& r1, const Region& r2) {
122 return r1.name() == r2.name();
123 }
124
125 inline bool operator!=(const Region& r1, const Region& r2) {
126 return !(r1.name() == r2.name());
127 }
128
129}
130
131#endif
Australia as geographical/economic region.
Definition: region.hpp:75
Custom geographical/economic region.
Definition: region.hpp:67
European Union as geographical/economic region.
Definition: region.hpp:81
France as geographical/economic region.
Definition: region.hpp:87
Region class, used for inflation applicability.
Definition: region.hpp:36
const std::string & code() const
Definition: region.hpp:117
const std::string & name() const
Definition: region.hpp:113
ext::shared_ptr< Data > data_
Definition: region.hpp:46
Region()=default
United Kingdom as geographical/economic region.
Definition: region.hpp:93
USA as geographical/economic region.
Definition: region.hpp:99
South Africa as geographical/economic region.
Definition: region.hpp:105
Definition: any.hpp:35
bool operator==(const Currency &c1, const Currency &c2)
Definition: currency.hpp:191
bool operator!=(const Currency &c1, const Currency &c2)
Definition: currency.hpp:196
STL namespace.
std::string code
Definition: region.hpp:51
std::string name
Definition: region.hpp:50
Data(std::string name, std::string code)
Definition: region.hpp:52