[Kmymoney-devel] Access Alkimia numerator and denominator
Christian Dávid
christian-david at web.de
Wed Nov 5 19:46:20 UTC 2014
Hi,
this discussion started in review request 120815 [1]. But that is the wrong
place (shame on me).
Christian David 1 day ago (Nov. 4, 2014, 7:42 nachm.)
> […]
>
> Another question: I need access to the numerator and denominator to convert
> a MyMoneyValue to the value type of the online banking library. Should I
> make const mpq_class &valueRef() const in the class AlkValue public, add
another method const mpq_class& toMpqClass() const or should I add two
methods (long numerator() const and long denominator() const)?
Cristian Oneț 4 hours, 20 minutes ago (Nov. 5, 2014, 4:03 nachm.)
> Thinking about this I'm not sure that gmpxx.h should be even exposed by
> alkvalue.h at all. Could you give a bit more detail where do you need the
> numerator and denominator? I would go with some forwad declarations and
> including gmpxx.h only where it's needed. Right now it ends up in a lot of
> places because it's included in alkvalue.h.
I want to use it to make AB_VALUE* AB_Value_fromMyMoneyMoney(const
MyMoneyMoney& input) [2] better - using double here is not good. It will
convert the credit transfer value from KMyMoney to aqbanking.
Btw: gmp is exposed already with two methods, both are public:
static mpz_class denominatorToPrecision(mpz_class denom);
static mpz_class precisionToDenominator(mpz_class prec);
But maybe that is just a workaround for something else and should not serve as
pattern?!
Greetings
Christian
[1] https://git.reviewboard.kde.org/r/120815/
[2]
https://projects.kde.org/projects/extragear/office/kmymoney/repository/revisions/add-onlinebanking/entry/kmymoney/plugins/kbanking/aqbankingqtoperators.h
More information about the KMyMoney-devel
mailing list