1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2004, 2007 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
20#include <ql/currency.hpp>
21#include <utility>
22
23namespace QuantLib {
24
25 std::ostream& operator<<(std::ostream& out, const Currency& c) {
26 if (!c.empty())
27 return out << c.code();
28 else
29 return out << "null currency";
30 }
31
32 Currency::Data::Data(std::string name,
33 std::string code,
34 Integer numericCode,
35 std::string symbol,
36 std::string fractionSymbol,
37 Integer fractionsPerUnit,
38 const Rounding& rounding,
39 std::string formatString,
40 Currency triangulationCurrency,
41 std::set<std::string> minorUnitCodes)
42 : name(std::move(name)), code(std::move(code)), numeric(numericCode), symbol(std::move(symbol)),
43 fractionSymbol(std::move(fractionSymbol)), fractionsPerUnit(fractionsPerUnit),
44 rounding(rounding), triangulated(std::move(triangulationCurrency)),
45 formatString(std::move(formatString)), minorUnitCodes(std::move(minorUnitCodes)) {}
46
47 Currency::Currency(const std::string& name,
48 const std::string& code,
49 Integer numericCode,
50 const std::string& symbol,
51 const std::string& fractionSymbol,
52 Integer fractionsPerUnit,
53 const Rounding& rounding,
54 const std::string& formatString,
55 const Currency& triangulationCurrency,
56 const std::set<std::string>& minorUnitCodes)
57 : data_(ext::make_shared<Currency::Data>(args: name,
58 args: code,
59 args&: numericCode,
60 args: symbol,
61 args: fractionSymbol,
62 args&: fractionsPerUnit,
63 args: rounding,
64 args: formatString,
65 args: triangulationCurrency,
66 args: minorUnitCodes)) {}
67}
68
69

source code of quantlib/ql/currency.cpp

Morty Proxy This is a proxified and sanitized view of the page, visit original site.