view 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
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.CFXMLParser;

import dstep.corefoundation.CFArray;
import dstep.corefoundation.CFBase;
import dstep.corefoundation.CFData;
import dstep.corefoundation.CFDictionary;
import dstep.corefoundation.CFTree;
import dstep.corefoundation.CFURL;
import dstep.corefoundation.CFXMLNode;
import dstep.objc.bridge.Bridge;
import dstep.objc.objc : id;

struct __CFXMLParser;
alias __CFXMLParser* CFXMLParserRef;
alias uint CFXMLParserOptions;
alias int CFXMLParserStatusCode;

extern (C)
{
	alias void* function (void*) CFXMLParserRetainCallBack;
	alias CFDataRef function (CFXMLParserRef, CFXMLExternalID*, void*) CFXMLParserResolveExternalEntityCallBack;
	alias void function (CFXMLParserRef, void*, void*, void*) CFXMLParserAddChildCallBack;
	alias void function (CFXMLParserRef, void*, void*) CFXMLParserEndXMLStructureCallBack;
	alias CFStringRef function (void*) CFXMLParserCopyDescriptionCallBack;
	alias void function (void*) CFXMLParserReleaseCallBack;
	alias ubyte function (CFXMLParserRef, int, void*) CFXMLParserHandleErrorCallBack;
	alias void* function (CFXMLParserRef, CFXMLNodeRef, void*) CFXMLParserCreateXMLStructureCallBack;
}

extern (C)
{
	extern
	{
		const CFStringRef kCFXMLTreeErrorDescription;
		const CFStringRef kCFXMLTreeErrorLineNumber;
		const CFStringRef kCFXMLTreeErrorLocation;
		const CFStringRef kCFXMLTreeErrorStatusCode;
	}
}

enum
{
	kCFXMLParserValidateDocument = (1 << 0),
	kCFXMLParserSkipMetaData = (1 << 1),
	kCFXMLParserReplacePhysicalEntities = (1 << 2),
	kCFXMLParserSkipWhitespace = (1 << 3),
	kCFXMLParserResolveExternalEntities = (1 << 4),
	kCFXMLParserAddImpliedAttributes = (1 << 5),
	kCFXMLParserAllOptions = 0x00FFFFFF,
	kCFXMLParserNoOptions = 0
}

enum
{
	kCFXMLStatusParseNotBegun = -2,
	kCFXMLStatusParseInProgress = -1,
	kCFXMLStatusParseSuccessful = 0,
	kCFXMLErrorUnexpectedEOF = 1,
	kCFXMLErrorUnknownEncoding,
	kCFXMLErrorEncodingConversionFailure,
	kCFXMLErrorMalformedProcessingInstruction,
	kCFXMLErrorMalformedDTD,
	kCFXMLErrorMalformedName,
	kCFXMLErrorMalformedCDSect,
	kCFXMLErrorMalformedCloseTag,
	kCFXMLErrorMalformedStartTag,
	kCFXMLErrorMalformedDocument,
	kCFXMLErrorElementlessDocument,
	kCFXMLErrorMalformedComment,
	kCFXMLErrorMalformedCharacterReference,
	kCFXMLErrorMalformedParsedCharacterData,
	kCFXMLErrorNoData
}

struct CFXMLParserCallBacks
{
	int version_;
	CFXMLParserCreateXMLStructureCallBack* createXMLStructure;
	CFXMLParserAddChildCallBack* addChild;
	CFXMLParserEndXMLStructureCallBack* endXMLStructure;
	CFXMLParserResolveExternalEntityCallBack* resolveExternalEntity;
	CFXMLParserHandleErrorCallBack* handleError;
}


struct CFXMLParserContext
{
	int version_;
	void* info;
	CFXMLParserRetainCallBack* retain;
	CFXMLParserReleaseCallBack* release;
	CFXMLParserCopyDescriptionCallBack* copyDescription;
}

extern (C)
{
	uint CFXMLParserGetTypeID ();
	CFXMLParserRef CFXMLParserCreate (CFAllocatorRef allocator, CFDataRef xmlData, CFURLRef dataSource, uint parseOptions, int versionOfNodes, CFXMLParserCallBacks* callBacks, CFXMLParserContext* context);
	CFXMLParserRef CFXMLParserCreateWithDataFromURL (CFAllocatorRef allocator, CFURLRef dataSource, uint parseOptions, int versionOfNodes, CFXMLParserCallBacks* callBacks, CFXMLParserContext* context);
	void CFXMLParserGetContext (CFXMLParserRef parser, CFXMLParserContext* context);
	void CFXMLParserGetCallBacks (CFXMLParserRef parser, CFXMLParserCallBacks* callBacks);
	CFURLRef CFXMLParserGetSourceURL (CFXMLParserRef parser);
	int CFXMLParserGetLocation (CFXMLParserRef parser);
	int CFXMLParserGetLineNumber (CFXMLParserRef parser);
	void* CFXMLParserGetDocument (CFXMLParserRef parser);
	int CFXMLParserGetStatusCode (CFXMLParserRef parser);
	CFStringRef CFXMLParserCopyErrorDescription (CFXMLParserRef parser);
	void CFXMLParserAbort (CFXMLParserRef parser, int errorCode, CFStringRef errorDescription);
	ubyte CFXMLParserParse (CFXMLParserRef parser);
	CFXMLTreeRef CFXMLTreeCreateFromData (CFAllocatorRef allocator, CFDataRef xmlData, CFURLRef dataSource, uint parseOptions, int versionOfNodes);
	CFXMLTreeRef CFXMLTreeCreateFromDataWithError (CFAllocatorRef allocator, CFDataRef xmlData, CFURLRef dataSource, uint parseOptions, int versionOfNodes, CFDictionaryRef* errorDict);
	CFXMLTreeRef CFXMLTreeCreateWithDataFromURL (CFAllocatorRef allocator, CFURLRef dataSource, uint parseOptions, int versionOfNodes);
	CFDataRef CFXMLTreeCreateXMLData (CFAllocatorRef allocator, CFXMLTreeRef xmlTree);
	CFStringRef CFXMLCreateStringByEscapingEntities (CFAllocatorRef allocator, CFStringRef string, CFDictionaryRef entitiesDictionary);
	CFStringRef CFXMLCreateStringByUnescapingEntities (CFAllocatorRef allocator, CFStringRef string, CFDictionaryRef entitiesDictionary);
}