use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSXMLDocumentContentKind(pub NSUInteger);
impl NSXMLDocumentContentKind {
#[doc(alias = "NSXMLDocumentXMLKind")]
pub const XMLKind: Self = Self(0);
#[doc(alias = "NSXMLDocumentXHTMLKind")]
pub const XHTMLKind: Self = Self(1);
#[doc(alias = "NSXMLDocumentHTMLKind")]
pub const HTMLKind: Self = Self(2);
#[doc(alias = "NSXMLDocumentTextKind")]
pub const TextKind: Self = Self(3);
}
unsafe impl Encode for NSXMLDocumentContentKind {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSXMLDocumentContentKind {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSXMLNode, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSXMLNode")]
pub struct NSXMLDocument;
);
#[cfg(all(feature = "NSObject", feature = "NSXMLNode"))]
extern_conformance!(
unsafe impl NSCopying for NSXMLDocument {}
);
#[cfg(all(feature = "NSObject", feature = "NSXMLNode"))]
unsafe impl CopyingHelper for NSXMLDocument {
type Result = Self;
}
#[cfg(feature = "NSXMLNode")]
extern_conformance!(
unsafe impl NSObjectProtocol for NSXMLDocument {}
);
#[cfg(feature = "NSXMLNode")]
impl NSXMLDocument {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "NSError",
feature = "NSString",
feature = "NSXMLNodeOptions"
))]
#[unsafe(method(initWithXMLString:options:error:_))]
#[unsafe(method_family = init)]
pub fn initWithXMLString_options_error(
this: Allocated<Self>,
string: &NSString,
mask: NSXMLNodeOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL", feature = "NSXMLNodeOptions"))]
#[unsafe(method(initWithContentsOfURL:options:error:_))]
#[unsafe(method_family = init)]
pub fn initWithContentsOfURL_options_error(
this: Allocated<Self>,
url: &NSURL,
mask: NSXMLNodeOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError", feature = "NSXMLNodeOptions"))]
#[unsafe(method(initWithData:options:error:_))]
#[unsafe(method_family = init)]
pub fn initWithData_options_error(
this: Allocated<Self>,
data: &NSData,
mask: NSXMLNodeOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "NSXMLElement")]
#[unsafe(method(initWithRootElement:))]
#[unsafe(method_family = init)]
pub fn initWithRootElement(
this: Allocated<Self>,
element: Option<&NSXMLElement>,
) -> Retained<Self>;
#[unsafe(method(replacementClassForClass:))]
#[unsafe(method_family = none)]
pub unsafe fn replacementClassForClass(cls: &AnyClass) -> &'static AnyClass;
#[cfg(feature = "NSString")]
#[unsafe(method(characterEncoding))]
#[unsafe(method_family = none)]
pub fn characterEncoding(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[unsafe(method(setCharacterEncoding:))]
#[unsafe(method_family = none)]
pub fn setCharacterEncoding(&self, character_encoding: Option<&NSString>);
#[cfg(feature = "NSString")]
#[unsafe(method(version))]
#[unsafe(method_family = none)]
pub fn version(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[unsafe(method(setVersion:))]
#[unsafe(method_family = none)]
pub fn setVersion(&self, version: Option<&NSString>);
#[unsafe(method(isStandalone))]
#[unsafe(method_family = none)]
pub fn isStandalone(&self) -> bool;
#[unsafe(method(setStandalone:))]
#[unsafe(method_family = none)]
pub fn setStandalone(&self, standalone: bool);
#[unsafe(method(documentContentKind))]
#[unsafe(method_family = none)]
pub fn documentContentKind(&self) -> NSXMLDocumentContentKind;
#[unsafe(method(setDocumentContentKind:))]
#[unsafe(method_family = none)]
pub fn setDocumentContentKind(&self, document_content_kind: NSXMLDocumentContentKind);
#[cfg(feature = "NSString")]
#[unsafe(method(MIMEType))]
#[unsafe(method_family = none)]
pub fn MIMEType(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[unsafe(method(setMIMEType:))]
#[unsafe(method_family = none)]
pub fn setMIMEType(&self, mime_type: Option<&NSString>);
#[cfg(feature = "NSXMLDTD")]
#[unsafe(method(DTD))]
#[unsafe(method_family = none)]
pub fn DTD(&self) -> Option<Retained<NSXMLDTD>>;
#[cfg(feature = "NSXMLDTD")]
#[unsafe(method(setDTD:))]
#[unsafe(method_family = none)]
pub fn setDTD(&self, dtd: Option<&NSXMLDTD>);
#[cfg(feature = "NSXMLElement")]
#[unsafe(method(setRootElement:))]
#[unsafe(method_family = none)]
pub fn setRootElement(&self, root: &NSXMLElement);
#[cfg(feature = "NSXMLElement")]
#[unsafe(method(rootElement))]
#[unsafe(method_family = none)]
pub fn rootElement(&self) -> Option<Retained<NSXMLElement>>;
#[unsafe(method(insertChild:atIndex:))]
#[unsafe(method_family = none)]
pub fn insertChild_atIndex(&self, child: &NSXMLNode, index: NSUInteger);
#[cfg(feature = "NSArray")]
#[unsafe(method(insertChildren:atIndex:))]
#[unsafe(method_family = none)]
pub fn insertChildren_atIndex(&self, children: &NSArray<NSXMLNode>, index: NSUInteger);
#[unsafe(method(removeChildAtIndex:))]
#[unsafe(method_family = none)]
pub fn removeChildAtIndex(&self, index: NSUInteger);
#[cfg(feature = "NSArray")]
#[unsafe(method(setChildren:))]
#[unsafe(method_family = none)]
pub fn setChildren(&self, children: Option<&NSArray<NSXMLNode>>);
#[unsafe(method(addChild:))]
#[unsafe(method_family = none)]
pub fn addChild(&self, child: &NSXMLNode);
#[unsafe(method(replaceChildAtIndex:withNode:))]
#[unsafe(method_family = none)]
pub fn replaceChildAtIndex_withNode(&self, index: NSUInteger, node: &NSXMLNode);
#[cfg(feature = "NSData")]
#[unsafe(method(XMLData))]
#[unsafe(method_family = none)]
pub fn XMLData(&self) -> Retained<NSData>;
#[cfg(all(feature = "NSData", feature = "NSXMLNodeOptions"))]
#[unsafe(method(XMLDataWithOptions:))]
#[unsafe(method_family = none)]
pub fn XMLDataWithOptions(&self, options: NSXMLNodeOptions) -> Retained<NSData>;
#[cfg(all(
feature = "NSData",
feature = "NSDictionary",
feature = "NSError",
feature = "NSString"
))]
#[unsafe(method(objectByApplyingXSLT:arguments:error:_))]
#[unsafe(method_family = none)]
pub fn objectByApplyingXSLT_arguments_error(
&self,
xslt: &NSData,
arguments: Option<&NSDictionary<NSString, NSString>>,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
#[unsafe(method(objectByApplyingXSLTString:arguments:error:_))]
#[unsafe(method_family = none)]
pub fn objectByApplyingXSLTString_arguments_error(
&self,
xslt: &NSString,
arguments: Option<&NSDictionary<NSString, NSString>>,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSString",
feature = "NSURL"
))]
#[unsafe(method(objectByApplyingXSLTAtURL:arguments:error:_))]
#[unsafe(method_family = none)]
pub fn objectByApplyingXSLTAtURL_arguments_error(
&self,
xslt_url: &NSURL,
argument: Option<&NSDictionary<NSString, NSString>>,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(feature = "NSError")]
#[unsafe(method(validateAndReturnError:_))]
#[unsafe(method_family = none)]
pub fn validateAndReturnError(&self) -> Result<(), Retained<NSError>>;
);
}
#[cfg(feature = "NSXMLNode")]
impl NSXMLDocument {
extern_methods!(
#[unsafe(method(initWithKind:))]
#[unsafe(method_family = init)]
pub fn initWithKind(this: Allocated<Self>, kind: NSXMLNodeKind) -> Retained<Self>;
#[cfg(feature = "NSXMLNodeOptions")]
#[unsafe(method(initWithKind:options:))]
#[unsafe(method_family = init)]
pub fn initWithKind_options(
this: Allocated<Self>,
kind: NSXMLNodeKind,
options: NSXMLNodeOptions,
) -> Retained<Self>;
);
}
#[cfg(feature = "NSXMLNode")]
impl NSXMLDocument {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
#[cfg(feature = "NSXMLNode")]
impl DefaultRetained for NSXMLDocument {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}