use objc2::__framework_prelude::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSXMLParserExternalEntityResolvingPolicy(pub NSUInteger);
impl NSXMLParserExternalEntityResolvingPolicy {
pub const NSXMLParserResolveExternalEntitiesNever: Self = Self(0);
pub const NSXMLParserResolveExternalEntitiesNoNetwork: Self = Self(1);
pub const NSXMLParserResolveExternalEntitiesSameOriginOnly: Self = Self(2);
pub const NSXMLParserResolveExternalEntitiesAlways: Self = Self(3);
}
unsafe impl Encode for NSXMLParserExternalEntityResolvingPolicy {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSXMLParserExternalEntityResolvingPolicy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSXMLParser;
unsafe impl ClassType for NSXMLParser {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSXMLParser {}
extern_methods!(
unsafe impl NSXMLParser {
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Init initWithData:)]
pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;
#[cfg(feature = "NSStream")]
#[method_id(@__retain_semantics Init initWithStream:)]
pub unsafe fn initWithStream(
this: Allocated<Self>,
stream: &NSInputStream,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSXMLParserDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSXMLParserDelegate>>,
);
#[method(shouldProcessNamespaces)]
pub unsafe fn shouldProcessNamespaces(&self) -> bool;
#[method(setShouldProcessNamespaces:)]
pub unsafe fn setShouldProcessNamespaces(&self, should_process_namespaces: bool);
#[method(shouldReportNamespacePrefixes)]
pub unsafe fn shouldReportNamespacePrefixes(&self) -> bool;
#[method(setShouldReportNamespacePrefixes:)]
pub unsafe fn setShouldReportNamespacePrefixes(
&self,
should_report_namespace_prefixes: bool,
);
#[method(externalEntityResolvingPolicy)]
pub unsafe fn externalEntityResolvingPolicy(
&self,
) -> NSXMLParserExternalEntityResolvingPolicy;
#[method(setExternalEntityResolvingPolicy:)]
pub unsafe fn setExternalEntityResolvingPolicy(
&self,
external_entity_resolving_policy: NSXMLParserExternalEntityResolvingPolicy,
);
#[cfg(all(feature = "NSSet", feature = "NSURL"))]
#[method_id(@__retain_semantics Other allowedExternalEntityURLs)]
pub unsafe fn allowedExternalEntityURLs(&self) -> Option<Retained<NSSet<NSURL>>>;
#[cfg(all(feature = "NSSet", feature = "NSURL"))]
#[method(setAllowedExternalEntityURLs:)]
pub unsafe fn setAllowedExternalEntityURLs(
&self,
allowed_external_entity_ur_ls: Option<&NSSet<NSURL>>,
);
#[method(parse)]
pub unsafe fn parse(&self) -> bool;
#[method(abortParsing)]
pub unsafe fn abortParsing(&self);
#[cfg(feature = "NSError")]
#[method_id(@__retain_semantics Other parserError)]
pub unsafe fn parserError(&self) -> Option<Retained<NSError>>;
#[method(shouldResolveExternalEntities)]
pub unsafe fn shouldResolveExternalEntities(&self) -> bool;
#[method(setShouldResolveExternalEntities:)]
pub unsafe fn setShouldResolveExternalEntities(
&self,
should_resolve_external_entities: bool,
);
}
);
extern_methods!(
unsafe impl NSXMLParser {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
unsafe impl NSXMLParser {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other publicID)]
pub unsafe fn publicID(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other systemID)]
pub unsafe fn systemID(&self) -> Option<Retained<NSString>>;
#[method(lineNumber)]
pub unsafe fn lineNumber(&self) -> NSInteger;
#[method(columnNumber)]
pub unsafe fn columnNumber(&self) -> NSInteger;
}
);
extern_protocol!(
pub unsafe trait NSXMLParserDelegate: NSObjectProtocol {
#[optional]
#[method(parserDidStartDocument:)]
unsafe fn parserDidStartDocument(&self, parser: &NSXMLParser);
#[optional]
#[method(parserDidEndDocument:)]
unsafe fn parserDidEndDocument(&self, parser: &NSXMLParser);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundNotationDeclarationWithName:publicID:systemID:)]
unsafe fn parser_foundNotationDeclarationWithName_publicID_systemID(
&self,
parser: &NSXMLParser,
name: &NSString,
public_id: Option<&NSString>,
system_id: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundUnparsedEntityDeclarationWithName:publicID:systemID:notationName:)]
unsafe fn parser_foundUnparsedEntityDeclarationWithName_publicID_systemID_notationName(
&self,
parser: &NSXMLParser,
name: &NSString,
public_id: Option<&NSString>,
system_id: Option<&NSString>,
notation_name: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:)]
unsafe fn parser_foundAttributeDeclarationWithName_forElement_type_defaultValue(
&self,
parser: &NSXMLParser,
attribute_name: &NSString,
element_name: &NSString,
r#type: Option<&NSString>,
default_value: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundElementDeclarationWithName:model:)]
unsafe fn parser_foundElementDeclarationWithName_model(
&self,
parser: &NSXMLParser,
element_name: &NSString,
model: &NSString,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundInternalEntityDeclarationWithName:value:)]
unsafe fn parser_foundInternalEntityDeclarationWithName_value(
&self,
parser: &NSXMLParser,
name: &NSString,
value: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundExternalEntityDeclarationWithName:publicID:systemID:)]
unsafe fn parser_foundExternalEntityDeclarationWithName_publicID_systemID(
&self,
parser: &NSXMLParser,
name: &NSString,
public_id: Option<&NSString>,
system_id: Option<&NSString>,
);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[optional]
#[method(parser:didStartElement:namespaceURI:qualifiedName:attributes:)]
unsafe fn parser_didStartElement_namespaceURI_qualifiedName_attributes(
&self,
parser: &NSXMLParser,
element_name: &NSString,
namespace_uri: Option<&NSString>,
q_name: Option<&NSString>,
attribute_dict: &NSDictionary<NSString, NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:didEndElement:namespaceURI:qualifiedName:)]
unsafe fn parser_didEndElement_namespaceURI_qualifiedName(
&self,
parser: &NSXMLParser,
element_name: &NSString,
namespace_uri: Option<&NSString>,
q_name: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:didStartMappingPrefix:toURI:)]
unsafe fn parser_didStartMappingPrefix_toURI(
&self,
parser: &NSXMLParser,
prefix: &NSString,
namespace_uri: &NSString,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:didEndMappingPrefix:)]
unsafe fn parser_didEndMappingPrefix(&self, parser: &NSXMLParser, prefix: &NSString);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundCharacters:)]
unsafe fn parser_foundCharacters(&self, parser: &NSXMLParser, string: &NSString);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundIgnorableWhitespace:)]
unsafe fn parser_foundIgnorableWhitespace(
&self,
parser: &NSXMLParser,
whitespace_string: &NSString,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundProcessingInstructionWithTarget:data:)]
unsafe fn parser_foundProcessingInstructionWithTarget_data(
&self,
parser: &NSXMLParser,
target: &NSString,
data: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(parser:foundComment:)]
unsafe fn parser_foundComment(&self, parser: &NSXMLParser, comment: &NSString);
#[cfg(feature = "NSData")]
#[optional]
#[method(parser:foundCDATA:)]
unsafe fn parser_foundCDATA(&self, parser: &NSXMLParser, cdata_block: &NSData);
#[cfg(all(feature = "NSData", feature = "NSString"))]
#[optional]
#[method_id(@__retain_semantics Other parser:resolveExternalEntityName:systemID:)]
unsafe fn parser_resolveExternalEntityName_systemID(
&self,
parser: &NSXMLParser,
name: &NSString,
system_id: Option<&NSString>,
) -> Option<Retained<NSData>>;
#[cfg(feature = "NSError")]
#[optional]
#[method(parser:parseErrorOccurred:)]
unsafe fn parser_parseErrorOccurred(&self, parser: &NSXMLParser, parse_error: &NSError);
#[cfg(feature = "NSError")]
#[optional]
#[method(parser:validationErrorOccurred:)]
unsafe fn parser_validationErrorOccurred(
&self,
parser: &NSXMLParser,
validation_error: &NSError,
);
}
unsafe impl ProtocolType for dyn NSXMLParserDelegate {}
);
extern "C" {
#[cfg(all(feature = "NSError", feature = "NSString"))]
pub static NSXMLParserErrorDomain: &'static NSErrorDomain;
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSXMLParserError(pub NSInteger);
impl NSXMLParserError {
pub const NSXMLParserInternalError: Self = Self(1);
pub const NSXMLParserOutOfMemoryError: Self = Self(2);
pub const NSXMLParserDocumentStartError: Self = Self(3);
pub const NSXMLParserEmptyDocumentError: Self = Self(4);
pub const NSXMLParserPrematureDocumentEndError: Self = Self(5);
pub const NSXMLParserInvalidHexCharacterRefError: Self = Self(6);
pub const NSXMLParserInvalidDecimalCharacterRefError: Self = Self(7);
pub const NSXMLParserInvalidCharacterRefError: Self = Self(8);
pub const NSXMLParserInvalidCharacterError: Self = Self(9);
pub const NSXMLParserCharacterRefAtEOFError: Self = Self(10);
pub const NSXMLParserCharacterRefInPrologError: Self = Self(11);
pub const NSXMLParserCharacterRefInEpilogError: Self = Self(12);
pub const NSXMLParserCharacterRefInDTDError: Self = Self(13);
pub const NSXMLParserEntityRefAtEOFError: Self = Self(14);
pub const NSXMLParserEntityRefInPrologError: Self = Self(15);
pub const NSXMLParserEntityRefInEpilogError: Self = Self(16);
pub const NSXMLParserEntityRefInDTDError: Self = Self(17);
pub const NSXMLParserParsedEntityRefAtEOFError: Self = Self(18);
pub const NSXMLParserParsedEntityRefInPrologError: Self = Self(19);
pub const NSXMLParserParsedEntityRefInEpilogError: Self = Self(20);
pub const NSXMLParserParsedEntityRefInInternalSubsetError: Self = Self(21);
pub const NSXMLParserEntityReferenceWithoutNameError: Self = Self(22);
pub const NSXMLParserEntityReferenceMissingSemiError: Self = Self(23);
pub const NSXMLParserParsedEntityRefNoNameError: Self = Self(24);
pub const NSXMLParserParsedEntityRefMissingSemiError: Self = Self(25);
pub const NSXMLParserUndeclaredEntityError: Self = Self(26);
pub const NSXMLParserUnparsedEntityError: Self = Self(28);
pub const NSXMLParserEntityIsExternalError: Self = Self(29);
pub const NSXMLParserEntityIsParameterError: Self = Self(30);
pub const NSXMLParserUnknownEncodingError: Self = Self(31);
pub const NSXMLParserEncodingNotSupportedError: Self = Self(32);
pub const NSXMLParserStringNotStartedError: Self = Self(33);
pub const NSXMLParserStringNotClosedError: Self = Self(34);
pub const NSXMLParserNamespaceDeclarationError: Self = Self(35);
pub const NSXMLParserEntityNotStartedError: Self = Self(36);
pub const NSXMLParserEntityNotFinishedError: Self = Self(37);
pub const NSXMLParserLessThanSymbolInAttributeError: Self = Self(38);
pub const NSXMLParserAttributeNotStartedError: Self = Self(39);
pub const NSXMLParserAttributeNotFinishedError: Self = Self(40);
pub const NSXMLParserAttributeHasNoValueError: Self = Self(41);
pub const NSXMLParserAttributeRedefinedError: Self = Self(42);
pub const NSXMLParserLiteralNotStartedError: Self = Self(43);
pub const NSXMLParserLiteralNotFinishedError: Self = Self(44);
pub const NSXMLParserCommentNotFinishedError: Self = Self(45);
pub const NSXMLParserProcessingInstructionNotStartedError: Self = Self(46);
pub const NSXMLParserProcessingInstructionNotFinishedError: Self = Self(47);
pub const NSXMLParserNotationNotStartedError: Self = Self(48);
pub const NSXMLParserNotationNotFinishedError: Self = Self(49);
pub const NSXMLParserAttributeListNotStartedError: Self = Self(50);
pub const NSXMLParserAttributeListNotFinishedError: Self = Self(51);
pub const NSXMLParserMixedContentDeclNotStartedError: Self = Self(52);
pub const NSXMLParserMixedContentDeclNotFinishedError: Self = Self(53);
pub const NSXMLParserElementContentDeclNotStartedError: Self = Self(54);
pub const NSXMLParserElementContentDeclNotFinishedError: Self = Self(55);
pub const NSXMLParserXMLDeclNotStartedError: Self = Self(56);
pub const NSXMLParserXMLDeclNotFinishedError: Self = Self(57);
pub const NSXMLParserConditionalSectionNotStartedError: Self = Self(58);
pub const NSXMLParserConditionalSectionNotFinishedError: Self = Self(59);
pub const NSXMLParserExternalSubsetNotFinishedError: Self = Self(60);
pub const NSXMLParserDOCTYPEDeclNotFinishedError: Self = Self(61);
pub const NSXMLParserMisplacedCDATAEndStringError: Self = Self(62);
pub const NSXMLParserCDATANotFinishedError: Self = Self(63);
pub const NSXMLParserMisplacedXMLDeclarationError: Self = Self(64);
pub const NSXMLParserSpaceRequiredError: Self = Self(65);
pub const NSXMLParserSeparatorRequiredError: Self = Self(66);
pub const NSXMLParserNMTOKENRequiredError: Self = Self(67);
pub const NSXMLParserNAMERequiredError: Self = Self(68);
pub const NSXMLParserPCDATARequiredError: Self = Self(69);
pub const NSXMLParserURIRequiredError: Self = Self(70);
pub const NSXMLParserPublicIdentifierRequiredError: Self = Self(71);
pub const NSXMLParserLTRequiredError: Self = Self(72);
pub const NSXMLParserGTRequiredError: Self = Self(73);
pub const NSXMLParserLTSlashRequiredError: Self = Self(74);
pub const NSXMLParserEqualExpectedError: Self = Self(75);
pub const NSXMLParserTagNameMismatchError: Self = Self(76);
pub const NSXMLParserUnfinishedTagError: Self = Self(77);
pub const NSXMLParserStandaloneValueError: Self = Self(78);
pub const NSXMLParserInvalidEncodingNameError: Self = Self(79);
pub const NSXMLParserCommentContainsDoubleHyphenError: Self = Self(80);
pub const NSXMLParserInvalidEncodingError: Self = Self(81);
pub const NSXMLParserExternalStandaloneEntityError: Self = Self(82);
pub const NSXMLParserInvalidConditionalSectionError: Self = Self(83);
pub const NSXMLParserEntityValueRequiredError: Self = Self(84);
pub const NSXMLParserNotWellBalancedError: Self = Self(85);
pub const NSXMLParserExtraContentError: Self = Self(86);
pub const NSXMLParserInvalidCharacterInEntityError: Self = Self(87);
pub const NSXMLParserParsedEntityRefInInternalError: Self = Self(88);
pub const NSXMLParserEntityRefLoopError: Self = Self(89);
pub const NSXMLParserEntityBoundaryError: Self = Self(90);
pub const NSXMLParserInvalidURIError: Self = Self(91);
pub const NSXMLParserURIFragmentError: Self = Self(92);
pub const NSXMLParserNoDTDError: Self = Self(94);
pub const NSXMLParserDelegateAbortedParseError: Self = Self(512);
}
unsafe impl Encode for NSXMLParserError {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSXMLParserError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}