Definition at line 117 of file gnc-quotes.cpp.
◆ GncQuotesImpl() [1/3]
| GncQuotesImpl::GncQuotesImpl |
( |
| ) |
|
Definition at line 298 of file gnc-quotes.cpp.
299 m_sources{}, m_failures{},
302{
303 m_sources = m_quotesource->get_sources();
304}
QofBook * qof_session_get_book(const QofSession *session)
Returns the QofBook of this session.
gnc_commodity * gnc_default_currency(void)
Return the default currency set by the user.
◆ GncQuotesImpl() [2/3]
| GncQuotesImpl::GncQuotesImpl |
( |
QofBook * |
book | ) |
|
|
explicit |
Definition at line 306 of file gnc-quotes.cpp.
307m_sources{}, m_book{book},
309{
310 m_sources = m_quotesource->get_sources();
311}
◆ GncQuotesImpl() [3/3]
Definition at line 313 of file gnc-quotes.cpp.
313 :
314m_quotesource{std::move(quote_source)},
316{
317 m_sources = m_quotesource->get_sources();
318}
◆ failures()
| const QFVec & GncQuotesImpl::failures |
( |
| ) |
|
|
noexcept |
◆ fetch() [1/3]
| void GncQuotesImpl::fetch |
( |
CommVec & |
commodities | ) |
|
Definition at line 338 of file gnc-quotes.cpp.
339{
340 m_failures.clear();
341 if (commodities.empty())
342 throw (
GncQuoteException(bl::translate(
"GncQuotes::Fetch called with no commodities.")));
343 auto quote_str{query_fq (commodities)};
344 auto ptree{parse_quotes (quote_str)};
345 create_quotes(ptree, commodities);
346}
◆ fetch() [2/3]
| void GncQuotesImpl::fetch |
( |
gnc_commodity * |
comm | ) |
|
Definition at line 331 of file gnc-quotes.cpp.
332{
333 auto commodities = CommVec {comm};
334 fetch (commodities);
335}
◆ fetch() [3/3]
| void GncQuotesImpl::fetch |
( |
QofBook * |
book | ) |
|
Definition at line 321 of file gnc-quotes.cpp.
322{
323 if (!book)
324 throw (
GncQuoteException(bl::translate(
"GncQuotes::Fetch called with no book.")));
325 auto commodities = gnc_quotes_get_quotable_commodities (
327 fetch (commodities);
328}
gnc_commodity_table * gnc_commodity_table_get_table(QofBook *book)
Returns the commodity table associated with a book.
◆ had_failures()
| bool GncQuotesImpl::had_failures |
( |
| ) |
|
|
inlinenoexcept |
◆ report()
| void GncQuotesImpl::report |
( |
const char * |
source, |
|
|
const StrVec & |
commodities, |
|
|
bool |
verbose |
|
) |
| |
Definition at line 349 of file gnc-quotes.cpp.
351{
352 if (!source)
353 throw (
GncQuoteException(bl::translate(
"GncQuotes::Report called with no source.")));
354
355 bool is_currency{strcmp(source, "currency") == 0};
356 m_failures.clear();
357 if (commodities.empty())
358 {
359 std::cerr <<
_(
"There were no commodities for which to retrieve quotes.") << std::endl;
360 return;
361 }
362 try
363 {
364 auto quote_str{query_fq (source, commodities)};
365 auto ptree{parse_quotes (quote_str)};
366 auto source_pt_ai{ptree.find(source)};
367 if (is_currency)
368 show_currency_quotes(source_pt_ai->second, commodities, verbose);
369 else
370 show_quotes(source_pt_ai->second, commodities, verbose);
371 }
373 {
374 std::cerr <<
_(
"Finance::Quote retrieval failed with error ") << err.what() << std::endl;
375 }
376}
◆ report_failures()
| std::string GncQuotesImpl::report_failures |
( |
| ) |
|
|
noexcept |
Definition at line 423 of file gnc-quotes.cpp.
424{
425 std::string retval{
_(
"Quotes for the following commodities were unavailable or unusable:\n")};
426 std::for_each(m_failures.begin(), m_failures.end(),
427 [&retval](auto failure)
428 {
429 auto [ns, sym, reason, err] = failure;
430 retval += "* " + ns + ":" + sym + " " +
431 explain(reason, err) + "\n";
432 });
433 return retval;
434}
◆ sources()
| const QuoteSources & GncQuotesImpl::sources |
( |
| ) |
|
|
inlinenoexcept |
◆ version()
| const std::string & GncQuotesImpl::version |
( |
| ) |
|
|
inlinenoexcept |
Definition at line 130 of file gnc-quotes.cpp.
130{ return m_quotesource->get_version(); }
The documentation for this class was generated from the following file: