25 #ifndef GNC_SX_TTINFO_H 26 #define GNC_SX_TTINFO_H 33 #include "gnc-numeric.hpp" 43 const char* operator* ()
const {
return m_str ? m_str->c_str() :
nullptr; };
44 void operator= (
const char* str) {
if (str) m_str = str;
else reset(); };
45 void reset () { m_str = std::nullopt; };
47 std::optional<std::string> m_str;
52 using OptionalString::operator=;
53 void operator= (std::optional<gnc_numeric> num)
64 const char* get_action ()
const {
return *m_action; };
65 const char* get_memo ()
const {
return *m_memo; };
66 const Account* get_account ()
const {
return m_acc; };
67 const char* get_credit_formula ()
const {
return *m_credit_formula; };
68 const char* get_debit_formula ()
const {
return *m_debit_formula; };
70 void set_action (
const char *action) { m_action = action; };
71 void set_memo (
const char *memo) { m_memo = memo; };
72 void set_account (
Account *acc) { m_acc = acc; };
73 void set_credit_formula (
const char *credit_formula) { set_formulas (
nullptr, credit_formula); };
74 void set_debit_formula (
const char *debit_formula) { set_formulas (debit_formula,
nullptr); };
75 void set_credit_formula_numeric (gnc_numeric num) { set_formulas_numeric ({}, num); };
76 void set_debit_formula_numeric (gnc_numeric num) { set_formulas_numeric (num, {}); };
79 void set_formulas (
const char* debit,
const char *credit)
81 m_debit_formula = debit;
82 m_credit_formula = credit;
84 void set_formulas_numeric (std::optional<gnc_numeric> debit, std::optional<gnc_numeric> credit)
86 m_debit_formula = debit;
87 m_credit_formula = credit;
91 using TTSplitInfoPtr = std::shared_ptr<TTSplitInfo>;
92 using TTSplitInfoVec = std::vector<TTSplitInfoPtr>;
99 gnc_commodity *m_common_currency =
nullptr;
100 TTSplitInfoVec m_splits;
102 const char* get_description ()
const {
return *m_description; };
103 const char* get_num ()
const {
return *m_num; };
104 const char* get_notes ()
const {
return *m_notes; };
105 gnc_commodity* get_currency ()
const {
return m_common_currency; };
106 const TTSplitInfoVec& get_template_splits ()
const {
return m_splits; };
108 void set_description (
const char *description) { m_description = description; };
109 void set_num (
const char *num) { m_num = num; };
110 void set_notes (
const char *notes) { m_notes = notes; };
111 void set_currency (gnc_commodity *currency) { m_common_currency = currency; };
112 void clear_template_splits () { m_splits.clear(); };
113 void append_template_split (TTSplitInfoPtr& ttsi) { m_splits.push_back (ttsi); };
117 using TTInfoPtr = std::shared_ptr<TTInfo>;
118 using TTInfoVec = std::vector<TTInfoPtr>;
The primary numeric class for representing amounts and values.
std::string to_string() const noexcept
Return a string representation of the GncNumeric.
Account handling public routines.
Scheduled Transactions public handling routines.
Commodity handling public routines.