ledger-core
Amount.hpp
1 // AUTOGENERATED FILE - DO NOT MODIFY!
2 // This file generated by Djinni from amount.djinni
3 
4 #ifndef DJINNI_GENERATED_AMOUNT_HPP
5 #define DJINNI_GENERATED_AMOUNT_HPP
6 
7 #include "../utils/optional.hpp"
8 #include <cstdint>
9 #include <memory>
10 #include <string>
11 #ifndef LIBCORE_EXPORT
12  #if defined(_MSC_VER)
13  #include <libcore_export.h>
14  #else
15  #define LIBCORE_EXPORT
16  #endif
17 #endif
18 
19 namespace ledger { namespace core { namespace api {
20 
21 class BigInt;
22 struct Currency;
23 struct CurrencyUnit;
24 struct FormatRules;
25 struct Locale;
26 
28 class LIBCORE_EXPORT Amount {
29 public:
30  virtual ~Amount() {}
31 
36  virtual std::shared_ptr<BigInt> toBigInt() = 0;
37 
42  virtual Currency getCurrency() = 0;
43 
48  virtual CurrencyUnit getUnit() = 0;
49 
55  virtual std::shared_ptr<Amount> toUnit(const CurrencyUnit & unit) = 0;
56 
58  virtual std::shared_ptr<Amount> toMagnitude(int32_t magnitude) = 0;
59 
64  virtual std::string toString() = 0;
65 
70  virtual int64_t toLong() = 0;
71 
76  virtual double toDouble() = 0;
77 
79  virtual std::string format(const Locale & locale, const std::experimental::optional<FormatRules> & rules) = 0;
80 
82  static std::shared_ptr<Amount> fromHex(const Currency & currency, const std::string & hex);
83 
85  static std::shared_ptr<Amount> fromLong(const Currency & currency, int64_t value);
86 };
87 
88 } } } // namespace ledger::core::api
89 #endif //DJINNI_GENERATED_AMOUNT_HPP
Definition: Locale.hpp:13
Definition: Amount.hpp:28
Definition: Currency.hpp:23
Definition: CurrencyUnit.hpp:15
Definition: Account.cpp:8
Definition: optional.hpp:177