view dstep/foundation/NSPropertyList.d @ 16:19885b43130e

Huge update, the bridge actually works now
author Jacob Carlborg <doob@me.com>
date Sun, 03 Jan 2010 22:06:11 +0100
parents 89f3c3ef1fd2
children b9de51448c6b
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.NSPropertyList;

import dstep.corefoundation.CFPropertyList;
import dstep.foundation.NSData;
import dstep.foundation.NSObjCRuntime;
import dstep.foundation.NSObject;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc;

alias NSUInteger NSPropertyListMutabilityOptions;
alias NSUInteger NSPropertyListFormat;

enum
{
	NSPropertyListImmutable = kCFPropertyListImmutable,
	NSPropertyListMutableContainers = kCFPropertyListMutableContainers,
	NSPropertyListMutableContainersAndLeaves = kCFPropertyListMutableContainersAndLeaves
}

enum
{
	NSPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat,
	NSPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0,
	NSPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0
}

class NSPropertyListSerialization : NSObject
{
	mixin (ObjcWrap);
	
	this ()
	{
		super(typeof(this).alloc.init.objcObject);
	}
	
	typeof(this) init ()
	{
		return invokeObjcSelf!(typeof(this), "init");
	}

	static bool propertyList (Object plist, uint format)
	{
		return invokeObjcSuperClass!(bool, "propertyList:isValidForFormat:", Object, uint)(plist, format);
	}

	static NSData dataFromPropertyList (Object plist, uint format, NSString** errorString)
	{
		return invokeObjcSuperClass!(NSData, "dataFromPropertyList:format:errorDescription:", Object, uint, NSString**)(plist, format, errorString);
	}

	static Object propertyListFromData (NSData data, uint opt, NSPropertyListFormat* format, NSString** errorString)
	{
		return invokeObjcSuperClass!(Object, "propertyListFromData:mutabilityOption:format:errorDescription:", NSData, uint, NSPropertyListFormat*, NSString**)(data, opt, format, errorString);
	}
}