comparison dstep/corefoundation/CFXMLParser.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
comparison
equal deleted inserted replaced
10:27e00625790b 11:07194b026fa4
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Jul 12, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.corefoundation.CFXMLParser;
8
9 import dstep.corefoundation.CFArray;
10 import dstep.corefoundation.CFBase;
11 import dstep.corefoundation.CFData;
12 import dstep.corefoundation.CFDictionary;
13 import dstep.corefoundation.CFTree;
14 import dstep.corefoundation.CFURL;
15 import dstep.corefoundation.CFXMLNode;
16 import dstep.objc.bridge.Bridge;
17 import dstep.objc.objc : id;
18
19 struct __CFXMLParser;
20 alias __CFXMLParser* CFXMLParserRef;
21 alias uint CFXMLParserOptions;
22 alias int CFXMLParserStatusCode;
23
24 extern (C)
25 {
26 alias void* function (void*) CFXMLParserRetainCallBack;
27 alias CFDataRef function (CFXMLParserRef, CFXMLExternalID*, void*) CFXMLParserResolveExternalEntityCallBack;
28 alias void function (CFXMLParserRef, void*, void*, void*) CFXMLParserAddChildCallBack;
29 alias void function (CFXMLParserRef, void*, void*) CFXMLParserEndXMLStructureCallBack;
30 alias CFStringRef function (void*) CFXMLParserCopyDescriptionCallBack;
31 alias void function (void*) CFXMLParserReleaseCallBack;
32 alias ubyte function (CFXMLParserRef, int, void*) CFXMLParserHandleErrorCallBack;
33 alias void* function (CFXMLParserRef, CFXMLNodeRef, void*) CFXMLParserCreateXMLStructureCallBack;
34 }
35
36 extern (C)
37 {
38 extern
39 {
40 const CFStringRef kCFXMLTreeErrorDescription;
41 const CFStringRef kCFXMLTreeErrorLineNumber;
42 const CFStringRef kCFXMLTreeErrorLocation;
43 const CFStringRef kCFXMLTreeErrorStatusCode;
44 }
45 }
46
47 enum
48 {
49 kCFXMLParserValidateDocument = (1 << 0),
50 kCFXMLParserSkipMetaData = (1 << 1),
51 kCFXMLParserReplacePhysicalEntities = (1 << 2),
52 kCFXMLParserSkipWhitespace = (1 << 3),
53 kCFXMLParserResolveExternalEntities = (1 << 4),
54 kCFXMLParserAddImpliedAttributes = (1 << 5),
55 kCFXMLParserAllOptions = 0x00FFFFFF,
56 kCFXMLParserNoOptions = 0
57 }
58
59 enum
60 {
61 kCFXMLStatusParseNotBegun = -2,
62 kCFXMLStatusParseInProgress = -1,
63 kCFXMLStatusParseSuccessful = 0,
64 kCFXMLErrorUnexpectedEOF = 1,
65 kCFXMLErrorUnknownEncoding,
66 kCFXMLErrorEncodingConversionFailure,
67 kCFXMLErrorMalformedProcessingInstruction,
68 kCFXMLErrorMalformedDTD,
69 kCFXMLErrorMalformedName,
70 kCFXMLErrorMalformedCDSect,
71 kCFXMLErrorMalformedCloseTag,
72 kCFXMLErrorMalformedStartTag,
73 kCFXMLErrorMalformedDocument,
74 kCFXMLErrorElementlessDocument,
75 kCFXMLErrorMalformedComment,
76 kCFXMLErrorMalformedCharacterReference,
77 kCFXMLErrorMalformedParsedCharacterData,
78 kCFXMLErrorNoData
79 }
80
81 struct CFXMLParserCallBacks
82 {
83 int version_;
84 CFXMLParserCreateXMLStructureCallBack* createXMLStructure;
85 CFXMLParserAddChildCallBack* addChild;
86 CFXMLParserEndXMLStructureCallBack* endXMLStructure;
87 CFXMLParserResolveExternalEntityCallBack* resolveExternalEntity;
88 CFXMLParserHandleErrorCallBack* handleError;
89 }
90
91
92 struct CFXMLParserContext
93 {
94 int version_;
95 void* info;
96 CFXMLParserRetainCallBack* retain;
97 CFXMLParserReleaseCallBack* release;
98 CFXMLParserCopyDescriptionCallBack* copyDescription;
99 }
100
101 extern (C)
102 {
103 uint CFXMLParserGetTypeID ();
104 CFXMLParserRef CFXMLParserCreate (CFAllocatorRef allocator, CFDataRef xmlData, CFURLRef dataSource, uint parseOptions, int versionOfNodes, CFXMLParserCallBacks* callBacks, CFXMLParserContext* context);
105 CFXMLParserRef CFXMLParserCreateWithDataFromURL (CFAllocatorRef allocator, CFURLRef dataSource, uint parseOptions, int versionOfNodes, CFXMLParserCallBacks* callBacks, CFXMLParserContext* context);
106 void CFXMLParserGetContext (CFXMLParserRef parser, CFXMLParserContext* context);
107 void CFXMLParserGetCallBacks (CFXMLParserRef parser, CFXMLParserCallBacks* callBacks);
108 CFURLRef CFXMLParserGetSourceURL (CFXMLParserRef parser);
109 int CFXMLParserGetLocation (CFXMLParserRef parser);
110 int CFXMLParserGetLineNumber (CFXMLParserRef parser);
111 void* CFXMLParserGetDocument (CFXMLParserRef parser);
112 int CFXMLParserGetStatusCode (CFXMLParserRef parser);
113 CFStringRef CFXMLParserCopyErrorDescription (CFXMLParserRef parser);
114 void CFXMLParserAbort (CFXMLParserRef parser, int errorCode, CFStringRef errorDescription);
115 ubyte CFXMLParserParse (CFXMLParserRef parser);
116 CFXMLTreeRef CFXMLTreeCreateFromData (CFAllocatorRef allocator, CFDataRef xmlData, CFURLRef dataSource, uint parseOptions, int versionOfNodes);
117 CFXMLTreeRef CFXMLTreeCreateFromDataWithError (CFAllocatorRef allocator, CFDataRef xmlData, CFURLRef dataSource, uint parseOptions, int versionOfNodes, CFDictionaryRef* errorDict);
118 CFXMLTreeRef CFXMLTreeCreateWithDataFromURL (CFAllocatorRef allocator, CFURLRef dataSource, uint parseOptions, int versionOfNodes);
119 CFDataRef CFXMLTreeCreateXMLData (CFAllocatorRef allocator, CFXMLTreeRef xmlTree);
120 CFStringRef CFXMLCreateStringByEscapingEntities (CFAllocatorRef allocator, CFStringRef string, CFDictionaryRef entitiesDictionary);
121 CFStringRef CFXMLCreateStringByUnescapingEntities (CFAllocatorRef allocator, CFStringRef string, CFDictionaryRef entitiesDictionary);
122 }