view dstep/corefoundation/CFNumberFormatter.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 12, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.corefoundation.CFNumberFormatter;

import dstep.corefoundation.CFBase;
import dstep.corefoundation.CFLocale;
import dstep.corefoundation.CFNumber;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc : id;

struct __CFNumberFormatter;
alias __CFNumberFormatter* CFNumberFormatterRef;
alias int CFNumberFormatterStyle;
alias uint CFNumberFormatterOptionFlags;
alias int CFNumberFormatterRoundingMode;
alias int CFNumberFormatterPadPosition;

extern (C)
{
	extern
	{
		const CFStringRef kCFNumberFormatterCurrencyCode;
		const CFStringRef kCFNumberFormatterDecimalSeparator;
		const CFStringRef kCFNumberFormatterCurrencyDecimalSeparator;
		const CFStringRef kCFNumberFormatterAlwaysShowDecimalSeparator;
		const CFStringRef kCFNumberFormatterGroupingSeparator;
		const CFStringRef kCFNumberFormatterUseGroupingSeparator;
		const CFStringRef kCFNumberFormatterPercentSymbol;
		const CFStringRef kCFNumberFormatterZeroSymbol;
		const CFStringRef kCFNumberFormatterNaNSymbol;
		const CFStringRef kCFNumberFormatterInfinitySymbol;
		const CFStringRef kCFNumberFormatterMinusSign;
		const CFStringRef kCFNumberFormatterPlusSign;
		const CFStringRef kCFNumberFormatterCurrencySymbol;
		const CFStringRef kCFNumberFormatterExponentSymbol;
		const CFStringRef kCFNumberFormatterMinIntegerDigits;
		const CFStringRef kCFNumberFormatterMaxIntegerDigits;
		const CFStringRef kCFNumberFormatterMinFractionDigits;
		const CFStringRef kCFNumberFormatterMaxFractionDigits;
		const CFStringRef kCFNumberFormatterGroupingSize;
		const CFStringRef kCFNumberFormatterSecondaryGroupingSize;
		const CFStringRef kCFNumberFormatterRoundingMode;
		const CFStringRef kCFNumberFormatterRoundingIncrement;
		const CFStringRef kCFNumberFormatterFormatWidth;
		const CFStringRef kCFNumberFormatterPaddingPosition;
		const CFStringRef kCFNumberFormatterPaddingCharacter;
		const CFStringRef kCFNumberFormatterDefaultFormat;
		const CFStringRef kCFNumberFormatterMultiplier;
		const CFStringRef kCFNumberFormatterPositivePrefix;
		const CFStringRef kCFNumberFormatterPositiveSuffix;
		const CFStringRef kCFNumberFormatterNegativePrefix;
		const CFStringRef kCFNumberFormatterNegativeSuffix;
		const CFStringRef kCFNumberFormatterPerMillSymbol;
		const CFStringRef kCFNumberFormatterInternationalCurrencySymbol;
		const CFStringRef kCFNumberFormatterCurrencyGroupingSeparator;
		const CFStringRef kCFNumberFormatterIsLenient;
		const CFStringRef kCFNumberFormatterUseSignificantDigits;
		const CFStringRef kCFNumberFormatterMinSignificantDigits;
		const CFStringRef kCFNumberFormatterMaxSignificantDigits;
	}
}

enum
{
	kCFNumberFormatterNoStyle = 0,
	kCFNumberFormatterDecimalStyle = 1,
	kCFNumberFormatterCurrencyStyle = 2,
	kCFNumberFormatterPercentStyle = 3,
	kCFNumberFormatterScientificStyle = 4,
	kCFNumberFormatterSpellOutStyle = 5
}

enum
{
	kCFNumberFormatterParseIntegersOnly = 1
}

enum
{
	kCFNumberFormatterRoundCeiling = 0,
	kCFNumberFormatterRoundFloor = 1,
	kCFNumberFormatterRoundDown = 2,
	kCFNumberFormatterRoundUp = 3,
	kCFNumberFormatterRoundHalfEven = 4,
	kCFNumberFormatterRoundHalfDown = 5,
	kCFNumberFormatterRoundHalfUp = 6
}

enum
{
	kCFNumberFormatterPadBeforePrefix = 0,
	kCFNumberFormatterPadAfterPrefix = 1,
	kCFNumberFormatterPadBeforeSuffix = 2,
	kCFNumberFormatterPadAfterSuffix = 3
}

extern (C)
{
	uint CFNumberFormatterGetTypeID ();
	CFNumberFormatterRef CFNumberFormatterCreate (CFAllocatorRef allocator, CFLocaleRef locale, int style);
	CFLocaleRef CFNumberFormatterGetLocale (CFNumberFormatterRef formatter);
	int CFNumberFormatterGetStyle (CFNumberFormatterRef formatter);
	CFStringRef CFNumberFormatterGetFormat (CFNumberFormatterRef formatter);
	void CFNumberFormatterSetFormat (CFNumberFormatterRef formatter, CFStringRef formatString);
	CFStringRef CFNumberFormatterCreateStringWithNumber (CFAllocatorRef allocator, CFNumberFormatterRef formatter, CFNumberRef number);
	CFStringRef CFNumberFormatterCreateStringWithValue (CFAllocatorRef allocator, CFNumberFormatterRef formatter, int numberType, void* valuePtr);
	CFNumberRef CFNumberFormatterCreateNumberFromString (CFAllocatorRef allocator, CFNumberFormatterRef formatter, CFStringRef string, CFRange* rangep, uint options);
	ubyte CFNumberFormatterGetValueFromString (CFNumberFormatterRef formatter, CFStringRef string, CFRange* rangep, int numberType, void* valuePtr);
	void CFNumberFormatterSetProperty (CFNumberFormatterRef formatter, CFStringRef key, void* value);
	void* CFNumberFormatterCopyProperty (CFNumberFormatterRef formatter, CFStringRef key);
	ubyte CFNumberFormatterGetDecimalInfoForCurrencyCode (CFStringRef currencyCode, int* defaultFractionDigits, double* roundingIncrement);
}