view dstep/corefoundation/CFBase.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.CFBase;

/*import dstep.AvailabilityMacros;
import dstep.MacTypes;
import dstep.coreservices.carboncore.MacTypes;
import dstep.libkern.OSTypes;*/
import dstep.objc.bridge.Bridge;
import dstep.objc.objc : id;
/*import dstep.stdbool;
import dstep.stdint;
import dstep.windows;
import dstep.winsock2;*/

alias uint CFTypeID;
alias uint CFOptionFlags;
alias uint CFHashCode;
alias int CFIndex;
alias void* CFTypeRef;
struct __CFString;
alias __CFString* CFStringRef;
alias __CFString* CFMutableStringRef;
alias void* CFPropertyListRef;
alias int CFComparisonResult;
struct __CFNull;
alias __CFNull* CFNullRef;
struct __CFAllocator;
alias __CFAllocator* CFAllocatorRef;

extern (C)
{
	alias void function (void*, void*) CFAllocatorDeallocateCallBack;
	alias void* function (void*, int, uint, void*) CFAllocatorReallocateCallBack;
	alias void* function (void*) CFAllocatorRetainCallBack;
	alias CFStringRef function (void*) CFAllocatorCopyDescriptionCallBack;
	alias int function (void*, void*, void*) CFComparatorFunction;
	alias void function (void*) CFAllocatorReleaseCallBack;
	alias int function (int, uint, void*) CFAllocatorPreferredSizeCallBack;
	alias void* function (int, uint, void*) CFAllocatorAllocateCallBack;
}

extern (C)
{
	extern
	{
		double kCFCoreFoundationVersionNumber;
		const CFNullRef kCFNull;
		const CFAllocatorRef kCFAllocatorDefault;
		const CFAllocatorRef kCFAllocatorSystemDefault;
		const CFAllocatorRef kCFAllocatorMalloc;
		const CFAllocatorRef kCFAllocatorMallocZone;
		const CFAllocatorRef kCFAllocatorNull;
		const CFAllocatorRef kCFAllocatorUseContext;
	}
}

enum
{
	kCFCompareLessThan = -1,
	kCFCompareEqualTo = 0,
	kCFCompareGreaterThan = 1
}

enum
{
	kCFNotFound = -1
}

struct CFRange
{
	int location;
	int length;
}


struct CFAllocatorContext
{
	int version_;
	void* info;
	CFAllocatorRetainCallBack* retain;
	CFAllocatorReleaseCallBack* release;
	CFAllocatorCopyDescriptionCallBack* copyDescription;
	CFAllocatorAllocateCallBack* allocate;
	CFAllocatorReallocateCallBack* reallocate;
	CFAllocatorDeallocateCallBack* deallocate;
	CFAllocatorPreferredSizeCallBack* preferredSize;
}

extern (C)
{
	CFRange __CFRangeMake (int loc, int len);
	uint CFNullGetTypeID ();
	uint CFAllocatorGetTypeID ();
	void CFAllocatorSetDefault (CFAllocatorRef allocator);
	CFAllocatorRef CFAllocatorGetDefault ();
	CFAllocatorRef CFAllocatorCreate (CFAllocatorRef allocator, CFAllocatorContext* context);
	void* CFAllocatorAllocate (CFAllocatorRef allocator, int size, uint hint);
	void* CFAllocatorReallocate (CFAllocatorRef allocator, void* ptr, int newsize, uint hint);
	void CFAllocatorDeallocate (CFAllocatorRef allocator, void* ptr);
	int CFAllocatorGetPreferredSizeForSize (CFAllocatorRef allocator, int size, uint hint);
	void CFAllocatorGetContext (CFAllocatorRef allocator, CFAllocatorContext* context);
	uint CFGetTypeID (void* cf);
	CFStringRef CFCopyTypeIDDescription (uint type_id);
	void* CFRetain (void* cf);
	void CFRelease (void* cf);
	int CFGetRetainCount (void* cf);
	void* CFMakeCollectable (void* cf);
	ubyte CFEqual (void* cf1, void* cf2);
	uint CFHash (void* cf);
	CFStringRef CFCopyDescription (void* cf);
	CFAllocatorRef CFGetAllocator (void* cf);
}