comparison 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
comparison
equal deleted inserted replaced
13:4f583f7e242e 14:89f3c3ef1fd2
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Aug 3, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.foundation.NSPropertyList;
8
9 import dstep.corefoundation.CFPropertyList;
10 import dstep.foundation.NSData;
11 import dstep.foundation.NSObject;
12 import dstep.foundation.NSString;
13 import dstep.objc.bridge.Bridge;
14 import dstep.objc.objc : id;
15
16 alias NSUInteger NSPropertyListMutabilityOptions;
17 alias NSUInteger NSPropertyListFormat;
18
19 enum
20 {
21 NSPropertyListImmutable = kCFPropertyListImmutable,
22 NSPropertyListMutableContainers = kCFPropertyListMutableContainers,
23 NSPropertyListMutableContainersAndLeaves = kCFPropertyListMutableContainersAndLeaves
24 }
25
26 enum
27 {
28 NSPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat,
29 NSPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0,
30 NSPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0
31 }
32
33 class NSPropertyListSerialization : NSObject
34 {
35 mixin ObjcWrap;
36
37 static bool propertyList (Object plist, uint format)
38 {
39 return invokeObjcSelfClass!(bool, "propertyList:isValidForFormat:", Object, uint)(plist, format);
40 }
41
42 static NSData dataFromPropertyList (Object plist, uint format, NSString** errorString)
43 {
44 return invokeObjcSelfClass!(NSData, "dataFromPropertyList:format:errorDescription:", Object, uint, NSString**)(plist, format, errorString);
45 }
46
47 static Object propertyListFromData (NSData data, uint opt, NSPropertyListFormat* format, NSString** errorString)
48 {
49 return invokeObjcSelfClass!(Object, "propertyListFromData:mutabilityOption:format:errorDescription:", NSData, uint, NSPropertyListFormat*, NSString**)(data, opt, format, errorString);
50 }
51 }
52