Mercurial > projects > dstep
view dstep/foundation/NSDecimal.d @ 27:57371c29ef73 default tip
ObjcWrap is now automatically mixed in. Added support for building as a dylib with DMD.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Fri, 09 Apr 2010 23:00:22 +0200 |
parents | 19885b43130e |
children |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Aug 3, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.foundation.NSDecimal; import dstep.foundation.NSDictionary; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSString; import dstep.internal.Version; import dstep.objc.bridge.Bridge; import dstep.objc.bridge.Capsule; import dstep.objc.objc; import bindings = dstep.foundation.NSDecimal_bindings; alias NSUInteger NSRoundingMode; alias NSUInteger NSCalculationError; enum { NSRoundPlain, NSRoundDown, NSRoundUp, NSRoundBankers } enum { NSCalculationNoError = 0, NSCalculationLossOfPrecision, NSCalculationUnderflow, NSCalculationOverflow, NSCalculationDivideByZero } struct NSDecimal { int _exponent; uint _length; uint _isNegative; uint _isCompact; uint _reserved; ushort* _mantissa; } NSString NSDecimalString (NSDecimal* dcm, Object locale) { return Bridge.invokeObjcFunction!(NSString, bindings.NSDecimalString, NSDecimal*, Object)(dcm, locale); } extern (C) { void NSDecimalCopy (NSDecimal* destination, NSDecimal* source); void NSDecimalCompact (NSDecimal* number); int NSDecimalCompare (NSDecimal* leftOperand, NSDecimal* rightOperand); void NSDecimalRound (NSDecimal* result, NSDecimal* number, NSInteger scale, uint roundingMode); uint NSDecimalNormalize (NSDecimal* number1, NSDecimal* number2, uint roundingMode); uint NSDecimalAdd (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); uint NSDecimalSubtract (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); uint NSDecimalMultiply (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); uint NSDecimalDivide (NSDecimal* result, NSDecimal* leftOperand, NSDecimal* rightOperand, uint roundingMode); uint NSDecimalPower (NSDecimal* result, NSDecimal* number, NSUInteger power, uint roundingMode); uint NSDecimalMultiplyByPowerOf10 (NSDecimal* result, NSDecimal* number, short power, uint roundingMode); }