[Kmymoney-devel] Access Alkimia numerator and denominator

Thomas Baumgart thb at net-bembel.de
Fri Nov 7 06:24:28 UTC 2014


Hi,

On Thursday 06 November 2014 12:17:23 Cristian Oneț wrote:

> Hi,
> 
> If the AB_Value_fromString function can work with the
> "numerator/denominator" format (for example: 24839/25) I would prefer
> using AB_Value_fromString(value.toString().toLatin1().data()) where
> value is an AlkValue (or MyMoneyMoney). This would mean using the
> existing API.

Not sure if AB_Value_fromString works directly with the AlkValue string 
representation. But using the following code should solve the problem (not 
optimized for readability):

  QRegExp exp("(-?\\d+)/(\\d+)";
  if(exp.exactMatch(value.toString()) {
    AB_Value_fromString(exp.cap(1).toLong(), exp.cap(2).toULong());
  } else {
    printf("Houston, we have a problem");
  }


> 2014-11-06 9:56 GMT+02:00 Christian Dávid <christian-david at web.de>:
> > Am Mittwoch, 5. November 2014, 20:46:20 schrieb Christian Dávid:
> >> 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.
> > 
> > I forgot: functions which could be used are
> > 
> > // s is the same as used in alkimia
> > AB_VALUE *      AB_Value_fromString (const char *s)
> > AB_VALUE *      AB_Value_fromInt (long int num, long int denom)
> > AB_VALUE *      AB_Value_fromDouble (double i) // <- really bad, used now
> > 
> >> [2]
> >> https://projects.kde.org/projects/extragear/office/kmymoney/repository/re
> >> vis
> >> ions/add-onlinebanking/entry/kmymoney/plugins/kbanking/aqbankingqtoperat
> >> ors. h
> > 
> > _______________________________________________
> > KMyMoney-devel mailing list
> > KMyMoney-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/kmymoney-devel
> 
> _______________________________________________
> KMyMoney-devel mailing list
> KMyMoney-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kmymoney-devel
-- 

Regards

Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
-------------------------------------------------------------
Windows are like... windows. Shiny, fragile, expensive.
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 225 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20141107/55684313/attachment-0001.sig>


More information about the KMyMoney-devel mailing list