| 1 |
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT |
| 2 |
// file at the top-level directory of this distribution. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 |
// option. This file may not be copied, modified, or distributed |
| 8 |
// except according to those terms. |
| 9 |
|
| 10 |
use std::os::raw::{c_char, c_void}; |
| 11 |
|
| 12 |
use crate::array::CFArrayRef; |
| 13 |
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID}; |
| 14 |
use crate::dictionary::CFDictionaryRef; |
| 15 |
use crate::string::{CFStringEncoding, CFStringRef}; |
| 16 |
use crate::tree::CFTreeRef; |
| 17 |
use crate::url::CFURLRef; |
| 18 |
|
| 19 |
#[repr(C)] |
| 20 |
pub struct __CFXMLNode(c_void); |
| 21 |
|
| 22 |
pub type CFXMLNodeRef = *mut __CFXMLNode; |
| 23 |
pub type CFXMLTreeRef = CFTreeRef; |
| 24 |
|
| 25 |
pub const kCFXMLNodeCurrentVersion: CFIndex = 1; |
| 26 |
|
| 27 |
pub type CFXMLNodeTypeCode = CFIndex; |
| 28 |
pub const kCFXMLNodeTypeDocument: CFXMLNodeTypeCode = 1; |
| 29 |
pub const kCFXMLNodeTypeElement: CFXMLNodeTypeCode = 2; |
| 30 |
pub const kCFXMLNodeTypeAttribute: CFXMLNodeTypeCode = 3; |
| 31 |
pub const kCFXMLNodeTypeProcessingInstruction: CFXMLNodeTypeCode = 4; |
| 32 |
pub const kCFXMLNodeTypeComment: CFXMLNodeTypeCode = 5; |
| 33 |
pub const kCFXMLNodeTypeText: CFXMLNodeTypeCode = 6; |
| 34 |
pub const kCFXMLNodeTypeCDATASection: CFXMLNodeTypeCode = 7; |
| 35 |
pub const kCFXMLNodeTypeDocumentFragment: CFXMLNodeTypeCode = 8; |
| 36 |
pub const kCFXMLNodeTypeEntity: CFXMLNodeTypeCode = 9; |
| 37 |
pub const kCFXMLNodeTypeEntityReference: CFXMLNodeTypeCode = 10; |
| 38 |
pub const kCFXMLNodeTypeDocumentType: CFXMLNodeTypeCode = 11; |
| 39 |
pub const kCFXMLNodeTypeWhitespace: CFXMLNodeTypeCode = 12; |
| 40 |
pub const kCFXMLNodeTypeNotation: CFXMLNodeTypeCode = 13; |
| 41 |
pub const kCFXMLNodeTypeElementTypeDeclaration: CFXMLNodeTypeCode = 14; |
| 42 |
pub const kCFXMLNodeTypeAttributeListDeclaration: CFXMLNodeTypeCode = 15; |
| 43 |
|
| 44 |
#[repr(C)] |
| 45 |
#[derive(Debug, Clone, Copy)] |
| 46 |
pub struct CFXMLElementInfo { |
| 47 |
pub attributes: CFDictionaryRef, |
| 48 |
pub attributeOrder: CFArrayRef, |
| 49 |
pub isEmpty: Boolean, |
| 50 |
pub _reserved: [c_char; 3], |
| 51 |
} |
| 52 |
|
| 53 |
#[repr(C)] |
| 54 |
#[derive(Debug, Clone, Copy)] |
| 55 |
pub struct CFXMLProcessingInstructionInfo { |
| 56 |
pub dataString: CFStringRef, |
| 57 |
} |
| 58 |
|
| 59 |
#[repr(C)] |
| 60 |
#[derive(Debug, Clone, Copy)] |
| 61 |
pub struct CFXMLDocumentInfo { |
| 62 |
pub sourceURL: CFURLRef, |
| 63 |
pub encoding: CFStringEncoding, |
| 64 |
} |
| 65 |
|
| 66 |
#[repr(C)] |
| 67 |
#[derive(Debug, Clone, Copy)] |
| 68 |
pub struct CFXMLExternalID { |
| 69 |
pub systemID: CFURLRef, |
| 70 |
pub publicID: CFStringRef, |
| 71 |
} |
| 72 |
|
| 73 |
#[repr(C)] |
| 74 |
#[derive(Debug, Clone, Copy)] |
| 75 |
pub struct CFXMLDocumentTypeInfo { |
| 76 |
pub externalID: CFXMLExternalID, |
| 77 |
} |
| 78 |
|
| 79 |
#[repr(C)] |
| 80 |
#[derive(Debug, Clone, Copy)] |
| 81 |
pub struct CFXMLNotationInfo { |
| 82 |
pub externalID: CFXMLExternalID, |
| 83 |
} |
| 84 |
|
| 85 |
#[repr(C)] |
| 86 |
#[derive(Debug, Clone, Copy)] |
| 87 |
pub struct CFXMLElementTypeDeclarationInfo { |
| 88 |
pub contentDescription: CFStringRef, |
| 89 |
} |
| 90 |
|
| 91 |
#[repr(C)] |
| 92 |
#[derive(Debug, Clone, Copy)] |
| 93 |
pub struct CFXMLAttributeDeclarationInfo { |
| 94 |
pub attributeName: CFStringRef, |
| 95 |
pub typeString: CFStringRef, |
| 96 |
pub defaultString: CFStringRef, |
| 97 |
} |
| 98 |
|
| 99 |
#[repr(C)] |
| 100 |
#[derive(Debug, Clone, Copy)] |
| 101 |
pub struct CFXMLAttributeListDeclarationInfo { |
| 102 |
pub numberOfAttributes: CFIndex, |
| 103 |
pub attributes: *mut CFXMLAttributeDeclarationInfo, |
| 104 |
} |
| 105 |
|
| 106 |
pub type CFXMLEntityTypeCode = CFIndex; |
| 107 |
pub const kCFXMLEntityTypeParameter: CFXMLEntityTypeCode = 0; |
| 108 |
pub const kCFXMLEntityTypeParsedInternal: CFXMLEntityTypeCode = 1; |
| 109 |
pub const kCFXMLEntityTypeParsedExternal: CFXMLEntityTypeCode = 2; |
| 110 |
pub const kCFXMLEntityTypeUnparsed: CFXMLEntityTypeCode = 3; |
| 111 |
pub const kCFXMLEntityTypeCharacter: CFXMLEntityTypeCode = 4; |
| 112 |
|
| 113 |
#[repr(C)] |
| 114 |
#[derive(Debug, Clone, Copy)] |
| 115 |
pub struct CFXMLEntityInfo { |
| 116 |
pub entityType: CFXMLEntityTypeCode, |
| 117 |
pub replacementText: CFStringRef, |
| 118 |
pub entityID: CFXMLExternalID, |
| 119 |
pub notationName: CFStringRef, |
| 120 |
} |
| 121 |
|
| 122 |
#[repr(C)] |
| 123 |
#[derive(Debug, Clone, Copy)] |
| 124 |
pub struct CFXMLEntityReferenceInfo { |
| 125 |
pub entityType: CFXMLEntityTypeCode, |
| 126 |
} |
| 127 |
|
| 128 |
extern "C" { |
| 129 |
/* |
| 130 |
* CFXMLNode.h |
| 131 |
*/ |
| 132 |
pub fn CFXMLNodeGetTypeID() -> CFTypeID; |
| 133 |
pub fn CFXMLNodeCreate( |
| 134 |
alloc: CFAllocatorRef, |
| 135 |
xmlType: CFXMLNodeTypeCode, |
| 136 |
dataString: CFStringRef, |
| 137 |
additionalInfoPtr: *const c_void, |
| 138 |
version: CFIndex, |
| 139 |
) -> CFXMLNodeRef; |
| 140 |
pub fn CFXMLNodeCreateCopy(alloc: CFAllocatorRef, origNode: CFXMLNodeRef) -> CFXMLNodeRef; |
| 141 |
pub fn CFXMLNodeGetTypeCode(node: CFXMLNodeRef) -> CFXMLNodeTypeCode; |
| 142 |
pub fn CFXMLNodeGetString(node: CFXMLNodeRef) -> CFStringRef; |
| 143 |
pub fn CFXMLNodeGetInfoPtr(node: CFXMLNodeRef) -> *const c_void; |
| 144 |
pub fn CFXMLNodeGetVersion(node: CFXMLNodeRef) -> CFIndex; |
| 145 |
pub fn CFXMLTreeCreateWithNode(alloc: CFAllocatorRef, node: CFXMLNodeRef) -> CFXMLTreeRef; |
| 146 |
pub fn CFXMLTreeGetNode(xmlTree: CFXMLTreeRef) -> CFXMLNodeRef; |
| 147 |
} |