Coverage Report

Created: 2025-08-05 06:45

/src/quantlib/ql/currency.cpp
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) 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
23
namespace QuantLib {
24
25
0
    std::ostream& operator<<(std::ostream& out, const Currency& c) {
26
0
        if (!c.empty())
27
0
            return out << c.code();
28
0
        else
29
0
            return out << "null currency";
30
0
    }
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
                         Currency triangulationCurrency,
40
                         std::set<std::string> minorUnitCodes)
41
0
    : name(std::move(name)), code(std::move(code)), numeric(numericCode), symbol(std::move(symbol)),
42
0
      fractionSymbol(std::move(fractionSymbol)), fractionsPerUnit(fractionsPerUnit),
43
0
      rounding(rounding), triangulated(std::move(triangulationCurrency)),
44
0
      minorUnitCodes(std::move(minorUnitCodes)) {}
45
46
    Currency::Currency(const std::string& name,
47
                       const std::string& code,
48
                       Integer numericCode,
49
                       const std::string& symbol,
50
                       const std::string& fractionSymbol,
51
                       Integer fractionsPerUnit,
52
                       const Rounding& rounding,
53
                       const Currency& triangulationCurrency,
54
                       const std::set<std::string>& minorUnitCodes)
55
0
    : data_(ext::make_shared<Currency::Data>(name,
56
0
                                             code,
57
0
                                             numericCode,
58
0
                                             symbol,
59
0
                                             fractionSymbol,
60
0
                                             fractionsPerUnit,
61
0
                                             rounding,
62
0
                                             triangulationCurrency,
63
0
                                             minorUnitCodes)) {}
64
65
}