57enum Result { FAILED, ADDED, DUPLICATED, REPLACED };
86 GncImportPrice (
int date_format,
int currency_format) : m_date_format{date_format},
87 m_currency_format{currency_format}{};
89 void set (GncPricePropType prop_type,
const std::string& value,
bool enable_test_empty);
90 void set_date_format (
int date_format) { m_date_format = date_format ;}
91 void set_currency_format (
int currency_format) { m_currency_format = currency_format ;}
92 void reset (GncPricePropType prop_type);
93 std::string verify_essentials (
void);
94 Result create_price (
QofBook* book, GNCPriceDB *pdb,
bool over);
96 gnc_commodity* get_from_commodity () {
if (m_from_commodity)
return *m_from_commodity;
else return nullptr; }
97 void set_from_commodity (gnc_commodity* comm) {
if (comm) m_from_commodity = comm;
else m_from_commodity.reset(); }
99 gnc_commodity* get_to_currency () {
if (m_to_currency)
return *m_to_currency;
else return nullptr; }
100 void set_to_currency (gnc_commodity* curr) {
if (curr) m_to_currency = curr;
else m_to_currency.reset(); }
102 std::string errors();
106 int m_currency_format;
107 std::optional<GncDate> m_date;
108 std::optional<GncNumeric> m_amount;
109 std::optional<gnc_commodity*> m_from_commodity;
110 std::optional<std::string> m_from_namespace;
111 std::optional<std::string> m_from_symbol;
112 std::optional<gnc_commodity*> m_to_currency;
114 std::map<GncPricePropType, std::string> m_errors;