use crate::common::*;
use crate::Foundation::*;
ns_enum!(
#[underlying(NSUInteger)]
pub enum NSXMLDocumentContentKind {
NSXMLDocumentXMLKind = 0,
NSXMLDocumentXHTMLKind = 1,
NSXMLDocumentHTMLKind = 2,
NSXMLDocumentTextKind = 3,
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSXMLDocument;
unsafe impl ClassType for NSXMLDocument {
#[inherits(NSObject)]
type Super = NSXMLNode;
}
);
extern_methods!(
unsafe impl NSXMLDocument {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Option<Allocated<Self>>) -> Id<Self, Shared>;
#[method_id(@__retain_semantics Init initWithXMLString:options:error:)]
pub unsafe fn initWithXMLString_options_error(
this: Option<Allocated<Self>>,
string: &NSString,
mask: NSXMLNodeOptions,
) -> Result<Id<Self, Shared>, Id<NSError, Shared>>;
#[method_id(@__retain_semantics Init initWithContentsOfURL:options:error:)]
pub unsafe fn initWithContentsOfURL_options_error(
this: Option<Allocated<Self>>,
url: &NSURL,
mask: NSXMLNodeOptions,
) -> Result<Id<Self, Shared>, Id<NSError, Shared>>;
#[method_id(@__retain_semantics Init initWithData:options:error:)]
pub unsafe fn initWithData_options_error(
this: Option<Allocated<Self>>,
data: &NSData,
mask: NSXMLNodeOptions,
) -> Result<Id<Self, Shared>, Id<NSError, Shared>>;
#[method_id(@__retain_semantics Init initWithRootElement:)]
pub unsafe fn initWithRootElement(
this: Option<Allocated<Self>>,
element: Option<&NSXMLElement>,
) -> Id<Self, Shared>;
#[method(replacementClassForClass:)]
pub unsafe fn replacementClassForClass(cls: &Class) -> &'static Class;
#[method_id(@__retain_semantics Other characterEncoding)]
pub unsafe fn characterEncoding(&self) -> Option<Id<NSString, Shared>>;
#[method(setCharacterEncoding:)]
pub unsafe fn setCharacterEncoding(&self, characterEncoding: Option<&NSString>);
#[method_id(@__retain_semantics Other version)]
pub unsafe fn version(&self) -> Option<Id<NSString, Shared>>;
#[method(setVersion:)]
pub unsafe fn setVersion(&self, version: Option<&NSString>);
#[method(isStandalone)]
pub unsafe fn isStandalone(&self) -> bool;
#[method(setStandalone:)]
pub unsafe fn setStandalone(&self, standalone: bool);
#[method(documentContentKind)]
pub unsafe fn documentContentKind(&self) -> NSXMLDocumentContentKind;
#[method(setDocumentContentKind:)]
pub unsafe fn setDocumentContentKind(&self, documentContentKind: NSXMLDocumentContentKind);
#[method_id(@__retain_semantics Other MIMEType)]
pub unsafe fn MIMEType(&self) -> Option<Id<NSString, Shared>>;
#[method(setMIMEType:)]
pub unsafe fn setMIMEType(&self, MIMEType: Option<&NSString>);
#[method_id(@__retain_semantics Other DTD)]
pub unsafe fn DTD(&self) -> Option<Id<NSXMLDTD, Shared>>;
#[method(setDTD:)]
pub unsafe fn setDTD(&self, DTD: Option<&NSXMLDTD>);
#[method(setRootElement:)]
pub unsafe fn setRootElement(&self, root: &NSXMLElement);
#[method_id(@__retain_semantics Other rootElement)]
pub unsafe fn rootElement(&self) -> Option<Id<NSXMLElement, Shared>>;
#[method(insertChild:atIndex:)]
pub unsafe fn insertChild_atIndex(&self, child: &NSXMLNode, index: NSUInteger);
#[method(insertChildren:atIndex:)]
pub unsafe fn insertChildren_atIndex(
&self,
children: &NSArray<NSXMLNode>,
index: NSUInteger,
);
#[method(removeChildAtIndex:)]
pub unsafe fn removeChildAtIndex(&self, index: NSUInteger);
#[method(setChildren:)]
pub unsafe fn setChildren(&self, children: Option<&NSArray<NSXMLNode>>);
#[method(addChild:)]
pub unsafe fn addChild(&self, child: &NSXMLNode);
#[method(replaceChildAtIndex:withNode:)]
pub unsafe fn replaceChildAtIndex_withNode(&self, index: NSUInteger, node: &NSXMLNode);
#[method_id(@__retain_semantics Other XMLData)]
pub unsafe fn XMLData(&self) -> Id<NSData, Shared>;
#[method_id(@__retain_semantics Other XMLDataWithOptions:)]
pub unsafe fn XMLDataWithOptions(&self, options: NSXMLNodeOptions) -> Id<NSData, Shared>;
#[method_id(@__retain_semantics Other objectByApplyingXSLT:arguments:error:)]
pub unsafe fn objectByApplyingXSLT_arguments_error(
&self,
xslt: &NSData,
arguments: Option<&NSDictionary<NSString, NSString>>,
) -> Result<Id<Object, Shared>, Id<NSError, Shared>>;
#[method_id(@__retain_semantics Other objectByApplyingXSLTString:arguments:error:)]
pub unsafe fn objectByApplyingXSLTString_arguments_error(
&self,
xslt: &NSString,
arguments: Option<&NSDictionary<NSString, NSString>>,
) -> Result<Id<Object, Shared>, Id<NSError, Shared>>;
#[method_id(@__retain_semantics Other objectByApplyingXSLTAtURL:arguments:error:)]
pub unsafe fn objectByApplyingXSLTAtURL_arguments_error(
&self,
xsltURL: &NSURL,
argument: Option<&NSDictionary<NSString, NSString>>,
) -> Result<Id<Object, Shared>, Id<NSError, Shared>>;
#[method(validateAndReturnError:)]
pub unsafe fn validateAndReturnError(&self) -> Result<(), Id<NSError, Shared>>;
}
);
extern_methods!(
unsafe impl NSXMLDocument {
#[method_id(@__retain_semantics Init initWithKind:)]
pub unsafe fn initWithKind(
this: Option<Allocated<Self>>,
kind: NSXMLNodeKind,
) -> Id<Self, Shared>;
#[method_id(@__retain_semantics Init initWithKind:options:)]
pub unsafe fn initWithKind_options(
this: Option<Allocated<Self>>,
kind: NSXMLNodeKind,
options: NSXMLNodeOptions,
) -> Id<Self, Shared>;
}
);