view dstep/foundation/NSPropertyList.d @ 14:89f3c3ef1fd2

Added the Foundation framework
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 15:23:15 +0200
parents
children 19885b43130e
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.NSObject;
import dstep.foundation.NSString;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc : id;

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;

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

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

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