Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
use core::mem::ManuallyDrop;
use core::ptr;
use core::sync::atomic::{AtomicPtr, Ordering};
use objc2::rc::Retained;
use objc2::Message;
/// Allows storing an `Retained` in a static and lazily loading it.
#[derive(Debug)]
pub struct CachedId<T> {
ptr: AtomicPtr<T>,
}
impl<T> CachedId<T> {
/// Constructs a new [`CachedId`].
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
Self {
ptr: AtomicPtr::new(ptr::null_mut()),
}
}
}
impl<T: Message> CachedId<T> {
/// Returns the cached object. If no object is yet cached, creates one
/// from the given closure and stores it.
#[inline]
pub fn get(&self, f: impl FnOnce() -> Retained<T>) -> &'static T {
// TODO: Investigate if we can use weaker orderings.
let ptr = self.ptr.load(Ordering::SeqCst);
// SAFETY: The pointer is either NULL, or has been created below.
unsafe { ptr.as_ref() }.unwrap_or_else(|| {
// "Forget" about releasing the object, promoting it to a static.
let s = ManuallyDrop::new(f());
let ptr = Retained::as_ptr(&s);
self.ptr.store(ptr as *mut T, Ordering::SeqCst);
// SAFETY: The pointer is valid, and will always be valid, since
// we haven't released it.
unsafe { ptr.as_ref().unwrap_unchecked() }
})
}
}

View File

@@ -0,0 +1,7 @@
mod cached;
#[cfg(feature = "NSString")]
mod ns_string;
pub use self::cached::CachedId;
#[cfg(feature = "NSString")]
pub use self::ns_string::*;

View File

@@ -0,0 +1,262 @@
#![allow(missing_copy_implementations)]
//! Macro for making a static NSString.
//!
//! This closely follows what clang does, see:
//! - Apple: <https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/CodeGen/CodeGenModule.cpp#L5057-L5249>
//! - GNUStep 2.0 (not yet supported): <https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/CodeGen/CGObjCGNU.cpp#L973-L1118>
//! - Other (not yet supported): <https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/CodeGen/CGObjCGNU.cpp#L2471-L2507>
//!
//! Note that this uses the `CFString` static, while `clang` has support for
//! generating a pure `NSString`. We don't support that yet (since I don't
//! know the use-case), but we definitely could!
//! See: <https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/CodeGen/CGObjCMac.cpp#L2007-L2068>
//!
//! See also the following crates that implement UTF-16 conversion:
//! `utf16_lit`, `windows`, `const_utf16`, `wide-literals`, ...
use core::ffi::c_void;
use crate::Foundation::NSString;
use objc2::runtime::AnyClass;
// This is defined in CoreFoundation, but we don't emit a link attribute
// here because it is already linked via Foundation.
//
// Although this is a "private" (underscored) symbol, it is directly
// referenced in Objective-C binaries. So it's safe for us to reference.
extern "C" {
pub static __CFConstantStringClassReference: AnyClass;
}
/// Structure used to describe a constant `CFString`.
///
/// This struct is the same as [`CF_CONST_STRING`], which contains
/// [`CFRuntimeBase`]. While the documentation clearly says that the ABI of
/// `CFRuntimeBase` should not be relied on, we can rely on it as long as we
/// only do it with regards to `CFString` (because `clang` does this as well).
///
/// [`CFRuntimeBase`]: <https://github.com/apple-oss-distributions/CF/blob/CF-1153.18/CFRuntime.h#L216-L228>
/// [`CF_CONST_STRING`]: <https://github.com/apple-oss-distributions/CF/blob/CF-1153.18/CFInternal.h#L332-L336>
#[repr(C)]
#[derive(Debug)]
pub struct CFConstString {
isa: &'static AnyClass,
// Important that we don't use `usize` here, since that would be wrong on
// big-endian systems!
cfinfo: u32,
#[cfg(target_pointer_width = "64")]
_rc: u32,
data: *const c_void,
len: usize,
}
// Required to place in a `static`.
unsafe impl Sync for CFConstString {}
impl CFConstString {
// From `CFString.c`:
// <https://github.com/apple-oss-distributions/CF/blob/CF-1153.18/CFString.c#L184-L212>
// > !!! Note: Constant CFStrings use the bit patterns:
// > C8 (11001000 = default allocator, not inline, not freed contents; 8-bit; has NULL byte; doesn't have length; is immutable)
// > D0 (11010000 = default allocator, not inline, not freed contents; Unicode; is immutable)
// > The bit usages should not be modified in a way that would effect these bit patterns.
//
// Hence CoreFoundation guarantees that these two are always valid.
//
// The `CFTypeID` of `CFStringRef` is guaranteed to always be 7:
// <https://github.com/apple-oss-distributions/CF/blob/CF-1153.18/CFRuntime.c#L982>
const FLAGS_ASCII: u32 = 0x07_C8;
const FLAGS_UTF16: u32 = 0x07_D0;
pub const unsafe fn new_ascii(isa: &'static AnyClass, data: &'static [u8]) -> Self {
Self {
isa,
cfinfo: Self::FLAGS_ASCII,
#[cfg(target_pointer_width = "64")]
_rc: 0,
data: data.as_ptr().cast(),
// The length does not include the trailing NUL.
len: data.len() - 1,
}
}
pub const unsafe fn new_utf16(isa: &'static AnyClass, data: &'static [u16]) -> Self {
Self {
isa,
cfinfo: Self::FLAGS_UTF16,
#[cfg(target_pointer_width = "64")]
_rc: 0,
data: data.as_ptr().cast(),
// The length does not include the trailing NUL.
len: data.len() - 1,
}
}
#[inline]
pub const fn as_nsstring_const(&self) -> &NSString {
let ptr: *const Self = self;
unsafe { &*ptr.cast::<NSString>() }
}
// This is deliberately not `const` to prevent the result from being used
// in other statics, since that is only possible if the
// `unstable-static-nsstring` feature is enabled.
#[inline]
pub fn as_nsstring(&self) -> &NSString {
self.as_nsstring_const()
}
}
/// Returns `true` if `bytes` is entirely ASCII with no interior NULs.
pub const fn is_ascii_no_nul(bytes: &[u8]) -> bool {
let mut i = 0;
while i < bytes.len() {
let byte = bytes[i];
if !byte.is_ascii() || byte == b'\0' {
return false;
}
i += 1;
}
true
}
#[derive(Debug)]
pub struct Utf16Char {
pub repr: [u16; 2],
pub len: usize,
}
impl Utf16Char {
const fn encode(ch: u32) -> Self {
if ch <= 0xffff {
Self {
repr: [ch as u16, 0],
len: 1,
}
} else {
let payload = ch - 0x10000;
let hi = (payload >> 10) | 0xd800;
let lo = (payload & 0x3ff) | 0xdc00;
Self {
repr: [hi as u16, lo as u16],
len: 2,
}
}
}
#[cfg(test)]
fn as_slice(&self) -> &[u16] {
&self.repr[..self.len]
}
}
#[derive(Debug)]
pub struct EncodeUtf16Iter {
str: &'static [u8],
index: usize,
}
impl EncodeUtf16Iter {
pub const fn new(str: &'static [u8]) -> Self {
Self { str, index: 0 }
}
pub const fn next(self) -> Option<(Self, Utf16Char)> {
if self.index >= self.str.len() {
None
} else {
let (index, ch) = decode_utf8(self.str, self.index);
Some((Self { index, ..self }, Utf16Char::encode(ch)))
}
}
}
// (&str bytes, index) -> (new index, decoded char)
const fn decode_utf8(s: &[u8], i: usize) -> (usize, u32) {
let b0 = s[i];
match b0 {
// one-byte seq
0b0000_0000..=0b0111_1111 => {
let decoded = b0 as u32;
(i + 1, decoded)
}
// two-byte seq
0b1100_0000..=0b1101_1111 => {
let decoded = ((b0 as u32 & 0x1f) << 6) | (s[i + 1] as u32 & 0x3f);
(i + 2, decoded)
}
// 3 byte seq
0b1110_0000..=0b1110_1111 => {
let decoded = ((b0 as u32 & 0x0f) << 12)
| ((s[i + 1] as u32 & 0x3f) << 6)
| (s[i + 2] as u32 & 0x3f);
(i + 3, decoded)
}
// 4 byte seq
0b1111_0000..=0b1111_0111 => {
let decoded = ((b0 as u32 & 0x07) << 18)
| ((s[i + 1] as u32 & 0x3f) << 12)
| ((s[i + 2] as u32 & 0x3f) << 6)
| (s[i + 3] as u32 & 0x3f);
(i + 4, decoded)
}
// continuation bytes, or never-valid bytes.
0b1000_0000..=0b1011_1111 | 0b1111_1000..=0b1111_1111 => {
panic!("Encountered invalid bytes")
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_ascii() {
assert!(is_ascii_no_nul(b"a"));
assert!(is_ascii_no_nul(b"abc"));
assert!(!is_ascii_no_nul(b"\xff"));
assert!(!is_ascii_no_nul(b"\0"));
assert!(!is_ascii_no_nul(b"a\0b"));
assert!(!is_ascii_no_nul(b"ab\0"));
assert!(!is_ascii_no_nul(b"a\0b\0"));
}
#[test]
#[ignore = "slow, enable this if working on ns_string!"]
fn test_decode_utf8() {
for c in '\u{0}'..=core::char::MAX {
let mut buf;
for off in 0..4 {
// Ensure we see garbage if we read outside bounds.
buf = [0xff; 8];
let len = c.encode_utf8(&mut buf[off..(off + 4)]).len();
let (end_idx, decoded) = decode_utf8(&buf, off);
assert_eq!(
(end_idx, decoded),
(off + len, c as u32),
"failed for U+{code:04X} ({ch:?}) encoded as {buf:#x?} over {range:?}",
code = c as u32,
ch = c,
buf = &buf[off..(off + len)],
range = off..(off + len),
);
}
}
}
#[test]
#[ignore = "slow, enable this if working on ns_string!"]
fn encode_utf16() {
for c in '\u{0}'..=core::char::MAX {
assert_eq!(
c.encode_utf16(&mut [0u16; 2]),
Utf16Char::encode(c as u32).as_slice(),
"failed for U+{:04X} ({:?})",
c as u32,
c
);
}
}
}

540
vendor/objc2-foundation/src/array.rs vendored Normal file
View File

@@ -0,0 +1,540 @@
//! Utilities for the `NSArray` and `NSMutableArray` classes.
use alloc::vec::Vec;
#[cfg(feature = "NSEnumerator")]
use core::fmt;
#[cfg(feature = "NSRange")]
use core::ops::Range;
use core::ops::{Index, IndexMut};
use objc2::mutability::{IsIdCloneable, IsMutable, IsRetainable};
use objc2::rc::{Retained, RetainedFromIterator};
use objc2::{extern_methods, ClassType, Message};
#[cfg(feature = "NSEnumerator")]
use super::iter;
use super::util;
use crate::Foundation::{NSArray, NSMutableArray};
impl<T: Message> NSArray<T> {
pub fn from_vec(mut vec: Vec<Retained<T>>) -> Retained<Self> {
// We intentionally extract the length before we access the
// pointer as mutable, to not invalidate that mutable pointer.
let len = vec.len();
let ptr = util::retained_ptr_cast(vec.as_mut_ptr());
// SAFETY: We've consumed the `Retained<T>`s, which means that we can
// now safely take ownership (even if `T` is mutable).
unsafe { Self::initWithObjects_count(Self::alloc(), ptr, len) }
// The drop of `Vec` here would invalidate our mutable pointer,
// except for the fact that we're using `UnsafeCell` in `AnyObject`.
}
pub fn from_id_slice(slice: &[Retained<T>]) -> Retained<Self>
where
T: IsIdCloneable,
{
let len = slice.len();
let ptr = util::retained_ptr_cast_const(slice.as_ptr());
// SAFETY: Because of the `T: IsIdCloneable` bound, and since we
// take `&[Retained<T>]` (effectively `&Retained<T>`), we are allowed to give
// the slice to Objective-C, which will retain it internally.
//
// Faster version of:
// Self::from_vec(slice.iter().map(|obj| obj.clone()).collect())
unsafe { Self::initWithObjects_count(Self::alloc(), ptr, len) }
}
pub fn from_slice(slice: &[&T]) -> Retained<Self>
where
T: IsRetainable,
{
let len = slice.len();
let ptr = util::ref_ptr_cast_const(slice.as_ptr());
// SAFETY: Because of the `T: IsRetainable` bound, we are allowed
// to give the slice to Objective-C, which will retain it
// internally.
//
// Faster version of:
// Self::from_vec(slice.iter().map(|obj| obj.retain()).collect())
unsafe { Self::initWithObjects_count(Self::alloc(), ptr, len) }
}
#[doc(alias = "getObjects:range:")]
#[cfg(feature = "NSRange")]
pub fn to_vec(&self) -> Vec<&T> {
// SAFETY: The range is know to be in bounds
unsafe { self.objects_in_range_unchecked(0..self.len()) }
}
#[doc(alias = "getObjects:range:")]
#[cfg(feature = "NSRange")]
pub fn to_vec_retained(&self) -> Vec<Retained<T>>
where
T: IsIdCloneable,
{
// SAFETY: The objects are stored in the array
self.to_vec()
.into_iter()
.map(|obj| unsafe { util::collection_retain(obj) })
.collect()
}
// `fn into_vec(Retained<NSArray>) -> Vec<Retained<T>>` would not be safe, since
// the array itself is unconditionally `IsIdCloneable`, even when
// containing mutable elements, and hence we would be able to
// duplicate those.
}
impl<T: Message> NSMutableArray<T> {
pub fn from_vec(mut vec: Vec<Retained<T>>) -> Retained<Self> {
let len = vec.len();
let ptr = util::retained_ptr_cast(vec.as_mut_ptr());
// SAFETY: Same as `NSArray::from_vec`.
unsafe { Self::initWithObjects_count(Self::alloc(), ptr, len) }
}
pub fn from_id_slice(slice: &[Retained<T>]) -> Retained<Self>
where
T: IsIdCloneable,
{
let len = slice.len();
let ptr = util::retained_ptr_cast_const(slice.as_ptr());
// SAFETY: Same as `NSArray::from_id_slice`
unsafe { Self::initWithObjects_count(Self::alloc(), ptr, len) }
}
pub fn from_slice(slice: &[&T]) -> Retained<Self>
where
T: IsRetainable,
{
let len = slice.len();
let ptr = util::ref_ptr_cast_const(slice.as_ptr());
// SAFETY: Same as `NSArray::from_slice`.
unsafe { Self::initWithObjects_count(Self::alloc(), ptr, len) }
}
#[cfg(feature = "NSRange")]
pub fn into_vec(array: Retained<Self>) -> Vec<Retained<T>> {
// SAFETY: We've consumed the array, so taking ownership of the
// returned values is safe.
array
.to_vec()
.into_iter()
.map(|obj| unsafe { util::mutable_collection_retain_removed(obj) })
.collect()
}
}
impl<T: Message> NSArray<T> {
#[doc(alias = "count")]
pub fn len(&self) -> usize {
self.count()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}
extern_methods!(
unsafe impl<T: Message> NSArray<T> {
#[method(objectAtIndex:)]
unsafe fn get_unchecked(&self, index: usize) -> &T;
#[doc(alias = "objectAtIndex:")]
pub fn get(&self, index: usize) -> Option<&T> {
// TODO: Replace this check with catching the thrown NSRangeException
if index < self.len() {
// SAFETY: The index is checked to be in bounds.
Some(unsafe { self.get_unchecked(index) })
} else {
None
}
}
#[doc(alias = "objectAtIndex:")]
pub fn get_retained(&self, index: usize) -> Option<Retained<T>>
where
T: IsIdCloneable,
{
// SAFETY: The object is stored in the array
self.get(index)
.map(|obj| unsafe { util::collection_retain(obj) })
}
#[method(objectAtIndex:)]
unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T;
#[doc(alias = "objectAtIndex:")]
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
where
T: IsMutable,
{
// TODO: Replace this check with catching the thrown NSRangeException
if index < self.len() {
// SAFETY: The index is checked to be in bounds, and the
// reference is safe as mutable because of the `T: IsMutable`
// bound.
Some(unsafe { self.get_unchecked_mut(index) })
} else {
None
}
}
#[doc(alias = "firstObject")]
#[method(firstObject)]
pub fn first(&self) -> Option<&T>;
#[doc(alias = "firstObject")]
pub fn first_retained(&self) -> Option<Retained<T>>
where
T: IsIdCloneable,
{
// SAFETY: The object is stored in the array
self.first()
.map(|obj| unsafe { util::collection_retain(obj) })
}
#[doc(alias = "firstObject")]
#[method(firstObject)]
pub fn first_mut(&mut self) -> Option<&mut T>
where
T: IsMutable;
#[doc(alias = "lastObject")]
#[method(lastObject)]
pub fn last(&self) -> Option<&T>;
#[doc(alias = "lastObject")]
pub fn last_retained(&self) -> Option<Retained<T>>
where
T: IsIdCloneable,
{
// SAFETY: The object is stored in the array
self.last()
.map(|obj| unsafe { util::collection_retain(obj) })
}
#[doc(alias = "lastObject")]
#[method(lastObject)]
pub fn last_mut(&mut self) -> Option<&mut T>
where
T: IsMutable;
}
);
impl<T: Message> NSArray<T> {
#[cfg(feature = "NSRange")]
unsafe fn objects_in_range_unchecked(&self, range: Range<usize>) -> Vec<&T> {
let range = crate::Foundation::NSRange::from(range);
let mut vec: Vec<core::ptr::NonNull<T>> = Vec::with_capacity(range.length);
unsafe {
self.getObjects_range(core::ptr::NonNull::new(vec.as_mut_ptr()).unwrap(), range);
vec.set_len(range.length);
core::mem::transmute(vec)
}
}
#[doc(alias = "getObjects:range:")]
#[cfg(feature = "NSRange")]
pub fn objects_in_range(&self, range: Range<usize>) -> Option<Vec<&T>> {
if range.end > self.len() {
return None;
}
// SAFETY: Just checked that the range is in bounds
Some(unsafe { self.objects_in_range_unchecked(range) })
}
}
impl<T: Message> NSMutableArray<T> {
#[doc(alias = "addObject:")]
pub fn push(&mut self, obj: Retained<T>) {
// SAFETY: We've consumed ownership of the object.
unsafe { self.addObject(&obj) }
}
#[doc(alias = "insertObject:atIndex:")]
pub fn insert(&mut self, index: usize, obj: Retained<T>) {
// TODO: Replace this check with catching the thrown NSRangeException
let len = self.len();
if index < len {
// SAFETY: We've consumed ownership of the object, and the
// index is checked to be in bounds.
unsafe { self.insertObject_atIndex(&obj, index) }
} else {
panic!(
"insertion index (is {}) should be <= len (is {})",
index, len
);
}
}
#[doc(alias = "replaceObjectAtIndex:withObject:")]
pub fn replace(&mut self, index: usize, obj: Retained<T>) -> Result<Retained<T>, Retained<T>> {
if let Some(old_obj) = self.get(index) {
// SAFETY: We remove the object from the array below.
let old_obj = unsafe { util::mutable_collection_retain_removed(old_obj) };
// SAFETY: The index is checked to be in bounds, and we've
// consumed ownership of the new object.
unsafe { self.replaceObjectAtIndex_withObject(index, &obj) };
Ok(old_obj)
} else {
Err(obj)
}
}
#[doc(alias = "removeObjectAtIndex:")]
pub fn remove(&mut self, index: usize) -> Option<Retained<T>> {
let obj = self.get(index)?;
// SAFETY: We remove the object from the array below.
let obj = unsafe { util::mutable_collection_retain_removed(obj) };
// SAFETY: The index is checked to be in bounds.
unsafe { self.removeObjectAtIndex(index) };
Some(obj)
}
#[doc(alias = "removeLastObject")]
pub fn pop(&mut self) -> Option<Retained<T>> {
let obj = self.last()?;
// SAFETY: We remove the object from the array below.
let obj = unsafe { util::mutable_collection_retain_removed(obj) };
// SAFETY: Just checked that there is an object.
unsafe { self.removeLastObject() };
Some(obj)
}
#[cfg(feature = "NSObjCRuntime")]
#[doc(alias = "sortUsingFunction:context:")]
pub fn sort_by<F: FnMut(&T, &T) -> core::cmp::Ordering>(&mut self, compare: F) {
// TODO: "C-unwind"
unsafe extern "C" fn compare_with_closure<T, F: FnMut(&T, &T) -> core::cmp::Ordering>(
obj1: core::ptr::NonNull<T>,
obj2: core::ptr::NonNull<T>,
context: *mut std::os::raw::c_void,
) -> isize {
let context: *mut F = context.cast();
// Bring back a reference to the closure.
// Guaranteed to be unique, we gave `sortUsingFunction` unique is
// ownership, and that method only runs one function at a time.
let closure: &mut F = unsafe { context.as_mut().unwrap_unchecked() };
// SAFETY: The objects are guaranteed to be valid
let (obj1, obj2) = unsafe { (obj1.as_ref(), obj2.as_ref()) };
crate::Foundation::NSComparisonResult::from((*closure)(obj1, obj2)) as _
}
// Create function pointer
let f: unsafe extern "C" fn(_, _, _) -> _ = compare_with_closure::<T, F>;
// Grab a type-erased pointer to the closure (a pointer to stack).
let mut closure = compare;
let context: *mut F = &mut closure;
unsafe { self.sortUsingFunction_context(f, context.cast()) };
// Keep the closure alive until the function has run.
drop(closure);
}
}
impl<T: Message> NSArray<T> {
#[cfg(feature = "NSEnumerator")]
#[doc(alias = "objectEnumerator")]
#[inline]
pub fn iter(&self) -> Iter<'_, T> {
Iter(super::iter::Iter::new(self))
}
#[cfg(feature = "NSEnumerator")]
#[doc(alias = "objectEnumerator")]
#[inline]
pub fn iter_mut(&mut self) -> IterMut<'_, T>
where
T: IsMutable,
{
IterMut(super::iter::IterMut::new(self))
}
#[cfg(feature = "NSEnumerator")]
#[doc(alias = "objectEnumerator")]
#[inline]
pub fn iter_retained(&self) -> IterRetained<'_, T>
where
T: IsIdCloneable,
{
IterRetained(super::iter::IterRetained::new(self))
}
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<T: Message> iter::FastEnumerationHelper for NSArray<T> {
type Item = T;
#[inline]
fn maybe_len(&self) -> Option<usize> {
Some(self.len())
}
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<T: Message> iter::FastEnumerationHelper for NSMutableArray<T> {
type Item = T;
#[inline]
fn maybe_len(&self) -> Option<usize> {
Some(self.len())
}
}
/// An iterator over the items of a `NSArray`.
#[derive(Debug)]
#[cfg(feature = "NSEnumerator")]
pub struct Iter<'a, T: Message>(iter::Iter<'a, NSArray<T>>);
#[cfg(feature = "NSEnumerator")]
__impl_iter! {
impl<'a, T: Message> Iterator<Item = &'a T> for Iter<'a, T> { ... }
}
/// A mutable iterator over the items of a `NSArray`.
#[derive(Debug)]
#[cfg(feature = "NSEnumerator")]
pub struct IterMut<'a, T: Message>(iter::IterMut<'a, NSArray<T>>);
#[cfg(feature = "NSEnumerator")]
__impl_iter! {
impl<'a, T: Message + IsMutable> Iterator<Item = &'a mut T> for IterMut<'a, T> { ... }
}
/// An iterator that retains the items of a `NSArray`.
#[derive(Debug)]
#[cfg(feature = "NSEnumerator")]
pub struct IterRetained<'a, T: Message>(iter::IterRetained<'a, NSArray<T>>);
#[cfg(feature = "NSEnumerator")]
__impl_iter! {
impl<'a, T: Message + IsIdCloneable> Iterator<Item = Retained<T>> for IterRetained<'a, T> { ... }
}
/// A consuming iterator over the items of a `NSArray`.
#[derive(Debug)]
#[cfg(feature = "NSEnumerator")]
pub struct IntoIter<T: Message>(iter::IntoIter<NSArray<T>>);
#[cfg(feature = "NSEnumerator")]
__impl_iter! {
impl<'a, T: Message> Iterator<Item = Retained<T>> for IntoIter<T> { ... }
}
#[cfg(feature = "NSEnumerator")]
__impl_into_iter! {
impl<T: Message> IntoIterator for &NSArray<T> {
type IntoIter = Iter<'_, T>;
}
impl<T: Message> IntoIterator for &NSMutableArray<T> {
type IntoIter = Iter<'_, T>;
}
impl<T: Message + IsMutable> IntoIterator for &mut NSArray<T> {
type IntoIter = IterMut<'_, T>;
}
impl<T: Message + IsMutable> IntoIterator for &mut NSMutableArray<T> {
type IntoIter = IterMut<'_, T>;
}
impl<T: Message + IsIdCloneable> IntoIterator for Retained<NSArray<T>> {
type IntoIter = IntoIter<T>;
}
impl<T: Message> IntoIterator for Retained<NSMutableArray<T>> {
type IntoIter = IntoIter<T>;
}
}
impl<T: Message> Index<usize> for NSArray<T> {
type Output = T;
fn index(&self, index: usize) -> &T {
self.get(index).unwrap()
}
}
impl<T: Message> Index<usize> for NSMutableArray<T> {
type Output = T;
fn index(&self, index: usize) -> &T {
self.get(index).unwrap()
}
}
impl<T: Message + IsMutable> IndexMut<usize> for NSArray<T> {
fn index_mut(&mut self, index: usize) -> &mut T {
self.get_mut(index).unwrap()
}
}
impl<T: Message + IsMutable> IndexMut<usize> for NSMutableArray<T> {
fn index_mut(&mut self, index: usize) -> &mut T {
self.get_mut(index).unwrap()
}
}
#[cfg(feature = "NSEnumerator")]
impl<T: fmt::Debug + Message> fmt::Debug for NSArray<T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self).finish()
}
}
#[cfg(feature = "NSEnumerator")]
impl<T: fmt::Debug + Message> fmt::Debug for NSMutableArray<T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}
impl<T: Message> Extend<Retained<T>> for NSMutableArray<T> {
fn extend<I: IntoIterator<Item = Retained<T>>>(&mut self, iter: I) {
iter.into_iter().for_each(move |item| self.push(item));
}
}
impl<'a, T: Message + IsRetainable> Extend<&'a T> for NSMutableArray<T> {
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
// SAFETY: Because of the `T: IsRetainable` bound, it is safe for the
// array to retain the object here.
iter.into_iter()
.for_each(move |item| unsafe { self.addObject(item) });
}
}
impl<'a, T: Message + IsRetainable + 'a> RetainedFromIterator<&'a T> for NSArray<T> {
fn id_from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Retained<Self> {
let vec = Vec::from_iter(iter);
Self::from_slice(&vec)
}
}
impl<T: Message> RetainedFromIterator<Retained<T>> for NSArray<T> {
fn id_from_iter<I: IntoIterator<Item = Retained<T>>>(iter: I) -> Retained<Self> {
let vec = Vec::from_iter(iter);
Self::from_vec(vec)
}
}
impl<'a, T: Message + IsRetainable + 'a> RetainedFromIterator<&'a T> for NSMutableArray<T> {
fn id_from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Retained<Self> {
let vec = Vec::from_iter(iter);
Self::from_slice(&vec)
}
}
impl<T: Message> RetainedFromIterator<Retained<T>> for NSMutableArray<T> {
fn id_from_iter<I: IntoIterator<Item = Retained<T>>>(iter: I) -> Retained<Self> {
let vec = Vec::from_iter(iter);
Self::from_vec(vec)
}
}

View File

@@ -0,0 +1,72 @@
use core::fmt;
use core::panic::{RefUnwindSafe, UnwindSafe};
use objc2::rc::Retained;
use objc2::ClassType;
use crate::Foundation::*;
// SAFETY: `NSAttributedString` is immutable and `NSMutableAttributedString`
// can only be mutated from `&mut` methods.
unsafe impl Sync for NSAttributedString {}
unsafe impl Send for NSAttributedString {}
// Same reasoning as `NSString`.
impl UnwindSafe for NSAttributedString {}
impl RefUnwindSafe for NSAttributedString {}
impl NSAttributedString {
/// Creates a new attributed string from the given string and attributes.
///
/// The attributes are associated with every UTF-16 code unit in the
/// string.
///
/// # Safety
///
/// The attributes must be valid.
#[doc(alias = "initWithString:")]
#[cfg(feature = "NSDictionary")]
#[cfg(feature = "NSString")]
pub unsafe fn new_with_attributes(
string: &NSString,
attributes: &NSDictionary<NSAttributedStringKey, objc2::runtime::AnyObject>,
) -> Retained<Self> {
unsafe { Self::initWithString_attributes(Self::alloc(), string, Some(attributes)) }
}
/// Creates a new attributed string without any attributes.
#[doc(alias = "initWithString:")]
#[cfg(feature = "NSString")]
pub fn from_nsstring(string: &NSString) -> Retained<Self> {
Self::initWithString(Self::alloc(), string)
}
}
impl NSMutableAttributedString {
// TODO: new_with_attributes
#[doc(alias = "initWithString:")]
#[cfg(feature = "NSString")]
pub fn from_nsstring(string: &NSString) -> Retained<Self> {
Self::initWithString(Self::alloc(), string)
}
#[doc(alias = "initWithAttributedString:")]
pub fn from_attributed_nsstring(attributed_string: &NSAttributedString) -> Retained<Self> {
Self::initWithAttributedString(Self::alloc(), attributed_string)
}
}
impl fmt::Debug for NSAttributedString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Use -[NSAttributedString description] since it is pretty good
let obj: &NSObject = self;
fmt::Debug::fmt(obj, f)
}
}
impl fmt::Debug for NSMutableAttributedString {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}

33
vendor/objc2-foundation/src/bundle.rs vendored Normal file
View File

@@ -0,0 +1,33 @@
use core::fmt;
use core::panic::{RefUnwindSafe, UnwindSafe};
use crate::Foundation::NSBundle;
impl UnwindSafe for NSBundle {}
impl RefUnwindSafe for NSBundle {}
impl NSBundle {
#[cfg(feature = "NSString")]
#[cfg(feature = "NSDictionary")]
#[cfg(feature = "NSObject")]
pub fn name(&self) -> Option<objc2::rc::Retained<crate::Foundation::NSString>> {
use crate::Foundation::{NSCopying, NSString};
use objc2::runtime::AnyObject;
let info = self.infoDictionary()?;
// TODO: Use ns_string!
let name = info.get(&NSString::from_str("CFBundleName"))?;
let ptr: *const AnyObject = name;
let ptr: *const NSString = ptr.cast();
// SAFETY: TODO
let name = unsafe { ptr.as_ref().unwrap_unchecked() };
Some(name.copy())
}
}
impl fmt::Debug for NSBundle {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Delegate to NSObject
(**self).fmt(f)
}
}

View File

@@ -0,0 +1,54 @@
use core::cmp::Ordering;
use objc2::encode::{Encode, Encoding, RefEncode};
/// Constants that indicate sort order.
///
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nscomparisonresult?language=objc).
#[repr(isize)] // NSInteger
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum NSComparisonResult {
/// The left operand is smaller than the right operand.
Ascending = -1,
/// The two operands are equal.
Same = 0,
/// The left operand is greater than the right operand.
Descending = 1,
}
impl Default for NSComparisonResult {
#[inline]
fn default() -> Self {
Self::Same
}
}
unsafe impl Encode for NSComparisonResult {
const ENCODING: Encoding = isize::ENCODING;
}
unsafe impl RefEncode for NSComparisonResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
impl From<Ordering> for NSComparisonResult {
#[inline]
fn from(order: Ordering) -> Self {
match order {
Ordering::Less => Self::Ascending,
Ordering::Equal => Self::Same,
Ordering::Greater => Self::Descending,
}
}
}
impl From<NSComparisonResult> for Ordering {
#[inline]
fn from(comparison_result: NSComparisonResult) -> Self {
match comparison_result {
NSComparisonResult::Ascending => Self::Less,
NSComparisonResult::Same => Self::Equal,
NSComparisonResult::Descending => Self::Greater,
}
}
}

86
vendor/objc2-foundation/src/copying.rs vendored Normal file
View File

@@ -0,0 +1,86 @@
use objc2::mutability::CounterpartOrSelf;
use objc2::rc::Retained;
#[cfg(feature = "NSZone")]
use objc2::runtime::NSZone;
use objc2::{extern_protocol, ProtocolType};
extern_protocol!(
/// A protocol to provide functional copies of objects.
///
/// This is similar to Rust's [`Clone`] trait, along with sharing a few
/// similarities to the [`std::borrow::ToOwned`] trait with regards to the
/// output type.
///
/// See [Apple's documentation][apple-doc] for details.
///
/// [apple-doc]: https://developer.apple.com/documentation/foundation/nscopying
#[allow(clippy::missing_safety_doc)]
pub unsafe trait NSCopying {
/// Returns a new instance that's a copy of the receiver.
///
/// The output type is the immutable counterpart of the object, which is
/// usually `Self`, but e.g. `NSMutableString` returns `NSString`.
#[method_id(copy)]
#[optional]
fn copy(&self) -> Retained<Self::Immutable>
where
Self: CounterpartOrSelf;
/// Returns a new instance that's a copy of the receiver.
///
/// This is only used when implementing `NSCopying`, use
/// [`copy`][NSCopying::copy] instead.
///
///
/// # Safety
///
/// The zone pointer must be valid or NULL.
#[method_id(copyWithZone:)]
#[cfg(feature = "NSZone")]
unsafe fn copyWithZone(&self, zone: *mut NSZone) -> Retained<Self::Immutable>
where
Self: CounterpartOrSelf;
}
unsafe impl ProtocolType for dyn NSCopying {}
);
extern_protocol!(
/// A protocol to provide mutable copies of objects.
///
/// Only classes that have an “immutable vs. mutable” distinction should adopt
/// this protocol.
///
/// See [Apple's documentation][apple-doc] for details.
///
/// [apple-doc]: https://developer.apple.com/documentation/foundation/nsmutablecopying
#[allow(clippy::missing_safety_doc)]
pub unsafe trait NSMutableCopying {
/// Returns a new instance that's a mutable copy of the receiver.
///
/// The output type is the mutable counterpart of the object. E.g. both
/// `NSString` and `NSMutableString` return `NSMutableString`.
#[method_id(mutableCopy)]
#[optional]
fn mutableCopy(&self) -> Retained<Self::Mutable>
where
Self: CounterpartOrSelf;
/// Returns a new instance that's a mutable copy of the receiver.
///
/// This is only used when implementing `NSMutableCopying`, use
/// [`mutableCopy`][NSMutableCopying::mutableCopy] instead.
///
///
/// # Safety
///
/// The zone pointer must be valid or NULL.
#[method_id(mutableCopyWithZone:)]
#[cfg(feature = "NSZone")]
unsafe fn mutableCopyWithZone(&self, zone: *mut NSZone) -> Retained<Self::Mutable>
where
Self: CounterpartOrSelf;
}
unsafe impl ProtocolType for dyn NSMutableCopying {}
);

305
vendor/objc2-foundation/src/data.rs vendored Normal file
View File

@@ -0,0 +1,305 @@
#[cfg(feature = "block2")]
use alloc::vec::Vec;
use core::ffi::c_void;
use core::fmt;
use core::ops::Index;
use core::ops::IndexMut;
#[cfg(feature = "NSRange")]
use core::ops::Range;
use core::panic::{RefUnwindSafe, UnwindSafe};
use core::ptr::NonNull;
use core::slice::{self, SliceIndex};
use objc2::rc::Retained;
#[cfg(feature = "block2")]
use objc2::rc::RetainedFromIterator;
use objc2::{extern_methods, ClassType};
use crate::Foundation::{NSData, NSMutableData};
// SAFETY: `NSData` is immutable and `NSMutableData` can only be mutated from
// `&mut` methods.
unsafe impl Sync for NSData {}
unsafe impl Send for NSData {}
impl UnwindSafe for NSData {}
impl RefUnwindSafe for NSData {}
// GNUStep returns NULL from these methods
extern_methods!(
unsafe impl NSData {
#[method(bytes)]
pub(crate) fn bytes_raw(&self) -> Option<NonNull<c_void>>;
}
unsafe impl NSMutableData {
#[method(mutableBytes)]
pub(crate) fn mutable_bytes_raw(&mut self) -> Option<NonNull<c_void>>;
}
);
impl NSData {
pub fn with_bytes(bytes: &[u8]) -> Retained<Self> {
let bytes_ptr = bytes.as_ptr() as *mut c_void;
unsafe { Self::initWithBytes_length(Self::alloc(), bytes_ptr, bytes.len()) }
}
#[cfg(feature = "block2")]
pub fn from_vec(bytes: Vec<u8>) -> Retained<Self> {
// GNUStep's NSData `initWithBytesNoCopy:length:deallocator:` has a
// bug; it forgets to assign the input buffer and length to the
// instance before it swizzles to NSDataWithDeallocatorBlock.
// See https://github.com/gnustep/libs-base/pull/213
// So instead we use NSDataWithDeallocatorBlock directly.
//
// NSMutableData does not have this problem.
#[cfg(feature = "gnustep-1-7")]
let obj = unsafe { objc2::msg_send_id![objc2::class!(NSDataWithDeallocatorBlock), alloc] };
#[cfg(not(feature = "gnustep-1-7"))]
let obj = Self::alloc();
unsafe { with_vec(obj, bytes) }
}
}
impl NSMutableData {
pub fn with_bytes(bytes: &[u8]) -> Retained<Self> {
let bytes_ptr = bytes.as_ptr() as *mut c_void;
// SAFETY: Same as `NSData::with_bytes`
unsafe { Self::initWithBytes_length(Self::alloc(), bytes_ptr, bytes.len()) }
}
#[cfg(feature = "block2")]
pub fn from_vec(bytes: Vec<u8>) -> Retained<Self> {
// SAFETY: Same as `NSData::from_vec`
unsafe { with_vec(Self::alloc(), bytes) }
}
}
impl NSData {
pub fn len(&self) -> usize {
self.length()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
pub fn bytes(&self) -> &[u8] {
if let Some(ptr) = self.bytes_raw() {
let ptr: *const u8 = ptr.as_ptr().cast();
// SAFETY: The pointer is checked to not be NULL, and since we're
// working with raw bytes (`u8`), the alignment is also correct.
unsafe { slice::from_raw_parts(ptr, self.len()) }
} else {
// The bytes pointer may be null for length zero on GNUStep
&[]
}
}
}
impl NSMutableData {
#[doc(alias = "mutableBytes")]
pub fn bytes_mut(&mut self) -> &mut [u8] {
if let Some(ptr) = self.mutable_bytes_raw() {
let ptr: *mut u8 = ptr.as_ptr().cast();
// SAFETY: Same as `NSData::bytes`, with the addition that a
// mutable slice is safe, since we take `&mut NSMutableData`.
unsafe { slice::from_raw_parts_mut(ptr, self.len()) }
} else {
&mut []
}
}
#[doc(alias = "appendBytes:length:")]
pub fn extend_from_slice(&mut self, bytes: &[u8]) {
let bytes_ptr: NonNull<c_void> = NonNull::new(bytes.as_ptr() as *mut u8).unwrap().cast();
unsafe { self.appendBytes_length(bytes_ptr, bytes.len()) }
}
pub fn push(&mut self, byte: u8) {
self.extend_from_slice(&[byte]);
}
#[doc(alias = "replaceBytesInRange:withBytes:length:")]
#[cfg(feature = "NSRange")]
pub fn replace_range(&mut self, range: Range<usize>, bytes: &[u8]) {
// No need to verify the length of the range here,
// `replaceBytesInRange:` zero-fills if out of bounds.
let ptr = bytes.as_ptr() as *mut c_void;
unsafe { self.replaceBytesInRange_withBytes_length(range.into(), ptr, bytes.len()) }
}
#[cfg(feature = "NSRange")]
pub fn set_bytes(&mut self, bytes: &[u8]) {
let len = self.len();
self.replace_range(0..len, bytes);
}
}
impl AsRef<[u8]> for NSData {
fn as_ref(&self) -> &[u8] {
self.bytes()
}
}
impl AsRef<[u8]> for NSMutableData {
fn as_ref(&self) -> &[u8] {
self.bytes()
}
}
impl AsMut<[u8]> for NSMutableData {
fn as_mut(&mut self) -> &mut [u8] {
self.bytes_mut()
}
}
// Note: We don't implement `Borrow<[u8]>` since we can't guarantee that `Eq`,
// `Ord` and `Hash` are equal for `NSData` vs. `[u8]`!
impl<I: SliceIndex<[u8]>> Index<I> for NSData {
type Output = I::Output;
#[inline]
fn index(&self, index: I) -> &Self::Output {
// Replaces the need for getBytes:range:
Index::index(self.bytes(), index)
}
}
impl<I: SliceIndex<[u8]>> Index<I> for NSMutableData {
type Output = I::Output;
#[inline]
fn index(&self, index: I) -> &Self::Output {
Index::index(self.bytes(), index)
}
}
impl<I: SliceIndex<[u8]>> IndexMut<I> for NSMutableData {
#[inline]
fn index_mut(&mut self, index: I) -> &mut Self::Output {
IndexMut::index_mut(self.bytes_mut(), index)
}
}
impl fmt::Debug for NSData {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// -[NSData description] is quite unreadable
fmt::Debug::fmt(self.bytes(), f)
}
}
impl fmt::Debug for NSMutableData {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}
impl<'a> IntoIterator for &'a NSData {
type Item = &'a u8;
type IntoIter = core::slice::Iter<'a, u8>;
fn into_iter(self) -> Self::IntoIter {
self.bytes().iter()
}
}
impl<'a> IntoIterator for &'a NSMutableData {
type Item = &'a u8;
type IntoIter = core::slice::Iter<'a, u8>;
fn into_iter(self) -> Self::IntoIter {
self.bytes().iter()
}
}
impl<'a> IntoIterator for &'a mut NSMutableData {
type Item = &'a mut u8;
type IntoIter = core::slice::IterMut<'a, u8>;
fn into_iter(self) -> Self::IntoIter {
self.bytes_mut().iter_mut()
}
}
impl Extend<u8> for NSMutableData {
/// You should use [`extend_from_slice`] whenever possible, it is more
/// performant.
///
/// [`extend_from_slice`]: Self::extend_from_slice
fn extend<T: IntoIterator<Item = u8>>(&mut self, iter: T) {
let iterator = iter.into_iter();
iterator.for_each(move |item| self.push(item));
}
}
// Vec also has this impl
impl<'a> Extend<&'a u8> for NSMutableData {
fn extend<T: IntoIterator<Item = &'a u8>>(&mut self, iter: T) {
let iterator = iter.into_iter();
iterator.for_each(move |item| self.push(*item));
}
}
impl std::io::Write for NSMutableData {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.extend_from_slice(buf);
Ok(buf.len())
}
fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> {
self.extend_from_slice(buf);
Ok(())
}
fn flush(&mut self) -> std::io::Result<()> {
Ok(())
}
}
#[cfg(feature = "block2")]
impl RetainedFromIterator<u8> for NSData {
fn id_from_iter<I: IntoIterator<Item = u8>>(iter: I) -> Retained<Self> {
let vec = Vec::from_iter(iter);
Self::from_vec(vec)
}
}
#[cfg(feature = "block2")]
impl RetainedFromIterator<u8> for NSMutableData {
fn id_from_iter<I: IntoIterator<Item = u8>>(iter: I) -> Retained<Self> {
let vec = Vec::from_iter(iter);
Self::from_vec(vec)
}
}
#[cfg(feature = "block2")]
unsafe fn with_vec<T: objc2::Message>(obj: objc2::rc::Allocated<T>, bytes: Vec<u8>) -> Retained<T> {
use core::mem::ManuallyDrop;
use block2::{Block, RcBlock};
let capacity = bytes.capacity();
let dealloc = RcBlock::new(move |bytes: *mut c_void, len: usize| {
// Recreate the Vec and let it drop
let _ = unsafe { <Vec<u8>>::from_raw_parts(bytes.cast(), len, capacity) };
});
let dealloc: &Block<dyn Fn(*mut c_void, usize) + 'static> = &dealloc;
let mut bytes = ManuallyDrop::new(bytes);
let bytes_ptr: *mut c_void = bytes.as_mut_ptr().cast();
unsafe {
objc2::msg_send_id![
obj,
initWithBytesNoCopy: bytes_ptr,
length: bytes.len(),
deallocator: dealloc,
]
}
}

23
vendor/objc2-foundation/src/decimal.rs vendored Normal file
View File

@@ -0,0 +1,23 @@
use std::os::raw::c_ushort;
use objc2::encode::{Encode, Encoding, RefEncode};
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSDecimal {
// signed int _exponent:8;
// unsigned int _length:4;
// unsigned int _isNegative:1;
// unsigned int _isCompact:1;
// unsigned int _reserved:18;
_inner: i32,
_mantissa: [c_ushort; 8],
}
unsafe impl Encode for NSDecimal {
const ENCODING: Encoding = Encoding::Struct("NSDecimal", &[]);
}
unsafe impl RefEncode for NSDecimal {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

View File

@@ -0,0 +1,605 @@
//! Utilities for the `NSDictionary` and `NSMutableDictionary` classes.
use alloc::vec::Vec;
#[cfg(feature = "NSObject")]
use core::cmp::min;
use core::fmt;
use core::hash::Hash;
use core::mem;
use core::ops::{Index, IndexMut};
use core::ptr::{self, NonNull};
#[cfg(feature = "NSObject")]
use objc2::mutability::IsRetainable;
use objc2::mutability::{CounterpartOrSelf, HasStableHash, IsIdCloneable, IsMutable};
use objc2::rc::Retained;
#[cfg(feature = "NSObject")]
use objc2::runtime::ProtocolObject;
#[cfg(feature = "NSObject")]
use objc2::ClassType;
use objc2::{extern_methods, Message};
#[cfg(feature = "NSEnumerator")]
use super::iter;
use super::util;
#[cfg(feature = "NSObject")]
use crate::Foundation::NSCopying;
use crate::Foundation::{NSDictionary, NSMutableDictionary};
#[cfg(feature = "NSObject")]
fn keys_to_ptr<Q>(keys: &[&Q]) -> *mut NonNull<ProtocolObject<dyn NSCopying>>
where
Q: Message + NSCopying,
{
let keys: *mut NonNull<Q> = util::ref_ptr_cast_const(keys.as_ptr());
// SAFETY: `Q` is `Message + NSCopying`, and is therefore safe to cast to
// `ProtocolObject<dyn NSCopying>`.
let keys: *mut NonNull<ProtocolObject<dyn NSCopying>> = keys.cast();
keys
}
#[cfg(feature = "NSObject")]
impl<K: Message + Eq + Hash + HasStableHash, V: Message> NSDictionary<K, V> {
pub fn from_vec<Q>(keys: &[&Q], mut objects: Vec<Retained<V>>) -> Retained<Self>
where
Q: Message + NSCopying + CounterpartOrSelf<Immutable = K>,
{
// Find the minimum of the two provided lengths, to ensure that we
// don't read too far in one of the buffers.
//
// Note: We could also have chosen to just panic here if the buffers have
// different lengths, either would be fine.
let count = min(keys.len(), objects.len());
let keys = keys_to_ptr(keys);
let objects = util::retained_ptr_cast(objects.as_mut_ptr());
// SAFETY:
// - The objects are valid, similar reasoning as `NSArray::from_vec`.
//
// - The key must not be mutated, as that may cause the hash value to
// change, which is unsound as stated in:
// https://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/ObjectMutability/ObjectMutability.html#//apple_ref/doc/uid/TP40010810-CH5-SW69
//
// The dictionary always copies its keys, which is why we require
// `NSCopying` and use `CounterpartOrSelf` on all input data - we
// want to ensure that it is very clear that it's not actually
// `NSMutableString` that is being stored, but `NSString`.
//
// But that is not by itself enough to verify that the key does not
// still contain interior mutable objects (e.g. if the copy was only
// a shallow copy), which is why we also require `HasStableHash`.
//
// - The length is lower than or equal to the length of the two arrays.
unsafe { Self::initWithObjects_forKeys_count(Self::alloc(), objects, keys, count) }
}
pub fn from_id_slice<Q>(keys: &[&Q], objects: &[Retained<V>]) -> Retained<Self>
where
Q: Message + NSCopying + CounterpartOrSelf<Immutable = K>,
V: IsIdCloneable,
{
let count = min(keys.len(), objects.len());
let keys = keys_to_ptr(keys);
let objects = util::retained_ptr_cast_const(objects.as_ptr());
// SAFETY: See `NSDictionary::from_vec` and `NSArray::from_id_slice`.
unsafe { Self::initWithObjects_forKeys_count(Self::alloc(), objects, keys, count) }
}
pub fn from_slice<Q>(keys: &[&Q], objects: &[&V]) -> Retained<Self>
where
Q: Message + NSCopying + CounterpartOrSelf<Immutable = K>,
V: IsRetainable,
{
let count = min(keys.len(), objects.len());
let keys = keys_to_ptr(keys);
let objects = util::ref_ptr_cast_const(objects.as_ptr());
// SAFETY: See `NSDictionary::from_vec` and `NSArray::from_slice`.
unsafe { Self::initWithObjects_forKeys_count(Self::alloc(), objects, keys, count) }
}
}
#[cfg(feature = "NSObject")]
impl<K: Message + Eq + Hash + HasStableHash, V: Message> NSMutableDictionary<K, V> {
pub fn from_vec<Q>(keys: &[&Q], mut objects: Vec<Retained<V>>) -> Retained<Self>
where
Q: Message + NSCopying + CounterpartOrSelf<Immutable = K>,
{
let count = min(keys.len(), objects.len());
let keys: *mut NonNull<Q> = util::ref_ptr_cast_const(keys.as_ptr());
let keys: *mut NonNull<ProtocolObject<dyn NSCopying>> = keys.cast();
let objects = util::retained_ptr_cast(objects.as_mut_ptr());
// SAFETY: See `NSDictionary::from_vec`
unsafe { Self::initWithObjects_forKeys_count(Self::alloc(), objects, keys, count) }
}
pub fn from_id_slice<Q>(keys: &[&Q], objects: &[Retained<V>]) -> Retained<Self>
where
Q: Message + NSCopying + CounterpartOrSelf<Immutable = K>,
V: IsIdCloneable,
{
let count = min(keys.len(), objects.len());
let keys = keys_to_ptr(keys);
let objects = util::retained_ptr_cast_const(objects.as_ptr());
// SAFETY: See `NSDictionary::from_vec` and `NSArray::from_id_slice`.
unsafe { Self::initWithObjects_forKeys_count(Self::alloc(), objects, keys, count) }
}
pub fn from_slice<Q>(keys: &[&Q], objects: &[&V]) -> Retained<Self>
where
Q: Message + NSCopying + CounterpartOrSelf<Immutable = K>,
V: IsRetainable,
{
let count = min(keys.len(), objects.len());
let keys = keys_to_ptr(keys);
let objects = util::ref_ptr_cast_const(objects.as_ptr());
// SAFETY: See `NSDictionary::from_vec` and `NSArray::from_slice`.
unsafe { Self::initWithObjects_forKeys_count(Self::alloc(), objects, keys, count) }
}
}
// Note: We'd like to make getter methods take `K: Borrow<Q>` like
// `std::collections::HashMap`, so that e.g.
// `NSDictionary<NSString, ...>` could take a `&NSObject` as input,
// and still make that work since `NSString` borrows to `NSObject`.
//
// But we can't really, at least not with extra `unsafe` / an extra
// trait, since we don't control how the comparisons happen.
//
// The most useful alternative would probably be to take
// `impl AsRef<K>`, but objc2 classes deref to their superclass anyhow, so
// let's just use a simple normal reference.
extern_methods!(
unsafe impl<K: Message + Eq + Hash, V: Message> NSDictionary<K, V> {
#[doc(alias = "objectForKey:")]
#[method(objectForKey:)]
pub fn get(&self, key: &K) -> Option<&V>;
#[doc(alias = "objectForKey:")]
pub fn get_retained(&self, key: &K) -> Option<Retained<V>>
where
V: IsIdCloneable,
{
// SAFETY: The object is stored in the dictionary
self.get(key)
.map(|obj| unsafe { util::collection_retain(obj) })
}
/// Returns a mutable reference to the value corresponding to the key.
///
/// # Examples
///
#[cfg_attr(all(feature = "NSString", feature = "NSObject"), doc = "```")]
#[cfg_attr(
not(all(feature = "NSString", feature = "NSObject")),
doc = "```ignore"
)]
/// use objc2_foundation::{ns_string, NSMutableDictionary, NSMutableString, NSString};
///
/// let mut dict = NSMutableDictionary::new();
/// dict.insert_id(ns_string!("one"), NSMutableString::new());
/// println!("{:?}", dict.get_mut(ns_string!("one")));
/// ```
#[doc(alias = "objectForKey:")]
#[method(objectForKey:)]
pub fn get_mut(&mut self, key: &K) -> Option<&mut V>
where
V: IsMutable;
}
);
impl<K: Message, V: Message> NSDictionary<K, V> {
pub fn len(&self) -> usize {
self.count()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
#[doc(alias = "getObjects:andKeys:")]
pub fn keys_vec(&self) -> Vec<&K> {
let len = self.len();
let mut keys = Vec::with_capacity(len);
unsafe {
#[allow(deprecated)]
self.getObjects_andKeys(ptr::null_mut(), keys.as_mut_ptr());
keys.set_len(len);
mem::transmute::<Vec<NonNull<K>>, Vec<&K>>(keys)
}
}
// We don't provide `keys_mut_vec`, since keys are immutable.
#[doc(alias = "getObjects:andKeys:")]
pub fn values_vec(&self) -> Vec<&V> {
let len = self.len();
let mut vals = Vec::with_capacity(len);
unsafe {
#[allow(deprecated)]
self.getObjects_andKeys(vals.as_mut_ptr(), ptr::null_mut());
vals.set_len(len);
mem::transmute::<Vec<NonNull<V>>, Vec<&V>>(vals)
}
}
/// Returns a vector of mutable references to the values in the dictionary.
///
/// # Examples
///
#[cfg_attr(all(feature = "NSString", feature = "NSObject"), doc = "```")]
#[cfg_attr(
not(all(feature = "NSString", feature = "NSObject")),
doc = "```ignore"
)]
/// use objc2_foundation::{ns_string, NSMutableDictionary, NSMutableString, NSString};
///
/// let mut dict = NSMutableDictionary::new();
/// dict.insert_id(ns_string!("one"), NSMutableString::from_str("two"));
/// for val in dict.values_mut() {
/// println!("{:?}", val);
/// }
/// ```
#[doc(alias = "getObjects:andKeys:")]
pub fn values_vec_mut(&mut self) -> Vec<&mut V>
where
V: IsMutable,
{
let len = self.len();
let mut vals = Vec::with_capacity(len);
unsafe {
#[allow(deprecated)]
self.getObjects_andKeys(vals.as_mut_ptr(), ptr::null_mut());
vals.set_len(len);
mem::transmute::<Vec<NonNull<V>>, Vec<&mut V>>(vals)
}
}
#[doc(alias = "getObjects:andKeys:")]
pub fn to_vecs(&self) -> (Vec<&K>, Vec<&V>) {
let len = self.len();
let mut keys = Vec::with_capacity(len);
let mut objs = Vec::with_capacity(len);
unsafe {
#[allow(deprecated)]
self.getObjects_andKeys(objs.as_mut_ptr(), keys.as_mut_ptr());
keys.set_len(len);
objs.set_len(len);
(
mem::transmute::<Vec<NonNull<K>>, Vec<&K>>(keys),
mem::transmute::<Vec<NonNull<V>>, Vec<&V>>(objs),
)
}
}
/// Returns an [`NSArray`] containing the dictionary's values.
///
/// [`NSArray`]: crate::Foundation::NSArray
///
///
/// # Examples
///
/// ```
/// use objc2_foundation::{ns_string, NSMutableDictionary, NSObject, NSString};
///
/// let mut dict = NSMutableDictionary::new();
/// dict.insert_id(ns_string!("one"), NSObject::new());
/// let array = dict.to_array();
/// assert_eq!(array.len(), 1);
/// ```
#[cfg(feature = "NSArray")]
pub fn to_array(&self) -> Retained<crate::Foundation::NSArray<V>>
where
V: IsIdCloneable,
{
// SAFETY: The elements are retainable behind `Retained<V>`, so getting
// another reference to them (via. `NSArray`) is sound.
unsafe { self.allValues() }
}
}
impl<K: Message + Eq + Hash + HasStableHash, V: Message> NSMutableDictionary<K, V> {
/// Inserts a key-value pair into the dictionary.
///
/// If the dictionary did not have this key present, None is returned.
/// If the dictionary did have this key present, the value is updated,
/// and the old value is returned.
///
/// # Examples
///
/// ```
/// use objc2_foundation::{NSMutableDictionary, NSObject, ns_string};
///
/// let mut dict = NSMutableDictionary::new();
/// dict.insert_id(ns_string!("one"), NSObject::new());
/// ```
#[cfg(feature = "NSObject")]
#[doc(alias = "setObject:forKey:")]
pub fn insert_id(&mut self, key: &K, value: Retained<V>) -> Option<Retained<V>>
where
K: NSCopying + CounterpartOrSelf<Immutable = K>,
{
// SAFETY: We remove the object from the dictionary below
let old_obj = self
.get(key)
.map(|old_obj| unsafe { util::mutable_collection_retain_removed(old_obj) });
let key = ProtocolObject::from_ref(key);
// SAFETY: We have ownership over the value.
unsafe { self.setObject_forKey(&value, key) };
old_obj
}
/// Inserts a key-value pair into the dictionary.
///
/// If the dictionary did not have this key present, None is returned.
/// If the dictionary did have this key present, the value is updated,
/// and the old value is returned.
///
/// # Examples
///
/// ```
/// use objc2_foundation::{ns_string, NSCopying, NSMutableDictionary};
///
/// let mut dict = NSMutableDictionary::new();
/// dict.insert_id(ns_string!("key"), ns_string!("value").copy());
/// ```
#[cfg(feature = "NSObject")]
#[doc(alias = "setObject:forKey:")]
pub fn insert(&mut self, key: &K, value: &V) -> Option<Retained<V>>
where
K: NSCopying + CounterpartOrSelf<Immutable = K>,
V: IsRetainable,
{
// SAFETY: We remove the object from the dictionary below
let old_obj = self
.get(key)
.map(|old_obj| unsafe { util::mutable_collection_retain_removed(old_obj) });
let key = ProtocolObject::from_ref(key);
// SAFETY: The value is `IsRetainable`, and hence safe for the
// collection to retain.
unsafe { self.setObject_forKey(value, key) };
old_obj
}
/// Removes a key from the dictionary, returning the value at the key
/// if the key was previously in the dictionary.
///
/// # Examples
///
#[cfg_attr(all(feature = "NSString", feature = "NSObject"), doc = "```")]
#[cfg_attr(
not(all(feature = "NSString", feature = "NSObject")),
doc = "```ignore"
)]
/// use objc2_foundation::{ns_string, NSMutableDictionary, NSObject};
///
/// let mut dict = NSMutableDictionary::new();
/// dict.insert_id(ns_string!("one"), NSObject::new());
/// dict.remove(ns_string!("one"));
/// assert!(dict.is_empty());
/// ```
#[doc(alias = "removeObjectForKey:")]
pub fn remove(&mut self, key: &K) -> Option<Retained<V>>
where
K: CounterpartOrSelf<Immutable = K>,
{
// SAFETY: We remove the object from the dictionary below
let old_obj = self
.get(key)
.map(|old_obj| unsafe { util::mutable_collection_retain_removed(old_obj) });
self.removeObjectForKey(key);
old_obj
}
}
impl<K: Message, V: Message> NSDictionary<K, V> {
#[doc(alias = "keyEnumerator")]
#[cfg(feature = "NSEnumerator")]
pub fn keys(&self) -> Keys<'_, K, V> {
Keys(iter::Iter::new(self))
}
#[doc(alias = "keyEnumerator")]
#[cfg(feature = "NSEnumerator")]
pub fn keys_retained(&self) -> KeysRetained<'_, K, V>
where
K: IsIdCloneable,
{
KeysRetained(iter::IterRetained::new(self))
}
// TODO: Is this ever useful?
// pub fn into_keys(this: Retained<Self>) -> IntoKeys<K, V> {
// todo!()
// }
#[doc(alias = "objectEnumerator")]
#[cfg(feature = "NSEnumerator")]
pub fn values(&self) -> Values<'_, K, V> {
let enumerator = unsafe { self.objectEnumerator() };
// SAFETY: The enumerator came from the dictionary.
Values(unsafe { iter::IterWithBackingEnum::new(self, enumerator) })
}
#[doc(alias = "objectEnumerator")]
#[cfg(feature = "NSEnumerator")]
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V>
where
V: IsMutable,
{
let enumerator = unsafe { self.objectEnumerator() };
// SAFETY: The enumerator came from the dictionary.
ValuesMut(unsafe { iter::IterMutWithBackingEnum::new(self, enumerator) })
}
#[doc(alias = "objectEnumerator")]
#[cfg(feature = "NSEnumerator")]
pub fn values_retained(&self) -> ValuesRetained<'_, K, V>
where
V: IsIdCloneable,
{
let enumerator = unsafe { self.objectEnumerator() };
// SAFETY: The enumerator came from the dictionary.
ValuesRetained(unsafe { iter::IterRetainedWithBackingEnum::new(self, enumerator) })
}
#[doc(alias = "objectEnumerator")]
#[cfg(feature = "NSEnumerator")]
pub fn into_values(this: Retained<Self>) -> IntoValues<K, V>
where
V: IsIdCloneable,
{
let enumerator = unsafe { this.objectEnumerator() };
// SAFETY: The enumerator came from the dictionary.
IntoValues(unsafe { iter::IntoIterWithBackingEnum::new_immutable(this, enumerator) })
}
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<K: Message, V: Message> iter::FastEnumerationHelper for NSDictionary<K, V> {
// Fast enumeration for dictionaries returns the keys.
type Item = K;
#[inline]
fn maybe_len(&self) -> Option<usize> {
Some(self.len())
}
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<K: Message, V: Message> iter::FastEnumerationHelper for NSMutableDictionary<K, V> {
// The same goes for mutable dictionaries.
type Item = K;
#[inline]
fn maybe_len(&self) -> Option<usize> {
Some(self.len())
}
}
// We also cfg-gate `Keys` behind `NSEnumerator` for symmetry, even though we
// don't necessarily need to.
#[cfg(feature = "NSEnumerator")]
mod iter_helpers {
use super::*;
use crate::Foundation::NSEnumerator;
/// An iterator over the keys of a `NSDictionary`.
#[derive(Debug)]
pub struct Keys<'a, K: Message, V: Message>(pub(super) iter::Iter<'a, NSDictionary<K, V>>);
__impl_iter! {
impl<'a, K: Message, V: Message> Iterator<Item = &'a K> for Keys<'a, K, V> { ... }
}
/// An iterator that retains the keys of a `NSDictionary`.
#[derive(Debug)]
pub struct KeysRetained<'a, K: Message, V: Message>(
pub(super) iter::IterRetained<'a, NSDictionary<K, V>>,
);
__impl_iter! {
impl<'a, K: Message + IsIdCloneable, V: Message> Iterator<Item = Retained<K>> for KeysRetained<'a, K, V> { ... }
}
/// An iterator over the values of a `NSDictionary`.
#[derive(Debug)]
pub struct Values<'a, K: Message, V: Message>(
pub(super) iter::IterWithBackingEnum<'a, NSDictionary<K, V>, NSEnumerator<V>>,
);
__impl_iter! {
impl<'a, K: Message, V: Message> Iterator<Item = &'a V> for Values<'a, K, V> { ... }
}
/// A mutable iterator over the values of a `NSDictionary`.
#[derive(Debug)]
pub struct ValuesMut<'a, K: Message, V: Message>(
pub(super) iter::IterMutWithBackingEnum<'a, NSDictionary<K, V>, NSEnumerator<V>>,
);
__impl_iter! {
impl<'a, K: Message, V: Message + IsMutable> Iterator<Item = &'a mut V> for ValuesMut<'a, K, V> { ... }
}
/// A iterator that retains the values of a `NSDictionary`.
#[derive(Debug)]
pub struct ValuesRetained<'a, K: Message, V: Message>(
pub(super) iter::IterRetainedWithBackingEnum<'a, NSDictionary<K, V>, NSEnumerator<V>>,
);
__impl_iter! {
impl<'a, K: Message, V: Message + IsIdCloneable> Iterator<Item = Retained<V>> for ValuesRetained<'a, K, V> { ... }
}
/// A consuming iterator over the values of a `NSDictionary`.
#[derive(Debug)]
pub struct IntoValues<K: Message, V: Message>(
pub(super) iter::IntoIterWithBackingEnum<NSDictionary<K, V>, NSEnumerator<V>>,
);
__impl_iter! {
impl<K: Message, V: Message> Iterator<Item = Retained<V>> for IntoValues<K, V> { ... }
}
}
#[cfg(feature = "NSEnumerator")]
pub use self::iter_helpers::*;
impl<'a, K: Message + Eq + Hash, V: Message> Index<&'a K> for NSDictionary<K, V> {
type Output = V;
fn index<'s>(&'s self, index: &'a K) -> &'s V {
self.get(index).unwrap()
}
}
impl<'a, K: Message + Eq + Hash, V: Message> Index<&'a K> for NSMutableDictionary<K, V> {
type Output = V;
fn index<'s>(&'s self, index: &'a K) -> &'s V {
self.get(index).unwrap()
}
}
impl<'a, K: Message + Eq + Hash, V: Message + IsMutable> IndexMut<&'a K> for NSDictionary<K, V> {
fn index_mut<'s>(&'s mut self, index: &'a K) -> &'s mut V {
self.get_mut(index).unwrap()
}
}
impl<'a, K: Message + Eq + Hash, V: Message + IsMutable> IndexMut<&'a K>
for NSMutableDictionary<K, V>
{
fn index_mut<'s>(&'s mut self, index: &'a K) -> &'s mut V {
self.get_mut(index).unwrap()
}
}
impl<K: fmt::Debug + Message, V: fmt::Debug + Message> fmt::Debug for NSDictionary<K, V> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (keys, values) = self.to_vecs();
let iter = keys.into_iter().zip(values);
f.debug_map().entries(iter).finish()
}
}
impl<K: fmt::Debug + Message, V: fmt::Debug + Message> fmt::Debug for NSMutableDictionary<K, V> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}

View File

@@ -0,0 +1,46 @@
//! Utilities for the `NSEnumerator` class.
use objc2::rc::Retained;
use objc2::Message;
use super::iter;
use crate::Foundation::NSEnumerator;
// TODO: Measure whether iterating through `nextObject` or fast enumeration is
// fastest.
// impl<T: Message> Iterator for NSEnumerator<T> {
// type Item = Retained<T>;
//
// #[inline]
// fn next(&mut self) -> Option<Retained<T>> {
// self.nextObject()
// }
// }
unsafe impl<T: Message> iter::FastEnumerationHelper for NSEnumerator<T> {
type Item = T;
#[inline]
fn maybe_len(&self) -> Option<usize> {
None
}
}
/// A consuming iterator over the items of a `NSEnumerator`.
#[derive(Debug)]
pub struct IntoIter<T: Message>(iter::IntoIter<NSEnumerator<T>>);
__impl_iter! {
impl<'a, T: Message> Iterator<Item = Retained<T>> for IntoIter<T> { ... }
}
impl<T: Message> objc2::rc::RetainedIntoIterator for NSEnumerator<T> {
type Item = Retained<T>;
type IntoIter = IntoIter<T>;
#[inline]
fn id_into_iter(this: Retained<Self>) -> Self::IntoIter {
IntoIter(super::iter::IntoIter::new(this))
}
}
// TODO: Does fast enumeration modify the enumeration while iterating?

56
vendor/objc2-foundation/src/error.rs vendored Normal file
View File

@@ -0,0 +1,56 @@
#[cfg(feature = "NSString")]
use core::fmt;
use core::panic::{RefUnwindSafe, UnwindSafe};
use crate::Foundation::NSError;
impl UnwindSafe for NSError {}
impl RefUnwindSafe for NSError {}
/// Creation methods.
impl NSError {
/// Construct a new [`NSError`] with the given code in the given domain.
#[cfg(feature = "NSDictionary")]
#[cfg(feature = "NSString")]
pub fn new(
code: objc2::ffi::NSInteger,
domain: &crate::NSErrorDomain,
) -> objc2::rc::Retained<Self> {
use objc2::ClassType;
// SAFETY: `domain` and `user_info` are copied to the error object, so
// even if the `&NSString` came from a `&mut NSMutableString`, we're
// still good!
unsafe { Self::initWithDomain_code_userInfo(Self::alloc(), domain, code, None) }
}
}
/// Accessor methods.
impl NSError {
#[cfg(feature = "NSString")]
pub fn NSLocalizedDescriptionKey() -> &'static crate::NSErrorUserInfoKey {
unsafe { crate::NSLocalizedDescriptionKey }
}
}
#[cfg(feature = "NSString")]
#[cfg(feature = "NSDictionary")]
impl std::error::Error for NSError {}
#[cfg(feature = "NSString")]
#[cfg(feature = "NSDictionary")]
impl fmt::Debug for NSError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("NSError")
.field("domain", &self.domain())
.field("code", &self.code())
.field("user_info", &self.userInfo())
.finish()
}
}
#[cfg(feature = "NSString")]
impl fmt::Display for NSError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.localizedDescription())
}
}

113
vendor/objc2-foundation/src/exception.rs vendored Normal file
View File

@@ -0,0 +1,113 @@
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
use core::fmt;
use core::hint::unreachable_unchecked;
use core::panic::{RefUnwindSafe, UnwindSafe};
use objc2::exception::Exception;
use objc2::rc::Retained;
use objc2::runtime::{NSObject, NSObjectProtocol};
use objc2::{extern_methods, sel};
use crate::Foundation::NSException;
// SAFETY: Exception objects are immutable data containers, and documented as
// thread safe.
unsafe impl Sync for NSException {}
unsafe impl Send for NSException {}
impl UnwindSafe for NSException {}
impl RefUnwindSafe for NSException {}
extern_methods!(
unsafe impl NSException {
#[method(raise)]
unsafe fn raise_raw(&self);
}
);
impl NSException {
/// Create a new [`NSException`] object.
///
/// Returns `None` if the exception couldn't be created (example: If the
/// process is out of memory).
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
#[cfg(feature = "NSDictionary")]
pub fn new(
name: &crate::Foundation::NSExceptionName,
reason: Option<&crate::Foundation::NSString>,
user_info: Option<&crate::Foundation::NSDictionary>,
) -> Option<Retained<Self>> {
use objc2::ClassType;
unsafe {
objc2::msg_send_id![
Self::alloc(),
initWithName: name,
reason: reason,
userInfo: user_info,
]
}
}
/// Raises the exception, causing program flow to jump to the local
/// exception handler.
///
/// This is equivalent to using `objc2::exception::throw`.
///
///
/// # Safety
///
/// Same as `objc2::exception::throw`.
pub unsafe fn raise(&self) -> ! {
// SAFETY: `NSException` is immutable, so it is safe to give to
// the place where `@catch` receives it.
unsafe { self.raise_raw() };
// SAFETY: `raise` will throw an exception, or abort if something
// unexpected happened.
unsafe { unreachable_unchecked() }
}
/// Convert this into an [`Exception`] object.
pub fn into_exception(this: Retained<Self>) -> Retained<Exception> {
// SAFETY: Downcasting to "subclass"
unsafe { Retained::cast(this) }
}
fn is_nsexception(obj: &Exception) -> bool {
if obj.class().responds_to(sel!(isKindOfClass:)) {
// SAFETY: We only use `isKindOfClass:` on NSObject
let obj: *const Exception = obj;
let obj = unsafe { obj.cast::<NSObject>().as_ref().unwrap() };
obj.is_kind_of::<Self>()
} else {
false
}
}
/// Create this from an [`Exception`] object.
///
/// This should be considered a hint; it may return `Err` in very, very
/// few cases where the object is actually an instance of `NSException`.
pub fn from_exception(obj: Retained<Exception>) -> Result<Retained<Self>, Retained<Exception>> {
if Self::is_nsexception(&obj) {
// SAFETY: Just checked the object is an NSException
Ok(unsafe { Retained::cast::<Self>(obj) })
} else {
Err(obj)
}
}
}
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
impl fmt::Debug for NSException {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let obj: &objc2::runtime::AnyObject = self.as_ref();
write!(f, "{obj:?} '{}'", self.name())?;
if let Some(reason) = self.reason() {
write!(f, " reason:{reason}")?;
} else {
write!(f, " reason:(NULL)")?;
}
Ok(())
}
}

View File

@@ -0,0 +1,29 @@
use std::os::raw::c_ulong;
use objc2::encode::{Encode, Encoding, RefEncode};
use objc2::runtime::AnyObject;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSFastEnumerationState {
pub state: c_ulong,
pub itemsPtr: *mut *mut AnyObject,
pub mutationsPtr: *mut c_ulong,
pub extra: [c_ulong; 5],
}
unsafe impl Encode for NSFastEnumerationState {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
Encoding::C_ULONG,
Encoding::Pointer(&Encoding::Object),
Encoding::Pointer(&Encoding::C_ULONG),
Encoding::Array(5, &Encoding::C_ULONG),
],
);
}
unsafe impl RefEncode for NSFastEnumerationState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

View File

@@ -0,0 +1,90 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
pub const NSFileNoSuchFileError: NSInteger = 4;
pub const NSFileLockingError: NSInteger = 255;
pub const NSFileReadUnknownError: NSInteger = 256;
pub const NSFileReadNoPermissionError: NSInteger = 257;
pub const NSFileReadInvalidFileNameError: NSInteger = 258;
pub const NSFileReadCorruptFileError: NSInteger = 259;
pub const NSFileReadNoSuchFileError: NSInteger = 260;
pub const NSFileReadInapplicableStringEncodingError: NSInteger = 261;
pub const NSFileReadUnsupportedSchemeError: NSInteger = 262;
pub const NSFileReadTooLargeError: NSInteger = 263;
pub const NSFileReadUnknownStringEncodingError: NSInteger = 264;
pub const NSFileWriteUnknownError: NSInteger = 512;
pub const NSFileWriteNoPermissionError: NSInteger = 513;
pub const NSFileWriteInvalidFileNameError: NSInteger = 514;
pub const NSFileWriteFileExistsError: NSInteger = 516;
pub const NSFileWriteInapplicableStringEncodingError: NSInteger = 517;
pub const NSFileWriteUnsupportedSchemeError: NSInteger = 518;
pub const NSFileWriteOutOfSpaceError: NSInteger = 640;
pub const NSFileWriteVolumeReadOnlyError: NSInteger = 642;
pub const NSFileManagerUnmountUnknownError: NSInteger = 768;
pub const NSFileManagerUnmountBusyError: NSInteger = 769;
pub const NSKeyValueValidationError: NSInteger = 1024;
pub const NSFormattingError: NSInteger = 2048;
pub const NSUserCancelledError: NSInteger = 3072;
pub const NSFeatureUnsupportedError: NSInteger = 3328;
pub const NSExecutableNotLoadableError: NSInteger = 3584;
pub const NSExecutableArchitectureMismatchError: NSInteger = 3585;
pub const NSExecutableRuntimeMismatchError: NSInteger = 3586;
pub const NSExecutableLoadError: NSInteger = 3587;
pub const NSExecutableLinkError: NSInteger = 3588;
pub const NSFileErrorMinimum: NSInteger = 0;
pub const NSFileErrorMaximum: NSInteger = 1023;
pub const NSValidationErrorMinimum: NSInteger = 1024;
pub const NSValidationErrorMaximum: NSInteger = 2047;
pub const NSExecutableErrorMinimum: NSInteger = 3584;
pub const NSExecutableErrorMaximum: NSInteger = 3839;
pub const NSFormattingErrorMinimum: NSInteger = 2048;
pub const NSFormattingErrorMaximum: NSInteger = 2559;
pub const NSPropertyListReadCorruptError: NSInteger = 3840;
pub const NSPropertyListReadUnknownVersionError: NSInteger = 3841;
pub const NSPropertyListReadStreamError: NSInteger = 3842;
pub const NSPropertyListWriteStreamError: NSInteger = 3851;
pub const NSPropertyListWriteInvalidError: NSInteger = 3852;
pub const NSPropertyListErrorMinimum: NSInteger = 3840;
pub const NSPropertyListErrorMaximum: NSInteger = 4095;
pub const NSXPCConnectionInterrupted: NSInteger = 4097;
pub const NSXPCConnectionInvalid: NSInteger = 4099;
pub const NSXPCConnectionReplyInvalid: NSInteger = 4101;
pub const NSXPCConnectionCodeSigningRequirementFailure: NSInteger = 4102;
pub const NSXPCConnectionErrorMinimum: NSInteger = 4096;
pub const NSXPCConnectionErrorMaximum: NSInteger = 4224;
pub const NSUbiquitousFileUnavailableError: NSInteger = 4353;
pub const NSUbiquitousFileNotUploadedDueToQuotaError: NSInteger = 4354;
pub const NSUbiquitousFileUbiquityServerNotAvailable: NSInteger = 4355;
pub const NSUbiquitousFileErrorMinimum: NSInteger = 4352;
pub const NSUbiquitousFileErrorMaximum: NSInteger = 4607;
pub const NSUserActivityHandoffFailedError: NSInteger = 4608;
pub const NSUserActivityConnectionUnavailableError: NSInteger = 4609;
pub const NSUserActivityRemoteApplicationTimedOutError: NSInteger = 4610;
pub const NSUserActivityHandoffUserInfoTooLargeError: NSInteger = 4611;
pub const NSUserActivityErrorMinimum: NSInteger = 4608;
pub const NSUserActivityErrorMaximum: NSInteger = 4863;
pub const NSCoderReadCorruptError: NSInteger = 4864;
pub const NSCoderValueNotFoundError: NSInteger = 4865;
pub const NSCoderInvalidValueError: NSInteger = 4866;
pub const NSCoderErrorMinimum: NSInteger = 4864;
pub const NSCoderErrorMaximum: NSInteger = 4991;
pub const NSBundleErrorMinimum: NSInteger = 4992;
pub const NSBundleErrorMaximum: NSInteger = 5119;
pub const NSBundleOnDemandResourceOutOfSpaceError: NSInteger = 4992;
pub const NSBundleOnDemandResourceExceededMaximumSizeError: NSInteger = 4993;
pub const NSBundleOnDemandResourceInvalidTagError: NSInteger = 4994;
pub const NSCloudSharingNetworkFailureError: NSInteger = 5120;
pub const NSCloudSharingQuotaExceededError: NSInteger = 5121;
pub const NSCloudSharingTooManyParticipantsError: NSInteger = 5122;
pub const NSCloudSharingConflictError: NSInteger = 5123;
pub const NSCloudSharingNoPermissionError: NSInteger = 5124;
pub const NSCloudSharingOtherError: NSInteger = 5375;
pub const NSCloudSharingErrorMinimum: NSInteger = 5120;
pub const NSCloudSharingErrorMaximum: NSInteger = 5375;
pub const NSCompressionFailedError: NSInteger = 5376;
pub const NSDecompressionFailedError: NSInteger = 5377;
pub const NSCompressionErrorMinimum: NSInteger = 5376;
pub const NSCompressionErrorMaximum: NSInteger = 5503;

View File

@@ -0,0 +1,2 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT

View File

@@ -0,0 +1,133 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSGeometry")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSAffineTransformStruct {
pub m11: CGFloat,
pub m12: CGFloat,
pub m21: CGFloat,
pub m22: CGFloat,
pub tX: CGFloat,
pub tY: CGFloat,
}
#[cfg(feature = "NSGeometry")]
unsafe impl Encode for NSAffineTransformStruct {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
],
);
}
#[cfg(feature = "NSGeometry")]
unsafe impl RefEncode for NSAffineTransformStruct {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "NSGeometry")]
unsafe impl Send for NSAffineTransformStruct {}
#[cfg(feature = "NSGeometry")]
unsafe impl Sync for NSAffineTransformStruct {}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAffineTransform;
unsafe impl ClassType for NSAffineTransform {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAffineTransform {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAffineTransform {}
unsafe impl NSObjectProtocol for NSAffineTransform {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAffineTransform {}
extern_methods!(
unsafe impl NSAffineTransform {
#[method_id(@__retain_semantics Other transform)]
pub unsafe fn transform() -> Retained<NSAffineTransform>;
#[method_id(@__retain_semantics Init initWithTransform:)]
pub unsafe fn initWithTransform(
this: Allocated<Self>,
transform: &NSAffineTransform,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSGeometry")]
#[method(translateXBy:yBy:)]
pub unsafe fn translateXBy_yBy(&self, delta_x: CGFloat, delta_y: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(rotateByDegrees:)]
pub unsafe fn rotateByDegrees(&self, angle: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(rotateByRadians:)]
pub unsafe fn rotateByRadians(&self, angle: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(scaleBy:)]
pub unsafe fn scaleBy(&self, scale: CGFloat);
#[cfg(feature = "NSGeometry")]
#[method(scaleXBy:yBy:)]
pub unsafe fn scaleXBy_yBy(&self, scale_x: CGFloat, scale_y: CGFloat);
#[method(invert)]
pub unsafe fn invert(&self);
#[method(appendTransform:)]
pub unsafe fn appendTransform(&self, transform: &NSAffineTransform);
#[method(prependTransform:)]
pub unsafe fn prependTransform(&self, transform: &NSAffineTransform);
#[cfg(feature = "NSGeometry")]
#[method(transformPoint:)]
pub unsafe fn transformPoint(&self, a_point: NSPoint) -> NSPoint;
#[cfg(feature = "NSGeometry")]
#[method(transformSize:)]
pub unsafe fn transformSize(&self, a_size: NSSize) -> NSSize;
#[cfg(feature = "NSGeometry")]
#[method(transformStruct)]
pub unsafe fn transformStruct(&self) -> NSAffineTransformStruct;
#[cfg(feature = "NSGeometry")]
#[method(setTransformStruct:)]
pub unsafe fn setTransformStruct(&self, transform_struct: NSAffineTransformStruct);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAffineTransform {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,190 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAppleEventSendOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSAppleEventSendOptions: NSUInteger {
const NSAppleEventSendNoReply = 1;
const NSAppleEventSendQueueReply = 2;
const NSAppleEventSendWaitForReply = 3;
const NSAppleEventSendNeverInteract = 16;
const NSAppleEventSendCanInteract = 32;
const NSAppleEventSendAlwaysInteract = 48;
const NSAppleEventSendCanSwitchLayer = 64;
const NSAppleEventSendDontRecord = 4096;
const NSAppleEventSendDontExecute = 8192;
const NSAppleEventSendDontAnnotate = 65536;
const NSAppleEventSendDefaultOptions = 35;
}
}
unsafe impl Encode for NSAppleEventSendOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAppleEventSendOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAppleEventDescriptor;
unsafe impl ClassType for NSAppleEventDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAppleEventDescriptor {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAppleEventDescriptor {}
unsafe impl NSObjectProtocol for NSAppleEventDescriptor {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAppleEventDescriptor {}
extern_methods!(
unsafe impl NSAppleEventDescriptor {
#[method_id(@__retain_semantics Other nullDescriptor)]
pub unsafe fn nullDescriptor() -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other descriptorWithBoolean:)]
pub unsafe fn descriptorWithBoolean(boolean: Boolean) -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other descriptorWithEnumCode:)]
pub unsafe fn descriptorWithEnumCode(
enumerator: OSType,
) -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other descriptorWithInt32:)]
pub unsafe fn descriptorWithInt32(signed_int: i32) -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other descriptorWithDouble:)]
pub unsafe fn descriptorWithDouble(
double_value: c_double,
) -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other descriptorWithTypeCode:)]
pub unsafe fn descriptorWithTypeCode(type_code: OSType)
-> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptorWithString:)]
pub unsafe fn descriptorWithString(string: &NSString) -> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other descriptorWithDate:)]
pub unsafe fn descriptorWithDate(date: &NSDate) -> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other descriptorWithFileURL:)]
pub unsafe fn descriptorWithFileURL(file_url: &NSURL) -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other listDescriptor)]
pub unsafe fn listDescriptor() -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other recordDescriptor)]
pub unsafe fn recordDescriptor() -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Other currentProcessDescriptor)]
pub unsafe fn currentProcessDescriptor() -> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "libc")]
#[method_id(@__retain_semantics Other descriptorWithProcessIdentifier:)]
pub unsafe fn descriptorWithProcessIdentifier(
process_identifier: libc::pid_t,
) -> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptorWithBundleIdentifier:)]
pub unsafe fn descriptorWithBundleIdentifier(
bundle_identifier: &NSString,
) -> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other descriptorWithApplicationURL:)]
pub unsafe fn descriptorWithApplicationURL(
application_url: &NSURL,
) -> Retained<NSAppleEventDescriptor>;
#[method_id(@__retain_semantics Init initListDescriptor)]
pub unsafe fn initListDescriptor(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initRecordDescriptor)]
pub unsafe fn initRecordDescriptor(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other data)]
pub unsafe fn data(&self) -> Retained<NSData>;
#[method(booleanValue)]
pub unsafe fn booleanValue(&self) -> Boolean;
#[method(enumCodeValue)]
pub unsafe fn enumCodeValue(&self) -> OSType;
#[method(int32Value)]
pub unsafe fn int32Value(&self) -> i32;
#[method(doubleValue)]
pub unsafe fn doubleValue(&self) -> c_double;
#[method(typeCodeValue)]
pub unsafe fn typeCodeValue(&self) -> OSType;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringValue)]
pub unsafe fn stringValue(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateValue)]
pub unsafe fn dateValue(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other fileURLValue)]
pub unsafe fn fileURLValue(&self) -> Option<Retained<NSURL>>;
#[method(isRecordDescriptor)]
pub unsafe fn isRecordDescriptor(&self) -> bool;
#[method(numberOfItems)]
pub unsafe fn numberOfItems(&self) -> NSInteger;
#[method(insertDescriptor:atIndex:)]
pub unsafe fn insertDescriptor_atIndex(
&self,
descriptor: &NSAppleEventDescriptor,
index: NSInteger,
);
#[method_id(@__retain_semantics Other descriptorAtIndex:)]
pub unsafe fn descriptorAtIndex(
&self,
index: NSInteger,
) -> Option<Retained<NSAppleEventDescriptor>>;
#[method(removeDescriptorAtIndex:)]
pub unsafe fn removeDescriptorAtIndex(&self, index: NSInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAppleEventDescriptor {
#[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>;
}
);

View File

@@ -0,0 +1,84 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
pub type NSAppleEventManagerSuspensionID = *mut c_void;
extern "C" {
pub static NSAppleEventTimeOutDefault: c_double;
}
extern "C" {
pub static NSAppleEventTimeOutNone: c_double;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSAppleEventManagerWillProcessFirstEventNotification: &'static NSNotificationName;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAppleEventManager;
unsafe impl ClassType for NSAppleEventManager {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAppleEventManager {}
extern_methods!(
unsafe impl NSAppleEventManager {
#[method_id(@__retain_semantics Other sharedAppleEventManager)]
pub unsafe fn sharedAppleEventManager() -> Retained<NSAppleEventManager>;
#[cfg(feature = "NSAppleEventDescriptor")]
#[method_id(@__retain_semantics Other currentAppleEvent)]
pub unsafe fn currentAppleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
#[cfg(feature = "NSAppleEventDescriptor")]
#[method_id(@__retain_semantics Other currentReplyAppleEvent)]
pub unsafe fn currentReplyAppleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
#[method(suspendCurrentAppleEvent)]
pub unsafe fn suspendCurrentAppleEvent(&self) -> NSAppleEventManagerSuspensionID;
#[cfg(feature = "NSAppleEventDescriptor")]
#[method_id(@__retain_semantics Other appleEventForSuspensionID:)]
pub unsafe fn appleEventForSuspensionID(
&self,
suspension_id: NSAppleEventManagerSuspensionID,
) -> Retained<NSAppleEventDescriptor>;
#[cfg(feature = "NSAppleEventDescriptor")]
#[method_id(@__retain_semantics Other replyAppleEventForSuspensionID:)]
pub unsafe fn replyAppleEventForSuspensionID(
&self,
suspension_id: NSAppleEventManagerSuspensionID,
) -> Retained<NSAppleEventDescriptor>;
#[method(setCurrentAppleEventAndReplyEventWithSuspensionID:)]
pub unsafe fn setCurrentAppleEventAndReplyEventWithSuspensionID(
&self,
suspension_id: NSAppleEventManagerSuspensionID,
);
#[method(resumeWithSuspensionID:)]
pub unsafe fn resumeWithSuspensionID(&self, suspension_id: NSAppleEventManagerSuspensionID);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAppleEventManager {
#[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>;
}
);

View File

@@ -0,0 +1,112 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAppleScriptErrorMessage: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAppleScriptErrorNumber: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAppleScriptErrorAppName: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAppleScriptErrorBriefMessage: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAppleScriptErrorRange: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAppleScript;
unsafe impl ClassType for NSAppleScript {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAppleScript {}
unsafe impl NSObjectProtocol for NSAppleScript {}
extern_methods!(
unsafe impl NSAppleScript {
#[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithContentsOfURL:error:)]
pub unsafe fn initWithContentsOfURL_error(
this: Allocated<Self>,
url: &NSURL,
error_info: Option<&mut Option<Retained<NSDictionary<NSString, AnyObject>>>>,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithSource:)]
pub unsafe fn initWithSource(
this: Allocated<Self>,
source: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other source)]
pub unsafe fn source(&self) -> Option<Retained<NSString>>;
#[method(isCompiled)]
pub unsafe fn isCompiled(&self) -> bool;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(compileAndReturnError:)]
pub unsafe fn compileAndReturnError(
&self,
error_info: Option<&mut Option<Retained<NSDictionary<NSString, AnyObject>>>>,
) -> bool;
#[cfg(all(
feature = "NSAppleEventDescriptor",
feature = "NSDictionary",
feature = "NSString"
))]
#[method_id(@__retain_semantics Other executeAndReturnError:)]
pub unsafe fn executeAndReturnError(
&self,
error_info: Option<&mut Option<Retained<NSDictionary<NSString, AnyObject>>>>,
) -> Retained<NSAppleEventDescriptor>;
#[cfg(all(
feature = "NSAppleEventDescriptor",
feature = "NSDictionary",
feature = "NSString"
))]
#[method_id(@__retain_semantics Other executeAppleEvent:error:)]
pub unsafe fn executeAppleEvent_error(
&self,
event: &NSAppleEventDescriptor,
error_info: Option<&mut Option<Retained<NSDictionary<NSString, AnyObject>>>>,
) -> Retained<NSAppleEventDescriptor>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAppleScript {
#[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>;
}
);

View File

@@ -0,0 +1,216 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCoder")]
#[deprecated = "Use NSKeyedArchiver instead"]
pub struct NSArchiver;
#[cfg(feature = "NSCoder")]
unsafe impl ClassType for NSArchiver {
#[inherits(NSObject)]
type Super = NSCoder;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCoder")]
unsafe impl NSObjectProtocol for NSArchiver {}
extern_methods!(
#[cfg(feature = "NSCoder")]
unsafe impl NSArchiver {
#[cfg(feature = "NSData")]
#[deprecated = "Use NSKeyedArchiver instead"]
#[method_id(@__retain_semantics Init initForWritingWithMutableData:)]
pub unsafe fn initForWritingWithMutableData(
this: Allocated<Self>,
mdata: &NSMutableData,
) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[deprecated = "Use NSKeyedArchiver instead"]
#[method_id(@__retain_semantics Other archiverData)]
pub unsafe fn archiverData(&self) -> Retained<NSMutableData>;
#[deprecated = "Use NSKeyedArchiver instead"]
#[method(encodeRootObject:)]
pub unsafe fn encodeRootObject(&self, root_object: &AnyObject);
#[deprecated = "Use NSKeyedArchiver instead"]
#[method(encodeConditionalObject:)]
pub unsafe fn encodeConditionalObject(&self, object: Option<&AnyObject>);
#[cfg(feature = "NSData")]
#[deprecated = "Use NSKeyedArchiver instead"]
#[method_id(@__retain_semantics Other archivedDataWithRootObject:)]
pub unsafe fn archivedDataWithRootObject(root_object: &AnyObject) -> Retained<NSData>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedArchiver instead"]
#[method(archiveRootObject:toFile:)]
pub unsafe fn archiveRootObject_toFile(root_object: &AnyObject, path: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedArchiver instead"]
#[method(encodeClassName:intoClassName:)]
pub unsafe fn encodeClassName_intoClassName(
&self,
true_name: &NSString,
in_archive_name: &NSString,
);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedArchiver instead"]
#[method_id(@__retain_semantics Other classNameEncodedForTrueClassName:)]
pub unsafe fn classNameEncodedForTrueClassName(
&self,
true_name: &NSString,
) -> Option<Retained<NSString>>;
#[deprecated = "Use NSKeyedArchiver instead"]
#[method(replaceObject:withObject:)]
pub unsafe fn replaceObject_withObject(&self, object: &AnyObject, new_object: &AnyObject);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCoder")]
unsafe impl NSArchiver {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCoder")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
pub struct NSUnarchiver;
#[cfg(feature = "NSCoder")]
unsafe impl ClassType for NSUnarchiver {
#[inherits(NSObject)]
type Super = NSCoder;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCoder")]
unsafe impl NSObjectProtocol for NSUnarchiver {}
extern_methods!(
#[cfg(feature = "NSCoder")]
unsafe impl NSUnarchiver {
#[cfg(feature = "NSData")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method_id(@__retain_semantics Init initForReadingWithData:)]
pub unsafe fn initForReadingWithData(
this: Allocated<Self>,
data: &NSData,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSZone")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(setObjectZone:)]
pub unsafe fn setObjectZone(&self, zone: *mut NSZone);
#[cfg(feature = "NSZone")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(objectZone)]
pub unsafe fn objectZone(&self) -> *mut NSZone;
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(isAtEnd)]
pub unsafe fn isAtEnd(&self) -> bool;
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(systemVersion)]
pub unsafe fn systemVersion(&self) -> c_uint;
#[cfg(feature = "NSData")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method_id(@__retain_semantics Other unarchiveObjectWithData:)]
pub unsafe fn unarchiveObjectWithData(data: &NSData) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method_id(@__retain_semantics Other unarchiveObjectWithFile:)]
pub unsafe fn unarchiveObjectWithFile(path: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(decodeClassName:asClassName:)]
pub unsafe fn decodeClassName_asClassName_class(
in_archive_name: &NSString,
true_name: &NSString,
);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(decodeClassName:asClassName:)]
pub unsafe fn decodeClassName_asClassName(
&self,
in_archive_name: &NSString,
true_name: &NSString,
);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method_id(@__retain_semantics Other classNameDecodedForArchiveClassName:)]
pub unsafe fn classNameDecodedForArchiveClassName_class(
in_archive_name: &NSString,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method_id(@__retain_semantics Other classNameDecodedForArchiveClassName:)]
pub unsafe fn classNameDecodedForArchiveClassName(
&self,
in_archive_name: &NSString,
) -> Retained<NSString>;
#[deprecated = "Use NSKeyedUnarchiver instead"]
#[method(replaceObject:withObject:)]
pub unsafe fn replaceObject_withObject(&self, object: &AnyObject, new_object: &AnyObject);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCoder")]
unsafe impl NSUnarchiver {
#[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_category!(
/// Category "NSArchiverCallback" on [`NSObject`].
#[doc(alias = "NSArchiverCallback")]
pub unsafe trait NSObjectNSArchiverCallback {
#[method(classForArchiver)]
unsafe fn classForArchiver(&self) -> Option<&'static AnyClass>;
#[cfg(feature = "NSCoder")]
#[deprecated]
#[method_id(@__retain_semantics Other replacementObjectForArchiver:)]
unsafe fn replacementObjectForArchiver(
&self,
archiver: &NSArchiver,
) -> Option<Retained<AnyObject>>;
}
unsafe impl NSObjectNSArchiverCallback for NSObject {}
);

View File

@@ -0,0 +1,768 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + NSCoding> NSCoding for NSArray<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + IsIdCloneable> NSCopying for NSArray<ObjectType> {}
#[cfg(feature = "NSEnumerator")]
unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSArray<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + IsIdCloneable> NSMutableCopying for NSArray<ObjectType> {}
unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSArray<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + NSSecureCoding> NSSecureCoding for NSArray<ObjectType> {}
extern_methods!(
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[method(count)]
pub fn count(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other objectAtIndex:)]
pub unsafe fn objectAtIndex(&self, index: NSUInteger) -> Retained<ObjectType>;
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithObjects:count:)]
pub unsafe fn initWithObjects_count(
this: Allocated<Self>,
objects: *mut NonNull<ObjectType>,
cnt: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl<ObjectType: Message> DefaultRetained for NSArray<ObjectType> {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBinarySearchingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSBinarySearchingOptions: NSUInteger {
const NSBinarySearchingFirstEqual = 1<<8;
const NSBinarySearchingLastEqual = 1<<9;
const NSBinarySearchingInsertionIndex = 1<<10;
}
}
unsafe impl Encode for NSBinarySearchingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBinarySearchingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSExtendedArray
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[method_id(@__retain_semantics Other arrayByAddingObject:)]
pub unsafe fn arrayByAddingObject(
&self,
an_object: &ObjectType,
) -> Retained<NSArray<ObjectType>>;
#[method_id(@__retain_semantics Other arrayByAddingObjectsFromArray:)]
pub unsafe fn arrayByAddingObjectsFromArray(
&self,
other_array: &NSArray<ObjectType>,
) -> Retained<NSArray<ObjectType>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other componentsJoinedByString:)]
pub unsafe fn componentsJoinedByString(&self, separator: &NSString) -> Retained<NSString>;
#[method(containsObject:)]
pub unsafe fn containsObject(&self, an_object: &ObjectType) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other description)]
pub unsafe fn description(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionWithLocale:)]
pub unsafe fn descriptionWithLocale(
&self,
locale: Option<&AnyObject>,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionWithLocale:indent:)]
pub unsafe fn descriptionWithLocale_indent(
&self,
locale: Option<&AnyObject>,
level: NSUInteger,
) -> Retained<NSString>;
#[method_id(@__retain_semantics Other firstObjectCommonWithArray:)]
pub unsafe fn firstObjectCommonWithArray(
&self,
other_array: &NSArray<ObjectType>,
) -> Option<Retained<ObjectType>>;
#[cfg(feature = "NSRange")]
#[method(getObjects:range:)]
pub unsafe fn getObjects_range(
&self,
objects: NonNull<NonNull<ObjectType>>,
range: NSRange,
);
#[method(indexOfObject:)]
pub unsafe fn indexOfObject(&self, an_object: &ObjectType) -> NSUInteger;
#[cfg(feature = "NSRange")]
#[method(indexOfObject:inRange:)]
pub unsafe fn indexOfObject_inRange(
&self,
an_object: &ObjectType,
range: NSRange,
) -> NSUInteger;
#[method(indexOfObjectIdenticalTo:)]
pub unsafe fn indexOfObjectIdenticalTo(&self, an_object: &ObjectType) -> NSUInteger;
#[cfg(feature = "NSRange")]
#[method(indexOfObjectIdenticalTo:inRange:)]
pub unsafe fn indexOfObjectIdenticalTo_inRange(
&self,
an_object: &ObjectType,
range: NSRange,
) -> NSUInteger;
#[method(isEqualToArray:)]
pub unsafe fn isEqualToArray(&self, other_array: &NSArray<ObjectType>) -> bool;
#[method_id(@__retain_semantics Other firstObject)]
pub unsafe fn firstObject(&self) -> Option<Retained<ObjectType>>;
#[method_id(@__retain_semantics Other lastObject)]
pub unsafe fn lastObject(&self) -> Option<Retained<ObjectType>>;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other objectEnumerator)]
pub unsafe fn objectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other reverseObjectEnumerator)]
pub unsafe fn reverseObjectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other sortedArrayHint)]
pub unsafe fn sortedArrayHint(&self) -> Retained<NSData>;
#[method_id(@__retain_semantics Other sortedArrayUsingFunction:context:)]
pub unsafe fn sortedArrayUsingFunction_context(
&self,
comparator: unsafe extern "C" fn(
NonNull<ObjectType>,
NonNull<ObjectType>,
*mut c_void,
) -> NSInteger,
context: *mut c_void,
) -> Retained<NSArray<ObjectType>>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other sortedArrayUsingFunction:context:hint:)]
pub unsafe fn sortedArrayUsingFunction_context_hint(
&self,
comparator: unsafe extern "C" fn(
NonNull<ObjectType>,
NonNull<ObjectType>,
*mut c_void,
) -> NSInteger,
context: *mut c_void,
hint: Option<&NSData>,
) -> Retained<NSArray<ObjectType>>;
#[method_id(@__retain_semantics Other sortedArrayUsingSelector:)]
pub unsafe fn sortedArrayUsingSelector(
&self,
comparator: Sel,
) -> Retained<NSArray<ObjectType>>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other subarrayWithRange:)]
pub unsafe fn subarrayWithRange(&self, range: NSRange) -> Retained<NSArray<ObjectType>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method(writeToURL:error:_)]
pub unsafe fn writeToURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
#[method(makeObjectsPerformSelector:)]
pub unsafe fn makeObjectsPerformSelector(&self, a_selector: Sel);
#[method(makeObjectsPerformSelector:withObject:)]
pub unsafe fn makeObjectsPerformSelector_withObject(
&self,
a_selector: Sel,
argument: Option<&AnyObject>,
);
#[cfg(feature = "NSIndexSet")]
#[method_id(@__retain_semantics Other objectsAtIndexes:)]
pub unsafe fn objectsAtIndexes(
&self,
indexes: &NSIndexSet,
) -> Retained<NSArray<ObjectType>>;
#[method_id(@__retain_semantics Other objectAtIndexedSubscript:)]
pub unsafe fn objectAtIndexedSubscript(&self, idx: NSUInteger) -> Retained<ObjectType>;
#[cfg(feature = "block2")]
#[method(enumerateObjectsUsingBlock:)]
pub unsafe fn enumerateObjectsUsingBlock(
&self,
block: &block2::Block<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(enumerateObjectsWithOptions:usingBlock:)]
pub unsafe fn enumerateObjectsWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
#[method(enumerateObjectsAtIndexes:options:usingBlock:)]
pub unsafe fn enumerateObjectsAtIndexes_options_usingBlock(
&self,
s: &NSIndexSet,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(feature = "block2")]
#[method(indexOfObjectPassingTest:)]
pub unsafe fn indexOfObjectPassingTest(
&self,
predicate: &block2::Block<
dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
>,
) -> NSUInteger;
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(indexOfObjectWithOptions:passingTest:)]
pub unsafe fn indexOfObjectWithOptions_passingTest(
&self,
opts: NSEnumerationOptions,
predicate: &block2::Block<
dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
>,
) -> NSUInteger;
#[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
#[method(indexOfObjectAtIndexes:options:passingTest:)]
pub unsafe fn indexOfObjectAtIndexes_options_passingTest(
&self,
s: &NSIndexSet,
opts: NSEnumerationOptions,
predicate: &block2::Block<
dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
>,
) -> NSUInteger;
#[cfg(all(feature = "NSIndexSet", feature = "block2"))]
#[method_id(@__retain_semantics Other indexesOfObjectsPassingTest:)]
pub unsafe fn indexesOfObjectsPassingTest(
&self,
predicate: &block2::Block<
dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
>,
) -> Retained<NSIndexSet>;
#[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other indexesOfObjectsWithOptions:passingTest:)]
pub unsafe fn indexesOfObjectsWithOptions_passingTest(
&self,
opts: NSEnumerationOptions,
predicate: &block2::Block<
dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
>,
) -> Retained<NSIndexSet>;
#[cfg(all(feature = "NSIndexSet", feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other indexesOfObjectsAtIndexes:options:passingTest:)]
pub unsafe fn indexesOfObjectsAtIndexes_options_passingTest(
&self,
s: &NSIndexSet,
opts: NSEnumerationOptions,
predicate: &block2::Block<
dyn Fn(NonNull<ObjectType>, NSUInteger, NonNull<Bool>) -> Bool + '_,
>,
) -> Retained<NSIndexSet>;
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other sortedArrayUsingComparator:)]
pub unsafe fn sortedArrayUsingComparator(
&self,
cmptr: NSComparator,
) -> Retained<NSArray<ObjectType>>;
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other sortedArrayWithOptions:usingComparator:)]
pub unsafe fn sortedArrayWithOptions_usingComparator(
&self,
opts: NSSortOptions,
cmptr: NSComparator,
) -> Retained<NSArray<ObjectType>>;
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
#[method(indexOfObject:inSortedRange:options:usingComparator:)]
pub unsafe fn indexOfObject_inSortedRange_options_usingComparator(
&self,
obj: &ObjectType,
r: NSRange,
opts: NSBinarySearchingOptions,
cmp: NSComparator,
) -> NSUInteger;
}
);
extern_methods!(
/// NSArrayCreation
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[method_id(@__retain_semantics Other array)]
pub unsafe fn array() -> Retained<Self>;
#[method_id(@__retain_semantics Other arrayWithObject:)]
pub unsafe fn arrayWithObject(an_object: &ObjectType) -> Retained<Self>;
#[method_id(@__retain_semantics Other arrayWithObjects:count:)]
pub unsafe fn arrayWithObjects_count(
objects: NonNull<NonNull<ObjectType>>,
cnt: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other arrayWithArray:)]
pub unsafe fn arrayWithArray(array: &NSArray<ObjectType>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithArray:)]
pub unsafe fn initWithArray(
this: Allocated<Self>,
array: &NSArray<ObjectType>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithArray:copyItems:)]
pub unsafe fn initWithArray_copyItems(
this: Allocated<Self>,
array: &NSArray<ObjectType>,
flag: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithContentsOfURL:error:_)]
pub unsafe fn initWithContentsOfURL_error(
this: Allocated<Self>,
url: &NSURL,
) -> Result<Retained<NSArray<ObjectType>>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other arrayWithContentsOfURL:error:_)]
pub unsafe fn arrayWithContentsOfURL_error(
url: &NSURL,
) -> Result<Retained<NSArray<ObjectType>>, Retained<NSError>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSArray`
///
/// NSArrayCreation
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[method_id(@__retain_semantics Other array)]
pub unsafe fn array() -> Retained<Self>;
#[method_id(@__retain_semantics Other arrayWithObject:)]
pub unsafe fn arrayWithObject(an_object: &ObjectType) -> Retained<Self>;
#[method_id(@__retain_semantics Other arrayWithObjects:count:)]
pub unsafe fn arrayWithObjects_count(
objects: NonNull<NonNull<ObjectType>>,
cnt: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other arrayWithArray:)]
pub unsafe fn arrayWithArray(array: &NSArray<ObjectType>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithArray:)]
pub unsafe fn initWithArray(
this: Allocated<Self>,
array: &NSArray<ObjectType>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithArray:copyItems:)]
pub unsafe fn initWithArray_copyItems(
this: Allocated<Self>,
array: &NSArray<ObjectType>,
flag: bool,
) -> Retained<Self>;
}
);
extern_methods!(
/// NSArrayDiffing
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[cfg(all(feature = "NSOrderedCollectionDifference", feature = "block2"))]
#[method_id(@__retain_semantics Other differenceFromArray:withOptions:usingEquivalenceTest:)]
pub unsafe fn differenceFromArray_withOptions_usingEquivalenceTest(
&self,
other: &NSArray<ObjectType>,
options: NSOrderedCollectionDifferenceCalculationOptions,
block: &block2::Block<dyn Fn(NonNull<ObjectType>, NonNull<ObjectType>) -> Bool + '_>,
) -> Retained<NSOrderedCollectionDifference<ObjectType>>;
#[cfg(feature = "NSOrderedCollectionDifference")]
#[method_id(@__retain_semantics Other differenceFromArray:withOptions:)]
pub unsafe fn differenceFromArray_withOptions(
&self,
other: &NSArray<ObjectType>,
options: NSOrderedCollectionDifferenceCalculationOptions,
) -> Retained<NSOrderedCollectionDifference<ObjectType>>;
#[cfg(feature = "NSOrderedCollectionDifference")]
#[method_id(@__retain_semantics Other differenceFromArray:)]
pub unsafe fn differenceFromArray(
&self,
other: &NSArray<ObjectType>,
) -> Retained<NSOrderedCollectionDifference<ObjectType>>;
#[cfg(feature = "NSOrderedCollectionDifference")]
#[method_id(@__retain_semantics Other arrayByApplyingDifference:)]
pub unsafe fn arrayByApplyingDifference(
&self,
difference: &NSOrderedCollectionDifference<ObjectType>,
) -> Option<Retained<NSArray<ObjectType>>>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[deprecated = "Use -getObjects:range: instead"]
#[method(getObjects:)]
pub unsafe fn getObjects(&self, objects: NonNull<NonNull<ObjectType>>);
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other arrayWithContentsOfFile:)]
pub unsafe fn arrayWithContentsOfFile(
path: &NSString,
) -> Option<Retained<NSArray<ObjectType>>>;
#[cfg(feature = "NSURL")]
#[deprecated]
#[method_id(@__retain_semantics Other arrayWithContentsOfURL:)]
pub unsafe fn arrayWithContentsOfURL(url: &NSURL) -> Option<Retained<NSArray<ObjectType>>>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Init initWithContentsOfFile:)]
pub unsafe fn initWithContentsOfFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<NSArray<ObjectType>>>;
#[cfg(feature = "NSURL")]
#[deprecated]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<NSArray<ObjectType>>>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method(writeToFile:atomically:)]
pub unsafe fn writeToFile_atomically(
&self,
path: &NSString,
use_auxiliary_file: bool,
) -> bool;
#[cfg(feature = "NSURL")]
#[deprecated]
#[method(writeToURL:atomically:)]
pub unsafe fn writeToURL_atomically(&self, url: &NSURL, atomically: bool) -> bool;
}
);
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + NSCoding> NSCoding for NSMutableArray<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + IsIdCloneable> NSCopying for NSMutableArray<ObjectType> {}
#[cfg(feature = "NSEnumerator")]
unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSMutableArray<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + IsIdCloneable> NSMutableCopying for NSMutableArray<ObjectType> {}
unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSMutableArray<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + NSSecureCoding> NSSecureCoding for NSMutableArray<ObjectType> {}
extern_methods!(
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[method(addObject:)]
pub unsafe fn addObject(&mut self, an_object: &ObjectType);
#[method(insertObject:atIndex:)]
pub unsafe fn insertObject_atIndex(&mut self, an_object: &ObjectType, index: NSUInteger);
#[method(removeLastObject)]
pub unsafe fn removeLastObject(&mut self);
#[method(removeObjectAtIndex:)]
pub unsafe fn removeObjectAtIndex(&mut self, index: NSUInteger);
#[method(replaceObjectAtIndex:withObject:)]
pub unsafe fn replaceObjectAtIndex_withObject(
&mut self,
index: NSUInteger,
an_object: &ObjectType,
);
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCapacity:)]
pub unsafe fn initWithCapacity(
this: Allocated<Self>,
num_items: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSArray`
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[method_id(@__retain_semantics Init initWithObjects:count:)]
pub unsafe fn initWithObjects_count(
this: Allocated<Self>,
objects: *mut NonNull<ObjectType>,
cnt: NSUInteger,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl<ObjectType: Message> DefaultRetained for NSMutableArray<ObjectType> {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_methods!(
/// NSExtendedMutableArray
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[method(addObjectsFromArray:)]
pub unsafe fn addObjectsFromArray(&mut self, other_array: &NSArray<ObjectType>);
#[method(exchangeObjectAtIndex:withObjectAtIndex:)]
pub unsafe fn exchangeObjectAtIndex_withObjectAtIndex(
&mut self,
idx1: NSUInteger,
idx2: NSUInteger,
);
#[method(removeAllObjects)]
pub fn removeAllObjects(&mut self);
#[cfg(feature = "NSRange")]
#[method(removeObject:inRange:)]
pub unsafe fn removeObject_inRange(&mut self, an_object: &ObjectType, range: NSRange);
#[method(removeObject:)]
pub unsafe fn removeObject(&mut self, an_object: &ObjectType);
#[cfg(feature = "NSRange")]
#[method(removeObjectIdenticalTo:inRange:)]
pub unsafe fn removeObjectIdenticalTo_inRange(
&mut self,
an_object: &ObjectType,
range: NSRange,
);
#[method(removeObjectIdenticalTo:)]
pub unsafe fn removeObjectIdenticalTo(&mut self, an_object: &ObjectType);
#[deprecated = "Not supported"]
#[method(removeObjectsFromIndices:numIndices:)]
pub unsafe fn removeObjectsFromIndices_numIndices(
&mut self,
indices: NonNull<NSUInteger>,
cnt: NSUInteger,
);
#[method(removeObjectsInArray:)]
pub unsafe fn removeObjectsInArray(&mut self, other_array: &NSArray<ObjectType>);
#[cfg(feature = "NSRange")]
#[method(removeObjectsInRange:)]
pub unsafe fn removeObjectsInRange(&mut self, range: NSRange);
#[cfg(feature = "NSRange")]
#[method(replaceObjectsInRange:withObjectsFromArray:range:)]
pub unsafe fn replaceObjectsInRange_withObjectsFromArray_range(
&mut self,
range: NSRange,
other_array: &NSArray<ObjectType>,
other_range: NSRange,
);
#[cfg(feature = "NSRange")]
#[method(replaceObjectsInRange:withObjectsFromArray:)]
pub unsafe fn replaceObjectsInRange_withObjectsFromArray(
&mut self,
range: NSRange,
other_array: &NSArray<ObjectType>,
);
#[method(setArray:)]
pub unsafe fn setArray(&mut self, other_array: &NSArray<ObjectType>);
#[method(sortUsingFunction:context:)]
pub unsafe fn sortUsingFunction_context(
&mut self,
compare: unsafe extern "C" fn(
NonNull<ObjectType>,
NonNull<ObjectType>,
*mut c_void,
) -> NSInteger,
context: *mut c_void,
);
#[method(sortUsingSelector:)]
pub unsafe fn sortUsingSelector(&mut self, comparator: Sel);
#[cfg(feature = "NSIndexSet")]
#[method(insertObjects:atIndexes:)]
pub unsafe fn insertObjects_atIndexes(
&mut self,
objects: &NSArray<ObjectType>,
indexes: &NSIndexSet,
);
#[cfg(feature = "NSIndexSet")]
#[method(removeObjectsAtIndexes:)]
pub unsafe fn removeObjectsAtIndexes(&mut self, indexes: &NSIndexSet);
#[cfg(feature = "NSIndexSet")]
#[method(replaceObjectsAtIndexes:withObjects:)]
pub unsafe fn replaceObjectsAtIndexes_withObjects(
&mut self,
indexes: &NSIndexSet,
objects: &NSArray<ObjectType>,
);
#[method(setObject:atIndexedSubscript:)]
pub unsafe fn setObject_atIndexedSubscript(&mut self, obj: &ObjectType, idx: NSUInteger);
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(sortUsingComparator:)]
pub unsafe fn sortUsingComparator(&mut self, cmptr: NSComparator);
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(sortWithOptions:usingComparator:)]
pub unsafe fn sortWithOptions_usingComparator(
&mut self,
opts: NSSortOptions,
cmptr: NSComparator,
);
}
);
extern_methods!(
/// NSMutableArrayCreation
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[method_id(@__retain_semantics Other arrayWithCapacity:)]
pub unsafe fn arrayWithCapacity(num_items: NSUInteger) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other arrayWithContentsOfFile:)]
pub unsafe fn arrayWithContentsOfFile(
path: &NSString,
) -> Option<Retained<NSMutableArray<ObjectType>>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other arrayWithContentsOfURL:)]
pub unsafe fn arrayWithContentsOfURL(
url: &NSURL,
) -> Option<Retained<NSMutableArray<ObjectType>>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithContentsOfFile:)]
pub unsafe fn initWithContentsOfFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<NSMutableArray<ObjectType>>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<NSMutableArray<ObjectType>>>;
}
);
extern_methods!(
/// NSMutableArrayDiffing
unsafe impl<ObjectType: Message> NSMutableArray<ObjectType> {
#[cfg(feature = "NSOrderedCollectionDifference")]
#[method(applyDifference:)]
pub unsafe fn applyDifference(
&mut self,
difference: &NSOrderedCollectionDifference<ObjectType>,
);
}
);

View File

@@ -0,0 +1,930 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSAttributedStringKey = NSString;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSAttributedStringFormattingContextKey = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInflectionConceptsKey: &'static NSAttributedStringFormattingContextKey;
}
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSAttributedString;
unsafe impl ClassType for NSAttributedString {
type Super = NSObject;
type Mutability = ImmutableWithMutableSubclass<NSMutableAttributedString>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAttributedString {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAttributedString {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSAttributedString {}
unsafe impl NSObjectProtocol for NSAttributedString {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAttributedString {}
extern_methods!(
unsafe impl NSAttributedString {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other string)]
pub fn string(&self) -> Retained<NSString>;
#[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
#[method_id(@__retain_semantics Other attributesAtIndex:effectiveRange:)]
pub unsafe fn attributesAtIndex_effectiveRange(
&self,
location: NSUInteger,
range: NSRangePointer,
) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAttributedString {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for NSAttributedString {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAttributedStringEnumerationOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSAttributedStringEnumerationOptions: NSUInteger {
const NSAttributedStringEnumerationReverse = 1<<1;
const NSAttributedStringEnumerationLongestEffectiveRangeNotRequired = 1<<20;
}
}
unsafe impl Encode for NSAttributedStringEnumerationOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAttributedStringEnumerationOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSExtendedAttributedString
unsafe impl NSAttributedString {
#[method(length)]
pub fn length(&self) -> NSUInteger;
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method_id(@__retain_semantics Other attribute:atIndex:effectiveRange:)]
pub unsafe fn attribute_atIndex_effectiveRange(
&self,
attr_name: &NSAttributedStringKey,
location: NSUInteger,
range: NSRangePointer,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other attributedSubstringFromRange:)]
pub unsafe fn attributedSubstringFromRange(
&self,
range: NSRange,
) -> Retained<NSAttributedString>;
#[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
#[method_id(@__retain_semantics Other attributesAtIndex:longestEffectiveRange:inRange:)]
pub unsafe fn attributesAtIndex_longestEffectiveRange_inRange(
&self,
location: NSUInteger,
range: NSRangePointer,
range_limit: NSRange,
) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method_id(@__retain_semantics Other attribute:atIndex:longestEffectiveRange:inRange:)]
pub unsafe fn attribute_atIndex_longestEffectiveRange_inRange(
&self,
attr_name: &NSAttributedStringKey,
location: NSUInteger,
range: NSRangePointer,
range_limit: NSRange,
) -> Option<Retained<AnyObject>>;
#[method(isEqualToAttributedString:)]
pub unsafe fn isEqualToAttributedString(&self, other: &NSAttributedString) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithString:)]
pub fn initWithString(this: Allocated<Self>, str: &NSString) -> Retained<Self>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithString:attributes:)]
pub unsafe fn initWithString_attributes(
this: Allocated<Self>,
str: &NSString,
attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithAttributedString:)]
pub fn initWithAttributedString(
this: Allocated<Self>,
attr_str: &NSAttributedString,
) -> Retained<Self>;
#[cfg(all(
feature = "NSDictionary",
feature = "NSRange",
feature = "NSString",
feature = "block2"
))]
#[method(enumerateAttributesInRange:options:usingBlock:)]
pub unsafe fn enumerateAttributesInRange_options_usingBlock(
&self,
enumeration_range: NSRange,
opts: NSAttributedStringEnumerationOptions,
block: &block2::Block<
dyn Fn(
NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>,
NSRange,
NonNull<Bool>,
) + '_,
>,
);
#[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
#[method(enumerateAttribute:inRange:options:usingBlock:)]
pub unsafe fn enumerateAttribute_inRange_options_usingBlock(
&self,
attr_name: &NSAttributedStringKey,
enumeration_range: NSRange,
opts: NSAttributedStringEnumerationOptions,
block: &block2::Block<dyn Fn(*mut AnyObject, NSRange, NonNull<Bool>) + '_>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSAttributedString`
///
/// NSExtendedAttributedString
unsafe impl NSMutableAttributedString {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithString:)]
pub fn initWithString(this: Allocated<Self>, str: &NSString) -> Retained<Self>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithString:attributes:)]
pub unsafe fn initWithString_attributes(
this: Allocated<Self>,
str: &NSString,
attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithAttributedString:)]
pub fn initWithAttributedString(
this: Allocated<Self>,
attr_str: &NSAttributedString,
) -> Retained<Self>;
}
);
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSMutableAttributedString;
unsafe impl ClassType for NSMutableAttributedString {
#[inherits(NSObject)]
type Super = NSAttributedString;
type Mutability = MutableWithImmutableSuperclass<NSAttributedString>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMutableAttributedString {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMutableAttributedString {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSMutableAttributedString {}
unsafe impl NSObjectProtocol for NSMutableAttributedString {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMutableAttributedString {}
extern_methods!(
unsafe impl NSMutableAttributedString {
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method(replaceCharactersInRange:withString:)]
pub unsafe fn replaceCharactersInRange_withString(
&mut self,
range: NSRange,
str: &NSString,
);
#[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
#[method(setAttributes:range:)]
pub unsafe fn setAttributes_range(
&mut self,
attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
range: NSRange,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMutableAttributedString {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for NSMutableAttributedString {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_methods!(
/// NSExtendedMutableAttributedString
unsafe impl NSMutableAttributedString {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other mutableString)]
pub unsafe fn mutableString(&self) -> Retained<NSMutableString>;
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method(addAttribute:value:range:)]
pub unsafe fn addAttribute_value_range(
&mut self,
name: &NSAttributedStringKey,
value: &AnyObject,
range: NSRange,
);
#[cfg(all(feature = "NSDictionary", feature = "NSRange", feature = "NSString"))]
#[method(addAttributes:range:)]
pub unsafe fn addAttributes_range(
&mut self,
attrs: &NSDictionary<NSAttributedStringKey, AnyObject>,
range: NSRange,
);
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method(removeAttribute:range:)]
pub unsafe fn removeAttribute_range(
&mut self,
name: &NSAttributedStringKey,
range: NSRange,
);
#[cfg(feature = "NSRange")]
#[method(replaceCharactersInRange:withAttributedString:)]
pub unsafe fn replaceCharactersInRange_withAttributedString(
&mut self,
range: NSRange,
attr_string: &NSAttributedString,
);
#[method(insertAttributedString:atIndex:)]
pub unsafe fn insertAttributedString_atIndex(
&mut self,
attr_string: &NSAttributedString,
loc: NSUInteger,
);
#[method(appendAttributedString:)]
pub unsafe fn appendAttributedString(&mut self, attr_string: &NSAttributedString);
#[cfg(feature = "NSRange")]
#[method(deleteCharactersInRange:)]
pub unsafe fn deleteCharactersInRange(&mut self, range: NSRange);
#[method(setAttributedString:)]
pub fn setAttributedString(&mut self, attr_string: &NSAttributedString);
#[method(beginEditing)]
pub unsafe fn beginEditing(&mut self);
#[method(endEditing)]
pub unsafe fn endEditing(&mut self);
}
);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSInlinePresentationIntent(pub NSUInteger);
bitflags::bitflags! {
impl NSInlinePresentationIntent: NSUInteger {
#[doc(alias = "NSInlinePresentationIntentEmphasized")]
const Emphasized = 1<<0;
#[doc(alias = "NSInlinePresentationIntentStronglyEmphasized")]
const StronglyEmphasized = 1<<1;
#[doc(alias = "NSInlinePresentationIntentCode")]
const Code = 1<<2;
#[doc(alias = "NSInlinePresentationIntentStrikethrough")]
const Strikethrough = 1<<5;
#[doc(alias = "NSInlinePresentationIntentSoftBreak")]
const SoftBreak = 1<<6;
#[doc(alias = "NSInlinePresentationIntentLineBreak")]
const LineBreak = 1<<7;
#[doc(alias = "NSInlinePresentationIntentInlineHTML")]
const InlineHTML = 1<<8;
#[doc(alias = "NSInlinePresentationIntentBlockHTML")]
const BlockHTML = 1<<9;
}
}
unsafe impl Encode for NSInlinePresentationIntent {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSInlinePresentationIntent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInlinePresentationIntentAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAlternateDescriptionAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSImageURLAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLanguageIdentifierAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMarkdownSourcePositionAttributeName: &'static NSAttributedStringKey;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAttributedStringMarkdownParsingFailurePolicy(pub NSInteger);
impl NSAttributedStringMarkdownParsingFailurePolicy {
pub const NSAttributedStringMarkdownParsingFailureReturnError: Self = Self(0);
pub const NSAttributedStringMarkdownParsingFailureReturnPartiallyParsedIfPossible: Self =
Self(1);
}
unsafe impl Encode for NSAttributedStringMarkdownParsingFailurePolicy {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSAttributedStringMarkdownParsingFailurePolicy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAttributedStringMarkdownInterpretedSyntax(pub NSInteger);
impl NSAttributedStringMarkdownInterpretedSyntax {
#[doc(alias = "NSAttributedStringMarkdownInterpretedSyntaxFull")]
pub const Full: Self = Self(0);
#[doc(alias = "NSAttributedStringMarkdownInterpretedSyntaxInlineOnly")]
pub const InlineOnly: Self = Self(1);
#[doc(alias = "NSAttributedStringMarkdownInterpretedSyntaxInlineOnlyPreservingWhitespace")]
pub const InlineOnlyPreservingWhitespace: Self = Self(2);
}
unsafe impl Encode for NSAttributedStringMarkdownInterpretedSyntax {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSAttributedStringMarkdownInterpretedSyntax {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAttributedStringMarkdownSourcePosition;
unsafe impl ClassType for NSAttributedStringMarkdownSourcePosition {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSAttributedStringMarkdownSourcePosition {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAttributedStringMarkdownSourcePosition {}
unsafe impl NSObjectProtocol for NSAttributedStringMarkdownSourcePosition {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSAttributedStringMarkdownSourcePosition {}
extern_methods!(
unsafe impl NSAttributedStringMarkdownSourcePosition {
#[method(startLine)]
pub unsafe fn startLine(&self) -> NSInteger;
#[method(startColumn)]
pub unsafe fn startColumn(&self) -> NSInteger;
#[method(endLine)]
pub unsafe fn endLine(&self) -> NSInteger;
#[method(endColumn)]
pub unsafe fn endColumn(&self) -> NSInteger;
#[method_id(@__retain_semantics Init initWithStartLine:startColumn:endLine:endColumn:)]
pub unsafe fn initWithStartLine_startColumn_endLine_endColumn(
this: Allocated<Self>,
start_line: NSInteger,
start_column: NSInteger,
end_line: NSInteger,
end_column: NSInteger,
) -> Retained<Self>;
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method(rangeInString:)]
pub unsafe fn rangeInString(&self, string: &NSString) -> NSRange;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAttributedStringMarkdownSourcePosition {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAttributedStringMarkdownParsingOptions;
unsafe impl ClassType for NSAttributedStringMarkdownParsingOptions {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSAttributedStringMarkdownParsingOptions {}
unsafe impl NSObjectProtocol for NSAttributedStringMarkdownParsingOptions {}
extern_methods!(
unsafe impl NSAttributedStringMarkdownParsingOptions {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method(allowsExtendedAttributes)]
pub unsafe fn allowsExtendedAttributes(&self) -> bool;
#[method(setAllowsExtendedAttributes:)]
pub unsafe fn setAllowsExtendedAttributes(&self, allows_extended_attributes: bool);
#[method(interpretedSyntax)]
pub unsafe fn interpretedSyntax(&self) -> NSAttributedStringMarkdownInterpretedSyntax;
#[method(setInterpretedSyntax:)]
pub unsafe fn setInterpretedSyntax(
&self,
interpreted_syntax: NSAttributedStringMarkdownInterpretedSyntax,
);
#[method(failurePolicy)]
pub unsafe fn failurePolicy(&self) -> NSAttributedStringMarkdownParsingFailurePolicy;
#[method(setFailurePolicy:)]
pub unsafe fn setFailurePolicy(
&self,
failure_policy: NSAttributedStringMarkdownParsingFailurePolicy,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other languageCode)]
pub unsafe fn languageCode(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setLanguageCode:)]
pub unsafe fn setLanguageCode(&self, language_code: Option<&NSString>);
#[method(appliesSourcePositionAttributes)]
pub unsafe fn appliesSourcePositionAttributes(&self) -> bool;
#[method(setAppliesSourcePositionAttributes:)]
pub unsafe fn setAppliesSourcePositionAttributes(
&self,
applies_source_position_attributes: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAttributedStringMarkdownParsingOptions {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSAttributedStringCreateFromMarkdown
unsafe impl NSAttributedString {
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithContentsOfMarkdownFileAtURL:options:baseURL:error:_)]
pub unsafe fn initWithContentsOfMarkdownFileAtURL_options_baseURL_error(
this: Allocated<Self>,
markdown_file: &NSURL,
options: Option<&NSAttributedStringMarkdownParsingOptions>,
base_url: Option<&NSURL>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithMarkdown:options:baseURL:error:_)]
pub unsafe fn initWithMarkdown_options_baseURL_error(
this: Allocated<Self>,
markdown: &NSData,
options: Option<&NSAttributedStringMarkdownParsingOptions>,
base_url: Option<&NSURL>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithMarkdownString:options:baseURL:error:_)]
pub unsafe fn initWithMarkdownString_options_baseURL_error(
this: Allocated<Self>,
markdown_string: &NSString,
options: Option<&NSAttributedStringMarkdownParsingOptions>,
base_url: Option<&NSURL>,
) -> Result<Retained<Self>, Retained<NSError>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSAttributedString`
///
/// NSAttributedStringCreateFromMarkdown
unsafe impl NSMutableAttributedString {
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithContentsOfMarkdownFileAtURL:options:baseURL:error:_)]
pub unsafe fn initWithContentsOfMarkdownFileAtURL_options_baseURL_error(
this: Allocated<Self>,
markdown_file: &NSURL,
options: Option<&NSAttributedStringMarkdownParsingOptions>,
base_url: Option<&NSURL>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithMarkdown:options:baseURL:error:_)]
pub unsafe fn initWithMarkdown_options_baseURL_error(
this: Allocated<Self>,
markdown: &NSData,
options: Option<&NSAttributedStringMarkdownParsingOptions>,
base_url: Option<&NSURL>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithMarkdownString:options:baseURL:error:_)]
pub unsafe fn initWithMarkdownString_options_baseURL_error(
this: Allocated<Self>,
markdown_string: &NSString,
options: Option<&NSAttributedStringMarkdownParsingOptions>,
base_url: Option<&NSURL>,
) -> Result<Retained<Self>, Retained<NSError>>;
}
);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAttributedStringFormattingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSAttributedStringFormattingOptions: NSUInteger {
const NSAttributedStringFormattingInsertArgumentAttributesWithoutMerging = 1<<0;
const NSAttributedStringFormattingApplyReplacementIndexAttribute = 1<<1;
}
}
unsafe impl Encode for NSAttributedStringFormattingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAttributedStringFormattingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSAttributedStringFormatting
unsafe impl NSAttributedString {}
);
extern_methods!(
/// NSMutableAttributedStringFormatting
unsafe impl NSMutableAttributedString {}
);
extern "C" {
#[cfg(feature = "NSString")]
pub static NSReplacementIndexAttributeName: &'static NSAttributedStringKey;
}
extern_methods!(
/// NSMorphology
unsafe impl NSAttributedString {
#[method_id(@__retain_semantics Other attributedStringByInflectingString)]
pub unsafe fn attributedStringByInflectingString(&self) -> Retained<NSAttributedString>;
}
);
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMorphologyAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInflectionRuleAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInflectionAgreementArgumentAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInflectionAgreementConceptAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInflectionReferentConceptAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSInflectionAlternativeAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSPresentationIntentAttributeName: &'static NSAttributedStringKey;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPresentationIntentKind(pub NSInteger);
impl NSPresentationIntentKind {
#[doc(alias = "NSPresentationIntentKindParagraph")]
pub const Paragraph: Self = Self(0);
#[doc(alias = "NSPresentationIntentKindHeader")]
pub const Header: Self = Self(1);
#[doc(alias = "NSPresentationIntentKindOrderedList")]
pub const OrderedList: Self = Self(2);
#[doc(alias = "NSPresentationIntentKindUnorderedList")]
pub const UnorderedList: Self = Self(3);
#[doc(alias = "NSPresentationIntentKindListItem")]
pub const ListItem: Self = Self(4);
#[doc(alias = "NSPresentationIntentKindCodeBlock")]
pub const CodeBlock: Self = Self(5);
#[doc(alias = "NSPresentationIntentKindBlockQuote")]
pub const BlockQuote: Self = Self(6);
#[doc(alias = "NSPresentationIntentKindThematicBreak")]
pub const ThematicBreak: Self = Self(7);
#[doc(alias = "NSPresentationIntentKindTable")]
pub const Table: Self = Self(8);
#[doc(alias = "NSPresentationIntentKindTableHeaderRow")]
pub const TableHeaderRow: Self = Self(9);
#[doc(alias = "NSPresentationIntentKindTableRow")]
pub const TableRow: Self = Self(10);
#[doc(alias = "NSPresentationIntentKindTableCell")]
pub const TableCell: Self = Self(11);
}
unsafe impl Encode for NSPresentationIntentKind {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSPresentationIntentKind {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPresentationIntentTableColumnAlignment(pub NSInteger);
impl NSPresentationIntentTableColumnAlignment {
#[doc(alias = "NSPresentationIntentTableColumnAlignmentLeft")]
pub const Left: Self = Self(0);
#[doc(alias = "NSPresentationIntentTableColumnAlignmentCenter")]
pub const Center: Self = Self(1);
#[doc(alias = "NSPresentationIntentTableColumnAlignmentRight")]
pub const Right: Self = Self(2);
}
unsafe impl Encode for NSPresentationIntentTableColumnAlignment {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSPresentationIntentTableColumnAlignment {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSPresentationIntent;
unsafe impl ClassType for NSPresentationIntent {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSPresentationIntent {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSPresentationIntent {}
unsafe impl NSObjectProtocol for NSPresentationIntent {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSPresentationIntent {}
extern_methods!(
unsafe impl NSPresentationIntent {
#[method(intentKind)]
pub unsafe fn intentKind(&self) -> NSPresentationIntentKind;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Other parentIntent)]
pub unsafe fn parentIntent(&self) -> Option<Retained<NSPresentationIntent>>;
#[method_id(@__retain_semantics Other paragraphIntentWithIdentity:nestedInsideIntent:)]
pub unsafe fn paragraphIntentWithIdentity_nestedInsideIntent(
identity: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other headerIntentWithIdentity:level:nestedInsideIntent:)]
pub unsafe fn headerIntentWithIdentity_level_nestedInsideIntent(
identity: NSInteger,
level: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other codeBlockIntentWithIdentity:languageHint:nestedInsideIntent:)]
pub unsafe fn codeBlockIntentWithIdentity_languageHint_nestedInsideIntent(
identity: NSInteger,
language_hint: Option<&NSString>,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other thematicBreakIntentWithIdentity:nestedInsideIntent:)]
pub unsafe fn thematicBreakIntentWithIdentity_nestedInsideIntent(
identity: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other orderedListIntentWithIdentity:nestedInsideIntent:)]
pub unsafe fn orderedListIntentWithIdentity_nestedInsideIntent(
identity: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other unorderedListIntentWithIdentity:nestedInsideIntent:)]
pub unsafe fn unorderedListIntentWithIdentity_nestedInsideIntent(
identity: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other listItemIntentWithIdentity:ordinal:nestedInsideIntent:)]
pub unsafe fn listItemIntentWithIdentity_ordinal_nestedInsideIntent(
identity: NSInteger,
ordinal: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other blockQuoteIntentWithIdentity:nestedInsideIntent:)]
pub unsafe fn blockQuoteIntentWithIdentity_nestedInsideIntent(
identity: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[cfg(all(feature = "NSArray", feature = "NSValue"))]
#[method_id(@__retain_semantics Other tableIntentWithIdentity:columnCount:alignments:nestedInsideIntent:)]
pub unsafe fn tableIntentWithIdentity_columnCount_alignments_nestedInsideIntent(
identity: NSInteger,
column_count: NSInteger,
alignments: &NSArray<NSNumber>,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other tableHeaderRowIntentWithIdentity:nestedInsideIntent:)]
pub unsafe fn tableHeaderRowIntentWithIdentity_nestedInsideIntent(
identity: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other tableRowIntentWithIdentity:row:nestedInsideIntent:)]
pub unsafe fn tableRowIntentWithIdentity_row_nestedInsideIntent(
identity: NSInteger,
row: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method_id(@__retain_semantics Other tableCellIntentWithIdentity:column:nestedInsideIntent:)]
pub unsafe fn tableCellIntentWithIdentity_column_nestedInsideIntent(
identity: NSInteger,
column: NSInteger,
parent: Option<&NSPresentationIntent>,
) -> Retained<NSPresentationIntent>;
#[method(identity)]
pub unsafe fn identity(&self) -> NSInteger;
#[method(ordinal)]
pub unsafe fn ordinal(&self) -> NSInteger;
#[cfg(all(feature = "NSArray", feature = "NSValue"))]
#[method_id(@__retain_semantics Other columnAlignments)]
pub unsafe fn columnAlignments(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[method(columnCount)]
pub unsafe fn columnCount(&self) -> NSInteger;
#[method(headerLevel)]
pub unsafe fn headerLevel(&self) -> NSInteger;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other languageHint)]
pub unsafe fn languageHint(&self) -> Option<Retained<NSString>>;
#[method(column)]
pub unsafe fn column(&self) -> NSInteger;
#[method(row)]
pub unsafe fn row(&self) -> NSInteger;
#[method(indentationLevel)]
pub unsafe fn indentationLevel(&self) -> NSInteger;
#[method(isEquivalentToPresentationIntent:)]
pub unsafe fn isEquivalentToPresentationIntent(&self, other: &NSPresentationIntent)
-> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSPresentationIntent {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,41 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAutoreleasePool;
unsafe impl ClassType for NSAutoreleasePool {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAutoreleasePool {}
extern_methods!(
unsafe impl NSAutoreleasePool {
#[method(addObject:)]
pub unsafe fn addObject_class(an_object: &AnyObject);
#[method(addObject:)]
pub unsafe fn addObject(&self, an_object: &AnyObject);
#[method(drain)]
pub unsafe fn drain(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAutoreleasePool {
#[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>;
}
);

View File

@@ -0,0 +1,109 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBackgroundActivityResult(pub NSInteger);
impl NSBackgroundActivityResult {
#[doc(alias = "NSBackgroundActivityResultFinished")]
pub const Finished: Self = Self(1);
#[doc(alias = "NSBackgroundActivityResultDeferred")]
pub const Deferred: Self = Self(2);
}
unsafe impl Encode for NSBackgroundActivityResult {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSBackgroundActivityResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "block2")]
pub type NSBackgroundActivityCompletionHandler =
*mut block2::Block<dyn Fn(NSBackgroundActivityResult)>;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSBackgroundActivityScheduler;
unsafe impl ClassType for NSBackgroundActivityScheduler {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSBackgroundActivityScheduler {}
extern_methods!(
unsafe impl NSBackgroundActivityScheduler {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithIdentifier:)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSString,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other identifier)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
#[cfg(feature = "NSObjCRuntime")]
#[method(qualityOfService)]
pub unsafe fn qualityOfService(&self) -> NSQualityOfService;
#[cfg(feature = "NSObjCRuntime")]
#[method(setQualityOfService:)]
pub unsafe fn setQualityOfService(&self, quality_of_service: NSQualityOfService);
#[method(repeats)]
pub unsafe fn repeats(&self) -> bool;
#[method(setRepeats:)]
pub unsafe fn setRepeats(&self, repeats: bool);
#[cfg(feature = "NSDate")]
#[method(interval)]
pub unsafe fn interval(&self) -> NSTimeInterval;
#[cfg(feature = "NSDate")]
#[method(setInterval:)]
pub unsafe fn setInterval(&self, interval: NSTimeInterval);
#[cfg(feature = "NSDate")]
#[method(tolerance)]
pub unsafe fn tolerance(&self) -> NSTimeInterval;
#[cfg(feature = "NSDate")]
#[method(setTolerance:)]
pub unsafe fn setTolerance(&self, tolerance: NSTimeInterval);
#[cfg(feature = "block2")]
#[method(scheduleWithBlock:)]
pub unsafe fn scheduleWithBlock(
&self,
block: &block2::Block<dyn Fn(NSBackgroundActivityCompletionHandler)>,
);
#[method(invalidate)]
pub unsafe fn invalidate(&self);
#[method(shouldDefer)]
pub unsafe fn shouldDefer(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSBackgroundActivityScheduler {
#[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>;
}
);

View File

@@ -0,0 +1,481 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
pub const NSBundleExecutableArchitectureI386: c_uint = 0x00000007;
pub const NSBundleExecutableArchitecturePPC: c_uint = 0x00000012;
pub const NSBundleExecutableArchitectureX86_64: c_uint = 0x01000007;
pub const NSBundleExecutableArchitecturePPC64: c_uint = 0x01000012;
pub const NSBundleExecutableArchitectureARM64: c_uint = 0x0100000c;
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSBundle;
unsafe impl ClassType for NSBundle {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSBundle {}
unsafe impl Sync for NSBundle {}
unsafe impl NSObjectProtocol for NSBundle {}
extern_methods!(
unsafe impl NSBundle {
#[method_id(@__retain_semantics Other mainBundle)]
pub fn mainBundle() -> Retained<NSBundle>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other bundleWithPath:)]
pub unsafe fn bundleWithPath(path: &NSString) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithPath:)]
pub unsafe fn initWithPath(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other bundleWithURL:)]
pub unsafe fn bundleWithURL(url: &NSURL) -> Option<Retained<Self>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithURL:)]
pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other bundleForClass:)]
pub unsafe fn bundleForClass(a_class: &AnyClass) -> Retained<NSBundle>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other bundleWithIdentifier:)]
pub unsafe fn bundleWithIdentifier(identifier: &NSString) -> Option<Retained<NSBundle>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allBundles)]
pub unsafe fn allBundles() -> Retained<NSArray<NSBundle>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allFrameworks)]
pub unsafe fn allFrameworks() -> Retained<NSArray<NSBundle>>;
#[method(load)]
pub unsafe fn load(&self) -> bool;
#[method(isLoaded)]
pub unsafe fn isLoaded(&self) -> bool;
#[method(unload)]
pub unsafe fn unload(&self) -> bool;
#[cfg(feature = "NSError")]
#[method(preflightAndReturnError:_)]
pub unsafe fn preflightAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(loadAndReturnError:_)]
pub unsafe fn loadAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other bundleURL)]
pub unsafe fn bundleURL(&self) -> Retained<NSURL>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other resourceURL)]
pub unsafe fn resourceURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other executableURL)]
pub unsafe fn executableURL(&self) -> Option<Retained<NSURL>>;
#[cfg(all(feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLForAuxiliaryExecutable:)]
pub unsafe fn URLForAuxiliaryExecutable(
&self,
executable_name: &NSString,
) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other privateFrameworksURL)]
pub unsafe fn privateFrameworksURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other sharedFrameworksURL)]
pub unsafe fn sharedFrameworksURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other sharedSupportURL)]
pub unsafe fn sharedSupportURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other builtInPlugInsURL)]
pub unsafe fn builtInPlugInsURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other appStoreReceiptURL)]
pub unsafe fn appStoreReceiptURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other bundlePath)]
pub unsafe fn bundlePath(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other resourcePath)]
pub unsafe fn resourcePath(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other executablePath)]
pub unsafe fn executablePath(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other pathForAuxiliaryExecutable:)]
pub unsafe fn pathForAuxiliaryExecutable(
&self,
executable_name: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other privateFrameworksPath)]
pub unsafe fn privateFrameworksPath(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other sharedFrameworksPath)]
pub unsafe fn sharedFrameworksPath(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other sharedSupportPath)]
pub unsafe fn sharedSupportPath(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other builtInPlugInsPath)]
pub unsafe fn builtInPlugInsPath(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLForResource:withExtension:subdirectory:inBundleWithURL:)]
pub unsafe fn URLForResource_withExtension_subdirectory_inBundleWithURL(
name: Option<&NSString>,
ext: Option<&NSString>,
subpath: Option<&NSString>,
bundle_url: &NSURL,
) -> Option<Retained<NSURL>>;
#[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLsForResourcesWithExtension:subdirectory:inBundleWithURL:)]
pub unsafe fn URLsForResourcesWithExtension_subdirectory_inBundleWithURL(
ext: Option<&NSString>,
subpath: Option<&NSString>,
bundle_url: &NSURL,
) -> Option<Retained<NSArray<NSURL>>>;
#[cfg(all(feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLForResource:withExtension:)]
pub unsafe fn URLForResource_withExtension(
&self,
name: Option<&NSString>,
ext: Option<&NSString>,
) -> Option<Retained<NSURL>>;
#[cfg(all(feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLForResource:withExtension:subdirectory:)]
pub unsafe fn URLForResource_withExtension_subdirectory(
&self,
name: Option<&NSString>,
ext: Option<&NSString>,
subpath: Option<&NSString>,
) -> Option<Retained<NSURL>>;
#[cfg(all(feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLForResource:withExtension:subdirectory:localization:)]
pub unsafe fn URLForResource_withExtension_subdirectory_localization(
&self,
name: Option<&NSString>,
ext: Option<&NSString>,
subpath: Option<&NSString>,
localization_name: Option<&NSString>,
) -> Option<Retained<NSURL>>;
#[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLsForResourcesWithExtension:subdirectory:)]
pub unsafe fn URLsForResourcesWithExtension_subdirectory(
&self,
ext: Option<&NSString>,
subpath: Option<&NSString>,
) -> Option<Retained<NSArray<NSURL>>>;
#[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
#[method_id(@__retain_semantics Other URLsForResourcesWithExtension:subdirectory:localization:)]
pub unsafe fn URLsForResourcesWithExtension_subdirectory_localization(
&self,
ext: Option<&NSString>,
subpath: Option<&NSString>,
localization_name: Option<&NSString>,
) -> Option<Retained<NSArray<NSURL>>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other pathForResource:ofType:inDirectory:)]
pub unsafe fn pathForResource_ofType_inDirectory_class(
name: Option<&NSString>,
ext: Option<&NSString>,
bundle_path: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other pathsForResourcesOfType:inDirectory:)]
pub unsafe fn pathsForResourcesOfType_inDirectory_class(
ext: Option<&NSString>,
bundle_path: &NSString,
) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other pathForResource:ofType:)]
pub unsafe fn pathForResource_ofType(
&self,
name: Option<&NSString>,
ext: Option<&NSString>,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other pathForResource:ofType:inDirectory:)]
pub unsafe fn pathForResource_ofType_inDirectory(
&self,
name: Option<&NSString>,
ext: Option<&NSString>,
subpath: Option<&NSString>,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other pathForResource:ofType:inDirectory:forLocalization:)]
pub unsafe fn pathForResource_ofType_inDirectory_forLocalization(
&self,
name: Option<&NSString>,
ext: Option<&NSString>,
subpath: Option<&NSString>,
localization_name: Option<&NSString>,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other pathsForResourcesOfType:inDirectory:)]
pub unsafe fn pathsForResourcesOfType_inDirectory(
&self,
ext: Option<&NSString>,
subpath: Option<&NSString>,
) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other pathsForResourcesOfType:inDirectory:forLocalization:)]
pub unsafe fn pathsForResourcesOfType_inDirectory_forLocalization(
&self,
ext: Option<&NSString>,
subpath: Option<&NSString>,
localization_name: Option<&NSString>,
) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForKey:value:table:)]
pub unsafe fn localizedStringForKey_value_table(
&self,
key: &NSString,
value: Option<&NSString>,
table_name: Option<&NSString>,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other bundleIdentifier)]
pub unsafe fn bundleIdentifier(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other infoDictionary)]
pub fn infoDictionary(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other localizedInfoDictionary)]
pub unsafe fn localizedInfoDictionary(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other objectForInfoDictionaryKey:)]
pub unsafe fn objectForInfoDictionaryKey(
&self,
key: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method(classNamed:)]
pub unsafe fn classNamed(&self, class_name: &NSString) -> Option<&'static AnyClass>;
#[method(principalClass)]
pub unsafe fn principalClass(&self) -> Option<&'static AnyClass>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other preferredLocalizations)]
pub unsafe fn preferredLocalizations(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other localizations)]
pub unsafe fn localizations(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other developmentLocalization)]
pub unsafe fn developmentLocalization(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other preferredLocalizationsFromArray:)]
pub unsafe fn preferredLocalizationsFromArray(
localizations_array: &NSArray<NSString>,
) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other preferredLocalizationsFromArray:forPreferences:)]
pub unsafe fn preferredLocalizationsFromArray_forPreferences(
localizations_array: &NSArray<NSString>,
preferences_array: Option<&NSArray<NSString>>,
) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSValue"))]
#[method_id(@__retain_semantics Other executableArchitectures)]
pub unsafe fn executableArchitectures(&self) -> Option<Retained<NSArray<NSNumber>>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSBundle {
#[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!(
/// NSBundleExtensionMethods
#[cfg(feature = "NSString")]
unsafe impl NSString {
#[method_id(@__retain_semantics Other variantFittingPresentationWidth:)]
pub unsafe fn variantFittingPresentationWidth(
&self,
width: NSInteger,
) -> Retained<NSString>;
}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSBundleDidLoadNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLoadedClasses: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSBundleResourceRequest;
unsafe impl ClassType for NSBundleResourceRequest {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSBundleResourceRequest {}
#[cfg(feature = "NSProgress")]
unsafe impl NSProgressReporting for NSBundleResourceRequest {}
extern_methods!(
unsafe impl NSBundleResourceRequest {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithTags:)]
pub unsafe fn initWithTags(this: Allocated<Self>, tags: &NSSet<NSString>)
-> Retained<Self>;
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithTags:bundle:)]
pub unsafe fn initWithTags_bundle(
this: Allocated<Self>,
tags: &NSSet<NSString>,
bundle: &NSBundle,
) -> Retained<Self>;
#[method(loadingPriority)]
pub unsafe fn loadingPriority(&self) -> c_double;
#[method(setLoadingPriority:)]
pub unsafe fn setLoadingPriority(&self, loading_priority: c_double);
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other tags)]
pub unsafe fn tags(&self) -> Retained<NSSet<NSString>>;
#[method_id(@__retain_semantics Other bundle)]
pub unsafe fn bundle(&self) -> Retained<NSBundle>;
#[cfg(all(feature = "NSError", feature = "block2"))]
#[method(beginAccessingResourcesWithCompletionHandler:)]
pub unsafe fn beginAccessingResourcesWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "block2")]
#[method(conditionallyBeginAccessingResourcesWithCompletionHandler:)]
pub unsafe fn conditionallyBeginAccessingResourcesWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(Bool)>,
);
#[method(endAccessingResources)]
pub unsafe fn endAccessingResources(&self);
#[cfg(feature = "NSProgress")]
#[method_id(@__retain_semantics Other progress)]
pub unsafe fn progress(&self) -> Retained<NSProgress>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSBundleResourceRequest {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSBundleResourceRequestAdditions
unsafe impl NSBundle {
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method(setPreservationPriority:forTags:)]
pub unsafe fn setPreservationPriority_forTags(
&self,
priority: c_double,
tags: &NSSet<NSString>,
);
#[cfg(feature = "NSString")]
#[method(preservationPriorityForTag:)]
pub unsafe fn preservationPriorityForTag(&self, tag: &NSString) -> c_double;
}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSBundleResourceRequestLowDiskSpaceNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSBundleResourceRequestLoadingPriorityUrgent: c_double;
}

View File

@@ -0,0 +1,181 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSByteCountFormatterUnits(pub NSUInteger);
bitflags::bitflags! {
impl NSByteCountFormatterUnits: NSUInteger {
const NSByteCountFormatterUseDefault = 0;
const NSByteCountFormatterUseBytes = 1<<0;
const NSByteCountFormatterUseKB = 1<<1;
const NSByteCountFormatterUseMB = 1<<2;
const NSByteCountFormatterUseGB = 1<<3;
const NSByteCountFormatterUseTB = 1<<4;
const NSByteCountFormatterUsePB = 1<<5;
const NSByteCountFormatterUseEB = 1<<6;
const NSByteCountFormatterUseZB = 1<<7;
const NSByteCountFormatterUseYBOrHigher = 0x0FF<<8;
const NSByteCountFormatterUseAll = 0x0FFFF;
}
}
unsafe impl Encode for NSByteCountFormatterUnits {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSByteCountFormatterUnits {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSByteCountFormatterCountStyle(pub NSInteger);
impl NSByteCountFormatterCountStyle {
#[doc(alias = "NSByteCountFormatterCountStyleFile")]
pub const File: Self = Self(0);
#[doc(alias = "NSByteCountFormatterCountStyleMemory")]
pub const Memory: Self = Self(1);
#[doc(alias = "NSByteCountFormatterCountStyleDecimal")]
pub const Decimal: Self = Self(2);
#[doc(alias = "NSByteCountFormatterCountStyleBinary")]
pub const Binary: Self = Self(3);
}
unsafe impl Encode for NSByteCountFormatterCountStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSByteCountFormatterCountStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSByteCountFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSByteCountFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSByteCountFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSByteCountFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSByteCountFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSByteCountFormatter {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromByteCount:countStyle:)]
pub unsafe fn stringFromByteCount_countStyle(
byte_count: c_longlong,
count_style: NSByteCountFormatterCountStyle,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromByteCount:)]
pub unsafe fn stringFromByteCount(&self, byte_count: c_longlong) -> Retained<NSString>;
#[cfg(all(feature = "NSMeasurement", feature = "NSString", feature = "NSUnit"))]
#[method_id(@__retain_semantics Other stringFromMeasurement:countStyle:)]
pub unsafe fn stringFromMeasurement_countStyle(
measurement: &NSMeasurement<NSUnitInformationStorage>,
count_style: NSByteCountFormatterCountStyle,
) -> Retained<NSString>;
#[cfg(all(feature = "NSMeasurement", feature = "NSString", feature = "NSUnit"))]
#[method_id(@__retain_semantics Other stringFromMeasurement:)]
pub unsafe fn stringFromMeasurement(
&self,
measurement: &NSMeasurement<NSUnitInformationStorage>,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringForObjectValue:)]
pub unsafe fn stringForObjectValue(
&self,
obj: Option<&AnyObject>,
) -> Option<Retained<NSString>>;
#[method(allowedUnits)]
pub unsafe fn allowedUnits(&self) -> NSByteCountFormatterUnits;
#[method(setAllowedUnits:)]
pub unsafe fn setAllowedUnits(&self, allowed_units: NSByteCountFormatterUnits);
#[method(countStyle)]
pub unsafe fn countStyle(&self) -> NSByteCountFormatterCountStyle;
#[method(setCountStyle:)]
pub unsafe fn setCountStyle(&self, count_style: NSByteCountFormatterCountStyle);
#[method(allowsNonnumericFormatting)]
pub unsafe fn allowsNonnumericFormatting(&self) -> bool;
#[method(setAllowsNonnumericFormatting:)]
pub unsafe fn setAllowsNonnumericFormatting(&self, allows_nonnumeric_formatting: bool);
#[method(includesUnit)]
pub unsafe fn includesUnit(&self) -> bool;
#[method(setIncludesUnit:)]
pub unsafe fn setIncludesUnit(&self, includes_unit: bool);
#[method(includesCount)]
pub unsafe fn includesCount(&self) -> bool;
#[method(setIncludesCount:)]
pub unsafe fn setIncludesCount(&self, includes_count: bool);
#[method(includesActualByteCount)]
pub unsafe fn includesActualByteCount(&self) -> bool;
#[method(setIncludesActualByteCount:)]
pub unsafe fn setIncludesActualByteCount(&self, includes_actual_byte_count: bool);
#[method(isAdaptive)]
pub unsafe fn isAdaptive(&self) -> bool;
#[method(setAdaptive:)]
pub unsafe fn setAdaptive(&self, adaptive: bool);
#[method(zeroPadsFractionDigits)]
pub unsafe fn zeroPadsFractionDigits(&self) -> bool;
#[method(setZeroPadsFractionDigits:)]
pub unsafe fn setZeroPadsFractionDigits(&self, zero_pads_fraction_digits: bool);
#[method(formattingContext)]
pub unsafe fn formattingContext(&self) -> NSFormattingContext;
#[method(setFormattingContext:)]
pub unsafe fn setFormattingContext(&self, formatting_context: NSFormattingContext);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSByteCountFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,111 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// TODO: pub fn NSHostByteOrder() -> c_long;
// TODO: pub fn NSSwapShort(inv: c_ushort,) -> c_ushort;
// TODO: pub fn NSSwapInt(inv: c_uint,) -> c_uint;
// TODO: pub fn NSSwapLong(inv: c_ulong,) -> c_ulong;
// TODO: pub fn NSSwapLongLong(inv: c_ulonglong,) -> c_ulonglong;
// TODO: pub fn NSSwapBigShortToHost(x: c_ushort,) -> c_ushort;
// TODO: pub fn NSSwapBigIntToHost(x: c_uint,) -> c_uint;
// TODO: pub fn NSSwapBigLongToHost(x: c_ulong,) -> c_ulong;
// TODO: pub fn NSSwapBigLongLongToHost(x: c_ulonglong,) -> c_ulonglong;
// TODO: pub fn NSSwapHostShortToBig(x: c_ushort,) -> c_ushort;
// TODO: pub fn NSSwapHostIntToBig(x: c_uint,) -> c_uint;
// TODO: pub fn NSSwapHostLongToBig(x: c_ulong,) -> c_ulong;
// TODO: pub fn NSSwapHostLongLongToBig(x: c_ulonglong,) -> c_ulonglong;
// TODO: pub fn NSSwapLittleShortToHost(x: c_ushort,) -> c_ushort;
// TODO: pub fn NSSwapLittleIntToHost(x: c_uint,) -> c_uint;
// TODO: pub fn NSSwapLittleLongToHost(x: c_ulong,) -> c_ulong;
// TODO: pub fn NSSwapLittleLongLongToHost(x: c_ulonglong,) -> c_ulonglong;
// TODO: pub fn NSSwapHostShortToLittle(x: c_ushort,) -> c_ushort;
// TODO: pub fn NSSwapHostIntToLittle(x: c_uint,) -> c_uint;
// TODO: pub fn NSSwapHostLongToLittle(x: c_ulong,) -> c_ulong;
// TODO: pub fn NSSwapHostLongLongToLittle(x: c_ulonglong,) -> c_ulonglong;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSSwappedFloat {
pub v: c_uint,
}
unsafe impl Encode for NSSwappedFloat {
const ENCODING: Encoding = Encoding::Struct("?", &[<c_uint>::ENCODING]);
}
unsafe impl RefEncode for NSSwappedFloat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
unsafe impl Send for NSSwappedFloat {}
unsafe impl Sync for NSSwappedFloat {}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSSwappedDouble {
pub v: c_ulonglong,
}
unsafe impl Encode for NSSwappedDouble {
const ENCODING: Encoding = Encoding::Struct("?", &[<c_ulonglong>::ENCODING]);
}
unsafe impl RefEncode for NSSwappedDouble {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
unsafe impl Send for NSSwappedDouble {}
unsafe impl Sync for NSSwappedDouble {}
// TODO: pub fn NSConvertHostFloatToSwapped(x: c_float,) -> NSSwappedFloat;
// TODO: pub fn NSConvertSwappedFloatToHost(x: NSSwappedFloat,) -> c_float;
// TODO: pub fn NSConvertHostDoubleToSwapped(x: c_double,) -> NSSwappedDouble;
// TODO: pub fn NSConvertSwappedDoubleToHost(x: NSSwappedDouble,) -> c_double;
// TODO: pub fn NSSwapFloat(x: NSSwappedFloat,) -> NSSwappedFloat;
// TODO: pub fn NSSwapDouble(x: NSSwappedDouble,) -> NSSwappedDouble;
// TODO: pub fn NSSwapBigDoubleToHost(x: NSSwappedDouble,) -> c_double;
// TODO: pub fn NSSwapBigFloatToHost(x: NSSwappedFloat,) -> c_float;
// TODO: pub fn NSSwapHostDoubleToBig(x: c_double,) -> NSSwappedDouble;
// TODO: pub fn NSSwapHostFloatToBig(x: c_float,) -> NSSwappedFloat;
// TODO: pub fn NSSwapLittleDoubleToHost(x: NSSwappedDouble,) -> c_double;
// TODO: pub fn NSSwapLittleFloatToHost(x: NSSwappedFloat,) -> c_float;
// TODO: pub fn NSSwapHostDoubleToLittle(x: c_double,) -> NSSwappedDouble;
// TODO: pub fn NSSwapHostFloatToLittle(x: c_float,) -> NSSwappedFloat;

View File

@@ -0,0 +1,107 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCache<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject> {
__superclass: NSObject,
_inner0: PhantomData<*mut KeyType>,
_inner1: PhantomData<*mut ObjectType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> ClassType
for NSCache<KeyType, ObjectType>
{
type Super = NSObject;
type Mutability = InteriorMutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol for NSCache<KeyType, ObjectType> {}
extern_methods!(
unsafe impl<KeyType: Message, ObjectType: Message> NSCache<KeyType, ObjectType> {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setName:)]
pub unsafe fn setName(&self, name: &NSString);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSCacheDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSCacheDelegate>>);
#[method_id(@__retain_semantics Other objectForKey:)]
pub unsafe fn objectForKey(&self, key: &KeyType) -> Option<Retained<ObjectType>>;
#[method(setObject:forKey:)]
pub unsafe fn setObject_forKey(&self, obj: &ObjectType, key: &KeyType);
#[method(setObject:forKey:cost:)]
pub unsafe fn setObject_forKey_cost(&self, obj: &ObjectType, key: &KeyType, g: NSUInteger);
#[method(removeObjectForKey:)]
pub unsafe fn removeObjectForKey(&self, key: &KeyType);
#[method(removeAllObjects)]
pub unsafe fn removeAllObjects(&self);
#[method(totalCostLimit)]
pub unsafe fn totalCostLimit(&self) -> NSUInteger;
#[method(setTotalCostLimit:)]
pub unsafe fn setTotalCostLimit(&self, total_cost_limit: NSUInteger);
#[method(countLimit)]
pub unsafe fn countLimit(&self) -> NSUInteger;
#[method(setCountLimit:)]
pub unsafe fn setCountLimit(&self, count_limit: NSUInteger);
#[method(evictsObjectsWithDiscardedContent)]
pub unsafe fn evictsObjectsWithDiscardedContent(&self) -> bool;
#[method(setEvictsObjectsWithDiscardedContent:)]
pub unsafe fn setEvictsObjectsWithDiscardedContent(
&self,
evicts_objects_with_discarded_content: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<KeyType: Message, ObjectType: Message> NSCache<KeyType, ObjectType> {
#[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_protocol!(
pub unsafe trait NSCacheDelegate: NSObjectProtocol {
#[optional]
#[method(cache:willEvictObject:)]
unsafe fn cache_willEvictObject(&self, cache: &NSCache, obj: &AnyObject);
}
unsafe impl ProtocolType for dyn NSCacheDelegate {}
);

View File

@@ -0,0 +1,827 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSCalendarIdentifier = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierGregorian: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierBuddhist: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierChinese: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierCoptic: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierEthiopicAmeteMihret: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierEthiopicAmeteAlem: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierHebrew: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierISO8601: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierIndian: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierIslamic: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierIslamicCivil: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierJapanese: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierPersian: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierRepublicOfChina: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierIslamicTabular: &'static NSCalendarIdentifier;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCalendarIdentifierIslamicUmmAlQura: &'static NSCalendarIdentifier;
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCalendarUnit(pub NSUInteger);
bitflags::bitflags! {
impl NSCalendarUnit: NSUInteger {
#[doc(alias = "NSCalendarUnitEra")]
const Era = 2;
#[doc(alias = "NSCalendarUnitYear")]
const Year = 4;
#[doc(alias = "NSCalendarUnitMonth")]
const Month = 8;
#[doc(alias = "NSCalendarUnitDay")]
const Day = 16;
#[doc(alias = "NSCalendarUnitHour")]
const Hour = 32;
#[doc(alias = "NSCalendarUnitMinute")]
const Minute = 64;
#[doc(alias = "NSCalendarUnitSecond")]
const Second = 128;
#[doc(alias = "NSCalendarUnitWeekday")]
const Weekday = 512;
#[doc(alias = "NSCalendarUnitWeekdayOrdinal")]
const WeekdayOrdinal = 1024;
#[doc(alias = "NSCalendarUnitQuarter")]
const Quarter = 2048;
#[doc(alias = "NSCalendarUnitWeekOfMonth")]
const WeekOfMonth = 4096;
#[doc(alias = "NSCalendarUnitWeekOfYear")]
const WeekOfYear = 8192;
#[doc(alias = "NSCalendarUnitYearForWeekOfYear")]
const YearForWeekOfYear = 16384;
#[doc(alias = "NSCalendarUnitNanosecond")]
const Nanosecond = 32768;
#[doc(alias = "NSCalendarUnitCalendar")]
const Calendar = 1048576;
#[doc(alias = "NSCalendarUnitTimeZone")]
const TimeZone = 2097152;
#[deprecated]
const NSEraCalendarUnit = 2;
#[deprecated]
const NSYearCalendarUnit = 4;
#[deprecated]
const NSMonthCalendarUnit = 8;
#[deprecated]
const NSDayCalendarUnit = 16;
#[deprecated]
const NSHourCalendarUnit = 32;
#[deprecated]
const NSMinuteCalendarUnit = 64;
#[deprecated]
const NSSecondCalendarUnit = 128;
#[deprecated = "NSCalendarUnitWeekOfMonth or NSCalendarUnitWeekOfYear, depending on which you mean"]
const NSWeekCalendarUnit = 256;
#[deprecated]
const NSWeekdayCalendarUnit = 512;
#[deprecated]
const NSWeekdayOrdinalCalendarUnit = 1024;
#[deprecated]
const NSQuarterCalendarUnit = 2048;
#[deprecated]
const NSWeekOfMonthCalendarUnit = 4096;
#[deprecated]
const NSWeekOfYearCalendarUnit = 8192;
#[deprecated]
const NSYearForWeekOfYearCalendarUnit = 16384;
#[deprecated]
const NSCalendarCalendarUnit = 1048576;
#[deprecated]
const NSTimeZoneCalendarUnit = 2097152;
}
}
unsafe impl Encode for NSCalendarUnit {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCalendarUnit {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCalendarOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSCalendarOptions: NSUInteger {
const NSCalendarWrapComponents = 1<<0;
const NSCalendarMatchStrictly = 1<<1;
const NSCalendarSearchBackwards = 1<<2;
const NSCalendarMatchPreviousTimePreservingSmallerUnits = 1<<8;
const NSCalendarMatchNextTimePreservingSmallerUnits = 1<<9;
const NSCalendarMatchNextTime = 1<<10;
const NSCalendarMatchFirst = 1<<12;
const NSCalendarMatchLast = 1<<13;
}
}
unsafe impl Encode for NSCalendarOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCalendarOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCalendar;
unsafe impl ClassType for NSCalendar {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSCalendar {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSCalendar {}
unsafe impl NSObjectProtocol for NSCalendar {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSCalendar {}
extern_methods!(
unsafe impl NSCalendar {
#[method_id(@__retain_semantics Other currentCalendar)]
pub unsafe fn currentCalendar() -> Retained<NSCalendar>;
#[method_id(@__retain_semantics Other autoupdatingCurrentCalendar)]
pub unsafe fn autoupdatingCurrentCalendar() -> Retained<NSCalendar>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other calendarWithIdentifier:)]
pub unsafe fn calendarWithIdentifier(
calendar_identifier_constant: &NSCalendarIdentifier,
) -> Option<Retained<NSCalendar>>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithCalendarIdentifier:)]
pub unsafe fn initWithCalendarIdentifier(
this: Allocated<Self>,
ident: &NSCalendarIdentifier,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other calendarIdentifier)]
pub unsafe fn calendarIdentifier(&self) -> Retained<NSCalendarIdentifier>;
#[cfg(feature = "NSLocale")]
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
#[cfg(feature = "NSLocale")]
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[cfg(feature = "NSTimeZone")]
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
#[cfg(feature = "NSTimeZone")]
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: &NSTimeZone);
#[method(firstWeekday)]
pub unsafe fn firstWeekday(&self) -> NSUInteger;
#[method(setFirstWeekday:)]
pub unsafe fn setFirstWeekday(&self, first_weekday: NSUInteger);
#[method(minimumDaysInFirstWeek)]
pub unsafe fn minimumDaysInFirstWeek(&self) -> NSUInteger;
#[method(setMinimumDaysInFirstWeek:)]
pub unsafe fn setMinimumDaysInFirstWeek(&self, minimum_days_in_first_week: NSUInteger);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other eraSymbols)]
pub unsafe fn eraSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other longEraSymbols)]
pub unsafe fn longEraSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other monthSymbols)]
pub unsafe fn monthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortMonthSymbols)]
pub unsafe fn shortMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortMonthSymbols)]
pub unsafe fn veryShortMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other standaloneMonthSymbols)]
pub unsafe fn standaloneMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortStandaloneMonthSymbols)]
pub unsafe fn shortStandaloneMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortStandaloneMonthSymbols)]
pub unsafe fn veryShortStandaloneMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other weekdaySymbols)]
pub unsafe fn weekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortWeekdaySymbols)]
pub unsafe fn shortWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortWeekdaySymbols)]
pub unsafe fn veryShortWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other standaloneWeekdaySymbols)]
pub unsafe fn standaloneWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortStandaloneWeekdaySymbols)]
pub unsafe fn shortStandaloneWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortStandaloneWeekdaySymbols)]
pub unsafe fn veryShortStandaloneWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other quarterSymbols)]
pub unsafe fn quarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortQuarterSymbols)]
pub unsafe fn shortQuarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other standaloneQuarterSymbols)]
pub unsafe fn standaloneQuarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortStandaloneQuarterSymbols)]
pub unsafe fn shortStandaloneQuarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other AMSymbol)]
pub unsafe fn AMSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other PMSymbol)]
pub unsafe fn PMSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSRange")]
#[method(minimumRangeOfUnit:)]
pub unsafe fn minimumRangeOfUnit(&self, unit: NSCalendarUnit) -> NSRange;
#[cfg(feature = "NSRange")]
#[method(maximumRangeOfUnit:)]
pub unsafe fn maximumRangeOfUnit(&self, unit: NSCalendarUnit) -> NSRange;
#[cfg(all(feature = "NSDate", feature = "NSRange"))]
#[method(rangeOfUnit:inUnit:forDate:)]
pub unsafe fn rangeOfUnit_inUnit_forDate(
&self,
smaller: NSCalendarUnit,
larger: NSCalendarUnit,
date: &NSDate,
) -> NSRange;
#[cfg(feature = "NSDate")]
#[method(ordinalityOfUnit:inUnit:forDate:)]
pub unsafe fn ordinalityOfUnit_inUnit_forDate(
&self,
smaller: NSCalendarUnit,
larger: NSCalendarUnit,
date: &NSDate,
) -> NSUInteger;
#[cfg(feature = "NSDate")]
#[method(rangeOfUnit:startDate:interval:forDate:)]
pub unsafe fn rangeOfUnit_startDate_interval_forDate(
&self,
unit: NSCalendarUnit,
datep: Option<&mut Option<Retained<NSDate>>>,
tip: *mut NSTimeInterval,
date: &NSDate,
) -> bool;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateFromComponents:)]
pub unsafe fn dateFromComponents(
&self,
comps: &NSDateComponents,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other components:fromDate:)]
pub unsafe fn components_fromDate(
&self,
unit_flags: NSCalendarUnit,
date: &NSDate,
) -> Retained<NSDateComponents>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateByAddingComponents:toDate:options:)]
pub unsafe fn dateByAddingComponents_toDate_options(
&self,
comps: &NSDateComponents,
date: &NSDate,
opts: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other components:fromDate:toDate:options:)]
pub unsafe fn components_fromDate_toDate_options(
&self,
unit_flags: NSCalendarUnit,
starting_date: &NSDate,
result_date: &NSDate,
opts: NSCalendarOptions,
) -> Retained<NSDateComponents>;
#[cfg(feature = "NSDate")]
#[method(getEra:year:month:day:fromDate:)]
pub unsafe fn getEra_year_month_day_fromDate(
&self,
era_value_pointer: *mut NSInteger,
year_value_pointer: *mut NSInteger,
month_value_pointer: *mut NSInteger,
day_value_pointer: *mut NSInteger,
date: &NSDate,
);
#[cfg(feature = "NSDate")]
#[method(getEra:yearForWeekOfYear:weekOfYear:weekday:fromDate:)]
pub unsafe fn getEra_yearForWeekOfYear_weekOfYear_weekday_fromDate(
&self,
era_value_pointer: *mut NSInteger,
year_value_pointer: *mut NSInteger,
week_value_pointer: *mut NSInteger,
weekday_value_pointer: *mut NSInteger,
date: &NSDate,
);
#[cfg(feature = "NSDate")]
#[method(getHour:minute:second:nanosecond:fromDate:)]
pub unsafe fn getHour_minute_second_nanosecond_fromDate(
&self,
hour_value_pointer: *mut NSInteger,
minute_value_pointer: *mut NSInteger,
second_value_pointer: *mut NSInteger,
nanosecond_value_pointer: *mut NSInteger,
date: &NSDate,
);
#[cfg(feature = "NSDate")]
#[method(component:fromDate:)]
pub unsafe fn component_fromDate(&self, unit: NSCalendarUnit, date: &NSDate) -> NSInteger;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateWithEra:year:month:day:hour:minute:second:nanosecond:)]
pub unsafe fn dateWithEra_year_month_day_hour_minute_second_nanosecond(
&self,
era_value: NSInteger,
year_value: NSInteger,
month_value: NSInteger,
day_value: NSInteger,
hour_value: NSInteger,
minute_value: NSInteger,
second_value: NSInteger,
nanosecond_value: NSInteger,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateWithEra:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:)]
pub unsafe fn dateWithEra_yearForWeekOfYear_weekOfYear_weekday_hour_minute_second_nanosecond(
&self,
era_value: NSInteger,
year_value: NSInteger,
week_value: NSInteger,
weekday_value: NSInteger,
hour_value: NSInteger,
minute_value: NSInteger,
second_value: NSInteger,
nanosecond_value: NSInteger,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other startOfDayForDate:)]
pub unsafe fn startOfDayForDate(&self, date: &NSDate) -> Retained<NSDate>;
#[cfg(all(feature = "NSDate", feature = "NSTimeZone"))]
#[method_id(@__retain_semantics Other componentsInTimeZone:fromDate:)]
pub unsafe fn componentsInTimeZone_fromDate(
&self,
timezone: &NSTimeZone,
date: &NSDate,
) -> Retained<NSDateComponents>;
#[cfg(all(feature = "NSDate", feature = "NSObjCRuntime"))]
#[method(compareDate:toDate:toUnitGranularity:)]
pub unsafe fn compareDate_toDate_toUnitGranularity(
&self,
date1: &NSDate,
date2: &NSDate,
unit: NSCalendarUnit,
) -> NSComparisonResult;
#[cfg(feature = "NSDate")]
#[method(isDate:equalToDate:toUnitGranularity:)]
pub unsafe fn isDate_equalToDate_toUnitGranularity(
&self,
date1: &NSDate,
date2: &NSDate,
unit: NSCalendarUnit,
) -> bool;
#[cfg(feature = "NSDate")]
#[method(isDate:inSameDayAsDate:)]
pub unsafe fn isDate_inSameDayAsDate(&self, date1: &NSDate, date2: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[method(isDateInToday:)]
pub unsafe fn isDateInToday(&self, date: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[method(isDateInYesterday:)]
pub unsafe fn isDateInYesterday(&self, date: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[method(isDateInTomorrow:)]
pub unsafe fn isDateInTomorrow(&self, date: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[method(isDateInWeekend:)]
pub unsafe fn isDateInWeekend(&self, date: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[method(rangeOfWeekendStartDate:interval:containingDate:)]
pub unsafe fn rangeOfWeekendStartDate_interval_containingDate(
&self,
datep: Option<&mut Option<Retained<NSDate>>>,
tip: *mut NSTimeInterval,
date: &NSDate,
) -> bool;
#[cfg(feature = "NSDate")]
#[method(nextWeekendStartDate:interval:options:afterDate:)]
pub unsafe fn nextWeekendStartDate_interval_options_afterDate(
&self,
datep: Option<&mut Option<Retained<NSDate>>>,
tip: *mut NSTimeInterval,
options: NSCalendarOptions,
date: &NSDate,
) -> bool;
#[method_id(@__retain_semantics Other components:fromDateComponents:toDateComponents:options:)]
pub unsafe fn components_fromDateComponents_toDateComponents_options(
&self,
unit_flags: NSCalendarUnit,
starting_date_comp: &NSDateComponents,
result_date_comp: &NSDateComponents,
options: NSCalendarOptions,
) -> Retained<NSDateComponents>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateByAddingUnit:value:toDate:options:)]
pub unsafe fn dateByAddingUnit_value_toDate_options(
&self,
unit: NSCalendarUnit,
value: NSInteger,
date: &NSDate,
options: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(all(feature = "NSDate", feature = "block2"))]
#[method(enumerateDatesStartingAfterDate:matchingComponents:options:usingBlock:)]
pub unsafe fn enumerateDatesStartingAfterDate_matchingComponents_options_usingBlock(
&self,
start: &NSDate,
comps: &NSDateComponents,
opts: NSCalendarOptions,
block: &block2::Block<dyn Fn(*mut NSDate, Bool, NonNull<Bool>) + '_>,
);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other nextDateAfterDate:matchingComponents:options:)]
pub unsafe fn nextDateAfterDate_matchingComponents_options(
&self,
date: &NSDate,
comps: &NSDateComponents,
options: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other nextDateAfterDate:matchingUnit:value:options:)]
pub unsafe fn nextDateAfterDate_matchingUnit_value_options(
&self,
date: &NSDate,
unit: NSCalendarUnit,
value: NSInteger,
options: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other nextDateAfterDate:matchingHour:minute:second:options:)]
pub unsafe fn nextDateAfterDate_matchingHour_minute_second_options(
&self,
date: &NSDate,
hour_value: NSInteger,
minute_value: NSInteger,
second_value: NSInteger,
options: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateBySettingUnit:value:ofDate:options:)]
pub unsafe fn dateBySettingUnit_value_ofDate_options(
&self,
unit: NSCalendarUnit,
v: NSInteger,
date: &NSDate,
opts: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other dateBySettingHour:minute:second:ofDate:options:)]
pub unsafe fn dateBySettingHour_minute_second_ofDate_options(
&self,
h: NSInteger,
m: NSInteger,
s: NSInteger,
date: &NSDate,
opts: NSCalendarOptions,
) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method(date:matchesComponents:)]
pub unsafe fn date_matchesComponents(
&self,
date: &NSDate,
components: &NSDateComponents,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCalendar {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSCalendarDayChangedNotification: &'static NSNotificationName;
}
pub const NSDateComponentUndefined: NSInteger = NSIntegerMax as _;
#[deprecated]
pub const NSUndefinedDateComponent: NSInteger = NSDateComponentUndefined;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDateComponents;
unsafe impl ClassType for NSDateComponents {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSDateComponents {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSDateComponents {}
unsafe impl NSObjectProtocol for NSDateComponents {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSDateComponents {}
extern_methods!(
unsafe impl NSDateComponents {
#[method_id(@__retain_semantics Other calendar)]
pub unsafe fn calendar(&self) -> Option<Retained<NSCalendar>>;
#[method(setCalendar:)]
pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[cfg(feature = "NSTimeZone")]
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
#[cfg(feature = "NSTimeZone")]
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[method(era)]
pub unsafe fn era(&self) -> NSInteger;
#[method(setEra:)]
pub unsafe fn setEra(&self, era: NSInteger);
#[method(year)]
pub unsafe fn year(&self) -> NSInteger;
#[method(setYear:)]
pub unsafe fn setYear(&self, year: NSInteger);
#[method(month)]
pub unsafe fn month(&self) -> NSInteger;
#[method(setMonth:)]
pub unsafe fn setMonth(&self, month: NSInteger);
#[method(day)]
pub unsafe fn day(&self) -> NSInteger;
#[method(setDay:)]
pub unsafe fn setDay(&self, day: NSInteger);
#[method(hour)]
pub unsafe fn hour(&self) -> NSInteger;
#[method(setHour:)]
pub unsafe fn setHour(&self, hour: NSInteger);
#[method(minute)]
pub unsafe fn minute(&self) -> NSInteger;
#[method(setMinute:)]
pub unsafe fn setMinute(&self, minute: NSInteger);
#[method(second)]
pub unsafe fn second(&self) -> NSInteger;
#[method(setSecond:)]
pub unsafe fn setSecond(&self, second: NSInteger);
#[method(nanosecond)]
pub unsafe fn nanosecond(&self) -> NSInteger;
#[method(setNanosecond:)]
pub unsafe fn setNanosecond(&self, nanosecond: NSInteger);
#[method(weekday)]
pub unsafe fn weekday(&self) -> NSInteger;
#[method(setWeekday:)]
pub unsafe fn setWeekday(&self, weekday: NSInteger);
#[method(weekdayOrdinal)]
pub unsafe fn weekdayOrdinal(&self) -> NSInteger;
#[method(setWeekdayOrdinal:)]
pub unsafe fn setWeekdayOrdinal(&self, weekday_ordinal: NSInteger);
#[method(quarter)]
pub unsafe fn quarter(&self) -> NSInteger;
#[method(setQuarter:)]
pub unsafe fn setQuarter(&self, quarter: NSInteger);
#[method(weekOfMonth)]
pub unsafe fn weekOfMonth(&self) -> NSInteger;
#[method(setWeekOfMonth:)]
pub unsafe fn setWeekOfMonth(&self, week_of_month: NSInteger);
#[method(weekOfYear)]
pub unsafe fn weekOfYear(&self) -> NSInteger;
#[method(setWeekOfYear:)]
pub unsafe fn setWeekOfYear(&self, week_of_year: NSInteger);
#[method(yearForWeekOfYear)]
pub unsafe fn yearForWeekOfYear(&self) -> NSInteger;
#[method(setYearForWeekOfYear:)]
pub unsafe fn setYearForWeekOfYear(&self, year_for_week_of_year: NSInteger);
#[method(isLeapMonth)]
pub unsafe fn isLeapMonth(&self) -> bool;
#[method(setLeapMonth:)]
pub unsafe fn setLeapMonth(&self, leap_month: bool);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other date)]
pub unsafe fn date(&self) -> Option<Retained<NSDate>>;
#[deprecated = "Use -weekOfMonth or -weekOfYear, depending on which you mean"]
#[method(week)]
pub unsafe fn week(&self) -> NSInteger;
#[deprecated = "Use -setWeekOfMonth: or -setWeekOfYear:, depending on which you mean"]
#[method(setWeek:)]
pub unsafe fn setWeek(&self, v: NSInteger);
#[method(setValue:forComponent:)]
pub unsafe fn setValue_forComponent(&self, value: NSInteger, unit: NSCalendarUnit);
#[method(valueForComponent:)]
pub unsafe fn valueForComponent(&self, unit: NSCalendarUnit) -> NSInteger;
#[method(isValidDate)]
pub unsafe fn isValidDate(&self) -> bool;
#[method(isValidDateInCalendar:)]
pub unsafe fn isValidDateInCalendar(&self, calendar: &NSCalendar) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDateComponents {
#[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>;
}
);

View File

@@ -0,0 +1,307 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSDate")]
#[deprecated = "Use NSCalendar and NSDateComponents and NSDateFormatter instead"]
pub struct NSCalendarDate;
#[cfg(feature = "NSDate")]
unsafe impl ClassType for NSCalendarDate {
#[inherits(NSObject)]
type Super = NSDate;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSDate", feature = "NSObject"))]
unsafe impl NSCoding for NSCalendarDate {}
#[cfg(all(feature = "NSDate", feature = "NSObject"))]
unsafe impl NSCopying for NSCalendarDate {}
#[cfg(feature = "NSDate")]
unsafe impl NSObjectProtocol for NSCalendarDate {}
#[cfg(all(feature = "NSDate", feature = "NSObject"))]
unsafe impl NSSecureCoding for NSCalendarDate {}
extern_methods!(
#[cfg(feature = "NSDate")]
unsafe impl NSCalendarDate {
#[deprecated = "Use NSCalendar instead"]
#[method_id(@__retain_semantics Other calendarDate)]
pub unsafe fn calendarDate() -> Retained<AnyObject>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Other dateWithString:calendarFormat:locale:)]
pub unsafe fn dateWithString_calendarFormat_locale(
description: &NSString,
format: &NSString,
locale: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Other dateWithString:calendarFormat:)]
pub unsafe fn dateWithString_calendarFormat(
description: &NSString,
format: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSTimeZone")]
#[deprecated = "Use NSCalendar and NSDateComponents instead"]
#[method_id(@__retain_semantics Other dateWithYear:month:day:hour:minute:second:timeZone:)]
pub unsafe fn dateWithYear_month_day_hour_minute_second_timeZone(
year: NSInteger,
month: NSUInteger,
day: NSUInteger,
hour: NSUInteger,
minute: NSUInteger,
second: NSUInteger,
a_time_zone: Option<&NSTimeZone>,
) -> Retained<AnyObject>;
#[deprecated = "Use NSCalendar instead"]
#[method_id(@__retain_semantics Other dateByAddingYears:months:days:hours:minutes:seconds:)]
pub unsafe fn dateByAddingYears_months_days_hours_minutes_seconds(
&self,
year: NSInteger,
month: NSInteger,
day: NSInteger,
hour: NSInteger,
minute: NSInteger,
second: NSInteger,
) -> Retained<NSCalendarDate>;
#[deprecated]
#[method(dayOfCommonEra)]
pub unsafe fn dayOfCommonEra(&self) -> NSInteger;
#[deprecated]
#[method(dayOfMonth)]
pub unsafe fn dayOfMonth(&self) -> NSInteger;
#[deprecated]
#[method(dayOfWeek)]
pub unsafe fn dayOfWeek(&self) -> NSInteger;
#[deprecated]
#[method(dayOfYear)]
pub unsafe fn dayOfYear(&self) -> NSInteger;
#[deprecated]
#[method(hourOfDay)]
pub unsafe fn hourOfDay(&self) -> NSInteger;
#[deprecated]
#[method(minuteOfHour)]
pub unsafe fn minuteOfHour(&self) -> NSInteger;
#[deprecated]
#[method(monthOfYear)]
pub unsafe fn monthOfYear(&self) -> NSInteger;
#[deprecated]
#[method(secondOfMinute)]
pub unsafe fn secondOfMinute(&self) -> NSInteger;
#[deprecated]
#[method(yearOfCommonEra)]
pub unsafe fn yearOfCommonEra(&self) -> NSInteger;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other calendarFormat)]
pub unsafe fn calendarFormat(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other descriptionWithCalendarFormat:locale:)]
pub unsafe fn descriptionWithCalendarFormat_locale(
&self,
format: &NSString,
locale: Option<&AnyObject>,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other descriptionWithCalendarFormat:)]
pub unsafe fn descriptionWithCalendarFormat(&self, format: &NSString)
-> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other descriptionWithLocale:)]
pub unsafe fn descriptionWithLocale(
&self,
locale: Option<&AnyObject>,
) -> Retained<NSString>;
#[cfg(feature = "NSTimeZone")]
#[deprecated]
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Init initWithString:calendarFormat:locale:)]
pub unsafe fn initWithString_calendarFormat_locale(
this: Allocated<Self>,
description: &NSString,
format: &NSString,
locale: Option<&AnyObject>,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Init initWithString:calendarFormat:)]
pub unsafe fn initWithString_calendarFormat(
this: Allocated<Self>,
description: &NSString,
format: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Init initWithString:)]
pub unsafe fn initWithString(
this: Allocated<Self>,
description: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSTimeZone")]
#[deprecated = "Use NSCalendar and NSDateComponents instead"]
#[method_id(@__retain_semantics Init initWithYear:month:day:hour:minute:second:timeZone:)]
pub unsafe fn initWithYear_month_day_hour_minute_second_timeZone(
this: Allocated<Self>,
year: NSInteger,
month: NSUInteger,
day: NSUInteger,
hour: NSUInteger,
minute: NSUInteger,
second: NSUInteger,
a_time_zone: Option<&NSTimeZone>,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method(setCalendarFormat:)]
pub unsafe fn setCalendarFormat(&self, format: Option<&NSString>);
#[cfg(feature = "NSTimeZone")]
#[deprecated]
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, a_time_zone: Option<&NSTimeZone>);
#[deprecated]
#[method(years:months:days:hours:minutes:seconds:sinceDate:)]
pub unsafe fn years_months_days_hours_minutes_seconds_sinceDate(
&self,
yp: *mut NSInteger,
mop: *mut NSInteger,
dp: *mut NSInteger,
hp: *mut NSInteger,
mip: *mut NSInteger,
sp: *mut NSInteger,
date: &NSCalendarDate,
);
#[deprecated]
#[method_id(@__retain_semantics Other distantFuture)]
pub unsafe fn distantFuture() -> Retained<Self>;
#[deprecated]
#[method_id(@__retain_semantics Other distantPast)]
pub unsafe fn distantPast() -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSDate`
#[cfg(feature = "NSDate")]
unsafe impl NSCalendarDate {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithTimeIntervalSinceReferenceDate:)]
pub unsafe fn initWithTimeIntervalSinceReferenceDate(
this: Allocated<Self>,
ti: NSTimeInterval,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSDate")]
unsafe impl NSCalendarDate {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSCalendarDateExtras
#[cfg(feature = "NSDate")]
unsafe impl NSDate {
#[cfg(feature = "NSString")]
#[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
#[method_id(@__retain_semantics Other dateWithNaturalLanguageString:locale:)]
pub unsafe fn dateWithNaturalLanguageString_locale(
string: &NSString,
locale: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
#[method_id(@__retain_semantics Other dateWithNaturalLanguageString:)]
pub unsafe fn dateWithNaturalLanguageString(
string: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Other dateWithString:)]
pub unsafe fn dateWithString(a_string: &NSString) -> Retained<AnyObject>;
#[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
#[deprecated]
#[method_id(@__retain_semantics Other dateWithCalendarFormat:timeZone:)]
pub unsafe fn dateWithCalendarFormat_timeZone(
&self,
format: Option<&NSString>,
a_time_zone: Option<&NSTimeZone>,
) -> Retained<NSCalendarDate>;
#[cfg(all(feature = "NSString", feature = "NSTimeZone"))]
#[deprecated]
#[method_id(@__retain_semantics Other descriptionWithCalendarFormat:timeZone:locale:)]
pub unsafe fn descriptionWithCalendarFormat_timeZone_locale(
&self,
format: Option<&NSString>,
a_time_zone: Option<&NSTimeZone>,
locale: Option<&AnyObject>,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSDateFormatter instead"]
#[method_id(@__retain_semantics Init initWithString:)]
pub unsafe fn initWithString(
this: Allocated<Self>,
description: &NSString,
) -> Option<Retained<Self>>;
}
);

View File

@@ -0,0 +1,278 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
pub const NSOpenStepUnicodeReservedBase: c_uint = 0xF400;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCharacterSet;
unsafe impl ClassType for NSCharacterSet {
type Super = NSObject;
type Mutability = ImmutableWithMutableSubclass<NSMutableCharacterSet>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSCharacterSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSCharacterSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSCharacterSet {}
unsafe impl NSObjectProtocol for NSCharacterSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSCharacterSet {}
extern_methods!(
unsafe impl NSCharacterSet {
#[method_id(@__retain_semantics Other controlCharacterSet)]
pub unsafe fn controlCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other whitespaceCharacterSet)]
pub unsafe fn whitespaceCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other whitespaceAndNewlineCharacterSet)]
pub unsafe fn whitespaceAndNewlineCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other decimalDigitCharacterSet)]
pub unsafe fn decimalDigitCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other letterCharacterSet)]
pub unsafe fn letterCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other lowercaseLetterCharacterSet)]
pub unsafe fn lowercaseLetterCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other uppercaseLetterCharacterSet)]
pub unsafe fn uppercaseLetterCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other nonBaseCharacterSet)]
pub unsafe fn nonBaseCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other alphanumericCharacterSet)]
pub unsafe fn alphanumericCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other decomposableCharacterSet)]
pub unsafe fn decomposableCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other illegalCharacterSet)]
pub unsafe fn illegalCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other punctuationCharacterSet)]
pub unsafe fn punctuationCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other capitalizedLetterCharacterSet)]
pub unsafe fn capitalizedLetterCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other symbolCharacterSet)]
pub unsafe fn symbolCharacterSet() -> Retained<NSCharacterSet>;
#[method_id(@__retain_semantics Other newlineCharacterSet)]
pub unsafe fn newlineCharacterSet() -> Retained<NSCharacterSet>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other characterSetWithRange:)]
pub unsafe fn characterSetWithRange(a_range: NSRange) -> Retained<NSCharacterSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other characterSetWithCharactersInString:)]
pub unsafe fn characterSetWithCharactersInString(
a_string: &NSString,
) -> Retained<NSCharacterSet>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other characterSetWithBitmapRepresentation:)]
pub unsafe fn characterSetWithBitmapRepresentation(
data: &NSData,
) -> Retained<NSCharacterSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other characterSetWithContentsOfFile:)]
pub unsafe fn characterSetWithContentsOfFile(
f_name: &NSString,
) -> Option<Retained<NSCharacterSet>>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method(characterIsMember:)]
pub unsafe fn characterIsMember(&self, a_character: unichar) -> bool;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other bitmapRepresentation)]
pub unsafe fn bitmapRepresentation(&self) -> Retained<NSData>;
#[method_id(@__retain_semantics Other invertedSet)]
pub unsafe fn invertedSet(&self) -> Retained<NSCharacterSet>;
#[method(longCharacterIsMember:)]
pub unsafe fn longCharacterIsMember(&self, the_long_char: UTF32Char) -> bool;
#[method(isSupersetOfSet:)]
pub unsafe fn isSupersetOfSet(&self, the_other_set: &NSCharacterSet) -> bool;
#[method(hasMemberInPlane:)]
pub unsafe fn hasMemberInPlane(&self, the_plane: u8) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCharacterSet {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMutableCharacterSet;
unsafe impl ClassType for NSMutableCharacterSet {
#[inherits(NSObject)]
type Super = NSCharacterSet;
type Mutability = MutableWithImmutableSuperclass<NSCharacterSet>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMutableCharacterSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMutableCharacterSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSMutableCharacterSet {}
unsafe impl NSObjectProtocol for NSMutableCharacterSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMutableCharacterSet {}
extern_methods!(
unsafe impl NSMutableCharacterSet {
#[cfg(feature = "NSRange")]
#[method(addCharactersInRange:)]
pub unsafe fn addCharactersInRange(&mut self, a_range: NSRange);
#[cfg(feature = "NSRange")]
#[method(removeCharactersInRange:)]
pub unsafe fn removeCharactersInRange(&mut self, a_range: NSRange);
#[cfg(feature = "NSString")]
#[method(addCharactersInString:)]
pub unsafe fn addCharactersInString(&mut self, a_string: &NSString);
#[cfg(feature = "NSString")]
#[method(removeCharactersInString:)]
pub unsafe fn removeCharactersInString(&mut self, a_string: &NSString);
#[method(formUnionWithCharacterSet:)]
pub unsafe fn formUnionWithCharacterSet(&mut self, other_set: &NSCharacterSet);
#[method(formIntersectionWithCharacterSet:)]
pub unsafe fn formIntersectionWithCharacterSet(&mut self, other_set: &NSCharacterSet);
#[method(invert)]
pub unsafe fn invert(&mut self);
#[method_id(@__retain_semantics Other controlCharacterSet)]
pub unsafe fn controlCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other whitespaceCharacterSet)]
pub unsafe fn whitespaceCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other whitespaceAndNewlineCharacterSet)]
pub unsafe fn whitespaceAndNewlineCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other decimalDigitCharacterSet)]
pub unsafe fn decimalDigitCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other letterCharacterSet)]
pub unsafe fn letterCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other lowercaseLetterCharacterSet)]
pub unsafe fn lowercaseLetterCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other uppercaseLetterCharacterSet)]
pub unsafe fn uppercaseLetterCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other nonBaseCharacterSet)]
pub unsafe fn nonBaseCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other alphanumericCharacterSet)]
pub unsafe fn alphanumericCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other decomposableCharacterSet)]
pub unsafe fn decomposableCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other illegalCharacterSet)]
pub unsafe fn illegalCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other punctuationCharacterSet)]
pub unsafe fn punctuationCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other capitalizedLetterCharacterSet)]
pub unsafe fn capitalizedLetterCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other symbolCharacterSet)]
pub unsafe fn symbolCharacterSet() -> Retained<NSMutableCharacterSet>;
#[method_id(@__retain_semantics Other newlineCharacterSet)]
pub unsafe fn newlineCharacterSet() -> Retained<NSMutableCharacterSet>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other characterSetWithRange:)]
pub unsafe fn characterSetWithRange(a_range: NSRange) -> Retained<NSMutableCharacterSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other characterSetWithCharactersInString:)]
pub unsafe fn characterSetWithCharactersInString(
a_string: &NSString,
) -> Retained<NSMutableCharacterSet>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other characterSetWithBitmapRepresentation:)]
pub unsafe fn characterSetWithBitmapRepresentation(
data: &NSData,
) -> Retained<NSMutableCharacterSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other characterSetWithContentsOfFile:)]
pub unsafe fn characterSetWithContentsOfFile(
f_name: &NSString,
) -> Option<Retained<NSMutableCharacterSet>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSCharacterSet`
unsafe impl NSMutableCharacterSet {
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMutableCharacterSet {
#[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>;
}
);

View File

@@ -0,0 +1,100 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSClassDescription;
unsafe impl ClassType for NSClassDescription {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSClassDescription {}
extern_methods!(
unsafe impl NSClassDescription {
#[method(registerClassDescription:forClass:)]
pub unsafe fn registerClassDescription_forClass(
description: &NSClassDescription,
a_class: &AnyClass,
);
#[method(invalidateClassDescriptionCache)]
pub unsafe fn invalidateClassDescriptionCache();
#[method_id(@__retain_semantics Other classDescriptionForClass:)]
pub unsafe fn classDescriptionForClass(
a_class: &AnyClass,
) -> Option<Retained<NSClassDescription>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other attributeKeys)]
pub unsafe fn attributeKeys(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other toOneRelationshipKeys)]
pub unsafe fn toOneRelationshipKeys(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other toManyRelationshipKeys)]
pub unsafe fn toManyRelationshipKeys(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other inverseForRelationshipKey:)]
pub unsafe fn inverseForRelationshipKey(
&self,
relationship_key: &NSString,
) -> Option<Retained<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSClassDescription {
#[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_category!(
/// Category "NSClassDescriptionPrimitives" on [`NSObject`].
#[doc(alias = "NSClassDescriptionPrimitives")]
pub unsafe trait NSObjectNSClassDescriptionPrimitives {
#[method_id(@__retain_semantics Other classDescription)]
unsafe fn classDescription(&self) -> Retained<NSClassDescription>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other attributeKeys)]
unsafe fn attributeKeys(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other toOneRelationshipKeys)]
unsafe fn toOneRelationshipKeys(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other toManyRelationshipKeys)]
unsafe fn toManyRelationshipKeys(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other inverseForRelationshipKey:)]
unsafe fn inverseForRelationshipKey(
&self,
relationship_key: &NSString,
) -> Option<Retained<NSString>>;
}
unsafe impl NSObjectNSClassDescriptionPrimitives for NSObject {}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSClassDescriptionNeededForClassNotification: &'static NSNotificationName;
}

View File

@@ -0,0 +1,374 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDecodingFailurePolicy(pub NSInteger);
impl NSDecodingFailurePolicy {
#[doc(alias = "NSDecodingFailurePolicyRaiseException")]
pub const RaiseException: Self = Self(0);
#[doc(alias = "NSDecodingFailurePolicySetErrorAndReturn")]
pub const SetErrorAndReturn: Self = Self(1);
}
unsafe impl Encode for NSDecodingFailurePolicy {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSDecodingFailurePolicy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCoder;
unsafe impl ClassType for NSCoder {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSCoder {}
extern_methods!(
unsafe impl NSCoder {
#[method(encodeValueOfObjCType:at:)]
pub unsafe fn encodeValueOfObjCType_at(
&self,
r#type: NonNull<c_char>,
addr: NonNull<c_void>,
);
#[cfg(feature = "NSData")]
#[method(encodeDataObject:)]
pub unsafe fn encodeDataObject(&self, data: &NSData);
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other decodeDataObject)]
pub unsafe fn decodeDataObject(&self) -> Option<Retained<NSData>>;
#[method(decodeValueOfObjCType:at:size:)]
pub unsafe fn decodeValueOfObjCType_at_size(
&self,
r#type: NonNull<c_char>,
data: NonNull<c_void>,
size: NSUInteger,
);
#[cfg(feature = "NSString")]
#[method(versionForClassName:)]
pub unsafe fn versionForClassName(&self, class_name: &NSString) -> NSInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCoder {
#[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!(
/// NSExtendedCoder
unsafe impl NSCoder {
#[method(encodeObject:)]
pub unsafe fn encodeObject(&self, object: Option<&AnyObject>);
#[method(encodeRootObject:)]
pub unsafe fn encodeRootObject(&self, root_object: &AnyObject);
#[method(encodeBycopyObject:)]
pub unsafe fn encodeBycopyObject(&self, an_object: Option<&AnyObject>);
#[method(encodeByrefObject:)]
pub unsafe fn encodeByrefObject(&self, an_object: Option<&AnyObject>);
#[method(encodeConditionalObject:)]
pub unsafe fn encodeConditionalObject(&self, object: Option<&AnyObject>);
#[method(encodeArrayOfObjCType:count:at:)]
pub unsafe fn encodeArrayOfObjCType_count_at(
&self,
r#type: NonNull<c_char>,
count: NSUInteger,
array: NonNull<c_void>,
);
#[method(encodeBytes:length:)]
pub unsafe fn encodeBytes_length(&self, byteaddr: *mut c_void, length: NSUInteger);
#[method_id(@__retain_semantics Other decodeObject)]
pub unsafe fn decodeObject(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSError")]
#[method_id(@__retain_semantics Other decodeTopLevelObjectAndReturnError:_)]
pub unsafe fn decodeTopLevelObjectAndReturnError(
&self,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[method(decodeArrayOfObjCType:count:at:)]
pub unsafe fn decodeArrayOfObjCType_count_at(
&self,
item_type: NonNull<c_char>,
count: NSUInteger,
array: NonNull<c_void>,
);
#[method(decodeBytesWithReturnedLength:)]
pub unsafe fn decodeBytesWithReturnedLength(
&self,
lengthp: NonNull<NSUInteger>,
) -> *mut c_void;
#[method(encodePropertyList:)]
pub unsafe fn encodePropertyList(&self, a_property_list: &AnyObject);
#[method_id(@__retain_semantics Other decodePropertyList)]
pub unsafe fn decodePropertyList(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSZone")]
#[method(setObjectZone:)]
pub unsafe fn setObjectZone(&self, zone: *mut NSZone);
#[cfg(feature = "NSZone")]
#[method(objectZone)]
pub unsafe fn objectZone(&self) -> *mut NSZone;
#[method(systemVersion)]
pub unsafe fn systemVersion(&self) -> c_uint;
#[method(allowsKeyedCoding)]
pub unsafe fn allowsKeyedCoding(&self) -> bool;
#[cfg(feature = "NSString")]
#[method(encodeObject:forKey:)]
pub unsafe fn encodeObject_forKey(&self, object: Option<&AnyObject>, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeConditionalObject:forKey:)]
pub unsafe fn encodeConditionalObject_forKey(
&self,
object: Option<&AnyObject>,
key: &NSString,
);
#[cfg(feature = "NSString")]
#[method(encodeBool:forKey:)]
pub unsafe fn encodeBool_forKey(&self, value: bool, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeInt:forKey:)]
pub unsafe fn encodeInt_forKey(&self, value: c_int, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeInt32:forKey:)]
pub unsafe fn encodeInt32_forKey(&self, value: i32, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeInt64:forKey:)]
pub unsafe fn encodeInt64_forKey(&self, value: i64, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeFloat:forKey:)]
pub unsafe fn encodeFloat_forKey(&self, value: c_float, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeDouble:forKey:)]
pub unsafe fn encodeDouble_forKey(&self, value: c_double, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeBytes:length:forKey:)]
pub unsafe fn encodeBytes_length_forKey(
&self,
bytes: *mut u8,
length: NSUInteger,
key: &NSString,
);
#[cfg(feature = "NSString")]
#[method(containsValueForKey:)]
pub unsafe fn containsValueForKey(&self, key: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decodeObjectForKey:)]
pub unsafe fn decodeObjectForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeTopLevelObjectForKey:error:_)]
pub unsafe fn decodeTopLevelObjectForKey_error(
&self,
key: &NSString,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(feature = "NSString")]
#[method(decodeBoolForKey:)]
pub unsafe fn decodeBoolForKey(&self, key: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[method(decodeIntForKey:)]
pub unsafe fn decodeIntForKey(&self, key: &NSString) -> c_int;
#[cfg(feature = "NSString")]
#[method(decodeInt32ForKey:)]
pub unsafe fn decodeInt32ForKey(&self, key: &NSString) -> i32;
#[cfg(feature = "NSString")]
#[method(decodeInt64ForKey:)]
pub unsafe fn decodeInt64ForKey(&self, key: &NSString) -> i64;
#[cfg(feature = "NSString")]
#[method(decodeFloatForKey:)]
pub unsafe fn decodeFloatForKey(&self, key: &NSString) -> c_float;
#[cfg(feature = "NSString")]
#[method(decodeDoubleForKey:)]
pub unsafe fn decodeDoubleForKey(&self, key: &NSString) -> c_double;
#[cfg(feature = "NSString")]
#[method(decodeBytesForKey:returnedLength:)]
pub unsafe fn decodeBytesForKey_returnedLength(
&self,
key: &NSString,
lengthp: *mut NSUInteger,
) -> *mut u8;
#[cfg(feature = "NSString")]
#[method(encodeInteger:forKey:)]
pub unsafe fn encodeInteger_forKey(&self, value: NSInteger, key: &NSString);
#[cfg(feature = "NSString")]
#[method(decodeIntegerForKey:)]
pub unsafe fn decodeIntegerForKey(&self, key: &NSString) -> NSInteger;
#[method(requiresSecureCoding)]
pub unsafe fn requiresSecureCoding(&self) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decodeObjectOfClass:forKey:)]
pub unsafe fn decodeObjectOfClass_forKey(
&self,
a_class: &AnyClass,
key: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeTopLevelObjectOfClass:forKey:error:_)]
pub unsafe fn decodeTopLevelObjectOfClass_forKey_error(
&self,
a_class: &AnyClass,
key: &NSString,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeArrayOfObjectsOfClass:forKey:)]
pub unsafe fn decodeArrayOfObjectsOfClass_forKey(
&self,
cls: &AnyClass,
key: &NSString,
) -> Option<Retained<NSArray>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeDictionaryWithKeysOfClass:objectsOfClass:forKey:)]
pub unsafe fn decodeDictionaryWithKeysOfClass_objectsOfClass_forKey(
&self,
key_cls: &AnyClass,
object_cls: &AnyClass,
key: &NSString,
) -> Option<Retained<NSDictionary>>;
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeObjectOfClasses:forKey:)]
pub unsafe fn decodeObjectOfClasses_forKey(
&self,
classes: Option<&NSSet<TodoClass>>,
key: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSError", feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeTopLevelObjectOfClasses:forKey:error:_)]
pub unsafe fn decodeTopLevelObjectOfClasses_forKey_error(
&self,
classes: Option<&NSSet<TodoClass>>,
key: &NSString,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSArray", feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeArrayOfObjectsOfClasses:forKey:)]
pub unsafe fn decodeArrayOfObjectsOfClasses_forKey(
&self,
classes: &NSSet<TodoClass>,
key: &NSString,
) -> Option<Retained<NSArray>>;
#[cfg(all(feature = "NSDictionary", feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other decodeDictionaryWithKeysOfClasses:objectsOfClasses:forKey:)]
pub unsafe fn decodeDictionaryWithKeysOfClasses_objectsOfClasses_forKey(
&self,
key_classes: &NSSet<TodoClass>,
object_classes: &NSSet<TodoClass>,
key: &NSString,
) -> Option<Retained<NSDictionary>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decodePropertyListForKey:)]
pub unsafe fn decodePropertyListForKey(
&self,
key: &NSString,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSSet")]
#[method_id(@__retain_semantics Other allowedClasses)]
pub unsafe fn allowedClasses(&self) -> Option<Retained<NSSet<TodoClass>>>;
#[cfg(feature = "NSError")]
#[method(failWithError:)]
pub unsafe fn failWithError(&self, error: &NSError);
#[method(decodingFailurePolicy)]
pub unsafe fn decodingFailurePolicy(&self) -> NSDecodingFailurePolicy;
#[cfg(feature = "NSError")]
#[method_id(@__retain_semantics Other error)]
pub unsafe fn error(&self) -> Option<Retained<NSError>>;
}
);
extern "C" {
#[deprecated = "Not supported"]
pub fn NXReadNSObjectFromCoder(decoder: &NSCoder) -> *mut NSObject;
}
extern_methods!(
/// NSTypedstreamCompatibility
unsafe impl NSCoder {
#[deprecated = "Not supported"]
#[method(encodeNXObject:)]
pub unsafe fn encodeNXObject(&self, object: &AnyObject);
#[deprecated = "Not supported"]
#[method_id(@__retain_semantics Other decodeNXObject)]
pub unsafe fn decodeNXObject(&self) -> Option<Retained<AnyObject>>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl NSCoder {
#[deprecated]
#[method(decodeValueOfObjCType:at:)]
pub unsafe fn decodeValueOfObjCType_at(
&self,
r#type: NonNull<c_char>,
data: NonNull<c_void>,
);
}
);

View File

@@ -0,0 +1,179 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSComparisonPredicateOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSComparisonPredicateOptions: NSUInteger {
const NSCaseInsensitivePredicateOption = 0x01;
const NSDiacriticInsensitivePredicateOption = 0x02;
const NSNormalizedPredicateOption = 0x04;
}
}
unsafe impl Encode for NSComparisonPredicateOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSComparisonPredicateOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSComparisonPredicateModifier(pub NSUInteger);
impl NSComparisonPredicateModifier {
pub const NSDirectPredicateModifier: Self = Self(0);
pub const NSAllPredicateModifier: Self = Self(1);
pub const NSAnyPredicateModifier: Self = Self(2);
}
unsafe impl Encode for NSComparisonPredicateModifier {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSComparisonPredicateModifier {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPredicateOperatorType(pub NSUInteger);
impl NSPredicateOperatorType {
pub const NSLessThanPredicateOperatorType: Self = Self(0);
pub const NSLessThanOrEqualToPredicateOperatorType: Self = Self(1);
pub const NSGreaterThanPredicateOperatorType: Self = Self(2);
pub const NSGreaterThanOrEqualToPredicateOperatorType: Self = Self(3);
pub const NSEqualToPredicateOperatorType: Self = Self(4);
pub const NSNotEqualToPredicateOperatorType: Self = Self(5);
pub const NSMatchesPredicateOperatorType: Self = Self(6);
pub const NSLikePredicateOperatorType: Self = Self(7);
pub const NSBeginsWithPredicateOperatorType: Self = Self(8);
pub const NSEndsWithPredicateOperatorType: Self = Self(9);
pub const NSInPredicateOperatorType: Self = Self(10);
pub const NSCustomSelectorPredicateOperatorType: Self = Self(11);
pub const NSContainsPredicateOperatorType: Self = Self(99);
pub const NSBetweenPredicateOperatorType: Self = Self(100);
}
unsafe impl Encode for NSPredicateOperatorType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPredicateOperatorType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSPredicate")]
pub struct NSComparisonPredicate;
#[cfg(feature = "NSPredicate")]
unsafe impl ClassType for NSComparisonPredicate {
#[inherits(NSObject)]
type Super = NSPredicate;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
unsafe impl NSCoding for NSComparisonPredicate {}
#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
unsafe impl NSCopying for NSComparisonPredicate {}
#[cfg(feature = "NSPredicate")]
unsafe impl NSObjectProtocol for NSComparisonPredicate {}
#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
unsafe impl NSSecureCoding for NSComparisonPredicate {}
extern_methods!(
#[cfg(feature = "NSPredicate")]
unsafe impl NSComparisonPredicate {
#[cfg(feature = "NSExpression")]
#[method_id(@__retain_semantics Other predicateWithLeftExpression:rightExpression:modifier:type:options:)]
pub unsafe fn predicateWithLeftExpression_rightExpression_modifier_type_options(
lhs: &NSExpression,
rhs: &NSExpression,
modifier: NSComparisonPredicateModifier,
r#type: NSPredicateOperatorType,
options: NSComparisonPredicateOptions,
) -> Retained<NSComparisonPredicate>;
#[cfg(feature = "NSExpression")]
#[method_id(@__retain_semantics Other predicateWithLeftExpression:rightExpression:customSelector:)]
pub unsafe fn predicateWithLeftExpression_rightExpression_customSelector(
lhs: &NSExpression,
rhs: &NSExpression,
selector: Sel,
) -> Retained<NSComparisonPredicate>;
#[cfg(feature = "NSExpression")]
#[method_id(@__retain_semantics Init initWithLeftExpression:rightExpression:modifier:type:options:)]
pub unsafe fn initWithLeftExpression_rightExpression_modifier_type_options(
this: Allocated<Self>,
lhs: &NSExpression,
rhs: &NSExpression,
modifier: NSComparisonPredicateModifier,
r#type: NSPredicateOperatorType,
options: NSComparisonPredicateOptions,
) -> Retained<Self>;
#[cfg(feature = "NSExpression")]
#[method_id(@__retain_semantics Init initWithLeftExpression:rightExpression:customSelector:)]
pub unsafe fn initWithLeftExpression_rightExpression_customSelector(
this: Allocated<Self>,
lhs: &NSExpression,
rhs: &NSExpression,
selector: Sel,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(predicateOperatorType)]
pub unsafe fn predicateOperatorType(&self) -> NSPredicateOperatorType;
#[method(comparisonPredicateModifier)]
pub unsafe fn comparisonPredicateModifier(&self) -> NSComparisonPredicateModifier;
#[cfg(feature = "NSExpression")]
#[method_id(@__retain_semantics Other leftExpression)]
pub unsafe fn leftExpression(&self) -> Retained<NSExpression>;
#[cfg(feature = "NSExpression")]
#[method_id(@__retain_semantics Other rightExpression)]
pub unsafe fn rightExpression(&self) -> Retained<NSExpression>;
#[method(customSelector)]
pub unsafe fn customSelector(&self) -> Option<Sel>;
#[method(options)]
pub unsafe fn options(&self) -> NSComparisonPredicateOptions;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSPredicate")]
unsafe impl NSComparisonPredicate {
#[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>;
}
);

View File

@@ -0,0 +1,104 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCompoundPredicateType(pub NSUInteger);
impl NSCompoundPredicateType {
pub const NSNotPredicateType: Self = Self(0);
pub const NSAndPredicateType: Self = Self(1);
pub const NSOrPredicateType: Self = Self(2);
}
unsafe impl Encode for NSCompoundPredicateType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCompoundPredicateType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSPredicate")]
pub struct NSCompoundPredicate;
#[cfg(feature = "NSPredicate")]
unsafe impl ClassType for NSCompoundPredicate {
#[inherits(NSObject)]
type Super = NSPredicate;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
unsafe impl NSCoding for NSCompoundPredicate {}
#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
unsafe impl NSCopying for NSCompoundPredicate {}
#[cfg(feature = "NSPredicate")]
unsafe impl NSObjectProtocol for NSCompoundPredicate {}
#[cfg(all(feature = "NSObject", feature = "NSPredicate"))]
unsafe impl NSSecureCoding for NSCompoundPredicate {}
extern_methods!(
#[cfg(feature = "NSPredicate")]
unsafe impl NSCompoundPredicate {
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Init initWithType:subpredicates:)]
pub unsafe fn initWithType_subpredicates(
this: Allocated<Self>,
r#type: NSCompoundPredicateType,
subpredicates: &NSArray<NSPredicate>,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(compoundPredicateType)]
pub unsafe fn compoundPredicateType(&self) -> NSCompoundPredicateType;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other subpredicates)]
pub unsafe fn subpredicates(&self) -> Retained<NSArray>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other andPredicateWithSubpredicates:)]
pub unsafe fn andPredicateWithSubpredicates(
subpredicates: &NSArray<NSPredicate>,
) -> Retained<NSCompoundPredicate>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other orPredicateWithSubpredicates:)]
pub unsafe fn orPredicateWithSubpredicates(
subpredicates: &NSArray<NSPredicate>,
) -> Retained<NSCompoundPredicate>;
#[method_id(@__retain_semantics Other notPredicateWithSubpredicate:)]
pub unsafe fn notPredicateWithSubpredicate(
predicate: &NSPredicate,
) -> Retained<NSCompoundPredicate>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSPredicate")]
unsafe impl NSCompoundPredicate {
#[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>;
}
);

View File

@@ -0,0 +1,385 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use NSXPCConnection instead"]
pub struct NSConnection;
unsafe impl ClassType for NSConnection {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSConnection {}
extern_methods!(
unsafe impl NSConnection {
#[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other statistics)]
pub unsafe fn statistics(&self) -> Retained<NSDictionary<NSString, NSNumber>>;
#[cfg(feature = "NSArray")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other allConnections)]
pub unsafe fn allConnections() -> Retained<NSArray<NSConnection>>;
#[deprecated]
#[method_id(@__retain_semantics Other defaultConnection)]
pub unsafe fn defaultConnection() -> Retained<NSConnection>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other connectionWithRegisteredName:host:)]
pub unsafe fn connectionWithRegisteredName_host(
name: &NSString,
host_name: Option<&NSString>,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other connectionWithRegisteredName:host:usingNameServer:)]
pub unsafe fn connectionWithRegisteredName_host_usingNameServer(
name: &NSString,
host_name: Option<&NSString>,
server: &NSPortNameServer,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSDistantObject", feature = "NSProxy", feature = "NSString"))]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other rootProxyForConnectionWithRegisteredName:host:)]
pub unsafe fn rootProxyForConnectionWithRegisteredName_host(
name: &NSString,
host_name: Option<&NSString>,
) -> Option<Retained<NSDistantObject>>;
#[cfg(all(
feature = "NSDistantObject",
feature = "NSPortNameServer",
feature = "NSProxy",
feature = "NSString"
))]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other rootProxyForConnectionWithRegisteredName:host:usingNameServer:)]
pub unsafe fn rootProxyForConnectionWithRegisteredName_host_usingNameServer(
name: &NSString,
host_name: Option<&NSString>,
server: &NSPortNameServer,
) -> Option<Retained<NSDistantObject>>;
#[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
#[method_id(@__retain_semantics Other serviceConnectionWithName:rootObject:usingNameServer:)]
pub unsafe fn serviceConnectionWithName_rootObject_usingNameServer(
name: &NSString,
root: &AnyObject,
server: &NSPortNameServer,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other serviceConnectionWithName:rootObject:)]
pub unsafe fn serviceConnectionWithName_rootObject(
name: &NSString,
root: &AnyObject,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSDate")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(requestTimeout)]
pub unsafe fn requestTimeout(&self) -> NSTimeInterval;
#[cfg(feature = "NSDate")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(setRequestTimeout:)]
pub unsafe fn setRequestTimeout(&self, request_timeout: NSTimeInterval);
#[cfg(feature = "NSDate")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(replyTimeout)]
pub unsafe fn replyTimeout(&self) -> NSTimeInterval;
#[cfg(feature = "NSDate")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(setReplyTimeout:)]
pub unsafe fn setReplyTimeout(&self, reply_timeout: NSTimeInterval);
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other rootObject)]
pub unsafe fn rootObject(&self) -> Option<Retained<AnyObject>>;
#[deprecated = "Use NSXPCConnection instead"]
#[method(setRootObject:)]
pub unsafe fn setRootObject(&self, root_object: Option<&AnyObject>);
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self)
-> Option<Retained<ProtocolObject<dyn NSConnectionDelegate>>>;
#[deprecated = "Use NSXPCConnection instead"]
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSConnectionDelegate>>,
);
#[deprecated = "Use NSXPCConnection instead"]
#[method(independentConversationQueueing)]
pub unsafe fn independentConversationQueueing(&self) -> bool;
#[deprecated = "Use NSXPCConnection instead"]
#[method(setIndependentConversationQueueing:)]
pub unsafe fn setIndependentConversationQueueing(
&self,
independent_conversation_queueing: bool,
);
#[deprecated = "Use NSXPCConnection instead"]
#[method(isValid)]
pub unsafe fn isValid(&self) -> bool;
#[cfg(all(feature = "NSDistantObject", feature = "NSProxy"))]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other rootProxy)]
pub unsafe fn rootProxy(&self) -> Retained<NSDistantObject>;
#[deprecated = "Use NSXPCConnection instead"]
#[method(invalidate)]
pub unsafe fn invalidate(&self);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(addRequestMode:)]
pub unsafe fn addRequestMode(&self, rmode: &NSString);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(removeRequestMode:)]
pub unsafe fn removeRequestMode(&self, rmode: &NSString);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other requestModes)]
pub unsafe fn requestModes(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(registerName:)]
pub unsafe fn registerName(&self, name: Option<&NSString>) -> bool;
#[cfg(all(feature = "NSPortNameServer", feature = "NSString"))]
#[deprecated = "Use NSXPCConnection instead"]
#[method(registerName:withNameServer:)]
pub unsafe fn registerName_withNameServer(
&self,
name: Option<&NSString>,
server: &NSPortNameServer,
) -> bool;
#[cfg(feature = "NSPort")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other connectionWithReceivePort:sendPort:)]
pub unsafe fn connectionWithReceivePort_sendPort(
receive_port: Option<&NSPort>,
send_port: Option<&NSPort>,
) -> Option<Retained<Self>>;
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other currentConversation)]
pub unsafe fn currentConversation() -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSPort")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Init initWithReceivePort:sendPort:)]
pub unsafe fn initWithReceivePort_sendPort(
this: Allocated<Self>,
receive_port: Option<&NSPort>,
send_port: Option<&NSPort>,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSPort")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other sendPort)]
pub unsafe fn sendPort(&self) -> Retained<NSPort>;
#[cfg(feature = "NSPort")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other receivePort)]
pub unsafe fn receivePort(&self) -> Retained<NSPort>;
#[deprecated = "Use NSXPCConnection instead"]
#[method(enableMultipleThreads)]
pub unsafe fn enableMultipleThreads(&self);
#[deprecated = "Use NSXPCConnection instead"]
#[method(multipleThreadsEnabled)]
pub unsafe fn multipleThreadsEnabled(&self) -> bool;
#[cfg(feature = "NSRunLoop")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(addRunLoop:)]
pub unsafe fn addRunLoop(&self, runloop: &NSRunLoop);
#[cfg(feature = "NSRunLoop")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(removeRunLoop:)]
pub unsafe fn removeRunLoop(&self, runloop: &NSRunLoop);
#[deprecated = "Use NSXPCConnection instead"]
#[method(runInNewThread)]
pub unsafe fn runInNewThread(&self);
#[cfg(feature = "NSArray")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other remoteObjects)]
pub unsafe fn remoteObjects(&self) -> Retained<NSArray>;
#[cfg(feature = "NSArray")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other localObjects)]
pub unsafe fn localObjects(&self) -> Retained<NSArray>;
#[cfg(feature = "NSArray")]
#[method(dispatchWithComponents:)]
pub unsafe fn dispatchWithComponents(&self, components: &NSArray);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSConnection {
#[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 "C" {
#[cfg(feature = "NSString")]
pub static NSConnectionReplyMode: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSConnectionDidDieNotification: &'static NSString;
}
extern_protocol!(
#[deprecated = "Use NSXPCConnection instead"]
pub unsafe trait NSConnectionDelegate: NSObjectProtocol {
#[deprecated = "Use NSXPCConnection instead"]
#[optional]
#[method(makeNewConnection:sender:)]
unsafe fn makeNewConnection_sender(
&self,
conn: &NSConnection,
ancestor: &NSConnection,
) -> bool;
#[deprecated = "Use NSXPCConnection instead"]
#[optional]
#[method(connection:shouldMakeNewConnection:)]
unsafe fn connection_shouldMakeNewConnection(
&self,
ancestor: &NSConnection,
conn: &NSConnection,
) -> bool;
#[cfg(all(feature = "NSArray", feature = "NSData"))]
#[deprecated = "Use NSXPCConnection instead"]
#[optional]
#[method_id(@__retain_semantics Other authenticationDataForComponents:)]
unsafe fn authenticationDataForComponents(&self, components: &NSArray) -> Retained<NSData>;
#[cfg(all(feature = "NSArray", feature = "NSData"))]
#[deprecated = "Use NSXPCConnection instead"]
#[optional]
#[method(authenticateComponents:withData:)]
unsafe fn authenticateComponents_withData(
&self,
components: &NSArray,
signature: &NSData,
) -> bool;
#[deprecated = "Use NSXPCConnection instead"]
#[optional]
#[method_id(@__retain_semantics Other createConversationForConnection:)]
unsafe fn createConversationForConnection(
&self,
conn: &NSConnection,
) -> Retained<AnyObject>;
#[deprecated = "Use NSXPCConnection instead"]
#[optional]
#[method(connection:handleRequest:)]
unsafe fn connection_handleRequest(
&self,
connection: &NSConnection,
doreq: &NSDistantObjectRequest,
) -> bool;
}
unsafe impl ProtocolType for dyn NSConnectionDelegate {}
);
extern "C" {
#[cfg(feature = "NSString")]
pub static NSFailedAuthenticationException: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSConnectionDidInitializeNotification: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use NSXPCConnection instead"]
pub struct NSDistantObjectRequest;
unsafe impl ClassType for NSDistantObjectRequest {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSDistantObjectRequest {}
extern_methods!(
unsafe impl NSDistantObjectRequest {
#[cfg(feature = "NSInvocation")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other invocation)]
pub unsafe fn invocation(&self) -> Retained<NSInvocation>;
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other connection)]
pub unsafe fn connection(&self) -> Retained<NSConnection>;
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other conversation)]
pub unsafe fn conversation(&self) -> Retained<AnyObject>;
#[cfg(feature = "NSException")]
#[deprecated = "Use NSXPCConnection instead"]
#[method(replyWithException:)]
pub unsafe fn replyWithException(&self, exception: Option<&NSException>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDistantObjectRequest {
#[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>;
}
);

View File

@@ -0,0 +1,788 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDataReadingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDataReadingOptions: NSUInteger {
const NSDataReadingMappedIfSafe = 1<<0;
const NSDataReadingUncached = 1<<1;
const NSDataReadingMappedAlways = 1<<3;
#[deprecated]
const NSDataReadingMapped = NSDataReadingOptions::NSDataReadingMappedIfSafe.0;
#[deprecated]
const NSMappedRead = NSDataReadingOptions::NSDataReadingMapped.0;
#[deprecated]
const NSUncachedRead = NSDataReadingOptions::NSDataReadingUncached.0;
}
}
unsafe impl Encode for NSDataReadingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDataReadingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDataWritingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDataWritingOptions: NSUInteger {
const NSDataWritingAtomic = 1<<0;
const NSDataWritingWithoutOverwriting = 1<<1;
const NSDataWritingFileProtectionNone = 0x10000000;
const NSDataWritingFileProtectionComplete = 0x20000000;
const NSDataWritingFileProtectionCompleteUnlessOpen = 0x30000000;
const NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication = 0x40000000;
const NSDataWritingFileProtectionCompleteWhenUserInactive = 0x50000000;
const NSDataWritingFileProtectionMask = 0xf0000000;
#[deprecated]
const NSAtomicWrite = NSDataWritingOptions::NSDataWritingAtomic.0;
}
}
unsafe impl Encode for NSDataWritingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDataWritingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDataSearchOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDataSearchOptions: NSUInteger {
const NSDataSearchBackwards = 1<<0;
const NSDataSearchAnchored = 1<<1;
}
}
unsafe impl Encode for NSDataSearchOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDataSearchOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDataBase64EncodingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDataBase64EncodingOptions: NSUInteger {
const NSDataBase64Encoding64CharacterLineLength = 1<<0;
const NSDataBase64Encoding76CharacterLineLength = 1<<1;
const NSDataBase64EncodingEndLineWithCarriageReturn = 1<<4;
const NSDataBase64EncodingEndLineWithLineFeed = 1<<5;
}
}
unsafe impl Encode for NSDataBase64EncodingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDataBase64EncodingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDataBase64DecodingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDataBase64DecodingOptions: NSUInteger {
const NSDataBase64DecodingIgnoreUnknownCharacters = 1<<0;
}
}
unsafe impl Encode for NSDataBase64DecodingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDataBase64DecodingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSData;
unsafe impl ClassType for NSData {
type Super = NSObject;
type Mutability = ImmutableWithMutableSubclass<NSMutableData>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSData {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSData {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSData {}
unsafe impl NSObjectProtocol for NSData {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSData {}
extern_methods!(
unsafe impl NSData {
#[method(length)]
pub fn length(&self) -> NSUInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSData {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for NSData {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_methods!(
/// NSExtendedData
unsafe impl NSData {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other description)]
pub unsafe fn description(&self) -> Retained<NSString>;
#[method(getBytes:length:)]
pub unsafe fn getBytes_length(&self, buffer: NonNull<c_void>, length: NSUInteger);
#[cfg(feature = "NSRange")]
#[method(getBytes:range:)]
pub unsafe fn getBytes_range(&self, buffer: NonNull<c_void>, range: NSRange);
#[method(isEqualToData:)]
pub unsafe fn isEqualToData(&self, other: &NSData) -> bool;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other subdataWithRange:)]
pub unsafe fn subdataWithRange(&self, range: NSRange) -> Retained<NSData>;
#[cfg(feature = "NSString")]
#[method(writeToFile:atomically:)]
pub unsafe fn writeToFile_atomically(
&self,
path: &NSString,
use_auxiliary_file: bool,
) -> bool;
#[cfg(feature = "NSURL")]
#[method(writeToURL:atomically:)]
pub unsafe fn writeToURL_atomically(&self, url: &NSURL, atomically: bool) -> bool;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method(writeToFile:options:error:_)]
pub unsafe fn writeToFile_options_error(
&self,
path: &NSString,
write_options_mask: NSDataWritingOptions,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method(writeToURL:options:error:_)]
pub unsafe fn writeToURL_options_error(
&self,
url: &NSURL,
write_options_mask: NSDataWritingOptions,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSRange")]
#[method(rangeOfData:options:range:)]
pub unsafe fn rangeOfData_options_range(
&self,
data_to_find: &NSData,
mask: NSDataSearchOptions,
search_range: NSRange,
) -> NSRange;
#[cfg(all(feature = "NSRange", feature = "block2"))]
#[method(enumerateByteRangesUsingBlock:)]
pub unsafe fn enumerateByteRangesUsingBlock(
&self,
block: &block2::Block<dyn Fn(NonNull<c_void>, NSRange, NonNull<Bool>) + '_>,
);
}
);
extern_methods!(
/// NSDataCreation
unsafe impl NSData {
#[method_id(@__retain_semantics Other data)]
pub unsafe fn data() -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithBytes:length:)]
pub unsafe fn dataWithBytes_length(
bytes: *mut c_void,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithBytesNoCopy:length:)]
pub unsafe fn dataWithBytesNoCopy_length(
bytes: NonNull<c_void>,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithBytesNoCopy:length:freeWhenDone:)]
pub unsafe fn dataWithBytesNoCopy_length_freeWhenDone(
bytes: NonNull<c_void>,
length: NSUInteger,
b: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Other dataWithContentsOfFile:options:error:_)]
pub unsafe fn dataWithContentsOfFile_options_error(
path: &NSString,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other dataWithContentsOfURL:options:error:_)]
pub unsafe fn dataWithContentsOfURL_options_error(
url: &NSURL,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other dataWithContentsOfFile:)]
pub unsafe fn dataWithContentsOfFile(path: &NSString) -> Option<Retained<Self>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other dataWithContentsOfURL:)]
pub unsafe fn dataWithContentsOfURL(url: &NSURL) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithBytes:length:)]
pub unsafe fn initWithBytes_length(
this: Allocated<Self>,
bytes: *mut c_void,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithBytesNoCopy:length:)]
pub unsafe fn initWithBytesNoCopy_length(
this: Allocated<Self>,
bytes: NonNull<c_void>,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithBytesNoCopy:length:freeWhenDone:)]
pub unsafe fn initWithBytesNoCopy_length_freeWhenDone(
this: Allocated<Self>,
bytes: NonNull<c_void>,
length: NSUInteger,
b: bool,
) -> Retained<Self>;
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Init initWithBytesNoCopy:length:deallocator:)]
pub unsafe fn initWithBytesNoCopy_length_deallocator(
this: Allocated<Self>,
bytes: NonNull<c_void>,
length: NSUInteger,
deallocator: Option<&block2::Block<dyn Fn(NonNull<c_void>, NSUInteger)>>,
) -> Retained<Self>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithContentsOfFile:options:error:_)]
pub unsafe fn initWithContentsOfFile_options_error(
this: Allocated<Self>,
path: &NSString,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithContentsOfURL:options:error:_)]
pub unsafe fn initWithContentsOfURL_options_error(
this: Allocated<Self>,
url: &NSURL,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithContentsOfFile:)]
pub unsafe fn initWithContentsOfFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithData:)]
pub fn initWithData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithData:)]
pub fn dataWithData(data: &NSData) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSData`
///
/// NSDataCreation
unsafe impl NSMutableData {
#[method_id(@__retain_semantics Other data)]
pub unsafe fn data() -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithBytes:length:)]
pub unsafe fn dataWithBytes_length(
bytes: *mut c_void,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithBytesNoCopy:length:)]
pub unsafe fn dataWithBytesNoCopy_length(
bytes: NonNull<c_void>,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithBytesNoCopy:length:freeWhenDone:)]
pub unsafe fn dataWithBytesNoCopy_length_freeWhenDone(
bytes: NonNull<c_void>,
length: NSUInteger,
b: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Other dataWithContentsOfFile:options:error:_)]
pub unsafe fn dataWithContentsOfFile_options_error(
path: &NSString,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other dataWithContentsOfURL:options:error:_)]
pub unsafe fn dataWithContentsOfURL_options_error(
url: &NSURL,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other dataWithContentsOfFile:)]
pub unsafe fn dataWithContentsOfFile(path: &NSString) -> Option<Retained<Self>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other dataWithContentsOfURL:)]
pub unsafe fn dataWithContentsOfURL(url: &NSURL) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithBytes:length:)]
pub unsafe fn initWithBytes_length(
this: Allocated<Self>,
bytes: *mut c_void,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithBytesNoCopy:length:)]
pub unsafe fn initWithBytesNoCopy_length(
this: Allocated<Self>,
bytes: NonNull<c_void>,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithBytesNoCopy:length:freeWhenDone:)]
pub unsafe fn initWithBytesNoCopy_length_freeWhenDone(
this: Allocated<Self>,
bytes: NonNull<c_void>,
length: NSUInteger,
b: bool,
) -> Retained<Self>;
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Init initWithBytesNoCopy:length:deallocator:)]
pub unsafe fn initWithBytesNoCopy_length_deallocator(
this: Allocated<Self>,
bytes: NonNull<c_void>,
length: NSUInteger,
deallocator: Option<&block2::Block<dyn Fn(NonNull<c_void>, NSUInteger)>>,
) -> Retained<Self>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithContentsOfFile:options:error:_)]
pub unsafe fn initWithContentsOfFile_options_error(
this: Allocated<Self>,
path: &NSString,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithContentsOfURL:options:error:_)]
pub unsafe fn initWithContentsOfURL_options_error(
this: Allocated<Self>,
url: &NSURL,
read_options_mask: NSDataReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithContentsOfFile:)]
pub unsafe fn initWithContentsOfFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithData:)]
pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;
#[method_id(@__retain_semantics Other dataWithData:)]
pub fn dataWithData(data: &NSData) -> Retained<Self>;
}
);
extern_methods!(
/// NSDataBase64Encoding
unsafe impl NSData {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithBase64EncodedString:options:)]
pub unsafe fn initWithBase64EncodedString_options(
this: Allocated<Self>,
base64_string: &NSString,
options: NSDataBase64DecodingOptions,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other base64EncodedStringWithOptions:)]
pub unsafe fn base64EncodedStringWithOptions(
&self,
options: NSDataBase64EncodingOptions,
) -> Retained<NSString>;
#[method_id(@__retain_semantics Init initWithBase64EncodedData:options:)]
pub unsafe fn initWithBase64EncodedData_options(
this: Allocated<Self>,
base64_data: &NSData,
options: NSDataBase64DecodingOptions,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other base64EncodedDataWithOptions:)]
pub unsafe fn base64EncodedDataWithOptions(
&self,
options: NSDataBase64EncodingOptions,
) -> Retained<NSData>;
}
);
extern_methods!(
/// Methods declared on superclass `NSData`
///
/// NSDataBase64Encoding
unsafe impl NSMutableData {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithBase64EncodedString:options:)]
pub unsafe fn initWithBase64EncodedString_options(
this: Allocated<Self>,
base64_string: &NSString,
options: NSDataBase64DecodingOptions,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithBase64EncodedData:options:)]
pub unsafe fn initWithBase64EncodedData_options(
this: Allocated<Self>,
base64_data: &NSData,
options: NSDataBase64DecodingOptions,
) -> Option<Retained<Self>>;
}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDataCompressionAlgorithm(pub NSInteger);
impl NSDataCompressionAlgorithm {
#[doc(alias = "NSDataCompressionAlgorithmLZFSE")]
pub const LZFSE: Self = Self(0);
#[doc(alias = "NSDataCompressionAlgorithmLZ4")]
pub const LZ4: Self = Self(1);
#[doc(alias = "NSDataCompressionAlgorithmLZMA")]
pub const LZMA: Self = Self(2);
#[doc(alias = "NSDataCompressionAlgorithmZlib")]
pub const Zlib: Self = Self(3);
}
unsafe impl Encode for NSDataCompressionAlgorithm {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSDataCompressionAlgorithm {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSDataCompression
unsafe impl NSData {
#[cfg(feature = "NSError")]
#[method_id(@__retain_semantics Other decompressedDataUsingAlgorithm:error:_)]
pub unsafe fn decompressedDataUsingAlgorithm_error(
&self,
algorithm: NSDataCompressionAlgorithm,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method_id(@__retain_semantics Other compressedDataUsingAlgorithm:error:_)]
pub unsafe fn compressedDataUsingAlgorithm_error(
&self,
algorithm: NSDataCompressionAlgorithm,
) -> Result<Retained<Self>, Retained<NSError>>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl NSData {
#[deprecated = "This method is unsafe because it could potentially cause buffer overruns. Use -getBytes:length: instead."]
#[method(getBytes:)]
pub unsafe fn getBytes(&self, buffer: NonNull<c_void>);
#[cfg(feature = "NSString")]
#[deprecated = "Use +dataWithContentsOfURL:options:error: and NSDataReadingMappedIfSafe or NSDataReadingMappedAlways instead."]
#[method_id(@__retain_semantics Other dataWithContentsOfMappedFile:)]
pub unsafe fn dataWithContentsOfMappedFile(path: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use -initWithContentsOfURL:options:error: and NSDataReadingMappedIfSafe or NSDataReadingMappedAlways instead."]
#[method_id(@__retain_semantics Init initWithContentsOfMappedFile:)]
pub unsafe fn initWithContentsOfMappedFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use initWithBase64EncodedString:options: instead"]
#[method_id(@__retain_semantics Init initWithBase64Encoding:)]
pub unsafe fn initWithBase64Encoding(
this: Allocated<Self>,
base64_string: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use base64EncodedStringWithOptions: instead"]
#[method_id(@__retain_semantics Other base64Encoding)]
pub unsafe fn base64Encoding(&self) -> Retained<NSString>;
}
);
extern_methods!(
/// Methods declared on superclass `NSData`
///
/// NSDeprecated
unsafe impl NSMutableData {
#[cfg(feature = "NSString")]
#[deprecated = "Use -initWithContentsOfURL:options:error: and NSDataReadingMappedIfSafe or NSDataReadingMappedAlways instead."]
#[method_id(@__retain_semantics Init initWithContentsOfMappedFile:)]
pub unsafe fn initWithContentsOfMappedFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use initWithBase64EncodedString:options: instead"]
#[method_id(@__retain_semantics Init initWithBase64Encoding:)]
pub unsafe fn initWithBase64Encoding(
this: Allocated<Self>,
base64_string: &NSString,
) -> Option<Retained<Self>>;
}
);
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSMutableData;
unsafe impl ClassType for NSMutableData {
#[inherits(NSObject)]
type Super = NSData;
type Mutability = MutableWithImmutableSuperclass<NSData>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMutableData {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMutableData {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSMutableData {}
unsafe impl NSObjectProtocol for NSMutableData {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMutableData {}
extern_methods!(
unsafe impl NSMutableData {
#[method(setLength:)]
pub fn setLength(&mut self, length: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMutableData {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for NSMutableData {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_methods!(
/// NSExtendedMutableData
unsafe impl NSMutableData {
#[method(appendBytes:length:)]
pub unsafe fn appendBytes_length(&mut self, bytes: NonNull<c_void>, length: NSUInteger);
#[method(appendData:)]
pub unsafe fn appendData(&mut self, other: &NSData);
#[method(increaseLengthBy:)]
pub unsafe fn increaseLengthBy(&mut self, extra_length: NSUInteger);
#[cfg(feature = "NSRange")]
#[method(replaceBytesInRange:withBytes:)]
pub unsafe fn replaceBytesInRange_withBytes(
&mut self,
range: NSRange,
bytes: NonNull<c_void>,
);
#[cfg(feature = "NSRange")]
#[method(resetBytesInRange:)]
pub unsafe fn resetBytesInRange(&mut self, range: NSRange);
#[method(setData:)]
pub unsafe fn setData(&mut self, data: &NSData);
#[cfg(feature = "NSRange")]
#[method(replaceBytesInRange:withBytes:length:)]
pub unsafe fn replaceBytesInRange_withBytes_length(
&mut self,
range: NSRange,
replacement_bytes: *mut c_void,
replacement_length: NSUInteger,
);
}
);
extern_methods!(
/// NSMutableDataCreation
unsafe impl NSMutableData {
#[method_id(@__retain_semantics Other dataWithCapacity:)]
pub fn dataWithCapacity(a_num_items: NSUInteger) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other dataWithLength:)]
pub unsafe fn dataWithLength(length: NSUInteger) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithCapacity:)]
pub fn initWithCapacity(
this: Allocated<Self>,
capacity: NSUInteger,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithLength:)]
pub unsafe fn initWithLength(
this: Allocated<Self>,
length: NSUInteger,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// NSMutableDataCompression
unsafe impl NSMutableData {
#[cfg(feature = "NSError")]
#[method(decompressUsingAlgorithm:error:_)]
pub unsafe fn decompressUsingAlgorithm_error(
&mut self,
algorithm: NSDataCompressionAlgorithm,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(compressUsingAlgorithm:error:_)]
pub unsafe fn compressUsingAlgorithm_error(
&mut self,
algorithm: NSDataCompressionAlgorithm,
) -> Result<(), Retained<NSError>>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSPurgeableData;
unsafe impl ClassType for NSPurgeableData {
#[inherits(NSData, NSObject)]
type Super = NSMutableData;
type Mutability = Mutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSPurgeableData {}
#[cfg(feature = "NSObject")]
unsafe impl NSDiscardableContent for NSPurgeableData {}
unsafe impl NSObjectProtocol for NSPurgeableData {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSPurgeableData {}
extern_methods!(
unsafe impl NSPurgeableData {}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSPurgeableData {
#[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>;
}
);

View File

@@ -0,0 +1,167 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSSystemClockDidChangeNotification: &'static NSNotificationName;
}
pub type NSTimeInterval = c_double;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDate;
unsafe impl ClassType for NSDate {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSDate {}
unsafe impl Sync for NSDate {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSDate {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSDate {}
unsafe impl NSObjectProtocol for NSDate {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSDate {}
extern_methods!(
unsafe impl NSDate {
#[method(timeIntervalSinceReferenceDate)]
pub unsafe fn timeIntervalSinceReferenceDate(&self) -> NSTimeInterval;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithTimeIntervalSinceReferenceDate:)]
pub unsafe fn initWithTimeIntervalSinceReferenceDate(
this: Allocated<Self>,
ti: NSTimeInterval,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDate {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSExtendedDate
unsafe impl NSDate {
#[method(timeIntervalSinceDate:)]
pub unsafe fn timeIntervalSinceDate(&self, another_date: &NSDate) -> NSTimeInterval;
#[method(timeIntervalSinceNow)]
pub unsafe fn timeIntervalSinceNow(&self) -> NSTimeInterval;
#[method(timeIntervalSince1970)]
pub unsafe fn timeIntervalSince1970(&self) -> NSTimeInterval;
#[deprecated = "Use dateByAddingTimeInterval instead"]
#[method_id(@__retain_semantics Other addTimeInterval:)]
pub unsafe fn addTimeInterval(&self, seconds: NSTimeInterval) -> Retained<AnyObject>;
#[method_id(@__retain_semantics Other dateByAddingTimeInterval:)]
pub unsafe fn dateByAddingTimeInterval(&self, ti: NSTimeInterval) -> Retained<Self>;
#[method_id(@__retain_semantics Other earlierDate:)]
pub unsafe fn earlierDate(&self, another_date: &NSDate) -> Retained<NSDate>;
#[method_id(@__retain_semantics Other laterDate:)]
pub unsafe fn laterDate(&self, another_date: &NSDate) -> Retained<NSDate>;
#[cfg(feature = "NSObjCRuntime")]
#[method(compare:)]
pub unsafe fn compare(&self, other: &NSDate) -> NSComparisonResult;
#[method(isEqualToDate:)]
pub unsafe fn isEqualToDate(&self, other_date: &NSDate) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other description)]
pub unsafe fn description(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionWithLocale:)]
pub unsafe fn descriptionWithLocale(
&self,
locale: Option<&AnyObject>,
) -> Retained<NSString>;
#[method(timeIntervalSinceReferenceDate)]
pub unsafe fn timeIntervalSinceReferenceDate_class() -> NSTimeInterval;
}
);
extern_methods!(
/// NSDateCreation
unsafe impl NSDate {
#[method_id(@__retain_semantics Other date)]
pub unsafe fn date() -> Retained<Self>;
#[method_id(@__retain_semantics Other dateWithTimeIntervalSinceNow:)]
pub unsafe fn dateWithTimeIntervalSinceNow(secs: NSTimeInterval) -> Retained<Self>;
#[method_id(@__retain_semantics Other dateWithTimeIntervalSinceReferenceDate:)]
pub unsafe fn dateWithTimeIntervalSinceReferenceDate(ti: NSTimeInterval) -> Retained<Self>;
#[method_id(@__retain_semantics Other dateWithTimeIntervalSince1970:)]
pub unsafe fn dateWithTimeIntervalSince1970(secs: NSTimeInterval) -> Retained<Self>;
#[method_id(@__retain_semantics Other dateWithTimeInterval:sinceDate:)]
pub unsafe fn dateWithTimeInterval_sinceDate(
secs_to_be_added: NSTimeInterval,
date: &NSDate,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other distantFuture)]
pub unsafe fn distantFuture() -> Retained<NSDate>;
#[method_id(@__retain_semantics Other distantPast)]
pub unsafe fn distantPast() -> Retained<NSDate>;
#[method_id(@__retain_semantics Other now)]
pub unsafe fn now() -> Retained<NSDate>;
#[method_id(@__retain_semantics Init initWithTimeIntervalSinceNow:)]
pub unsafe fn initWithTimeIntervalSinceNow(
this: Allocated<Self>,
secs: NSTimeInterval,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithTimeIntervalSince1970:)]
pub unsafe fn initWithTimeIntervalSince1970(
this: Allocated<Self>,
secs: NSTimeInterval,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithTimeInterval:sinceDate:)]
pub unsafe fn initWithTimeInterval_sinceDate(
this: Allocated<Self>,
secs_to_be_added: NSTimeInterval,
date: &NSDate,
) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,230 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateComponentsFormatterUnitsStyle(pub NSInteger);
impl NSDateComponentsFormatterUnitsStyle {
#[doc(alias = "NSDateComponentsFormatterUnitsStylePositional")]
pub const Positional: Self = Self(0);
#[doc(alias = "NSDateComponentsFormatterUnitsStyleAbbreviated")]
pub const Abbreviated: Self = Self(1);
#[doc(alias = "NSDateComponentsFormatterUnitsStyleShort")]
pub const Short: Self = Self(2);
#[doc(alias = "NSDateComponentsFormatterUnitsStyleFull")]
pub const Full: Self = Self(3);
#[doc(alias = "NSDateComponentsFormatterUnitsStyleSpellOut")]
pub const SpellOut: Self = Self(4);
#[doc(alias = "NSDateComponentsFormatterUnitsStyleBrief")]
pub const Brief: Self = Self(5);
}
unsafe impl Encode for NSDateComponentsFormatterUnitsStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSDateComponentsFormatterUnitsStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateComponentsFormatterZeroFormattingBehavior(pub NSUInteger);
bitflags::bitflags! {
impl NSDateComponentsFormatterZeroFormattingBehavior: NSUInteger {
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorNone")]
const None = 0;
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorDefault")]
const Default = 1<<0;
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorDropLeading")]
const DropLeading = 1<<1;
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorDropMiddle")]
const DropMiddle = 1<<2;
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorDropTrailing")]
const DropTrailing = 1<<3;
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorDropAll")]
const DropAll = NSDateComponentsFormatterZeroFormattingBehavior::DropLeading.0|NSDateComponentsFormatterZeroFormattingBehavior::DropMiddle.0|NSDateComponentsFormatterZeroFormattingBehavior::DropTrailing.0;
#[doc(alias = "NSDateComponentsFormatterZeroFormattingBehaviorPad")]
const Pad = 1<<16;
}
}
unsafe impl Encode for NSDateComponentsFormatterZeroFormattingBehavior {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDateComponentsFormatterZeroFormattingBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSDateComponentsFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSDateComponentsFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSFormatter")]
unsafe impl Send for NSDateComponentsFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl Sync for NSDateComponentsFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSDateComponentsFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSDateComponentsFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSDateComponentsFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateComponentsFormatter {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringForObjectValue:)]
pub unsafe fn stringForObjectValue(
&self,
obj: Option<&AnyObject>,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSCalendar", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromDateComponents:)]
pub unsafe fn stringFromDateComponents(
&self,
components: &NSDateComponents,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromDate:toDate:)]
pub unsafe fn stringFromDate_toDate(
&self,
start_date: &NSDate,
end_date: &NSDate,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromTimeInterval:)]
pub unsafe fn stringFromTimeInterval(
&self,
ti: NSTimeInterval,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSCalendar", feature = "NSString"))]
#[method_id(@__retain_semantics Other localizedStringFromDateComponents:unitsStyle:)]
pub unsafe fn localizedStringFromDateComponents_unitsStyle(
components: &NSDateComponents,
units_style: NSDateComponentsFormatterUnitsStyle,
) -> Option<Retained<NSString>>;
#[method(unitsStyle)]
pub unsafe fn unitsStyle(&self) -> NSDateComponentsFormatterUnitsStyle;
#[method(setUnitsStyle:)]
pub unsafe fn setUnitsStyle(&self, units_style: NSDateComponentsFormatterUnitsStyle);
#[cfg(feature = "NSCalendar")]
#[method(allowedUnits)]
pub unsafe fn allowedUnits(&self) -> NSCalendarUnit;
#[cfg(feature = "NSCalendar")]
#[method(setAllowedUnits:)]
pub unsafe fn setAllowedUnits(&self, allowed_units: NSCalendarUnit);
#[method(zeroFormattingBehavior)]
pub unsafe fn zeroFormattingBehavior(
&self,
) -> NSDateComponentsFormatterZeroFormattingBehavior;
#[method(setZeroFormattingBehavior:)]
pub unsafe fn setZeroFormattingBehavior(
&self,
zero_formatting_behavior: NSDateComponentsFormatterZeroFormattingBehavior,
);
#[cfg(feature = "NSCalendar")]
#[method_id(@__retain_semantics Other calendar)]
pub unsafe fn calendar(&self) -> Option<Retained<NSCalendar>>;
#[cfg(feature = "NSCalendar")]
#[method(setCalendar:)]
pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other referenceDate)]
pub unsafe fn referenceDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method(setReferenceDate:)]
pub unsafe fn setReferenceDate(&self, reference_date: Option<&NSDate>);
#[method(allowsFractionalUnits)]
pub unsafe fn allowsFractionalUnits(&self) -> bool;
#[method(setAllowsFractionalUnits:)]
pub unsafe fn setAllowsFractionalUnits(&self, allows_fractional_units: bool);
#[method(maximumUnitCount)]
pub unsafe fn maximumUnitCount(&self) -> NSInteger;
#[method(setMaximumUnitCount:)]
pub unsafe fn setMaximumUnitCount(&self, maximum_unit_count: NSInteger);
#[method(collapsesLargestUnit)]
pub unsafe fn collapsesLargestUnit(&self) -> bool;
#[method(setCollapsesLargestUnit:)]
pub unsafe fn setCollapsesLargestUnit(&self, collapses_largest_unit: bool);
#[method(includesApproximationPhrase)]
pub unsafe fn includesApproximationPhrase(&self) -> bool;
#[method(setIncludesApproximationPhrase:)]
pub unsafe fn setIncludesApproximationPhrase(&self, includes_approximation_phrase: bool);
#[method(includesTimeRemainingPhrase)]
pub unsafe fn includesTimeRemainingPhrase(&self) -> bool;
#[method(setIncludesTimeRemainingPhrase:)]
pub unsafe fn setIncludesTimeRemainingPhrase(&self, includes_time_remaining_phrase: bool);
#[method(formattingContext)]
pub unsafe fn formattingContext(&self) -> NSFormattingContext;
#[method(setFormattingContext:)]
pub unsafe fn setFormattingContext(&self, formatting_context: NSFormattingContext);
#[cfg(feature = "NSString")]
#[method(getObjectValue:forString:errorDescription:)]
pub unsafe fn getObjectValue_forString_errorDescription(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateComponentsFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,447 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateFormatterStyle(pub NSUInteger);
impl NSDateFormatterStyle {
pub const NSDateFormatterNoStyle: Self = Self(0);
pub const NSDateFormatterShortStyle: Self = Self(1);
pub const NSDateFormatterMediumStyle: Self = Self(2);
pub const NSDateFormatterLongStyle: Self = Self(3);
pub const NSDateFormatterFullStyle: Self = Self(4);
}
unsafe impl Encode for NSDateFormatterStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDateFormatterStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateFormatterBehavior(pub NSUInteger);
impl NSDateFormatterBehavior {
#[doc(alias = "NSDateFormatterBehaviorDefault")]
pub const Default: Self = Self(0);
pub const NSDateFormatterBehavior10_0: Self = Self(1000);
pub const NSDateFormatterBehavior10_4: Self = Self(1040);
}
unsafe impl Encode for NSDateFormatterBehavior {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDateFormatterBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSDateFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSDateFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSFormatter")]
unsafe impl Send for NSDateFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl Sync for NSDateFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSDateFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSDateFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSDateFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateFormatter {
#[method(formattingContext)]
pub unsafe fn formattingContext(&self) -> NSFormattingContext;
#[method(setFormattingContext:)]
pub unsafe fn setFormattingContext(&self, formatting_context: NSFormattingContext);
#[cfg(all(feature = "NSError", feature = "NSRange", feature = "NSString"))]
#[method(getObjectValue:forString:range:error:_)]
pub unsafe fn getObjectValue_forString_range_error(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
rangep: *mut NSRange,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromDate:)]
pub unsafe fn stringFromDate(&self, date: &NSDate) -> Retained<NSString>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other dateFromString:)]
pub unsafe fn dateFromString(&self, string: &NSString) -> Option<Retained<NSDate>>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other localizedStringFromDate:dateStyle:timeStyle:)]
pub unsafe fn localizedStringFromDate_dateStyle_timeStyle(
date: &NSDate,
dstyle: NSDateFormatterStyle,
tstyle: NSDateFormatterStyle,
) -> Retained<NSString>;
#[cfg(all(feature = "NSLocale", feature = "NSString"))]
#[method_id(@__retain_semantics Other dateFormatFromTemplate:options:locale:)]
pub unsafe fn dateFormatFromTemplate_options_locale(
tmplate: &NSString,
opts: NSUInteger,
locale: Option<&NSLocale>,
) -> Option<Retained<NSString>>;
#[method(defaultFormatterBehavior)]
pub unsafe fn defaultFormatterBehavior() -> NSDateFormatterBehavior;
#[method(setDefaultFormatterBehavior:)]
pub unsafe fn setDefaultFormatterBehavior(
default_formatter_behavior: NSDateFormatterBehavior,
);
#[cfg(feature = "NSString")]
#[method(setLocalizedDateFormatFromTemplate:)]
pub unsafe fn setLocalizedDateFormatFromTemplate(&self, date_format_template: &NSString);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other dateFormat)]
pub unsafe fn dateFormat(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setDateFormat:)]
pub unsafe fn setDateFormat(&self, date_format: Option<&NSString>);
#[method(dateStyle)]
pub unsafe fn dateStyle(&self) -> NSDateFormatterStyle;
#[method(setDateStyle:)]
pub unsafe fn setDateStyle(&self, date_style: NSDateFormatterStyle);
#[method(timeStyle)]
pub unsafe fn timeStyle(&self) -> NSDateFormatterStyle;
#[method(setTimeStyle:)]
pub unsafe fn setTimeStyle(&self, time_style: NSDateFormatterStyle);
#[cfg(feature = "NSLocale")]
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Retained<NSLocale>;
#[cfg(feature = "NSLocale")]
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[method(generatesCalendarDates)]
pub unsafe fn generatesCalendarDates(&self) -> bool;
#[method(setGeneratesCalendarDates:)]
pub unsafe fn setGeneratesCalendarDates(&self, generates_calendar_dates: bool);
#[method(formatterBehavior)]
pub unsafe fn formatterBehavior(&self) -> NSDateFormatterBehavior;
#[method(setFormatterBehavior:)]
pub unsafe fn setFormatterBehavior(&self, formatter_behavior: NSDateFormatterBehavior);
#[cfg(feature = "NSTimeZone")]
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
#[cfg(feature = "NSTimeZone")]
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[cfg(feature = "NSCalendar")]
#[method_id(@__retain_semantics Other calendar)]
pub unsafe fn calendar(&self) -> Retained<NSCalendar>;
#[cfg(feature = "NSCalendar")]
#[method(setCalendar:)]
pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[method(isLenient)]
pub unsafe fn isLenient(&self) -> bool;
#[method(setLenient:)]
pub unsafe fn setLenient(&self, lenient: bool);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other twoDigitStartDate)]
pub unsafe fn twoDigitStartDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method(setTwoDigitStartDate:)]
pub unsafe fn setTwoDigitStartDate(&self, two_digit_start_date: Option<&NSDate>);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other defaultDate)]
pub unsafe fn defaultDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method(setDefaultDate:)]
pub unsafe fn setDefaultDate(&self, default_date: Option<&NSDate>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other eraSymbols)]
pub unsafe fn eraSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setEraSymbols:)]
pub unsafe fn setEraSymbols(&self, era_symbols: Option<&NSArray<NSString>>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other monthSymbols)]
pub unsafe fn monthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setMonthSymbols:)]
pub unsafe fn setMonthSymbols(&self, month_symbols: Option<&NSArray<NSString>>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortMonthSymbols)]
pub unsafe fn shortMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setShortMonthSymbols:)]
pub unsafe fn setShortMonthSymbols(&self, short_month_symbols: Option<&NSArray<NSString>>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other weekdaySymbols)]
pub unsafe fn weekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setWeekdaySymbols:)]
pub unsafe fn setWeekdaySymbols(&self, weekday_symbols: Option<&NSArray<NSString>>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortWeekdaySymbols)]
pub unsafe fn shortWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setShortWeekdaySymbols:)]
pub unsafe fn setShortWeekdaySymbols(
&self,
short_weekday_symbols: Option<&NSArray<NSString>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other AMSymbol)]
pub unsafe fn AMSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setAMSymbol:)]
pub unsafe fn setAMSymbol(&self, am_symbol: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other PMSymbol)]
pub unsafe fn PMSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPMSymbol:)]
pub unsafe fn setPMSymbol(&self, pm_symbol: Option<&NSString>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other longEraSymbols)]
pub unsafe fn longEraSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setLongEraSymbols:)]
pub unsafe fn setLongEraSymbols(&self, long_era_symbols: Option<&NSArray<NSString>>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortMonthSymbols)]
pub unsafe fn veryShortMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setVeryShortMonthSymbols:)]
pub unsafe fn setVeryShortMonthSymbols(
&self,
very_short_month_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other standaloneMonthSymbols)]
pub unsafe fn standaloneMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setStandaloneMonthSymbols:)]
pub unsafe fn setStandaloneMonthSymbols(
&self,
standalone_month_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortStandaloneMonthSymbols)]
pub unsafe fn shortStandaloneMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setShortStandaloneMonthSymbols:)]
pub unsafe fn setShortStandaloneMonthSymbols(
&self,
short_standalone_month_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortStandaloneMonthSymbols)]
pub unsafe fn veryShortStandaloneMonthSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setVeryShortStandaloneMonthSymbols:)]
pub unsafe fn setVeryShortStandaloneMonthSymbols(
&self,
very_short_standalone_month_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortWeekdaySymbols)]
pub unsafe fn veryShortWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setVeryShortWeekdaySymbols:)]
pub unsafe fn setVeryShortWeekdaySymbols(
&self,
very_short_weekday_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other standaloneWeekdaySymbols)]
pub unsafe fn standaloneWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setStandaloneWeekdaySymbols:)]
pub unsafe fn setStandaloneWeekdaySymbols(
&self,
standalone_weekday_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortStandaloneWeekdaySymbols)]
pub unsafe fn shortStandaloneWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setShortStandaloneWeekdaySymbols:)]
pub unsafe fn setShortStandaloneWeekdaySymbols(
&self,
short_standalone_weekday_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other veryShortStandaloneWeekdaySymbols)]
pub unsafe fn veryShortStandaloneWeekdaySymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setVeryShortStandaloneWeekdaySymbols:)]
pub unsafe fn setVeryShortStandaloneWeekdaySymbols(
&self,
very_short_standalone_weekday_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other quarterSymbols)]
pub unsafe fn quarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setQuarterSymbols:)]
pub unsafe fn setQuarterSymbols(&self, quarter_symbols: Option<&NSArray<NSString>>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortQuarterSymbols)]
pub unsafe fn shortQuarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setShortQuarterSymbols:)]
pub unsafe fn setShortQuarterSymbols(
&self,
short_quarter_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other standaloneQuarterSymbols)]
pub unsafe fn standaloneQuarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setStandaloneQuarterSymbols:)]
pub unsafe fn setStandaloneQuarterSymbols(
&self,
standalone_quarter_symbols: Option<&NSArray<NSString>>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other shortStandaloneQuarterSymbols)]
pub unsafe fn shortStandaloneQuarterSymbols(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setShortStandaloneQuarterSymbols:)]
pub unsafe fn setShortStandaloneQuarterSymbols(
&self,
short_standalone_quarter_symbols: Option<&NSArray<NSString>>,
);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other gregorianStartDate)]
pub unsafe fn gregorianStartDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSDate")]
#[method(setGregorianStartDate:)]
pub unsafe fn setGregorianStartDate(&self, gregorian_start_date: Option<&NSDate>);
#[method(doesRelativeDateFormatting)]
pub unsafe fn doesRelativeDateFormatting(&self) -> bool;
#[method(setDoesRelativeDateFormatting:)]
pub unsafe fn setDoesRelativeDateFormatting(&self, does_relative_date_formatting: bool);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateFormatter {
#[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!(
/// NSDateFormatterCompatibility
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateFormatter {
#[cfg(feature = "NSString")]
#[deprecated = "Create an NSDateFormatter with `init` and set the dateFormat property instead."]
#[method_id(@__retain_semantics Init initWithDateFormat:allowNaturalLanguage:)]
pub unsafe fn initWithDateFormat_allowNaturalLanguage(
this: Allocated<Self>,
format: &NSString,
flag: bool,
) -> Retained<Self>;
#[deprecated = "There is no replacement"]
#[method(allowsNaturalLanguage)]
pub unsafe fn allowsNaturalLanguage(&self) -> bool;
}
);

View File

@@ -0,0 +1,97 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDateInterval;
unsafe impl ClassType for NSDateInterval {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSDateInterval {}
unsafe impl Sync for NSDateInterval {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSDateInterval {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSDateInterval {}
unsafe impl NSObjectProtocol for NSDateInterval {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSDateInterval {}
extern_methods!(
unsafe impl NSDateInterval {
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other startDate)]
pub unsafe fn startDate(&self) -> Retained<NSDate>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other endDate)]
pub unsafe fn endDate(&self) -> Retained<NSDate>;
#[cfg(feature = "NSDate")]
#[method(duration)]
pub unsafe fn duration(&self) -> NSTimeInterval;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Init initWithStartDate:duration:)]
pub unsafe fn initWithStartDate_duration(
this: Allocated<Self>,
start_date: &NSDate,
duration: NSTimeInterval,
) -> Retained<Self>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Init initWithStartDate:endDate:)]
pub unsafe fn initWithStartDate_endDate(
this: Allocated<Self>,
start_date: &NSDate,
end_date: &NSDate,
) -> Retained<Self>;
#[cfg(feature = "NSObjCRuntime")]
#[method(compare:)]
pub unsafe fn compare(&self, date_interval: &NSDateInterval) -> NSComparisonResult;
#[method(isEqualToDateInterval:)]
pub unsafe fn isEqualToDateInterval(&self, date_interval: &NSDateInterval) -> bool;
#[method(intersectsDateInterval:)]
pub unsafe fn intersectsDateInterval(&self, date_interval: &NSDateInterval) -> bool;
#[method_id(@__retain_semantics Other intersectionWithDateInterval:)]
pub unsafe fn intersectionWithDateInterval(
&self,
date_interval: &NSDateInterval,
) -> Option<Retained<NSDateInterval>>;
#[cfg(feature = "NSDate")]
#[method(containsDate:)]
pub unsafe fn containsDate(&self, date: &NSDate) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDateInterval {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,129 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDateIntervalFormatterStyle(pub NSUInteger);
impl NSDateIntervalFormatterStyle {
pub const NSDateIntervalFormatterNoStyle: Self = Self(0);
pub const NSDateIntervalFormatterShortStyle: Self = Self(1);
pub const NSDateIntervalFormatterMediumStyle: Self = Self(2);
pub const NSDateIntervalFormatterLongStyle: Self = Self(3);
pub const NSDateIntervalFormatterFullStyle: Self = Self(4);
}
unsafe impl Encode for NSDateIntervalFormatterStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDateIntervalFormatterStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSDateIntervalFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSDateIntervalFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSFormatter")]
unsafe impl Send for NSDateIntervalFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl Sync for NSDateIntervalFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSDateIntervalFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSDateIntervalFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSDateIntervalFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateIntervalFormatter {
#[cfg(feature = "NSLocale")]
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Retained<NSLocale>;
#[cfg(feature = "NSLocale")]
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[cfg(feature = "NSCalendar")]
#[method_id(@__retain_semantics Other calendar)]
pub unsafe fn calendar(&self) -> Retained<NSCalendar>;
#[cfg(feature = "NSCalendar")]
#[method(setCalendar:)]
pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[cfg(feature = "NSTimeZone")]
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
#[cfg(feature = "NSTimeZone")]
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other dateTemplate)]
pub unsafe fn dateTemplate(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setDateTemplate:)]
pub unsafe fn setDateTemplate(&self, date_template: Option<&NSString>);
#[method(dateStyle)]
pub unsafe fn dateStyle(&self) -> NSDateIntervalFormatterStyle;
#[method(setDateStyle:)]
pub unsafe fn setDateStyle(&self, date_style: NSDateIntervalFormatterStyle);
#[method(timeStyle)]
pub unsafe fn timeStyle(&self) -> NSDateIntervalFormatterStyle;
#[method(setTimeStyle:)]
pub unsafe fn setTimeStyle(&self, time_style: NSDateIntervalFormatterStyle);
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromDate:toDate:)]
pub unsafe fn stringFromDate_toDate(
&self,
from_date: &NSDate,
to_date: &NSDate,
) -> Retained<NSString>;
#[cfg(all(feature = "NSDateInterval", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromDateInterval:)]
pub unsafe fn stringFromDateInterval(
&self,
date_interval: &NSDateInterval,
) -> Option<Retained<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSDateIntervalFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,141 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRoundingMode(pub NSUInteger);
impl NSRoundingMode {
pub const NSRoundPlain: Self = Self(0);
pub const NSRoundDown: Self = Self(1);
pub const NSRoundUp: Self = Self(2);
pub const NSRoundBankers: Self = Self(3);
}
unsafe impl Encode for NSRoundingMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSRoundingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCalculationError(pub NSUInteger);
impl NSCalculationError {
pub const NSCalculationNoError: Self = Self(0);
pub const NSCalculationLossOfPrecision: Self = Self(1);
pub const NSCalculationUnderflow: Self = Self(2);
pub const NSCalculationOverflow: Self = Self(3);
pub const NSCalculationDivideByZero: Self = Self(4);
}
unsafe impl Encode for NSCalculationError {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCalculationError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// TODO: pub fn NSDecimalIsNotANumber(dcm: NonNull<NSDecimal>,) -> Bool;
extern "C" {
pub fn NSDecimalCopy(destination: NonNull<NSDecimal>, source: NonNull<NSDecimal>);
}
extern "C" {
pub fn NSDecimalCompact(number: NonNull<NSDecimal>);
}
extern "C" {
#[cfg(feature = "NSObjCRuntime")]
pub fn NSDecimalCompare(
left_operand: NonNull<NSDecimal>,
right_operand: NonNull<NSDecimal>,
) -> NSComparisonResult;
}
extern "C" {
pub fn NSDecimalRound(
result: NonNull<NSDecimal>,
number: NonNull<NSDecimal>,
scale: NSInteger,
rounding_mode: NSRoundingMode,
);
}
extern "C" {
pub fn NSDecimalNormalize(
number1: NonNull<NSDecimal>,
number2: NonNull<NSDecimal>,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
pub fn NSDecimalAdd(
result: NonNull<NSDecimal>,
left_operand: NonNull<NSDecimal>,
right_operand: NonNull<NSDecimal>,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
pub fn NSDecimalSubtract(
result: NonNull<NSDecimal>,
left_operand: NonNull<NSDecimal>,
right_operand: NonNull<NSDecimal>,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
pub fn NSDecimalMultiply(
result: NonNull<NSDecimal>,
left_operand: NonNull<NSDecimal>,
right_operand: NonNull<NSDecimal>,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
pub fn NSDecimalDivide(
result: NonNull<NSDecimal>,
left_operand: NonNull<NSDecimal>,
right_operand: NonNull<NSDecimal>,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
pub fn NSDecimalPower(
result: NonNull<NSDecimal>,
number: NonNull<NSDecimal>,
power: NSUInteger,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
pub fn NSDecimalMultiplyByPowerOf10(
result: NonNull<NSDecimal>,
number: NonNull<NSDecimal>,
power: c_short,
rounding_mode: NSRoundingMode,
) -> NSCalculationError;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSDecimalString(
dcm: NonNull<NSDecimal>,
locale: Option<&AnyObject>,
) -> NonNull<NSString>;
}

View File

@@ -0,0 +1,383 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSDecimalNumberExactnessException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSDecimalNumberOverflowException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSDecimalNumberUnderflowException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSDecimalNumberDivideByZeroException: &'static NSExceptionName;
}
extern_protocol!(
pub unsafe trait NSDecimalNumberBehaviors {
#[cfg(feature = "NSDecimal")]
#[method(roundingMode)]
unsafe fn roundingMode(&self) -> NSRoundingMode;
#[method(scale)]
unsafe fn scale(&self) -> c_short;
#[cfg(all(feature = "NSDecimal", feature = "NSValue"))]
#[method_id(@__retain_semantics Other exceptionDuringOperation:error:leftOperand:rightOperand:)]
unsafe fn exceptionDuringOperation_error_leftOperand_rightOperand(
&self,
operation: Sel,
error: NSCalculationError,
left_operand: &NSDecimalNumber,
right_operand: Option<&NSDecimalNumber>,
) -> Option<Retained<NSDecimalNumber>>;
}
unsafe impl ProtocolType for dyn NSDecimalNumberBehaviors {}
);
extern_class!(
#[derive(Debug, PartialEq, Hash)]
#[cfg(feature = "NSValue")]
pub struct NSDecimalNumber;
#[cfg(feature = "NSValue")]
unsafe impl ClassType for NSDecimalNumber {
#[inherits(NSValue, NSObject)]
type Super = NSNumber;
type Mutability = Immutable;
}
);
#[cfg(feature = "NSValue")]
unsafe impl Send for NSDecimalNumber {}
#[cfg(feature = "NSValue")]
unsafe impl Sync for NSDecimalNumber {}
#[cfg(all(feature = "NSObject", feature = "NSValue"))]
unsafe impl NSCoding for NSDecimalNumber {}
#[cfg(all(feature = "NSObject", feature = "NSValue"))]
unsafe impl NSCopying for NSDecimalNumber {}
#[cfg(feature = "NSValue")]
unsafe impl NSObjectProtocol for NSDecimalNumber {}
#[cfg(all(feature = "NSObject", feature = "NSValue"))]
unsafe impl NSSecureCoding for NSDecimalNumber {}
extern_methods!(
#[cfg(feature = "NSValue")]
unsafe impl NSDecimalNumber {
#[method_id(@__retain_semantics Init initWithMantissa:exponent:isNegative:)]
pub unsafe fn initWithMantissa_exponent_isNegative(
this: Allocated<Self>,
mantissa: c_ulonglong,
exponent: c_short,
flag: bool,
) -> Retained<Self>;
#[cfg(feature = "NSDecimal")]
#[method_id(@__retain_semantics Init initWithDecimal:)]
pub unsafe fn initWithDecimal(this: Allocated<Self>, dcm: NSDecimal) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithString:)]
pub unsafe fn initWithString(
this: Allocated<Self>,
number_value: Option<&NSString>,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithString:locale:)]
pub unsafe fn initWithString_locale(
this: Allocated<Self>,
number_value: Option<&NSString>,
locale: Option<&AnyObject>,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionWithLocale:)]
pub unsafe fn descriptionWithLocale(
&self,
locale: Option<&AnyObject>,
) -> Retained<NSString>;
#[cfg(feature = "NSDecimal")]
#[method(decimalValue)]
pub unsafe fn decimalValue(&self) -> NSDecimal;
#[method_id(@__retain_semantics Other decimalNumberWithMantissa:exponent:isNegative:)]
pub unsafe fn decimalNumberWithMantissa_exponent_isNegative(
mantissa: c_ulonglong,
exponent: c_short,
flag: bool,
) -> Retained<NSDecimalNumber>;
#[cfg(feature = "NSDecimal")]
#[method_id(@__retain_semantics Other decimalNumberWithDecimal:)]
pub unsafe fn decimalNumberWithDecimal(dcm: NSDecimal) -> Retained<NSDecimalNumber>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decimalNumberWithString:)]
pub unsafe fn decimalNumberWithString(
number_value: Option<&NSString>,
) -> Retained<NSDecimalNumber>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decimalNumberWithString:locale:)]
pub unsafe fn decimalNumberWithString_locale(
number_value: Option<&NSString>,
locale: Option<&AnyObject>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other zero)]
pub unsafe fn zero() -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other one)]
pub unsafe fn one() -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other minimumDecimalNumber)]
pub unsafe fn minimumDecimalNumber() -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other maximumDecimalNumber)]
pub unsafe fn maximumDecimalNumber() -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other notANumber)]
pub unsafe fn notANumber() -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByAdding:)]
pub unsafe fn decimalNumberByAdding(
&self,
decimal_number: &NSDecimalNumber,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByAdding:withBehavior:)]
pub unsafe fn decimalNumberByAdding_withBehavior(
&self,
decimal_number: &NSDecimalNumber,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberBySubtracting:)]
pub unsafe fn decimalNumberBySubtracting(
&self,
decimal_number: &NSDecimalNumber,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberBySubtracting:withBehavior:)]
pub unsafe fn decimalNumberBySubtracting_withBehavior(
&self,
decimal_number: &NSDecimalNumber,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByMultiplyingBy:)]
pub unsafe fn decimalNumberByMultiplyingBy(
&self,
decimal_number: &NSDecimalNumber,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByMultiplyingBy:withBehavior:)]
pub unsafe fn decimalNumberByMultiplyingBy_withBehavior(
&self,
decimal_number: &NSDecimalNumber,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByDividingBy:)]
pub unsafe fn decimalNumberByDividingBy(
&self,
decimal_number: &NSDecimalNumber,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByDividingBy:withBehavior:)]
pub unsafe fn decimalNumberByDividingBy_withBehavior(
&self,
decimal_number: &NSDecimalNumber,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByRaisingToPower:)]
pub unsafe fn decimalNumberByRaisingToPower(
&self,
power: NSUInteger,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByRaisingToPower:withBehavior:)]
pub unsafe fn decimalNumberByRaisingToPower_withBehavior(
&self,
power: NSUInteger,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByMultiplyingByPowerOf10:)]
pub unsafe fn decimalNumberByMultiplyingByPowerOf10(
&self,
power: c_short,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByMultiplyingByPowerOf10:withBehavior:)]
pub unsafe fn decimalNumberByMultiplyingByPowerOf10_withBehavior(
&self,
power: c_short,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[method_id(@__retain_semantics Other decimalNumberByRoundingAccordingToBehavior:)]
pub unsafe fn decimalNumberByRoundingAccordingToBehavior(
&self,
behavior: Option<&ProtocolObject<dyn NSDecimalNumberBehaviors>>,
) -> Retained<NSDecimalNumber>;
#[cfg(feature = "NSObjCRuntime")]
#[method(compare:)]
pub unsafe fn compare(&self, decimal_number: &NSNumber) -> NSComparisonResult;
#[method_id(@__retain_semantics Other defaultBehavior)]
pub unsafe fn defaultBehavior() -> Retained<ProtocolObject<dyn NSDecimalNumberBehaviors>>;
#[method(setDefaultBehavior:)]
pub unsafe fn setDefaultBehavior(
default_behavior: &ProtocolObject<dyn NSDecimalNumberBehaviors>,
);
#[method(objCType)]
pub unsafe fn objCType(&self) -> NonNull<c_char>;
#[method(doubleValue)]
pub unsafe fn doubleValue(&self) -> c_double;
}
);
extern_methods!(
/// Methods declared on superclass `NSNumber`
#[cfg(feature = "NSValue")]
unsafe impl NSDecimalNumber {
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSValue`
#[cfg(feature = "NSValue")]
unsafe impl NSDecimalNumber {
#[method_id(@__retain_semantics Init initWithBytes:objCType:)]
pub unsafe fn initWithBytes_objCType(
this: Allocated<Self>,
value: NonNull<c_void>,
r#type: NonNull<c_char>,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSValue")]
unsafe impl NSDecimalNumber {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDecimalNumberHandler;
unsafe impl ClassType for NSDecimalNumberHandler {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSDecimalNumberHandler {}
unsafe impl Sync for NSDecimalNumberHandler {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSDecimalNumberHandler {}
unsafe impl NSDecimalNumberBehaviors for NSDecimalNumberHandler {}
unsafe impl NSObjectProtocol for NSDecimalNumberHandler {}
extern_methods!(
unsafe impl NSDecimalNumberHandler {
#[method_id(@__retain_semantics Other defaultDecimalNumberHandler)]
pub unsafe fn defaultDecimalNumberHandler() -> Retained<NSDecimalNumberHandler>;
#[cfg(feature = "NSDecimal")]
#[method_id(@__retain_semantics Init initWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:)]
pub unsafe fn initWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero(
this: Allocated<Self>,
rounding_mode: NSRoundingMode,
scale: c_short,
exact: bool,
overflow: bool,
underflow: bool,
divide_by_zero: bool,
) -> Retained<Self>;
#[cfg(feature = "NSDecimal")]
#[method_id(@__retain_semantics Other decimalNumberHandlerWithRoundingMode:scale:raiseOnExactness:raiseOnOverflow:raiseOnUnderflow:raiseOnDivideByZero:)]
pub unsafe fn decimalNumberHandlerWithRoundingMode_scale_raiseOnExactness_raiseOnOverflow_raiseOnUnderflow_raiseOnDivideByZero(
rounding_mode: NSRoundingMode,
scale: c_short,
exact: bool,
overflow: bool,
underflow: bool,
divide_by_zero: bool,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDecimalNumberHandler {
#[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!(
/// NSDecimalNumberExtensions
#[cfg(feature = "NSValue")]
unsafe impl NSNumber {
#[cfg(feature = "NSDecimal")]
#[method(decimalValue)]
pub unsafe fn decimalValue(&self) -> NSDecimal;
}
);
extern_methods!(
/// NSDecimalNumberScanning
#[cfg(feature = "NSScanner")]
unsafe impl NSScanner {
#[cfg(feature = "NSDecimal")]
#[method(scanDecimal:)]
pub unsafe fn scanDecimal(&self, dcm: *mut NSDecimal) -> bool;
}
);

View File

@@ -0,0 +1,578 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
for NSDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + IsIdCloneable, ObjectType: ?Sized + IsIdCloneable> NSCopying
for NSDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
for NSDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + IsIdCloneable, ObjectType: ?Sized + IsIdCloneable> NSMutableCopying
for NSDictionary<KeyType, ObjectType>
{
}
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
for NSDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
for NSDictionary<KeyType, ObjectType>
{
}
extern_methods!(
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[method(count)]
pub fn count(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other objectForKey:)]
pub unsafe fn objectForKey(&self, a_key: &KeyType) -> Option<Retained<ObjectType>>;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other keyEnumerator)]
pub unsafe fn keyEnumerator(&self) -> Retained<NSEnumerator<KeyType>>;
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Init initWithObjects:forKeys:count:)]
pub unsafe fn initWithObjects_forKeys_count(
this: Allocated<Self>,
objects: *mut NonNull<ObjectType>,
keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
cnt: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl<KeyType: Message, ObjectType: Message> DefaultRetained for NSDictionary<KeyType, ObjectType> {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_methods!(
/// NSExtendedDictionary
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allKeys)]
pub unsafe fn allKeys(&self) -> Retained<NSArray<KeyType>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allKeysForObject:)]
pub unsafe fn allKeysForObject(&self, an_object: &ObjectType)
-> Retained<NSArray<KeyType>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allValues)]
pub unsafe fn allValues(&self) -> Retained<NSArray<ObjectType>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other description)]
pub unsafe fn description(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionInStringsFileFormat)]
pub unsafe fn descriptionInStringsFileFormat(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionWithLocale:)]
pub unsafe fn descriptionWithLocale(
&self,
locale: Option<&AnyObject>,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other descriptionWithLocale:indent:)]
pub unsafe fn descriptionWithLocale_indent(
&self,
locale: Option<&AnyObject>,
level: NSUInteger,
) -> Retained<NSString>;
#[method(isEqualToDictionary:)]
pub unsafe fn isEqualToDictionary(
&self,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
) -> bool;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other objectEnumerator)]
pub unsafe fn objectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other objectsForKeys:notFoundMarker:)]
pub unsafe fn objectsForKeys_notFoundMarker(
&self,
keys: &NSArray<KeyType>,
marker: &ObjectType,
) -> Retained<NSArray<ObjectType>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method(writeToURL:error:_)]
pub unsafe fn writeToURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other keysSortedByValueUsingSelector:)]
pub unsafe fn keysSortedByValueUsingSelector(
&self,
comparator: Sel,
) -> Retained<NSArray<KeyType>>;
#[method(getObjects:andKeys:count:)]
pub unsafe fn getObjects_andKeys_count(
&self,
objects: *mut NonNull<ObjectType>,
keys: *mut NonNull<KeyType>,
count: NSUInteger,
);
#[method_id(@__retain_semantics Other objectForKeyedSubscript:)]
pub unsafe fn objectForKeyedSubscript(&self, key: &KeyType)
-> Option<Retained<ObjectType>>;
#[cfg(feature = "block2")]
#[method(enumerateKeysAndObjectsUsingBlock:)]
pub unsafe fn enumerateKeysAndObjectsUsingBlock(
&self,
block: &block2::Block<
dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) + '_,
>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(enumerateKeysAndObjectsWithOptions:usingBlock:)]
pub unsafe fn enumerateKeysAndObjectsWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &block2::Block<
dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) + '_,
>,
);
#[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other keysSortedByValueUsingComparator:)]
pub unsafe fn keysSortedByValueUsingComparator(
&self,
cmptr: NSComparator,
) -> Retained<NSArray<KeyType>>;
#[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other keysSortedByValueWithOptions:usingComparator:)]
pub unsafe fn keysSortedByValueWithOptions_usingComparator(
&self,
opts: NSSortOptions,
cmptr: NSComparator,
) -> Retained<NSArray<KeyType>>;
#[cfg(all(feature = "NSSet", feature = "block2"))]
#[method_id(@__retain_semantics Other keysOfEntriesPassingTest:)]
pub unsafe fn keysOfEntriesPassingTest(
&self,
predicate: &block2::Block<
dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) -> Bool + '_,
>,
) -> Retained<NSSet<KeyType>>;
#[cfg(all(feature = "NSObjCRuntime", feature = "NSSet", feature = "block2"))]
#[method_id(@__retain_semantics Other keysOfEntriesWithOptions:passingTest:)]
pub unsafe fn keysOfEntriesWithOptions_passingTest(
&self,
opts: NSEnumerationOptions,
predicate: &block2::Block<
dyn Fn(NonNull<KeyType>, NonNull<ObjectType>, NonNull<Bool>) -> Bool + '_,
>,
) -> Retained<NSSet<KeyType>>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[deprecated = "Use -getObjects:andKeys:count: instead"]
#[method(getObjects:andKeys:)]
pub unsafe fn getObjects_andKeys(
&self,
objects: *mut NonNull<ObjectType>,
keys: *mut NonNull<KeyType>,
);
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other dictionaryWithContentsOfFile:)]
pub unsafe fn dictionaryWithContentsOfFile(
path: &NSString,
) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSURL")]
#[deprecated]
#[method_id(@__retain_semantics Other dictionaryWithContentsOfURL:)]
pub unsafe fn dictionaryWithContentsOfURL(
url: &NSURL,
) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Init initWithContentsOfFile:)]
pub unsafe fn initWithContentsOfFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSURL")]
#[deprecated]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<NSDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method(writeToFile:atomically:)]
pub unsafe fn writeToFile_atomically(
&self,
path: &NSString,
use_auxiliary_file: bool,
) -> bool;
#[cfg(feature = "NSURL")]
#[deprecated]
#[method(writeToURL:atomically:)]
pub unsafe fn writeToURL_atomically(&self, url: &NSURL, atomically: bool) -> bool;
}
);
extern_methods!(
/// NSDictionaryCreation
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[method_id(@__retain_semantics Other dictionary)]
pub unsafe fn dictionary() -> Retained<Self>;
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Other dictionaryWithObject:forKey:)]
pub unsafe fn dictionaryWithObject_forKey(
object: &ObjectType,
key: &ProtocolObject<dyn NSCopying>,
) -> Retained<Self>;
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Other dictionaryWithObjects:forKeys:count:)]
pub unsafe fn dictionaryWithObjects_forKeys_count(
objects: *mut NonNull<ObjectType>,
keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
cnt: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other dictionaryWithDictionary:)]
pub unsafe fn dictionaryWithDictionary(
dict: &NSDictionary<KeyType, ObjectType>,
) -> Retained<Self>;
#[cfg(all(feature = "NSArray", feature = "NSObject"))]
#[method_id(@__retain_semantics Other dictionaryWithObjects:forKeys:)]
pub unsafe fn dictionaryWithObjects_forKeys(
objects: &NSArray<ObjectType>,
keys: &NSArray<ProtocolObject<dyn NSCopying>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithDictionary:)]
pub unsafe fn initWithDictionary(
this: Allocated<Self>,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithDictionary:copyItems:)]
pub unsafe fn initWithDictionary_copyItems(
this: Allocated<Self>,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
flag: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSArray", feature = "NSObject"))]
#[method_id(@__retain_semantics Init initWithObjects:forKeys:)]
pub unsafe fn initWithObjects_forKeys(
this: Allocated<Self>,
objects: &NSArray<ObjectType>,
keys: &NSArray<ProtocolObject<dyn NSCopying>>,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSDictionary`
///
/// NSDictionaryCreation
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[method_id(@__retain_semantics Other dictionary)]
pub unsafe fn dictionary() -> Retained<Self>;
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Other dictionaryWithObject:forKey:)]
pub unsafe fn dictionaryWithObject_forKey(
object: &ObjectType,
key: &ProtocolObject<dyn NSCopying>,
) -> Retained<Self>;
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Other dictionaryWithObjects:forKeys:count:)]
pub unsafe fn dictionaryWithObjects_forKeys_count(
objects: *mut NonNull<ObjectType>,
keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
cnt: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other dictionaryWithDictionary:)]
pub unsafe fn dictionaryWithDictionary(
dict: &NSDictionary<KeyType, ObjectType>,
) -> Retained<Self>;
#[cfg(all(feature = "NSArray", feature = "NSObject"))]
#[method_id(@__retain_semantics Other dictionaryWithObjects:forKeys:)]
pub unsafe fn dictionaryWithObjects_forKeys(
objects: &NSArray<ObjectType>,
keys: &NSArray<ProtocolObject<dyn NSCopying>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithDictionary:)]
pub unsafe fn initWithDictionary(
this: Allocated<Self>,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithDictionary:copyItems:)]
pub unsafe fn initWithDictionary_copyItems(
this: Allocated<Self>,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
flag: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSArray", feature = "NSObject"))]
#[method_id(@__retain_semantics Init initWithObjects:forKeys:)]
pub unsafe fn initWithObjects_forKeys(
this: Allocated<Self>,
objects: &NSArray<ObjectType>,
keys: &NSArray<ProtocolObject<dyn NSCopying>>,
) -> Retained<Self>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
for NSMutableDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + IsIdCloneable, ObjectType: ?Sized + IsIdCloneable> NSCopying
for NSMutableDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
for NSMutableDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + IsIdCloneable, ObjectType: ?Sized + IsIdCloneable> NSMutableCopying
for NSMutableDictionary<KeyType, ObjectType>
{
}
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
for NSMutableDictionary<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
for NSMutableDictionary<KeyType, ObjectType>
{
}
extern_methods!(
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[method(removeObjectForKey:)]
pub fn removeObjectForKey(&mut self, a_key: &KeyType);
#[cfg(feature = "NSObject")]
#[method(setObject:forKey:)]
pub unsafe fn setObject_forKey(
&mut self,
an_object: &ObjectType,
a_key: &ProtocolObject<dyn NSCopying>,
);
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCapacity:)]
pub unsafe fn initWithCapacity(
this: Allocated<Self>,
num_items: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSDictionary`
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Init initWithObjects:forKeys:count:)]
pub unsafe fn initWithObjects_forKeys_count(
this: Allocated<Self>,
objects: *mut NonNull<ObjectType>,
keys: *mut NonNull<ProtocolObject<dyn NSCopying>>,
cnt: NSUInteger,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl<KeyType: Message, ObjectType: Message> DefaultRetained
for NSMutableDictionary<KeyType, ObjectType>
{
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_methods!(
/// NSExtendedMutableDictionary
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[method(addEntriesFromDictionary:)]
pub unsafe fn addEntriesFromDictionary(
&mut self,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
);
#[method(removeAllObjects)]
pub fn removeAllObjects(&mut self);
#[cfg(feature = "NSArray")]
#[method(removeObjectsForKeys:)]
pub unsafe fn removeObjectsForKeys(&mut self, key_array: &NSArray<KeyType>);
#[method(setDictionary:)]
pub unsafe fn setDictionary(
&mut self,
other_dictionary: &NSDictionary<KeyType, ObjectType>,
);
#[cfg(feature = "NSObject")]
#[method(setObject:forKeyedSubscript:)]
pub unsafe fn setObject_forKeyedSubscript(
&mut self,
obj: Option<&ObjectType>,
key: &ProtocolObject<dyn NSCopying>,
);
}
);
extern_methods!(
/// NSMutableDictionaryCreation
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[method_id(@__retain_semantics Other dictionaryWithCapacity:)]
pub unsafe fn dictionaryWithCapacity(num_items: NSUInteger) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other dictionaryWithContentsOfFile:)]
pub unsafe fn dictionaryWithContentsOfFile(
path: &NSString,
) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other dictionaryWithContentsOfURL:)]
pub unsafe fn dictionaryWithContentsOfURL(
url: &NSURL,
) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithContentsOfFile:)]
pub unsafe fn initWithContentsOfFile(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
url: &NSURL,
) -> Option<Retained<NSMutableDictionary<KeyType, ObjectType>>>;
}
);
extern_methods!(
/// NSSharedKeySetDictionary
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[cfg(all(feature = "NSArray", feature = "NSObject"))]
#[method_id(@__retain_semantics Other sharedKeySetForKeys:)]
pub unsafe fn sharedKeySetForKeys(
keys: &NSArray<ProtocolObject<dyn NSCopying>>,
) -> Retained<AnyObject>;
}
);
extern_methods!(
/// NSSharedKeySetDictionary
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[method_id(@__retain_semantics Other dictionaryWithSharedKeySet:)]
pub unsafe fn dictionaryWithSharedKeySet(
keyset: &AnyObject,
) -> Retained<NSMutableDictionary<KeyType, ObjectType>>;
}
);

View File

@@ -0,0 +1,80 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSProxy")]
#[deprecated = "Use NSXPCConnection instead"]
pub struct NSDistantObject;
#[cfg(feature = "NSProxy")]
unsafe impl ClassType for NSDistantObject {
type Super = NSProxy;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSObject", feature = "NSProxy"))]
unsafe impl NSCoding for NSDistantObject {}
#[cfg(feature = "NSProxy")]
unsafe impl NSObjectProtocol for NSDistantObject {}
extern_methods!(
#[cfg(feature = "NSProxy")]
unsafe impl NSDistantObject {
#[cfg(feature = "NSConnection")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other proxyWithTarget:connection:)]
pub unsafe fn proxyWithTarget_connection(
target: &AnyObject,
connection: &NSConnection,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSConnection")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Init initWithTarget:connection:)]
pub unsafe fn initWithTarget_connection(
this: Allocated<Self>,
target: &AnyObject,
connection: &NSConnection,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSConnection")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other proxyWithLocal:connection:)]
pub unsafe fn proxyWithLocal_connection(
target: &AnyObject,
connection: &NSConnection,
) -> Retained<AnyObject>;
#[cfg(feature = "NSConnection")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Init initWithLocal:connection:)]
pub unsafe fn initWithLocal_connection(
this: Allocated<Self>,
target: &AnyObject,
connection: &NSConnection,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
in_coder: &NSCoder,
) -> Option<Retained<Self>>;
#[deprecated = "Use NSXPCConnection instead"]
#[method(setProtocolForProxy:)]
pub unsafe fn setProtocolForProxy(&self, proto: Option<&AnyProtocol>);
#[cfg(feature = "NSConnection")]
#[deprecated = "Use NSXPCConnection instead"]
#[method_id(@__retain_semantics Other connectionForProxy)]
pub unsafe fn connectionForProxy(&self) -> Retained<NSConnection>;
}
);

View File

@@ -0,0 +1,60 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDistributedLock;
unsafe impl ClassType for NSDistributedLock {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSDistributedLock {}
unsafe impl Sync for NSDistributedLock {}
unsafe impl NSObjectProtocol for NSDistributedLock {}
extern_methods!(
unsafe impl NSDistributedLock {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other lockWithPath:)]
pub unsafe fn lockWithPath(path: &NSString) -> Option<Retained<NSDistributedLock>>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithPath:)]
pub unsafe fn initWithPath(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[method(tryLock)]
pub unsafe fn tryLock(&self) -> bool;
#[method(unlock)]
pub unsafe fn unlock(&self);
#[method(breakLock)]
pub unsafe fn breakLock(&self);
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other lockDate)]
pub unsafe fn lockDate(&self) -> Retained<NSDate>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDistributedLock {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,181 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSDistributedNotificationCenterType = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocalNotificationCenterType: &'static NSDistributedNotificationCenterType;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNotificationSuspensionBehavior(pub NSUInteger);
impl NSNotificationSuspensionBehavior {
#[doc(alias = "NSNotificationSuspensionBehaviorDrop")]
pub const Drop: Self = Self(1);
#[doc(alias = "NSNotificationSuspensionBehaviorCoalesce")]
pub const Coalesce: Self = Self(2);
#[doc(alias = "NSNotificationSuspensionBehaviorHold")]
pub const Hold: Self = Self(3);
#[doc(alias = "NSNotificationSuspensionBehaviorDeliverImmediately")]
pub const DeliverImmediately: Self = Self(4);
}
unsafe impl Encode for NSNotificationSuspensionBehavior {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNotificationSuspensionBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDistributedNotificationOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDistributedNotificationOptions: NSUInteger {
const NSDistributedNotificationDeliverImmediately = 1<<0;
const NSDistributedNotificationPostToAllSessions = 1<<1;
}
}
unsafe impl Encode for NSDistributedNotificationOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDistributedNotificationOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSNotificationDeliverImmediately: NSDistributedNotificationOptions =
NSDistributedNotificationOptions(
NSDistributedNotificationOptions::NSDistributedNotificationDeliverImmediately.0,
);
pub static NSNotificationPostToAllSessions: NSDistributedNotificationOptions =
NSDistributedNotificationOptions(
NSDistributedNotificationOptions::NSDistributedNotificationPostToAllSessions.0,
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSNotification")]
pub struct NSDistributedNotificationCenter;
#[cfg(feature = "NSNotification")]
unsafe impl ClassType for NSDistributedNotificationCenter {
#[inherits(NSObject)]
type Super = NSNotificationCenter;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSNotification")]
unsafe impl NSObjectProtocol for NSDistributedNotificationCenter {}
extern_methods!(
#[cfg(feature = "NSNotification")]
unsafe impl NSDistributedNotificationCenter {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other notificationCenterForType:)]
pub unsafe fn notificationCenterForType(
notification_center_type: &NSDistributedNotificationCenterType,
) -> Retained<NSDistributedNotificationCenter>;
#[method_id(@__retain_semantics Other defaultCenter)]
pub unsafe fn defaultCenter() -> Retained<NSDistributedNotificationCenter>;
#[cfg(feature = "NSString")]
#[method(addObserver:selector:name:object:suspensionBehavior:)]
pub unsafe fn addObserver_selector_name_object_suspensionBehavior(
&self,
observer: &AnyObject,
selector: Sel,
name: Option<&NSNotificationName>,
object: Option<&NSString>,
suspension_behavior: NSNotificationSuspensionBehavior,
);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(postNotificationName:object:userInfo:deliverImmediately:)]
pub unsafe fn postNotificationName_object_userInfo_deliverImmediately(
&self,
name: &NSNotificationName,
object: Option<&NSString>,
user_info: Option<&NSDictionary>,
deliver_immediately: bool,
);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(postNotificationName:object:userInfo:options:)]
pub unsafe fn postNotificationName_object_userInfo_options(
&self,
name: &NSNotificationName,
object: Option<&NSString>,
user_info: Option<&NSDictionary>,
options: NSDistributedNotificationOptions,
);
#[method(suspended)]
pub unsafe fn suspended(&self) -> bool;
#[method(setSuspended:)]
pub unsafe fn setSuspended(&self, suspended: bool);
#[cfg(feature = "NSString")]
#[method(addObserver:selector:name:object:)]
pub unsafe fn addObserver_selector_name_object(
&self,
observer: &AnyObject,
a_selector: Sel,
a_name: Option<&NSNotificationName>,
an_object: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[method(postNotificationName:object:)]
pub unsafe fn postNotificationName_object(
&self,
a_name: &NSNotificationName,
an_object: Option<&NSString>,
);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(postNotificationName:object:userInfo:)]
pub unsafe fn postNotificationName_object_userInfo(
&self,
a_name: &NSNotificationName,
an_object: Option<&NSString>,
a_user_info: Option<&NSDictionary>,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:name:object:)]
pub unsafe fn removeObserver_name_object(
&self,
observer: &AnyObject,
a_name: Option<&NSNotificationName>,
an_object: Option<&NSString>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSNotification")]
unsafe impl NSDistributedNotificationCenter {
#[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>;
}
);

View File

@@ -0,0 +1,124 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEnergyFormatterUnit(pub NSInteger);
impl NSEnergyFormatterUnit {
#[doc(alias = "NSEnergyFormatterUnitJoule")]
pub const Joule: Self = Self(11);
#[doc(alias = "NSEnergyFormatterUnitKilojoule")]
pub const Kilojoule: Self = Self(14);
#[doc(alias = "NSEnergyFormatterUnitCalorie")]
pub const Calorie: Self = Self((7 << 8) + 1);
#[doc(alias = "NSEnergyFormatterUnitKilocalorie")]
pub const Kilocalorie: Self = Self((7 << 8) + 2);
}
unsafe impl Encode for NSEnergyFormatterUnit {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSEnergyFormatterUnit {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSEnergyFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSEnergyFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSEnergyFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSEnergyFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSEnergyFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSEnergyFormatter {
#[cfg(feature = "NSNumberFormatter")]
#[method_id(@__retain_semantics Other numberFormatter)]
pub unsafe fn numberFormatter(&self) -> Retained<NSNumberFormatter>;
#[cfg(feature = "NSNumberFormatter")]
#[method(setNumberFormatter:)]
pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
#[method(unitStyle)]
pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
#[method(setUnitStyle:)]
pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
#[method(isForFoodEnergyUse)]
pub unsafe fn isForFoodEnergyUse(&self) -> bool;
#[method(setForFoodEnergyUse:)]
pub unsafe fn setForFoodEnergyUse(&self, for_food_energy_use: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromValue:unit:)]
pub unsafe fn stringFromValue_unit(
&self,
value: c_double,
unit: NSEnergyFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromJoules:)]
pub unsafe fn stringFromJoules(&self, number_in_joules: c_double) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other unitStringFromValue:unit:)]
pub unsafe fn unitStringFromValue_unit(
&self,
value: c_double,
unit: NSEnergyFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other unitStringFromJoules:usedUnit:)]
pub unsafe fn unitStringFromJoules_usedUnit(
&self,
number_in_joules: c_double,
unitp: *mut NSEnergyFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(getObjectValue:forString:errorDescription:)]
pub unsafe fn getObjectValue_forString_errorDescription(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSEnergyFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,50 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSFastEnumeration {
#[method(countByEnumeratingWithState:objects:count:)]
unsafe fn countByEnumeratingWithState_objects_count(
&self,
state: NonNull<NSFastEnumerationState>,
buffer: NonNull<*mut AnyObject>,
len: NSUInteger,
) -> NSUInteger;
}
unsafe impl ProtocolType for dyn NSFastEnumeration {}
);
unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSEnumerator<ObjectType> {}
unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSEnumerator<ObjectType> {}
extern_methods!(
unsafe impl<ObjectType: Message> NSEnumerator<ObjectType> {
#[method_id(@__retain_semantics Other nextObject)]
pub fn nextObject(&mut self) -> Option<Retained<ObjectType>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<ObjectType: Message> NSEnumerator<ObjectType> {
#[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!(
/// NSExtendedEnumerator
unsafe impl<ObjectType: Message> NSEnumerator<ObjectType> {
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allObjects)]
pub fn allObjects(&self) -> Retained<NSArray<ObjectType>>;
}
);

View File

@@ -0,0 +1,232 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSString")]
pub type NSErrorDomain = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCocoaErrorDomain: &'static NSErrorDomain;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSPOSIXErrorDomain: &'static NSErrorDomain;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSOSStatusErrorDomain: &'static NSErrorDomain;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMachErrorDomain: &'static NSErrorDomain;
}
#[cfg(feature = "NSString")]
pub type NSErrorUserInfoKey = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSUnderlyingErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMultipleUnderlyingErrorsKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocalizedDescriptionKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocalizedFailureReasonErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocalizedRecoverySuggestionErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocalizedRecoveryOptionsErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSRecoveryAttempterErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHelpAnchorErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSDebugDescriptionErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocalizedFailureErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSStringEncodingErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSURLErrorKey: &'static NSErrorUserInfoKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSFilePathErrorKey: &'static NSErrorUserInfoKey;
}
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSError;
unsafe impl ClassType for NSError {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSError {}
unsafe impl Sync for NSError {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSError {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSError {}
unsafe impl NSObjectProtocol for NSError {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSError {}
extern_methods!(
unsafe impl NSError {
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithDomain:code:userInfo:)]
pub unsafe fn initWithDomain_code_userInfo(
this: Allocated<Self>,
domain: &NSErrorDomain,
code: NSInteger,
dict: Option<&NSDictionary<NSErrorUserInfoKey, AnyObject>>,
) -> Retained<Self>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other errorWithDomain:code:userInfo:)]
pub unsafe fn errorWithDomain_code_userInfo(
domain: &NSErrorDomain,
code: NSInteger,
dict: Option<&NSDictionary<NSErrorUserInfoKey, AnyObject>>,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other domain)]
pub fn domain(&self) -> Retained<NSErrorDomain>;
#[method(code)]
pub fn code(&self) -> NSInteger;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other userInfo)]
pub fn userInfo(&self) -> Retained<NSDictionary<NSErrorUserInfoKey, AnyObject>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedDescription)]
pub fn localizedDescription(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedFailureReason)]
pub unsafe fn localizedFailureReason(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedRecoverySuggestion)]
pub unsafe fn localizedRecoverySuggestion(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other localizedRecoveryOptions)]
pub unsafe fn localizedRecoveryOptions(&self) -> Option<Retained<NSArray<NSString>>>;
#[method_id(@__retain_semantics Other recoveryAttempter)]
pub unsafe fn recoveryAttempter(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other helpAnchor)]
pub unsafe fn helpAnchor(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other underlyingErrors)]
pub unsafe fn underlyingErrors(&self) -> Retained<NSArray<NSError>>;
#[cfg(all(feature = "NSString", feature = "block2"))]
#[method(setUserInfoValueProviderForDomain:provider:)]
pub unsafe fn setUserInfoValueProviderForDomain_provider(
error_domain: &NSErrorDomain,
provider: Option<
&block2::Block<
dyn Fn(NonNull<NSError>, NonNull<NSErrorUserInfoKey>) -> *mut AnyObject,
>,
>,
);
#[cfg(all(feature = "NSString", feature = "block2"))]
#[method(userInfoValueProviderForDomain:)]
pub unsafe fn userInfoValueProviderForDomain(
error_domain: &NSErrorDomain,
) -> *mut block2::Block<
dyn Fn(NonNull<NSError>, NonNull<NSErrorUserInfoKey>) -> *mut AnyObject,
>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSError {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_category!(
/// Category "NSErrorRecoveryAttempting" on [`NSObject`].
#[doc(alias = "NSErrorRecoveryAttempting")]
pub unsafe trait NSObjectNSErrorRecoveryAttempting {
#[method(attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:)]
unsafe fn attemptRecoveryFromError_optionIndex_delegate_didRecoverSelector_contextInfo(
&self,
error: &NSError,
recovery_option_index: NSUInteger,
delegate: Option<&AnyObject>,
did_recover_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(attemptRecoveryFromError:optionIndex:)]
unsafe fn attemptRecoveryFromError_optionIndex(
&self,
error: &NSError,
recovery_option_index: NSUInteger,
) -> bool;
}
unsafe impl NSObjectNSErrorRecoveryAttempting for NSObject {}
);

View File

@@ -0,0 +1,208 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSGenericException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSRangeException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInvalidArgumentException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInternalInconsistencyException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSMallocException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSObjectInaccessibleException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSObjectNotAvailableException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSDestinationInvalidException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSPortTimeoutException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInvalidSendPortException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInvalidReceivePortException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSPortSendException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSPortReceiveException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSOldStyleException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInconsistentArchiveException: &'static NSExceptionName;
}
extern_class!(
#[derive(PartialEq, Eq, Hash)]
pub struct NSException;
unsafe impl ClassType for NSException {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSException {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSException {}
unsafe impl NSObjectProtocol for NSException {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSException {}
extern_methods!(
unsafe impl NSException {
#[cfg(all(
feature = "NSDictionary",
feature = "NSObjCRuntime",
feature = "NSString"
))]
#[method_id(@__retain_semantics Other exceptionWithName:reason:userInfo:)]
pub unsafe fn exceptionWithName_reason_userInfo(
name: &NSExceptionName,
reason: Option<&NSString>,
user_info: Option<&NSDictionary>,
) -> Retained<NSException>;
#[cfg(all(
feature = "NSDictionary",
feature = "NSObjCRuntime",
feature = "NSString"
))]
#[method_id(@__retain_semantics Init initWithName:reason:userInfo:)]
pub unsafe fn initWithName_reason_userInfo(
this: Allocated<Self>,
a_name: &NSExceptionName,
a_reason: Option<&NSString>,
a_user_info: Option<&NSDictionary>,
) -> Retained<Self>;
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Retained<NSExceptionName>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other reason)]
pub fn reason(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSDictionary")]
#[method_id(@__retain_semantics Other userInfo)]
pub fn userInfo(&self) -> Option<Retained<NSDictionary>>;
#[cfg(all(feature = "NSArray", feature = "NSValue"))]
#[method_id(@__retain_semantics Other callStackReturnAddresses)]
pub unsafe fn callStackReturnAddresses(&self) -> Retained<NSArray<NSNumber>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other callStackSymbols)]
pub unsafe fn callStackSymbols(&self) -> Retained<NSArray<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSException {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// NSExceptionRaisingConveniences
unsafe impl NSException {}
);
pub type NSUncaughtExceptionHandler = TodoFunction;
extern "C" {
pub fn NSGetUncaughtExceptionHandler() -> *mut NSUncaughtExceptionHandler;
}
extern "C" {
pub fn NSSetUncaughtExceptionHandler(_: *mut NSUncaughtExceptionHandler);
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAssertionHandlerKey: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAssertionHandler;
unsafe impl ClassType for NSAssertionHandler {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAssertionHandler {}
extern_methods!(
unsafe impl NSAssertionHandler {
#[method_id(@__retain_semantics Other currentHandler)]
pub unsafe fn currentHandler() -> Retained<NSAssertionHandler>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAssertionHandler {
#[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>;
}
);

View File

@@ -0,0 +1,244 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSExpressionType(pub NSUInteger);
impl NSExpressionType {
pub const NSConstantValueExpressionType: Self = Self(0);
pub const NSEvaluatedObjectExpressionType: Self = Self(1);
pub const NSVariableExpressionType: Self = Self(2);
pub const NSKeyPathExpressionType: Self = Self(3);
pub const NSFunctionExpressionType: Self = Self(4);
pub const NSUnionSetExpressionType: Self = Self(5);
pub const NSIntersectSetExpressionType: Self = Self(6);
pub const NSMinusSetExpressionType: Self = Self(7);
pub const NSSubqueryExpressionType: Self = Self(13);
pub const NSAggregateExpressionType: Self = Self(14);
pub const NSAnyKeyExpressionType: Self = Self(15);
pub const NSBlockExpressionType: Self = Self(19);
pub const NSConditionalExpressionType: Self = Self(20);
}
unsafe impl Encode for NSExpressionType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSExpressionType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSExpression;
unsafe impl ClassType for NSExpression {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSExpression {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSExpression {}
unsafe impl NSObjectProtocol for NSExpression {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSExpression {}
extern_methods!(
unsafe impl NSExpression {
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other expressionWithFormat:argumentArray:)]
pub unsafe fn expressionWithFormat_argumentArray(
expression_format: &NSString,
arguments: &NSArray,
) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other expressionForConstantValue:)]
pub unsafe fn expressionForConstantValue(obj: Option<&AnyObject>)
-> Retained<NSExpression>;
#[method_id(@__retain_semantics Other expressionForEvaluatedObject)]
pub unsafe fn expressionForEvaluatedObject() -> Retained<NSExpression>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other expressionForVariable:)]
pub unsafe fn expressionForVariable(string: &NSString) -> Retained<NSExpression>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other expressionForKeyPath:)]
pub unsafe fn expressionForKeyPath(key_path: &NSString) -> Retained<NSExpression>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other expressionForFunction:arguments:)]
pub unsafe fn expressionForFunction_arguments(
name: &NSString,
parameters: &NSArray,
) -> Retained<NSExpression>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other expressionForAggregate:)]
pub unsafe fn expressionForAggregate(
subexpressions: &NSArray<NSExpression>,
) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other expressionForUnionSet:with:)]
pub unsafe fn expressionForUnionSet_with(
left: &NSExpression,
right: &NSExpression,
) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other expressionForIntersectSet:with:)]
pub unsafe fn expressionForIntersectSet_with(
left: &NSExpression,
right: &NSExpression,
) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other expressionForMinusSet:with:)]
pub unsafe fn expressionForMinusSet_with(
left: &NSExpression,
right: &NSExpression,
) -> Retained<NSExpression>;
#[cfg(all(feature = "NSPredicate", feature = "NSString"))]
#[method_id(@__retain_semantics Other expressionForSubquery:usingIteratorVariable:predicate:)]
pub unsafe fn expressionForSubquery_usingIteratorVariable_predicate(
expression: &NSExpression,
variable: &NSString,
predicate: &NSPredicate,
) -> Retained<NSExpression>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other expressionForFunction:selectorName:arguments:)]
pub unsafe fn expressionForFunction_selectorName_arguments(
target: &NSExpression,
name: &NSString,
parameters: Option<&NSArray>,
) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other expressionForAnyKey)]
pub unsafe fn expressionForAnyKey() -> Retained<NSExpression>;
#[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "block2"))]
#[method_id(@__retain_semantics Other expressionForBlock:arguments:)]
pub unsafe fn expressionForBlock_arguments(
block: &block2::Block<
dyn Fn(
*mut AnyObject,
NonNull<NSArray<NSExpression>>,
*mut NSMutableDictionary,
) -> NonNull<AnyObject>,
>,
arguments: Option<&NSArray<NSExpression>>,
) -> Retained<NSExpression>;
#[cfg(feature = "NSPredicate")]
#[method_id(@__retain_semantics Other expressionForConditional:trueExpression:falseExpression:)]
pub unsafe fn expressionForConditional_trueExpression_falseExpression(
predicate: &NSPredicate,
true_expression: &NSExpression,
false_expression: &NSExpression,
) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Init initWithExpressionType:)]
pub unsafe fn initWithExpressionType(
this: Allocated<Self>,
r#type: NSExpressionType,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(expressionType)]
pub unsafe fn expressionType(&self) -> NSExpressionType;
#[method_id(@__retain_semantics Other constantValue)]
pub unsafe fn constantValue(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other keyPath)]
pub unsafe fn keyPath(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other function)]
pub unsafe fn function(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other variable)]
pub unsafe fn variable(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other operand)]
pub unsafe fn operand(&self) -> Retained<NSExpression>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other arguments)]
pub unsafe fn arguments(&self) -> Option<Retained<NSArray<NSExpression>>>;
#[method_id(@__retain_semantics Other collection)]
pub unsafe fn collection(&self) -> Retained<AnyObject>;
#[cfg(feature = "NSPredicate")]
#[method_id(@__retain_semantics Other predicate)]
pub unsafe fn predicate(&self) -> Retained<NSPredicate>;
#[method_id(@__retain_semantics Other leftExpression)]
pub unsafe fn leftExpression(&self) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other rightExpression)]
pub unsafe fn rightExpression(&self) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other trueExpression)]
pub unsafe fn trueExpression(&self) -> Retained<NSExpression>;
#[method_id(@__retain_semantics Other falseExpression)]
pub unsafe fn falseExpression(&self) -> Retained<NSExpression>;
#[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "block2"))]
#[method(expressionBlock)]
pub unsafe fn expressionBlock(
&self,
) -> NonNull<
block2::Block<
dyn Fn(
*mut AnyObject,
NonNull<NSArray<NSExpression>>,
*mut NSMutableDictionary,
) -> NonNull<AnyObject>,
>,
>;
#[cfg(feature = "NSDictionary")]
#[method_id(@__retain_semantics Other expressionValueWithObject:context:)]
pub unsafe fn expressionValueWithObject_context(
&self,
object: Option<&AnyObject>,
context: Option<&NSMutableDictionary>,
) -> Option<Retained<AnyObject>>;
#[method(allowEvaluation)]
pub unsafe fn allowEvaluation(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSExpression {
#[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>;
}
);

View File

@@ -0,0 +1,81 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSExtensionContext;
unsafe impl ClassType for NSExtensionContext {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSExtensionContext {}
extern_methods!(
unsafe impl NSExtensionContext {
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other inputItems)]
pub unsafe fn inputItems(&self) -> Retained<NSArray>;
#[cfg(all(feature = "NSArray", feature = "block2"))]
#[method(completeRequestReturningItems:completionHandler:)]
pub unsafe fn completeRequestReturningItems_completionHandler(
&self,
items: Option<&NSArray>,
completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[cfg(feature = "NSError")]
#[method(cancelRequestWithError:)]
pub unsafe fn cancelRequestWithError(&self, error: &NSError);
#[cfg(all(feature = "NSURL", feature = "block2"))]
#[method(openURL:completionHandler:)]
pub unsafe fn openURL_completionHandler(
&self,
url: &NSURL,
completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSExtensionContext {
#[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 "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionItemsAndErrorsKey: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionHostWillEnterForegroundNotification: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionHostDidEnterBackgroundNotification: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionHostWillResignActiveNotification: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionHostDidBecomeActiveNotification: Option<&'static NSString>;
}

View File

@@ -0,0 +1,91 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSExtensionItem;
unsafe impl ClassType for NSExtensionItem {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSExtensionItem {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSExtensionItem {}
unsafe impl NSObjectProtocol for NSExtensionItem {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSExtensionItem {}
extern_methods!(
unsafe impl NSExtensionItem {
#[cfg(feature = "NSAttributedString")]
#[method_id(@__retain_semantics Other attributedTitle)]
pub unsafe fn attributedTitle(&self) -> Option<Retained<NSAttributedString>>;
#[cfg(feature = "NSAttributedString")]
#[method(setAttributedTitle:)]
pub unsafe fn setAttributedTitle(&self, attributed_title: Option<&NSAttributedString>);
#[cfg(feature = "NSAttributedString")]
#[method_id(@__retain_semantics Other attributedContentText)]
pub unsafe fn attributedContentText(&self) -> Option<Retained<NSAttributedString>>;
#[cfg(feature = "NSAttributedString")]
#[method(setAttributedContentText:)]
pub unsafe fn setAttributedContentText(
&self,
attributed_content_text: Option<&NSAttributedString>,
);
#[cfg(all(feature = "NSArray", feature = "NSItemProvider"))]
#[method_id(@__retain_semantics Other attachments)]
pub unsafe fn attachments(&self) -> Option<Retained<NSArray<NSItemProvider>>>;
#[cfg(all(feature = "NSArray", feature = "NSItemProvider"))]
#[method(setAttachments:)]
pub unsafe fn setAttachments(&self, attachments: Option<&NSArray<NSItemProvider>>);
#[cfg(feature = "NSDictionary")]
#[method_id(@__retain_semantics Other userInfo)]
pub unsafe fn userInfo(&self) -> Option<Retained<NSDictionary>>;
#[cfg(feature = "NSDictionary")]
#[method(setUserInfo:)]
pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSExtensionItem {
#[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 "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionItemAttributedTitleKey: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionItemAttributedContentTextKey: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionItemAttachmentsKey: Option<&'static NSString>;
}

View File

@@ -0,0 +1,15 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSExtensionRequestHandling: NSObjectProtocol {
#[cfg(feature = "NSExtensionContext")]
#[method(beginRequestWithExtensionContext:)]
unsafe fn beginRequestWithExtensionContext(&self, context: &NSExtensionContext);
}
unsafe impl ProtocolType for dyn NSExtensionRequestHandling {}
);

View File

@@ -0,0 +1,245 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileCoordinatorReadingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFileCoordinatorReadingOptions: NSUInteger {
const NSFileCoordinatorReadingWithoutChanges = 1<<0;
const NSFileCoordinatorReadingResolvesSymbolicLink = 1<<1;
const NSFileCoordinatorReadingImmediatelyAvailableMetadataOnly = 1<<2;
const NSFileCoordinatorReadingForUploading = 1<<3;
}
}
unsafe impl Encode for NSFileCoordinatorReadingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFileCoordinatorReadingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileCoordinatorWritingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFileCoordinatorWritingOptions: NSUInteger {
const NSFileCoordinatorWritingForDeleting = 1<<0;
const NSFileCoordinatorWritingForMoving = 1<<1;
const NSFileCoordinatorWritingForMerging = 1<<2;
const NSFileCoordinatorWritingForReplacing = 1<<3;
const NSFileCoordinatorWritingContentIndependentMetadataOnly = 1<<4;
}
}
unsafe impl Encode for NSFileCoordinatorWritingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFileCoordinatorWritingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFileAccessIntent;
unsafe impl ClassType for NSFileAccessIntent {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSFileAccessIntent {}
unsafe impl Sync for NSFileAccessIntent {}
unsafe impl NSObjectProtocol for NSFileAccessIntent {}
extern_methods!(
unsafe impl NSFileAccessIntent {
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other readingIntentWithURL:options:)]
pub unsafe fn readingIntentWithURL_options(
url: &NSURL,
options: NSFileCoordinatorReadingOptions,
) -> Retained<Self>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other writingIntentWithURL:options:)]
pub unsafe fn writingIntentWithURL_options(
url: &NSURL,
options: NSFileCoordinatorWritingOptions,
) -> Retained<Self>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other URL)]
pub unsafe fn URL(&self) -> Retained<NSURL>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFileAccessIntent {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFileCoordinator;
unsafe impl ClassType for NSFileCoordinator {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSFileCoordinator {}
extern_methods!(
unsafe impl NSFileCoordinator {
#[cfg(feature = "NSFilePresenter")]
#[method(addFilePresenter:)]
pub unsafe fn addFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);
#[cfg(feature = "NSFilePresenter")]
#[method(removeFilePresenter:)]
pub unsafe fn removeFilePresenter(file_presenter: &ProtocolObject<dyn NSFilePresenter>);
#[cfg(all(feature = "NSArray", feature = "NSFilePresenter"))]
#[method_id(@__retain_semantics Other filePresenters)]
pub unsafe fn filePresenters() -> Retained<NSArray<ProtocolObject<dyn NSFilePresenter>>>;
#[cfg(feature = "NSFilePresenter")]
#[method_id(@__retain_semantics Init initWithFilePresenter:)]
pub unsafe fn initWithFilePresenter(
this: Allocated<Self>,
file_presenter_or_nil: Option<&ProtocolObject<dyn NSFilePresenter>>,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other purposeIdentifier)]
pub unsafe fn purposeIdentifier(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPurposeIdentifier:)]
pub unsafe fn setPurposeIdentifier(&self, purpose_identifier: &NSString);
#[cfg(all(
feature = "NSArray",
feature = "NSError",
feature = "NSOperation",
feature = "block2"
))]
#[method(coordinateAccessWithIntents:queue:byAccessor:)]
pub unsafe fn coordinateAccessWithIntents_queue_byAccessor(
&self,
intents: &NSArray<NSFileAccessIntent>,
queue: &NSOperationQueue,
accessor: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
#[method(coordinateReadingItemAtURL:options:error:byAccessor:)]
pub unsafe fn coordinateReadingItemAtURL_options_error_byAccessor(
&self,
url: &NSURL,
options: NSFileCoordinatorReadingOptions,
out_error: Option<&mut Option<Retained<NSError>>>,
reader: &block2::Block<dyn Fn(NonNull<NSURL>) + '_>,
);
#[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
#[method(coordinateWritingItemAtURL:options:error:byAccessor:)]
pub unsafe fn coordinateWritingItemAtURL_options_error_byAccessor(
&self,
url: &NSURL,
options: NSFileCoordinatorWritingOptions,
out_error: Option<&mut Option<Retained<NSError>>>,
writer: &block2::Block<dyn Fn(NonNull<NSURL>) + '_>,
);
#[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
#[method(coordinateReadingItemAtURL:options:writingItemAtURL:options:error:byAccessor:)]
pub unsafe fn coordinateReadingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
&self,
reading_url: &NSURL,
reading_options: NSFileCoordinatorReadingOptions,
writing_url: &NSURL,
writing_options: NSFileCoordinatorWritingOptions,
out_error: Option<&mut Option<Retained<NSError>>>,
reader_writer: &block2::Block<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
);
#[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
#[method(coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor:)]
pub unsafe fn coordinateWritingItemAtURL_options_writingItemAtURL_options_error_byAccessor(
&self,
url1: &NSURL,
options1: NSFileCoordinatorWritingOptions,
url2: &NSURL,
options2: NSFileCoordinatorWritingOptions,
out_error: Option<&mut Option<Retained<NSError>>>,
writer: &block2::Block<dyn Fn(NonNull<NSURL>, NonNull<NSURL>) + '_>,
);
#[cfg(all(
feature = "NSArray",
feature = "NSError",
feature = "NSURL",
feature = "block2"
))]
#[method(prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:)]
pub unsafe fn prepareForReadingItemsAtURLs_options_writingItemsAtURLs_options_error_byAccessor(
&self,
reading_ur_ls: &NSArray<NSURL>,
reading_options: NSFileCoordinatorReadingOptions,
writing_ur_ls: &NSArray<NSURL>,
writing_options: NSFileCoordinatorWritingOptions,
out_error: Option<&mut Option<Retained<NSError>>>,
batch_accessor: &block2::Block<dyn Fn(NonNull<block2::Block<dyn Fn()>>) + '_>,
);
#[cfg(feature = "NSURL")]
#[method(itemAtURL:willMoveToURL:)]
pub unsafe fn itemAtURL_willMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);
#[cfg(feature = "NSURL")]
#[method(itemAtURL:didMoveToURL:)]
pub unsafe fn itemAtURL_didMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);
#[cfg(all(feature = "NSSet", feature = "NSString", feature = "NSURL"))]
#[method(itemAtURL:didChangeUbiquityAttributes:)]
pub unsafe fn itemAtURL_didChangeUbiquityAttributes(
&self,
url: &NSURL,
attributes: &NSSet<NSURLResourceKey>,
);
#[method(cancel)]
pub unsafe fn cancel(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFileCoordinator {
#[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>;
}
);

View File

@@ -0,0 +1,365 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFileHandle;
unsafe impl ClassType for NSFileHandle {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSFileHandle {}
unsafe impl Sync for NSFileHandle {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSFileHandle {}
unsafe impl NSObjectProtocol for NSFileHandle {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSFileHandle {}
extern_methods!(
unsafe impl NSFileHandle {
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other availableData)]
pub unsafe fn availableData(&self) -> Retained<NSData>;
#[method_id(@__retain_semantics Init initWithFileDescriptor:closeOnDealloc:)]
pub unsafe fn initWithFileDescriptor_closeOnDealloc(
this: Allocated<Self>,
fd: c_int,
closeopt: bool,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other readDataToEndOfFileAndReturnError:_)]
pub unsafe fn readDataToEndOfFileAndReturnError(
&self,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other readDataUpToLength:error:_)]
pub unsafe fn readDataUpToLength_error(
&self,
length: NSUInteger,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method(writeData:error:_)]
pub unsafe fn writeData_error(&self, data: &NSData) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(getOffset:error:_)]
pub unsafe fn getOffset_error(
&self,
offset_in_file: NonNull<c_ulonglong>,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(seekToEndReturningOffset:error:_)]
pub unsafe fn seekToEndReturningOffset_error(
&self,
offset_in_file: *mut c_ulonglong,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(seekToOffset:error:_)]
pub unsafe fn seekToOffset_error(
&self,
offset: c_ulonglong,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(truncateAtOffset:error:_)]
pub unsafe fn truncateAtOffset_error(
&self,
offset: c_ulonglong,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(synchronizeAndReturnError:_)]
pub unsafe fn synchronizeAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(closeAndReturnError:_)]
pub unsafe fn closeAndReturnError(&self) -> Result<(), Retained<NSError>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFileHandle {
#[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!(
/// NSFileHandleCreation
unsafe impl NSFileHandle {
#[method_id(@__retain_semantics Other fileHandleWithStandardInput)]
pub unsafe fn fileHandleWithStandardInput() -> Retained<NSFileHandle>;
#[method_id(@__retain_semantics Other fileHandleWithStandardOutput)]
pub unsafe fn fileHandleWithStandardOutput() -> Retained<NSFileHandle>;
#[method_id(@__retain_semantics Other fileHandleWithStandardError)]
pub unsafe fn fileHandleWithStandardError() -> Retained<NSFileHandle>;
#[method_id(@__retain_semantics Other fileHandleWithNullDevice)]
pub unsafe fn fileHandleWithNullDevice() -> Retained<NSFileHandle>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other fileHandleForReadingAtPath:)]
pub unsafe fn fileHandleForReadingAtPath(path: &NSString) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other fileHandleForWritingAtPath:)]
pub unsafe fn fileHandleForWritingAtPath(path: &NSString) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other fileHandleForUpdatingAtPath:)]
pub unsafe fn fileHandleForUpdatingAtPath(path: &NSString) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other fileHandleForReadingFromURL:error:_)]
pub unsafe fn fileHandleForReadingFromURL_error(
url: &NSURL,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other fileHandleForWritingToURL:error:_)]
pub unsafe fn fileHandleForWritingToURL_error(
url: &NSURL,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other fileHandleForUpdatingURL:error:_)]
pub unsafe fn fileHandleForUpdatingURL_error(
url: &NSURL,
) -> Result<Retained<Self>, Retained<NSError>>;
}
);
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSFileHandleOperationException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSFileHandleReadCompletionNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSFileHandleReadToEndOfFileCompletionNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSFileHandleConnectionAcceptedNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSFileHandleDataAvailableNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSFileHandleNotificationDataItem: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSFileHandleNotificationFileHandleItem: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSFileHandleNotificationMonitorModes: &'static NSString;
}
extern_methods!(
/// NSFileHandleAsynchronousAccess
unsafe impl NSFileHandle {
#[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "NSString"))]
#[method(readInBackgroundAndNotifyForModes:)]
pub unsafe fn readInBackgroundAndNotifyForModes(
&self,
modes: Option<&NSArray<NSRunLoopMode>>,
);
#[method(readInBackgroundAndNotify)]
pub unsafe fn readInBackgroundAndNotify(&self);
#[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "NSString"))]
#[method(readToEndOfFileInBackgroundAndNotifyForModes:)]
pub unsafe fn readToEndOfFileInBackgroundAndNotifyForModes(
&self,
modes: Option<&NSArray<NSRunLoopMode>>,
);
#[method(readToEndOfFileInBackgroundAndNotify)]
pub unsafe fn readToEndOfFileInBackgroundAndNotify(&self);
#[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "NSString"))]
#[method(acceptConnectionInBackgroundAndNotifyForModes:)]
pub unsafe fn acceptConnectionInBackgroundAndNotifyForModes(
&self,
modes: Option<&NSArray<NSRunLoopMode>>,
);
#[method(acceptConnectionInBackgroundAndNotify)]
pub unsafe fn acceptConnectionInBackgroundAndNotify(&self);
#[cfg(all(feature = "NSArray", feature = "NSObjCRuntime", feature = "NSString"))]
#[method(waitForDataInBackgroundAndNotifyForModes:)]
pub unsafe fn waitForDataInBackgroundAndNotifyForModes(
&self,
modes: Option<&NSArray<NSRunLoopMode>>,
);
#[method(waitForDataInBackgroundAndNotify)]
pub unsafe fn waitForDataInBackgroundAndNotify(&self);
#[cfg(feature = "block2")]
#[method(readabilityHandler)]
pub unsafe fn readabilityHandler(
&self,
) -> *mut block2::Block<dyn Fn(NonNull<NSFileHandle>)>;
#[cfg(feature = "block2")]
#[method(setReadabilityHandler:)]
pub unsafe fn setReadabilityHandler(
&self,
readability_handler: Option<&block2::Block<dyn Fn(NonNull<NSFileHandle>)>>,
);
#[cfg(feature = "block2")]
#[method(writeabilityHandler)]
pub unsafe fn writeabilityHandler(
&self,
) -> *mut block2::Block<dyn Fn(NonNull<NSFileHandle>)>;
#[cfg(feature = "block2")]
#[method(setWriteabilityHandler:)]
pub unsafe fn setWriteabilityHandler(
&self,
writeability_handler: Option<&block2::Block<dyn Fn(NonNull<NSFileHandle>)>>,
);
}
);
extern_methods!(
/// NSFileHandlePlatformSpecific
unsafe impl NSFileHandle {
#[method_id(@__retain_semantics Init initWithFileDescriptor:)]
pub unsafe fn initWithFileDescriptor(this: Allocated<Self>, fd: c_int) -> Retained<Self>;
#[method(fileDescriptor)]
pub unsafe fn fileDescriptor(&self) -> c_int;
}
);
extern_methods!(
unsafe impl NSFileHandle {
#[cfg(feature = "NSData")]
#[deprecated]
#[method_id(@__retain_semantics Other readDataToEndOfFile)]
pub unsafe fn readDataToEndOfFile(&self) -> Retained<NSData>;
#[cfg(feature = "NSData")]
#[deprecated]
#[method_id(@__retain_semantics Other readDataOfLength:)]
pub unsafe fn readDataOfLength(&self, length: NSUInteger) -> Retained<NSData>;
#[cfg(feature = "NSData")]
#[deprecated]
#[method(writeData:)]
pub unsafe fn writeData(&self, data: &NSData);
#[deprecated]
#[method(offsetInFile)]
pub unsafe fn offsetInFile(&self) -> c_ulonglong;
#[deprecated]
#[method(seekToEndOfFile)]
pub unsafe fn seekToEndOfFile(&self) -> c_ulonglong;
#[deprecated]
#[method(seekToFileOffset:)]
pub unsafe fn seekToFileOffset(&self, offset: c_ulonglong);
#[deprecated]
#[method(truncateFileAtOffset:)]
pub unsafe fn truncateFileAtOffset(&self, offset: c_ulonglong);
#[deprecated]
#[method(synchronizeFile)]
pub unsafe fn synchronizeFile(&self);
#[deprecated]
#[method(closeFile)]
pub unsafe fn closeFile(&self);
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSPipe;
unsafe impl ClassType for NSPipe {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSPipe {}
unsafe impl Sync for NSPipe {}
unsafe impl NSObjectProtocol for NSPipe {}
extern_methods!(
unsafe impl NSPipe {
#[method_id(@__retain_semantics Other fileHandleForReading)]
pub unsafe fn fileHandleForReading(&self) -> Retained<NSFileHandle>;
#[method_id(@__retain_semantics Other fileHandleForWriting)]
pub unsafe fn fileHandleForWriting(&self) -> Retained<NSFileHandle>;
#[method_id(@__retain_semantics Other pipe)]
pub unsafe fn pipe() -> Retained<NSPipe>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSPipe {
#[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>;
}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,146 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSFilePresenter: NSObjectProtocol {
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other presentedItemURL)]
unsafe fn presentedItemURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSOperation")]
#[method_id(@__retain_semantics Other presentedItemOperationQueue)]
unsafe fn presentedItemOperationQueue(&self) -> Retained<NSOperationQueue>;
#[cfg(feature = "NSURL")]
#[optional]
#[method_id(@__retain_semantics Other primaryPresentedItemURL)]
unsafe fn primaryPresentedItemURL(&self) -> Option<Retained<NSURL>>;
#[cfg(feature = "block2")]
#[optional]
#[method(relinquishPresentedItemToReader:)]
unsafe fn relinquishPresentedItemToReader(
&self,
reader: &block2::Block<dyn Fn(*mut block2::Block<dyn Fn()>)>,
);
#[cfg(feature = "block2")]
#[optional]
#[method(relinquishPresentedItemToWriter:)]
unsafe fn relinquishPresentedItemToWriter(
&self,
writer: &block2::Block<dyn Fn(*mut block2::Block<dyn Fn()>)>,
);
#[cfg(all(feature = "NSError", feature = "block2"))]
#[optional]
#[method(savePresentedItemChangesWithCompletionHandler:)]
unsafe fn savePresentedItemChangesWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(all(feature = "NSError", feature = "block2"))]
#[optional]
#[method(accommodatePresentedItemDeletionWithCompletionHandler:)]
unsafe fn accommodatePresentedItemDeletionWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(all(feature = "NSError", feature = "block2"))]
#[optional]
#[method(accommodatePresentedItemEvictionWithCompletionHandler:)]
unsafe fn accommodatePresentedItemEvictionWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "NSURL")]
#[optional]
#[method(presentedItemDidMoveToURL:)]
unsafe fn presentedItemDidMoveToURL(&self, new_url: &NSURL);
#[optional]
#[method(presentedItemDidChange)]
unsafe fn presentedItemDidChange(&self);
#[cfg(all(feature = "NSSet", feature = "NSString", feature = "NSURL"))]
#[optional]
#[method(presentedItemDidChangeUbiquityAttributes:)]
unsafe fn presentedItemDidChangeUbiquityAttributes(
&self,
attributes: &NSSet<NSURLResourceKey>,
);
#[cfg(all(feature = "NSSet", feature = "NSString", feature = "NSURL"))]
#[optional]
#[method_id(@__retain_semantics Other observedPresentedItemUbiquityAttributes)]
unsafe fn observedPresentedItemUbiquityAttributes(
&self,
) -> Retained<NSSet<NSURLResourceKey>>;
#[cfg(feature = "NSFileVersion")]
#[optional]
#[method(presentedItemDidGainVersion:)]
unsafe fn presentedItemDidGainVersion(&self, version: &NSFileVersion);
#[cfg(feature = "NSFileVersion")]
#[optional]
#[method(presentedItemDidLoseVersion:)]
unsafe fn presentedItemDidLoseVersion(&self, version: &NSFileVersion);
#[cfg(feature = "NSFileVersion")]
#[optional]
#[method(presentedItemDidResolveConflictVersion:)]
unsafe fn presentedItemDidResolveConflictVersion(&self, version: &NSFileVersion);
#[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
#[optional]
#[method(accommodatePresentedSubitemDeletionAtURL:completionHandler:)]
unsafe fn accommodatePresentedSubitemDeletionAtURL_completionHandler(
&self,
url: &NSURL,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "NSURL")]
#[optional]
#[method(presentedSubitemDidAppearAtURL:)]
unsafe fn presentedSubitemDidAppearAtURL(&self, url: &NSURL);
#[cfg(feature = "NSURL")]
#[optional]
#[method(presentedSubitemAtURL:didMoveToURL:)]
unsafe fn presentedSubitemAtURL_didMoveToURL(&self, old_url: &NSURL, new_url: &NSURL);
#[cfg(feature = "NSURL")]
#[optional]
#[method(presentedSubitemDidChangeAtURL:)]
unsafe fn presentedSubitemDidChangeAtURL(&self, url: &NSURL);
#[cfg(all(feature = "NSFileVersion", feature = "NSURL"))]
#[optional]
#[method(presentedSubitemAtURL:didGainVersion:)]
unsafe fn presentedSubitemAtURL_didGainVersion(&self, url: &NSURL, version: &NSFileVersion);
#[cfg(all(feature = "NSFileVersion", feature = "NSURL"))]
#[optional]
#[method(presentedSubitemAtURL:didLoseVersion:)]
unsafe fn presentedSubitemAtURL_didLoseVersion(&self, url: &NSURL, version: &NSFileVersion);
#[cfg(all(feature = "NSFileVersion", feature = "NSURL"))]
#[optional]
#[method(presentedSubitemAtURL:didResolveConflictVersion:)]
unsafe fn presentedSubitemAtURL_didResolveConflictVersion(
&self,
url: &NSURL,
version: &NSFileVersion,
);
}
unsafe impl ProtocolType for dyn NSFilePresenter {}
);

View File

@@ -0,0 +1,179 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileVersionAddingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFileVersionAddingOptions: NSUInteger {
const NSFileVersionAddingByMoving = 1<<0;
}
}
unsafe impl Encode for NSFileVersionAddingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFileVersionAddingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileVersionReplacingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFileVersionReplacingOptions: NSUInteger {
const NSFileVersionReplacingByMoving = 1<<0;
}
}
unsafe impl Encode for NSFileVersionReplacingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFileVersionReplacingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFileVersion;
unsafe impl ClassType for NSFileVersion {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSFileVersion {}
extern_methods!(
unsafe impl NSFileVersion {
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other currentVersionOfItemAtURL:)]
pub unsafe fn currentVersionOfItemAtURL(url: &NSURL) -> Option<Retained<NSFileVersion>>;
#[cfg(all(feature = "NSArray", feature = "NSURL"))]
#[method_id(@__retain_semantics Other otherVersionsOfItemAtURL:)]
pub unsafe fn otherVersionsOfItemAtURL(
url: &NSURL,
) -> Option<Retained<NSArray<NSFileVersion>>>;
#[cfg(all(feature = "NSArray", feature = "NSURL"))]
#[method_id(@__retain_semantics Other unresolvedConflictVersionsOfItemAtURL:)]
pub unsafe fn unresolvedConflictVersionsOfItemAtURL(
url: &NSURL,
) -> Option<Retained<NSArray<NSFileVersion>>>;
#[cfg(all(
feature = "NSArray",
feature = "NSError",
feature = "NSURL",
feature = "block2"
))]
#[method(getNonlocalVersionsOfItemAtURL:completionHandler:)]
pub unsafe fn getNonlocalVersionsOfItemAtURL_completionHandler(
url: &NSURL,
completion_handler: &block2::Block<dyn Fn(*mut NSArray<NSFileVersion>, *mut NSError)>,
);
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other versionOfItemAtURL:forPersistentIdentifier:)]
pub unsafe fn versionOfItemAtURL_forPersistentIdentifier(
url: &NSURL,
persistent_identifier: &AnyObject,
) -> Option<Retained<NSFileVersion>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other addVersionOfItemAtURL:withContentsOfURL:options:error:_)]
pub unsafe fn addVersionOfItemAtURL_withContentsOfURL_options_error(
url: &NSURL,
contents_url: &NSURL,
options: NSFileVersionAddingOptions,
) -> Result<Retained<NSFileVersion>, Retained<NSError>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other temporaryDirectoryURLForNewVersionOfItemAtURL:)]
pub unsafe fn temporaryDirectoryURLForNewVersionOfItemAtURL(url: &NSURL)
-> Retained<NSURL>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other URL)]
pub unsafe fn URL(&self) -> Retained<NSURL>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedName)]
pub unsafe fn localizedName(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedNameOfSavingComputer)]
pub unsafe fn localizedNameOfSavingComputer(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSPersonNameComponents")]
#[method_id(@__retain_semantics Other originatorNameComponents)]
pub unsafe fn originatorNameComponents(&self) -> Option<Retained<NSPersonNameComponents>>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other modificationDate)]
pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "NSObject")]
#[method_id(@__retain_semantics Other persistentIdentifier)]
pub unsafe fn persistentIdentifier(&self) -> Retained<ProtocolObject<dyn NSCoding>>;
#[method(isConflict)]
pub unsafe fn isConflict(&self) -> bool;
#[method(isResolved)]
pub unsafe fn isResolved(&self) -> bool;
#[method(setResolved:)]
pub unsafe fn setResolved(&self, resolved: bool);
#[method(isDiscardable)]
pub unsafe fn isDiscardable(&self) -> bool;
#[method(setDiscardable:)]
pub unsafe fn setDiscardable(&self, discardable: bool);
#[method(hasLocalContents)]
pub unsafe fn hasLocalContents(&self) -> bool;
#[method(hasThumbnail)]
pub unsafe fn hasThumbnail(&self) -> bool;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Other replaceItemAtURL:options:error:_)]
pub unsafe fn replaceItemAtURL_options_error(
&self,
url: &NSURL,
options: NSFileVersionReplacingOptions,
) -> Result<Retained<NSURL>, Retained<NSError>>;
#[cfg(feature = "NSError")]
#[method(removeAndReturnError:_)]
pub unsafe fn removeAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method(removeOtherVersionsOfItemAtURL:error:_)]
pub unsafe fn removeOtherVersionsOfItemAtURL_error(
url: &NSURL,
) -> Result<(), Retained<NSError>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFileVersion {
#[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>;
}
);

View File

@@ -0,0 +1,271 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileWrapperReadingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFileWrapperReadingOptions: NSUInteger {
const NSFileWrapperReadingImmediate = 1<<0;
const NSFileWrapperReadingWithoutMapping = 1<<1;
}
}
unsafe impl Encode for NSFileWrapperReadingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFileWrapperReadingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileWrapperWritingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFileWrapperWritingOptions: NSUInteger {
const NSFileWrapperWritingAtomic = 1<<0;
const NSFileWrapperWritingWithNameUpdating = 1<<1;
}
}
unsafe impl Encode for NSFileWrapperWritingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFileWrapperWritingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFileWrapper;
unsafe impl ClassType for NSFileWrapper {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSFileWrapper {}
unsafe impl NSObjectProtocol for NSFileWrapper {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSFileWrapper {}
extern_methods!(
unsafe impl NSFileWrapper {
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method_id(@__retain_semantics Init initWithURL:options:error:_)]
pub unsafe fn initWithURL_options_error(
this: Allocated<Self>,
url: &NSURL,
options: NSFileWrapperReadingOptions,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Init initDirectoryWithFileWrappers:)]
pub unsafe fn initDirectoryWithFileWrappers(
this: Allocated<Self>,
children_by_preferred_name: &NSDictionary<NSString, NSFileWrapper>,
) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Init initRegularFileWithContents:)]
pub unsafe fn initRegularFileWithContents(
this: Allocated<Self>,
contents: &NSData,
) -> Retained<Self>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initSymbolicLinkWithDestinationURL:)]
pub unsafe fn initSymbolicLinkWithDestinationURL(
this: Allocated<Self>,
url: &NSURL,
) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Init initWithSerializedRepresentation:)]
pub unsafe fn initWithSerializedRepresentation(
this: Allocated<Self>,
serialize_representation: &NSData,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
in_coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(isDirectory)]
pub unsafe fn isDirectory(&self) -> bool;
#[method(isRegularFile)]
pub unsafe fn isRegularFile(&self) -> bool;
#[method(isSymbolicLink)]
pub unsafe fn isSymbolicLink(&self) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other preferredFilename)]
pub unsafe fn preferredFilename(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setPreferredFilename:)]
pub unsafe fn setPreferredFilename(&self, preferred_filename: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other filename)]
pub unsafe fn filename(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setFilename:)]
pub unsafe fn setFilename(&self, filename: Option<&NSString>);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other fileAttributes)]
pub unsafe fn fileAttributes(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setFileAttributes:)]
pub unsafe fn setFileAttributes(&self, file_attributes: &NSDictionary<NSString, AnyObject>);
#[cfg(feature = "NSURL")]
#[method(matchesContentsOfURL:)]
pub unsafe fn matchesContentsOfURL(&self, url: &NSURL) -> bool;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method(readFromURL:options:error:_)]
pub unsafe fn readFromURL_options_error(
&self,
url: &NSURL,
options: NSFileWrapperReadingOptions,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSURL"))]
#[method(writeToURL:options:originalContentsURL:error:_)]
pub unsafe fn writeToURL_options_originalContentsURL_error(
&self,
url: &NSURL,
options: NSFileWrapperWritingOptions,
original_contents_url: Option<&NSURL>,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other serializedRepresentation)]
pub unsafe fn serializedRepresentation(&self) -> Option<Retained<NSData>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other addFileWrapper:)]
pub unsafe fn addFileWrapper(&self, child: &NSFileWrapper) -> Retained<NSString>;
#[cfg(all(feature = "NSData", feature = "NSString"))]
#[method_id(@__retain_semantics Other addRegularFileWithContents:preferredFilename:)]
pub unsafe fn addRegularFileWithContents_preferredFilename(
&self,
data: &NSData,
file_name: &NSString,
) -> Retained<NSString>;
#[method(removeFileWrapper:)]
pub unsafe fn removeFileWrapper(&self, child: &NSFileWrapper);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other fileWrappers)]
pub unsafe fn fileWrappers(
&self,
) -> Option<Retained<NSDictionary<NSString, NSFileWrapper>>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other keyForFileWrapper:)]
pub unsafe fn keyForFileWrapper(&self, child: &NSFileWrapper)
-> Option<Retained<NSString>>;
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other regularFileContents)]
pub unsafe fn regularFileContents(&self) -> Option<Retained<NSData>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other symbolicLinkDestinationURL)]
pub unsafe fn symbolicLinkDestinationURL(&self) -> Option<Retained<NSURL>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFileWrapper {
#[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!(
/// NSDeprecated
unsafe impl NSFileWrapper {
#[cfg(feature = "NSString")]
#[deprecated = "Use -initWithURL:options:error: instead."]
#[method_id(@__retain_semantics Init initWithPath:)]
pub unsafe fn initWithPath(
this: Allocated<Self>,
path: &NSString,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use -initSymbolicLinkWithDestinationURL: and -setPreferredFileName:, if necessary, instead."]
#[method_id(@__retain_semantics Init initSymbolicLinkWithDestination:)]
pub unsafe fn initSymbolicLinkWithDestination(
this: Allocated<Self>,
path: &NSString,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[deprecated = "Use -matchesContentsOfURL: instead."]
#[method(needsToBeUpdatedFromPath:)]
pub unsafe fn needsToBeUpdatedFromPath(&self, path: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[deprecated = "Use -readFromURL:options:error: instead."]
#[method(updateFromPath:)]
pub unsafe fn updateFromPath(&self, path: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[deprecated = "Use -writeToURL:options:originalContentsURL:error: instead."]
#[method(writeToFile:atomically:updateFilenames:)]
pub unsafe fn writeToFile_atomically_updateFilenames(
&self,
path: &NSString,
atomic_flag: bool,
update_filenames_flag: bool,
) -> bool;
#[cfg(feature = "NSString")]
#[deprecated = "Instantiate a new NSFileWrapper with -initWithURL:options:error:, send it -setPreferredFileName: if necessary, then use -addFileWrapper: instead."]
#[method_id(@__retain_semantics Other addFileWithPath:)]
pub unsafe fn addFileWithPath(&self, path: &NSString) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated = "Instantiate a new NSFileWrapper with -initWithSymbolicLinkDestinationURL:, send it -setPreferredFileName: if necessary, then use -addFileWrapper: instead."]
#[method_id(@__retain_semantics Other addSymbolicLinkWithDestination:preferredFilename:)]
pub unsafe fn addSymbolicLinkWithDestination_preferredFilename(
&self,
path: &NSString,
filename: &NSString,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated = "Use -symbolicLinkDestinationURL instead."]
#[method_id(@__retain_semantics Other symbolicLinkDestination)]
pub unsafe fn symbolicLinkDestination(&self) -> Retained<NSString>;
}
);

View File

@@ -0,0 +1,141 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFormattingContext(pub NSInteger);
impl NSFormattingContext {
#[doc(alias = "NSFormattingContextUnknown")]
pub const Unknown: Self = Self(0);
#[doc(alias = "NSFormattingContextDynamic")]
pub const Dynamic: Self = Self(1);
#[doc(alias = "NSFormattingContextStandalone")]
pub const Standalone: Self = Self(2);
#[doc(alias = "NSFormattingContextListItem")]
pub const ListItem: Self = Self(3);
#[doc(alias = "NSFormattingContextBeginningOfSentence")]
pub const BeginningOfSentence: Self = Self(4);
#[doc(alias = "NSFormattingContextMiddleOfSentence")]
pub const MiddleOfSentence: Self = Self(5);
}
unsafe impl Encode for NSFormattingContext {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSFormattingContext {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFormattingUnitStyle(pub NSInteger);
impl NSFormattingUnitStyle {
#[doc(alias = "NSFormattingUnitStyleShort")]
pub const Short: Self = Self(1);
#[doc(alias = "NSFormattingUnitStyleMedium")]
pub const Medium: Self = Self(2);
#[doc(alias = "NSFormattingUnitStyleLong")]
pub const Long: Self = Self(3);
}
unsafe impl Encode for NSFormattingUnitStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSFormattingUnitStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFormatter;
unsafe impl ClassType for NSFormatter {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSFormatter {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSFormatter {}
unsafe impl NSObjectProtocol for NSFormatter {}
extern_methods!(
unsafe impl NSFormatter {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringForObjectValue:)]
pub unsafe fn stringForObjectValue(
&self,
obj: Option<&AnyObject>,
) -> Option<Retained<NSString>>;
#[cfg(all(
feature = "NSAttributedString",
feature = "NSDictionary",
feature = "NSString"
))]
#[method_id(@__retain_semantics Other attributedStringForObjectValue:withDefaultAttributes:)]
pub unsafe fn attributedStringForObjectValue_withDefaultAttributes(
&self,
obj: &AnyObject,
attrs: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
) -> Option<Retained<NSAttributedString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other editingStringForObjectValue:)]
pub unsafe fn editingStringForObjectValue(
&self,
obj: &AnyObject,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(getObjectValue:forString:errorDescription:)]
pub unsafe fn getObjectValue_forString_errorDescription(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
#[cfg(feature = "NSString")]
#[method(isPartialStringValid:newEditingString:errorDescription:)]
pub unsafe fn isPartialStringValid_newEditingString_errorDescription(
&self,
partial_string: &NSString,
new_string: Option<&mut Option<Retained<NSString>>>,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[method(isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:)]
pub unsafe fn isPartialStringValid_proposedSelectedRange_originalString_originalSelectedRange_errorDescription(
&self,
partial_string_ptr: &mut Retained<NSString>,
proposed_sel_range_ptr: NSRangePointer,
orig_string: &NSString,
orig_sel_range: NSRange,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,74 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Building Garbage Collected apps is no longer supported."]
pub struct NSGarbageCollector;
unsafe impl ClassType for NSGarbageCollector {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSGarbageCollector {}
extern_methods!(
unsafe impl NSGarbageCollector {
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method_id(@__retain_semantics Other defaultCollector)]
pub unsafe fn defaultCollector() -> Retained<AnyObject>;
#[deprecated]
#[method(isCollecting)]
pub unsafe fn isCollecting(&self) -> bool;
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(disable)]
pub unsafe fn disable(&self);
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(enable)]
pub unsafe fn enable(&self);
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(collectIfNeeded)]
pub unsafe fn collectIfNeeded(&self);
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(collectExhaustively)]
pub unsafe fn collectExhaustively(&self);
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(disableCollectorForPointer:)]
pub unsafe fn disableCollectorForPointer(&self, ptr: NonNull<c_void>);
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(enableCollectorForPointer:)]
pub unsafe fn enableCollectorForPointer(&self, ptr: NonNull<c_void>);
#[cfg(feature = "NSZone")]
#[deprecated = "Building Garbage Collected apps is no longer supported."]
#[method(zone)]
pub unsafe fn zone(&self) -> NonNull<NSZone>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSGarbageCollector {
#[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>;
}
);

View File

@@ -0,0 +1,321 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
pub type NSPointPointer = *mut NSPoint;
pub type NSPointArray = *mut NSPoint;
pub type NSSizePointer = *mut NSSize;
pub type NSSizeArray = *mut NSSize;
pub type NSRectPointer = *mut NSRect;
pub type NSRectArray = *mut NSRect;
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSEdgeInsets {
pub top: CGFloat,
pub left: CGFloat,
pub bottom: CGFloat,
pub right: CGFloat,
}
unsafe impl Encode for NSEdgeInsets {
const ENCODING: Encoding = Encoding::Struct(
"NSEdgeInsets",
&[
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
<CGFloat>::ENCODING,
],
);
}
unsafe impl RefEncode for NSEdgeInsets {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
unsafe impl Send for NSEdgeInsets {}
unsafe impl Sync for NSEdgeInsets {}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAlignmentOptions(pub c_ulonglong);
bitflags::bitflags! {
impl NSAlignmentOptions: c_ulonglong {
const NSAlignMinXInward = 1<<0;
const NSAlignMinYInward = 1<<1;
const NSAlignMaxXInward = 1<<2;
const NSAlignMaxYInward = 1<<3;
const NSAlignWidthInward = 1<<4;
const NSAlignHeightInward = 1<<5;
const NSAlignMinXOutward = 1<<8;
const NSAlignMinYOutward = 1<<9;
const NSAlignMaxXOutward = 1<<10;
const NSAlignMaxYOutward = 1<<11;
const NSAlignWidthOutward = 1<<12;
const NSAlignHeightOutward = 1<<13;
const NSAlignMinXNearest = 1<<16;
const NSAlignMinYNearest = 1<<17;
const NSAlignMaxXNearest = 1<<18;
const NSAlignMaxYNearest = 1<<19;
const NSAlignWidthNearest = 1<<20;
const NSAlignHeightNearest = 1<<21;
const NSAlignRectFlipped = 1<<63;
const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.0|NSAlignmentOptions::NSAlignMaxXInward.0|NSAlignmentOptions::NSAlignMinYInward.0|NSAlignmentOptions::NSAlignMaxYInward.0;
const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.0|NSAlignmentOptions::NSAlignMaxXOutward.0|NSAlignmentOptions::NSAlignMinYOutward.0|NSAlignmentOptions::NSAlignMaxYOutward.0;
const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.0|NSAlignmentOptions::NSAlignMaxXNearest.0|NSAlignmentOptions::NSAlignMinYNearest.0|NSAlignmentOptions::NSAlignMaxYNearest.0;
}
}
unsafe impl Encode for NSAlignmentOptions {
const ENCODING: Encoding = c_ulonglong::ENCODING;
}
unsafe impl RefEncode for NSAlignmentOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub static NSZeroPoint: NSPoint;
}
extern "C" {
pub static NSZeroSize: NSSize;
}
extern "C" {
pub static NSZeroRect: NSRect;
}
extern "C" {
pub static NSEdgeInsetsZero: NSEdgeInsets;
}
// TODO: pub fn NSMakePoint(x: CGFloat,y: CGFloat,) -> NSPoint;
// TODO: pub fn NSMakeSize(w: CGFloat,h: CGFloat,) -> NSSize;
// TODO: pub fn NSMakeRect(x: CGFloat,y: CGFloat,w: CGFloat,h: CGFloat,) -> NSRect;
// TODO: pub fn NSMaxX(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSMaxY(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSMidX(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSMidY(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSMinX(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSMinY(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSWidth(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSHeight(a_rect: NSRect,) -> CGFloat;
// TODO: pub fn NSRectFromCGRect(cgrect: CGRect,) -> NSRect;
// TODO: pub fn NSRectToCGRect(nsrect: NSRect,) -> CGRect;
// TODO: pub fn NSPointFromCGPoint(cgpoint: CGPoint,) -> NSPoint;
// TODO: pub fn NSPointToCGPoint(nspoint: NSPoint,) -> CGPoint;
// TODO: pub fn NSSizeFromCGSize(cgsize: CGSize,) -> NSSize;
// TODO: pub fn NSSizeToCGSize(nssize: NSSize,) -> CGSize;
// TODO: pub fn NSEdgeInsetsMake(top: CGFloat,left: CGFloat,bottom: CGFloat,right: CGFloat,) -> NSEdgeInsets;
extern "C" {
pub fn NSEqualPoints(a_point: NSPoint, b_point: NSPoint) -> Bool;
}
extern "C" {
pub fn NSEqualSizes(a_size: NSSize, b_size: NSSize) -> Bool;
}
extern "C" {
pub fn NSEqualRects(a_rect: NSRect, b_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSIsEmptyRect(a_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSEdgeInsetsEqual(a_insets: NSEdgeInsets, b_insets: NSEdgeInsets) -> Bool;
}
extern "C" {
pub fn NSInsetRect(a_rect: NSRect, d_x: CGFloat, d_y: CGFloat) -> NSRect;
}
extern "C" {
pub fn NSIntegralRect(a_rect: NSRect) -> NSRect;
}
extern "C" {
pub fn NSIntegralRectWithOptions(a_rect: NSRect, opts: NSAlignmentOptions) -> NSRect;
}
extern "C" {
pub fn NSUnionRect(a_rect: NSRect, b_rect: NSRect) -> NSRect;
}
extern "C" {
pub fn NSIntersectionRect(a_rect: NSRect, b_rect: NSRect) -> NSRect;
}
extern "C" {
pub fn NSOffsetRect(a_rect: NSRect, d_x: CGFloat, d_y: CGFloat) -> NSRect;
}
extern "C" {
pub fn NSDivideRect(
in_rect: NSRect,
slice: NonNull<NSRect>,
rem: NonNull<NSRect>,
amount: CGFloat,
edge: NSRectEdge,
);
}
extern "C" {
pub fn NSPointInRect(a_point: NSPoint, a_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSMouseInRect(a_point: NSPoint, a_rect: NSRect, flipped: Bool) -> Bool;
}
extern "C" {
pub fn NSContainsRect(a_rect: NSRect, b_rect: NSRect) -> Bool;
}
extern "C" {
pub fn NSIntersectsRect(a_rect: NSRect, b_rect: NSRect) -> Bool;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromPoint(a_point: NSPoint) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromSize(a_size: NSSize) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromRect(a_rect: NSRect) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSPointFromString(a_string: &NSString) -> NSPoint;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSSizeFromString(a_string: &NSString) -> NSSize;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSRectFromString(a_string: &NSString) -> NSRect;
}
extern_methods!(
/// NSValueGeometryExtensions
#[cfg(feature = "NSValue")]
unsafe impl NSValue {
#[method_id(@__retain_semantics Other valueWithPoint:)]
pub unsafe fn valueWithPoint(point: NSPoint) -> Retained<NSValue>;
#[method_id(@__retain_semantics Other valueWithSize:)]
pub unsafe fn valueWithSize(size: NSSize) -> Retained<NSValue>;
#[method_id(@__retain_semantics Other valueWithRect:)]
pub unsafe fn valueWithRect(rect: NSRect) -> Retained<NSValue>;
#[method_id(@__retain_semantics Other valueWithEdgeInsets:)]
pub unsafe fn valueWithEdgeInsets(insets: NSEdgeInsets) -> Retained<NSValue>;
#[method(pointValue)]
pub unsafe fn pointValue(&self) -> NSPoint;
#[method(sizeValue)]
pub unsafe fn sizeValue(&self) -> NSSize;
#[method(rectValue)]
pub unsafe fn rectValue(&self) -> NSRect;
#[method(edgeInsetsValue)]
pub unsafe fn edgeInsetsValue(&self) -> NSEdgeInsets;
}
);
extern_methods!(
/// NSGeometryCoding
#[cfg(feature = "NSCoder")]
unsafe impl NSCoder {
#[method(encodePoint:)]
pub unsafe fn encodePoint(&self, point: NSPoint);
#[method(decodePoint)]
pub unsafe fn decodePoint(&self) -> NSPoint;
#[method(encodeSize:)]
pub unsafe fn encodeSize(&self, size: NSSize);
#[method(decodeSize)]
pub unsafe fn decodeSize(&self) -> NSSize;
#[method(encodeRect:)]
pub unsafe fn encodeRect(&self, rect: NSRect);
#[method(decodeRect)]
pub unsafe fn decodeRect(&self) -> NSRect;
}
);
extern_methods!(
/// NSGeometryKeyedCoding
#[cfg(feature = "NSCoder")]
unsafe impl NSCoder {
#[cfg(feature = "NSString")]
#[method(encodePoint:forKey:)]
pub unsafe fn encodePoint_forKey(&self, point: NSPoint, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeSize:forKey:)]
pub unsafe fn encodeSize_forKey(&self, size: NSSize, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeRect:forKey:)]
pub unsafe fn encodeRect_forKey(&self, rect: NSRect, key: &NSString);
#[cfg(feature = "NSString")]
#[method(decodePointForKey:)]
pub unsafe fn decodePointForKey(&self, key: &NSString) -> NSPoint;
#[cfg(feature = "NSString")]
#[method(decodeSizeForKey:)]
pub unsafe fn decodeSizeForKey(&self, key: &NSString) -> NSSize;
#[cfg(feature = "NSString")]
#[method(decodeRectForKey:)]
pub unsafe fn decodeRectForKey(&self, key: &NSString) -> NSRect;
}
);

View File

@@ -0,0 +1,20 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSFileTypeForHFSTypeCode(hfs_file_type_code: OSType) -> *mut NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSHFSTypeCodeFromFileType(file_type_string: Option<&NSString>) -> OSType;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSHFSTypeOfFile(full_file_path: Option<&NSString>) -> *mut NSString;
}

View File

@@ -0,0 +1,209 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSHTTPCookiePropertyKey = NSString;
// NS_TYPED_ENUM
#[cfg(feature = "NSString")]
pub type NSHTTPCookieStringPolicy = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieName: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieValue: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieOriginURL: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieVersion: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieDomain: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookiePath: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieSecure: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieExpires: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieComment: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieCommentURL: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieDiscard: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieMaximumAge: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookiePort: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieSameSitePolicy: &'static NSHTTPCookiePropertyKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieSameSiteLax: &'static NSHTTPCookieStringPolicy;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHTTPCookieSameSiteStrict: &'static NSHTTPCookieStringPolicy;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSHTTPCookie;
unsafe impl ClassType for NSHTTPCookie {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSHTTPCookie {}
unsafe impl Sync for NSHTTPCookie {}
unsafe impl NSObjectProtocol for NSHTTPCookie {}
extern_methods!(
unsafe impl NSHTTPCookie {
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithProperties:)]
pub unsafe fn initWithProperties(
this: Allocated<Self>,
properties: &NSDictionary<NSHTTPCookiePropertyKey, AnyObject>,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other cookieWithProperties:)]
pub unsafe fn cookieWithProperties(
properties: &NSDictionary<NSHTTPCookiePropertyKey, AnyObject>,
) -> Option<Retained<NSHTTPCookie>>;
#[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other requestHeaderFieldsWithCookies:)]
pub unsafe fn requestHeaderFieldsWithCookies(
cookies: &NSArray<NSHTTPCookie>,
) -> Retained<NSDictionary<NSString, NSString>>;
#[cfg(all(
feature = "NSArray",
feature = "NSDictionary",
feature = "NSString",
feature = "NSURL"
))]
#[method_id(@__retain_semantics Other cookiesWithResponseHeaderFields:forURL:)]
pub unsafe fn cookiesWithResponseHeaderFields_forURL(
header_fields: &NSDictionary<NSString, NSString>,
url: &NSURL,
) -> Retained<NSArray<NSHTTPCookie>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other properties)]
pub unsafe fn properties(
&self,
) -> Option<Retained<NSDictionary<NSHTTPCookiePropertyKey, AnyObject>>>;
#[method(version)]
pub unsafe fn version(&self) -> NSUInteger;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Retained<NSString>;
#[cfg(feature = "NSDate")]
#[method_id(@__retain_semantics Other expiresDate)]
pub unsafe fn expiresDate(&self) -> Option<Retained<NSDate>>;
#[method(isSessionOnly)]
pub unsafe fn isSessionOnly(&self) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other domain)]
pub unsafe fn domain(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other path)]
pub unsafe fn path(&self) -> Retained<NSString>;
#[method(isSecure)]
pub unsafe fn isSecure(&self) -> bool;
#[method(isHTTPOnly)]
pub unsafe fn isHTTPOnly(&self) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other comment)]
pub unsafe fn comment(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Other commentURL)]
pub unsafe fn commentURL(&self) -> Option<Retained<NSURL>>;
#[cfg(all(feature = "NSArray", feature = "NSValue"))]
#[method_id(@__retain_semantics Other portList)]
pub unsafe fn portList(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other sameSitePolicy)]
pub unsafe fn sameSitePolicy(&self) -> Option<Retained<NSHTTPCookieStringPolicy>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSHTTPCookie {
#[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>;
}
);

View File

@@ -0,0 +1,152 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSHTTPCookieAcceptPolicy(pub NSUInteger);
impl NSHTTPCookieAcceptPolicy {
#[doc(alias = "NSHTTPCookieAcceptPolicyAlways")]
pub const Always: Self = Self(0);
#[doc(alias = "NSHTTPCookieAcceptPolicyNever")]
pub const Never: Self = Self(1);
#[doc(alias = "NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain")]
pub const OnlyFromMainDocumentDomain: Self = Self(2);
}
unsafe impl Encode for NSHTTPCookieAcceptPolicy {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSHTTPCookieAcceptPolicy {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSHTTPCookieStorage;
unsafe impl ClassType for NSHTTPCookieStorage {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSHTTPCookieStorage {}
unsafe impl Sync for NSHTTPCookieStorage {}
unsafe impl NSObjectProtocol for NSHTTPCookieStorage {}
extern_methods!(
unsafe impl NSHTTPCookieStorage {
#[method_id(@__retain_semantics Other sharedHTTPCookieStorage)]
pub unsafe fn sharedHTTPCookieStorage() -> Retained<NSHTTPCookieStorage>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other sharedCookieStorageForGroupContainerIdentifier:)]
pub unsafe fn sharedCookieStorageForGroupContainerIdentifier(
identifier: &NSString,
) -> Retained<NSHTTPCookieStorage>;
#[cfg(all(feature = "NSArray", feature = "NSHTTPCookie"))]
#[method_id(@__retain_semantics Other cookies)]
pub unsafe fn cookies(&self) -> Option<Retained<NSArray<NSHTTPCookie>>>;
#[cfg(feature = "NSHTTPCookie")]
#[method(setCookie:)]
pub unsafe fn setCookie(&self, cookie: &NSHTTPCookie);
#[cfg(feature = "NSHTTPCookie")]
#[method(deleteCookie:)]
pub unsafe fn deleteCookie(&self, cookie: &NSHTTPCookie);
#[cfg(feature = "NSDate")]
#[method(removeCookiesSinceDate:)]
pub unsafe fn removeCookiesSinceDate(&self, date: &NSDate);
#[cfg(all(feature = "NSArray", feature = "NSHTTPCookie", feature = "NSURL"))]
#[method_id(@__retain_semantics Other cookiesForURL:)]
pub unsafe fn cookiesForURL(&self, url: &NSURL) -> Option<Retained<NSArray<NSHTTPCookie>>>;
#[cfg(all(feature = "NSArray", feature = "NSHTTPCookie", feature = "NSURL"))]
#[method(setCookies:forURL:mainDocumentURL:)]
pub unsafe fn setCookies_forURL_mainDocumentURL(
&self,
cookies: &NSArray<NSHTTPCookie>,
url: Option<&NSURL>,
main_document_url: Option<&NSURL>,
);
#[method(cookieAcceptPolicy)]
pub unsafe fn cookieAcceptPolicy(&self) -> NSHTTPCookieAcceptPolicy;
#[method(setCookieAcceptPolicy:)]
pub unsafe fn setCookieAcceptPolicy(&self, cookie_accept_policy: NSHTTPCookieAcceptPolicy);
#[cfg(all(
feature = "NSArray",
feature = "NSHTTPCookie",
feature = "NSSortDescriptor"
))]
#[method_id(@__retain_semantics Other sortedCookiesUsingDescriptors:)]
pub unsafe fn sortedCookiesUsingDescriptors(
&self,
sort_order: &NSArray<NSSortDescriptor>,
) -> Retained<NSArray<NSHTTPCookie>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSHTTPCookieStorage {
#[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!(
/// NSURLSessionTaskAdditions
unsafe impl NSHTTPCookieStorage {
#[cfg(all(
feature = "NSArray",
feature = "NSHTTPCookie",
feature = "NSURLSession"
))]
#[method(storeCookies:forTask:)]
pub unsafe fn storeCookies_forTask(
&self,
cookies: &NSArray<NSHTTPCookie>,
task: &NSURLSessionTask,
);
#[cfg(all(
feature = "NSArray",
feature = "NSHTTPCookie",
feature = "NSURLSession",
feature = "block2"
))]
#[method(getCookiesForTask:completionHandler:)]
pub unsafe fn getCookiesForTask_completionHandler(
&self,
task: &NSURLSessionTask,
completion_handler: &block2::Block<dyn Fn(*mut NSArray<NSHTTPCookie>)>,
);
}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSHTTPCookieManagerAcceptPolicyChangedNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSHTTPCookieManagerCookiesChangedNotification: &'static NSNotificationName;
}

View File

@@ -0,0 +1,331 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSPointerFunctions")]
pub static NSHashTableStrongMemory: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsStrongMemory.0);
#[cfg(feature = "NSPointerFunctions")]
pub static NSHashTableZeroingWeakMemory: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsZeroingWeakMemory.0);
#[cfg(feature = "NSPointerFunctions")]
pub static NSHashTableCopyIn: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsCopyIn.0);
#[cfg(feature = "NSPointerFunctions")]
pub static NSHashTableObjectPointerPersonality: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(
NSPointerFunctionsOptions::NSPointerFunctionsObjectPointerPersonality.0,
);
#[cfg(feature = "NSPointerFunctions")]
pub static NSHashTableWeakMemory: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsWeakMemory.0);
pub type NSHashTableOptions = NSUInteger;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSHashTable<ObjectType: ?Sized = AnyObject> {
__superclass: NSObject,
_inner0: PhantomData<*mut ObjectType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSHashTable<ObjectType> {
type Super = NSObject;
type Mutability = InteriorMutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + NSCoding> NSCoding for NSHashTable<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + IsIdCloneable> NSCopying for NSHashTable<ObjectType> {}
#[cfg(feature = "NSEnumerator")]
unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSHashTable<ObjectType> {}
unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSHashTable<ObjectType> {}
#[cfg(feature = "NSObject")]
unsafe impl<ObjectType: ?Sized + NSSecureCoding> NSSecureCoding for NSHashTable<ObjectType> {}
extern_methods!(
unsafe impl<ObjectType: Message> NSHashTable<ObjectType> {
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Init initWithOptions:capacity:)]
pub unsafe fn initWithOptions_capacity(
this: Allocated<Self>,
options: NSPointerFunctionsOptions,
initial_capacity: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Init initWithPointerFunctions:capacity:)]
pub unsafe fn initWithPointerFunctions_capacity(
this: Allocated<Self>,
functions: &NSPointerFunctions,
initial_capacity: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Other hashTableWithOptions:)]
pub unsafe fn hashTableWithOptions(
options: NSPointerFunctionsOptions,
) -> Retained<NSHashTable<ObjectType>>;
#[deprecated = "GC no longer supported"]
#[method_id(@__retain_semantics Other hashTableWithWeakObjects)]
pub unsafe fn hashTableWithWeakObjects() -> Retained<AnyObject>;
#[method_id(@__retain_semantics Other weakObjectsHashTable)]
pub unsafe fn weakObjectsHashTable() -> Retained<NSHashTable<ObjectType>>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Other pointerFunctions)]
pub unsafe fn pointerFunctions(&self) -> Retained<NSPointerFunctions>;
#[method(count)]
pub unsafe fn count(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other member:)]
pub unsafe fn member(&self, object: Option<&ObjectType>) -> Option<Retained<ObjectType>>;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other objectEnumerator)]
pub unsafe fn objectEnumerator(&self) -> Retained<NSEnumerator<ObjectType>>;
#[method(addObject:)]
pub unsafe fn addObject(&self, object: Option<&ObjectType>);
#[method(removeObject:)]
pub unsafe fn removeObject(&self, object: Option<&ObjectType>);
#[method(removeAllObjects)]
pub unsafe fn removeAllObjects(&self);
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other allObjects)]
pub unsafe fn allObjects(&self) -> Retained<NSArray<ObjectType>>;
#[method_id(@__retain_semantics Other anyObject)]
pub unsafe fn anyObject(&self) -> Option<Retained<ObjectType>>;
#[method(containsObject:)]
pub unsafe fn containsObject(&self, an_object: Option<&ObjectType>) -> bool;
#[method(intersectsHashTable:)]
pub unsafe fn intersectsHashTable(&self, other: &NSHashTable<ObjectType>) -> bool;
#[method(isEqualToHashTable:)]
pub unsafe fn isEqualToHashTable(&self, other: &NSHashTable<ObjectType>) -> bool;
#[method(isSubsetOfHashTable:)]
pub unsafe fn isSubsetOfHashTable(&self, other: &NSHashTable<ObjectType>) -> bool;
#[method(intersectHashTable:)]
pub unsafe fn intersectHashTable(&self, other: &NSHashTable<ObjectType>);
#[method(unionHashTable:)]
pub unsafe fn unionHashTable(&self, other: &NSHashTable<ObjectType>);
#[method(minusHashTable:)]
pub unsafe fn minusHashTable(&self, other: &NSHashTable<ObjectType>);
#[cfg(feature = "NSSet")]
#[method_id(@__retain_semantics Other setRepresentation)]
pub unsafe fn setRepresentation(&self) -> Retained<NSSet<ObjectType>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<ObjectType: Message> NSHashTable<ObjectType> {
#[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>;
}
);
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSHashEnumerator {
_pi: NSUInteger,
_si: NSUInteger,
_bs: *mut c_void,
}
unsafe impl Encode for NSHashEnumerator {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<NSUInteger>::ENCODING,
<NSUInteger>::ENCODING,
<*mut c_void>::ENCODING,
],
);
}
unsafe impl RefEncode for NSHashEnumerator {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub fn NSFreeHashTable(table: &NSHashTable);
}
extern "C" {
pub fn NSResetHashTable(table: &NSHashTable);
}
extern "C" {
pub fn NSCompareHashTables(table1: &NSHashTable, table2: &NSHashTable) -> Bool;
}
extern "C" {
#[cfg(feature = "NSZone")]
pub fn NSCopyHashTableWithZone(table: &NSHashTable, zone: *mut NSZone) -> NonNull<NSHashTable>;
}
extern "C" {
pub fn NSHashGet(table: &NSHashTable, pointer: *mut c_void) -> NonNull<c_void>;
}
extern "C" {
pub fn NSHashInsert(table: &NSHashTable, pointer: *mut c_void);
}
extern "C" {
pub fn NSHashInsertKnownAbsent(table: &NSHashTable, pointer: *mut c_void);
}
extern "C" {
pub fn NSHashInsertIfAbsent(table: &NSHashTable, pointer: *mut c_void) -> *mut c_void;
}
extern "C" {
pub fn NSHashRemove(table: &NSHashTable, pointer: *mut c_void);
}
extern "C" {
pub fn NSEnumerateHashTable(table: &NSHashTable) -> NSHashEnumerator;
}
extern "C" {
pub fn NSNextHashEnumeratorItem(enumerator: NonNull<NSHashEnumerator>) -> *mut c_void;
}
extern "C" {
pub fn NSEndHashTableEnumeration(enumerator: NonNull<NSHashEnumerator>);
}
extern "C" {
pub fn NSCountHashTable(table: &NSHashTable) -> NSUInteger;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromHashTable(table: &NSHashTable) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSArray")]
pub fn NSAllHashTableObjects(table: &NSHashTable) -> NonNull<NSArray>;
}
#[cfg(feature = "NSString")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSHashTableCallBacks {
pub hash: Option<unsafe extern "C" fn(NonNull<NSHashTable>, NonNull<c_void>) -> NSUInteger>,
pub isEqual: Option<
unsafe extern "C" fn(NonNull<NSHashTable>, NonNull<c_void>, NonNull<c_void>) -> Bool,
>,
pub retain: Option<unsafe extern "C" fn(NonNull<NSHashTable>, NonNull<c_void>)>,
pub release: Option<unsafe extern "C" fn(NonNull<NSHashTable>, NonNull<c_void>)>,
pub describe:
Option<unsafe extern "C" fn(NonNull<NSHashTable>, NonNull<c_void>) -> *mut NSString>,
}
#[cfg(feature = "NSString")]
unsafe impl Encode for NSHashTableCallBacks {
const ENCODING: Encoding = Encoding::Struct("?", &[<Option<unsafe extern "C" fn(NonNull<NSHashTable>,NonNull<c_void>,) -> NSUInteger>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSHashTable>,NonNull<c_void>,NonNull<c_void>,) -> Bool>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSHashTable>,NonNull<c_void>,)>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSHashTable>,NonNull<c_void>,)>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSHashTable>,NonNull<c_void>,) -> *mut NSString>>::ENCODING,]);
}
#[cfg(feature = "NSString")]
unsafe impl RefEncode for NSHashTableCallBacks {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[cfg(all(feature = "NSString", feature = "NSZone"))]
pub fn NSCreateHashTableWithZone(
call_backs: NSHashTableCallBacks,
capacity: NSUInteger,
zone: *mut NSZone,
) -> NonNull<NSHashTable>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSCreateHashTable(
call_backs: NSHashTableCallBacks,
capacity: NSUInteger,
) -> NonNull<NSHashTable>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIntegerHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonOwnedPointerHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonRetainedObjectHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSObjectHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSOwnedObjectIdentityHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSOwnedPointerHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSPointerToStructHashCallBacks: NSHashTableCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIntHashCallBacks: NSHashTableCallBacks;
}

View File

@@ -0,0 +1,87 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
pub struct NSHost;
unsafe impl ClassType for NSHost {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSHost {}
extern_methods!(
unsafe impl NSHost {
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other currentHost)]
pub unsafe fn currentHost() -> Retained<Self>;
#[cfg(feature = "NSString")]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other hostWithName:)]
pub unsafe fn hostWithName(name: Option<&NSString>) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other hostWithAddress:)]
pub unsafe fn hostWithAddress(address: &NSString) -> Retained<Self>;
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method(isEqualToHost:)]
pub unsafe fn isEqualToHost(&self, a_host: &NSHost) -> bool;
#[cfg(feature = "NSString")]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other names)]
pub unsafe fn names(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other address)]
pub unsafe fn address(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "Use Network framework instead, see deprecation notice in <Foundation/NSHost.h>"]
#[method_id(@__retain_semantics Other addresses)]
pub unsafe fn addresses(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedName)]
pub unsafe fn localizedName(&self) -> Option<Retained<NSString>>;
#[deprecated = "Caching no longer supported"]
#[method(setHostCacheEnabled:)]
pub unsafe fn setHostCacheEnabled(flag: bool);
#[deprecated = "Caching no longer supported"]
#[method(isHostCacheEnabled)]
pub unsafe fn isHostCacheEnabled() -> bool;
#[deprecated = "Caching no longer supported"]
#[method(flushHostCache)]
pub unsafe fn flushHostCache();
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSHost {
#[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>;
}
);

View File

@@ -0,0 +1,108 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSISO8601DateFormatOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSISO8601DateFormatOptions: NSUInteger {
const NSISO8601DateFormatWithYear = 1;
const NSISO8601DateFormatWithMonth = 2;
const NSISO8601DateFormatWithWeekOfYear = 4;
const NSISO8601DateFormatWithDay = 16;
const NSISO8601DateFormatWithTime = 32;
const NSISO8601DateFormatWithTimeZone = 64;
const NSISO8601DateFormatWithSpaceBetweenDateAndTime = 128;
const NSISO8601DateFormatWithDashSeparatorInDate = 256;
const NSISO8601DateFormatWithColonSeparatorInTime = 512;
const NSISO8601DateFormatWithColonSeparatorInTimeZone = 1024;
const NSISO8601DateFormatWithFractionalSeconds = 2048;
const NSISO8601DateFormatWithFullDate = 275;
const NSISO8601DateFormatWithFullTime = 1632;
const NSISO8601DateFormatWithInternetDateTime = 1907;
}
}
unsafe impl Encode for NSISO8601DateFormatOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSISO8601DateFormatOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSISO8601DateFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSISO8601DateFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSISO8601DateFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSISO8601DateFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSISO8601DateFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSSecureCoding for NSISO8601DateFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSISO8601DateFormatter {
#[cfg(feature = "NSTimeZone")]
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Retained<NSTimeZone>;
#[cfg(feature = "NSTimeZone")]
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[method(formatOptions)]
pub unsafe fn formatOptions(&self) -> NSISO8601DateFormatOptions;
#[method(setFormatOptions:)]
pub unsafe fn setFormatOptions(&self, format_options: NSISO8601DateFormatOptions);
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromDate:)]
pub unsafe fn stringFromDate(&self, date: &NSDate) -> Retained<NSString>;
#[cfg(all(feature = "NSDate", feature = "NSString"))]
#[method_id(@__retain_semantics Other dateFromString:)]
pub unsafe fn dateFromString(&self, string: &NSString) -> Option<Retained<NSDate>>;
#[cfg(all(feature = "NSDate", feature = "NSString", feature = "NSTimeZone"))]
#[method_id(@__retain_semantics Other stringFromDate:timeZone:formatOptions:)]
pub unsafe fn stringFromDate_timeZone_formatOptions(
date: &NSDate,
time_zone: &NSTimeZone,
format_options: NSISO8601DateFormatOptions,
) -> Retained<NSString>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSISO8601DateFormatter {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,93 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSIndexPath;
unsafe impl ClassType for NSIndexPath {
type Super = NSObject;
type Mutability = Immutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSIndexPath {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSIndexPath {}
unsafe impl NSObjectProtocol for NSIndexPath {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSIndexPath {}
extern_methods!(
unsafe impl NSIndexPath {
#[method_id(@__retain_semantics Other indexPathWithIndex:)]
pub unsafe fn indexPathWithIndex(index: NSUInteger) -> Retained<Self>;
#[method_id(@__retain_semantics Other indexPathWithIndexes:length:)]
pub unsafe fn indexPathWithIndexes_length(
indexes: *mut NSUInteger,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithIndexes:length:)]
pub unsafe fn initWithIndexes_length(
this: Allocated<Self>,
indexes: *mut NSUInteger,
length: NSUInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithIndex:)]
pub unsafe fn initWithIndex(this: Allocated<Self>, index: NSUInteger) -> Retained<Self>;
#[method_id(@__retain_semantics Other indexPathByAddingIndex:)]
pub unsafe fn indexPathByAddingIndex(&self, index: NSUInteger) -> Retained<NSIndexPath>;
#[method_id(@__retain_semantics Other indexPathByRemovingLastIndex)]
pub unsafe fn indexPathByRemovingLastIndex(&self) -> Retained<NSIndexPath>;
#[method(indexAtPosition:)]
pub unsafe fn indexAtPosition(&self, position: NSUInteger) -> NSUInteger;
#[method(length)]
pub unsafe fn length(&self) -> NSUInteger;
#[cfg(feature = "NSRange")]
#[method(getIndexes:range:)]
pub unsafe fn getIndexes_range(
&self,
indexes: NonNull<NSUInteger>,
position_range: NSRange,
);
#[cfg(feature = "NSObjCRuntime")]
#[method(compare:)]
pub unsafe fn compare(&self, other_object: &NSIndexPath) -> NSComparisonResult;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSIndexPath {
#[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!(
/// NSDeprecated
unsafe impl NSIndexPath {
#[deprecated]
#[method(getIndexes:)]
pub unsafe fn getIndexes(&self, indexes: NonNull<NSUInteger>);
}
);

View File

@@ -0,0 +1,318 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSIndexSet;
unsafe impl ClassType for NSIndexSet {
type Super = NSObject;
type Mutability = ImmutableWithMutableSubclass<NSMutableIndexSet>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSIndexSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSIndexSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSIndexSet {}
unsafe impl NSObjectProtocol for NSIndexSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSIndexSet {}
extern_methods!(
unsafe impl NSIndexSet {
#[method_id(@__retain_semantics Other indexSet)]
pub unsafe fn indexSet() -> Retained<Self>;
#[method_id(@__retain_semantics Other indexSetWithIndex:)]
pub unsafe fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other indexSetWithIndexesInRange:)]
pub unsafe fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Init initWithIndexesInRange:)]
pub unsafe fn initWithIndexesInRange(
this: Allocated<Self>,
range: NSRange,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithIndexSet:)]
pub unsafe fn initWithIndexSet(
this: Allocated<Self>,
index_set: &NSIndexSet,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithIndex:)]
pub unsafe fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;
#[method(isEqualToIndexSet:)]
pub unsafe fn isEqualToIndexSet(&self, index_set: &NSIndexSet) -> bool;
#[method(count)]
pub unsafe fn count(&self) -> NSUInteger;
#[method(firstIndex)]
pub unsafe fn firstIndex(&self) -> NSUInteger;
#[method(lastIndex)]
pub unsafe fn lastIndex(&self) -> NSUInteger;
#[method(indexGreaterThanIndex:)]
pub unsafe fn indexGreaterThanIndex(&self, value: NSUInteger) -> NSUInteger;
#[method(indexLessThanIndex:)]
pub unsafe fn indexLessThanIndex(&self, value: NSUInteger) -> NSUInteger;
#[method(indexGreaterThanOrEqualToIndex:)]
pub unsafe fn indexGreaterThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;
#[method(indexLessThanOrEqualToIndex:)]
pub unsafe fn indexLessThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;
#[cfg(feature = "NSRange")]
#[method(getIndexes:maxCount:inIndexRange:)]
pub unsafe fn getIndexes_maxCount_inIndexRange(
&self,
index_buffer: NonNull<NSUInteger>,
buffer_size: NSUInteger,
range: NSRangePointer,
) -> NSUInteger;
#[cfg(feature = "NSRange")]
#[method(countOfIndexesInRange:)]
pub unsafe fn countOfIndexesInRange(&self, range: NSRange) -> NSUInteger;
#[method(containsIndex:)]
pub unsafe fn containsIndex(&self, value: NSUInteger) -> bool;
#[cfg(feature = "NSRange")]
#[method(containsIndexesInRange:)]
pub unsafe fn containsIndexesInRange(&self, range: NSRange) -> bool;
#[method(containsIndexes:)]
pub unsafe fn containsIndexes(&self, index_set: &NSIndexSet) -> bool;
#[cfg(feature = "NSRange")]
#[method(intersectsIndexesInRange:)]
pub unsafe fn intersectsIndexesInRange(&self, range: NSRange) -> bool;
#[cfg(feature = "block2")]
#[method(enumerateIndexesUsingBlock:)]
pub unsafe fn enumerateIndexesUsingBlock(
&self,
block: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(enumerateIndexesWithOptions:usingBlock:)]
pub unsafe fn enumerateIndexesWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
#[method(enumerateIndexesInRange:options:usingBlock:)]
pub unsafe fn enumerateIndexesInRange_options_usingBlock(
&self,
range: NSRange,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(feature = "block2")]
#[method(indexPassingTest:)]
pub unsafe fn indexPassingTest(
&self,
predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
) -> NSUInteger;
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(indexWithOptions:passingTest:)]
pub unsafe fn indexWithOptions_passingTest(
&self,
opts: NSEnumerationOptions,
predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
) -> NSUInteger;
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
#[method(indexInRange:options:passingTest:)]
pub unsafe fn indexInRange_options_passingTest(
&self,
range: NSRange,
opts: NSEnumerationOptions,
predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
) -> NSUInteger;
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Other indexesPassingTest:)]
pub unsafe fn indexesPassingTest(
&self,
predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
) -> Retained<NSIndexSet>;
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method_id(@__retain_semantics Other indexesWithOptions:passingTest:)]
pub unsafe fn indexesWithOptions_passingTest(
&self,
opts: NSEnumerationOptions,
predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
) -> Retained<NSIndexSet>;
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
#[method_id(@__retain_semantics Other indexesInRange:options:passingTest:)]
pub unsafe fn indexesInRange_options_passingTest(
&self,
range: NSRange,
opts: NSEnumerationOptions,
predicate: &block2::Block<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
) -> Retained<NSIndexSet>;
#[cfg(all(feature = "NSRange", feature = "block2"))]
#[method(enumerateRangesUsingBlock:)]
pub unsafe fn enumerateRangesUsingBlock(
&self,
block: &block2::Block<dyn Fn(NSRange, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
#[method(enumerateRangesWithOptions:usingBlock:)]
pub unsafe fn enumerateRangesWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NSRange, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
#[method(enumerateRangesInRange:options:usingBlock:)]
pub unsafe fn enumerateRangesInRange_options_usingBlock(
&self,
range: NSRange,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NSRange, NonNull<Bool>) + '_>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSIndexSet {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMutableIndexSet;
unsafe impl ClassType for NSMutableIndexSet {
#[inherits(NSObject)]
type Super = NSIndexSet;
type Mutability = MutableWithImmutableSuperclass<NSIndexSet>;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMutableIndexSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMutableIndexSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSMutableCopying for NSMutableIndexSet {}
unsafe impl NSObjectProtocol for NSMutableIndexSet {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMutableIndexSet {}
extern_methods!(
unsafe impl NSMutableIndexSet {
#[method(addIndexes:)]
pub unsafe fn addIndexes(&mut self, index_set: &NSIndexSet);
#[method(removeIndexes:)]
pub unsafe fn removeIndexes(&mut self, index_set: &NSIndexSet);
#[method(removeAllIndexes)]
pub unsafe fn removeAllIndexes(&mut self);
#[method(addIndex:)]
pub unsafe fn addIndex(&mut self, value: NSUInteger);
#[method(removeIndex:)]
pub unsafe fn removeIndex(&mut self, value: NSUInteger);
#[cfg(feature = "NSRange")]
#[method(addIndexesInRange:)]
pub unsafe fn addIndexesInRange(&mut self, range: NSRange);
#[cfg(feature = "NSRange")]
#[method(removeIndexesInRange:)]
pub unsafe fn removeIndexesInRange(&mut self, range: NSRange);
#[method(shiftIndexesStartingAtIndex:by:)]
pub unsafe fn shiftIndexesStartingAtIndex_by(
&mut self,
index: NSUInteger,
delta: NSInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSIndexSet`
unsafe impl NSMutableIndexSet {
#[method_id(@__retain_semantics Other indexSet)]
pub unsafe fn indexSet() -> Retained<Self>;
#[method_id(@__retain_semantics Other indexSetWithIndex:)]
pub unsafe fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Other indexSetWithIndexesInRange:)]
pub unsafe fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;
#[cfg(feature = "NSRange")]
#[method_id(@__retain_semantics Init initWithIndexesInRange:)]
pub unsafe fn initWithIndexesInRange(
this: Allocated<Self>,
range: NSRange,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithIndexSet:)]
pub unsafe fn initWithIndexSet(
this: Allocated<Self>,
index_set: &NSIndexSet,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithIndex:)]
pub unsafe fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMutableIndexSet {
#[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>;
}
);

View File

@@ -0,0 +1,109 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSInflectionRule;
unsafe impl ClassType for NSInflectionRule {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSInflectionRule {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSInflectionRule {}
unsafe impl NSObjectProtocol for NSInflectionRule {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSInflectionRule {}
extern_methods!(
unsafe impl NSInflectionRule {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Other automaticRule)]
pub unsafe fn automaticRule() -> Retained<NSInflectionRule>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSInflectionRule {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSInflectionRuleExplicit;
unsafe impl ClassType for NSInflectionRuleExplicit {
#[inherits(NSObject)]
type Super = NSInflectionRule;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSInflectionRuleExplicit {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSInflectionRuleExplicit {}
unsafe impl NSObjectProtocol for NSInflectionRuleExplicit {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSInflectionRuleExplicit {}
extern_methods!(
unsafe impl NSInflectionRuleExplicit {
#[cfg(feature = "NSMorphology")]
#[method_id(@__retain_semantics Init initWithMorphology:)]
pub unsafe fn initWithMorphology(
this: Allocated<Self>,
morphology: &NSMorphology,
) -> Retained<Self>;
#[cfg(feature = "NSMorphology")]
#[method_id(@__retain_semantics Other morphology)]
pub unsafe fn morphology(&self) -> Retained<NSMorphology>;
}
);
extern_methods!(
/// Methods declared on superclass `NSInflectionRule`
unsafe impl NSInflectionRuleExplicit {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSInflectionRuleExplicit {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSInflectionAvailability
unsafe impl NSInflectionRule {
#[cfg(feature = "NSString")]
#[method(canInflectLanguage:)]
pub unsafe fn canInflectLanguage(language: &NSString) -> bool;
#[method(canInflectPreferredLocalization)]
pub unsafe fn canInflectPreferredLocalization() -> bool;
}
);

View File

@@ -0,0 +1,89 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSInvocation;
unsafe impl ClassType for NSInvocation {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSInvocation {}
extern_methods!(
unsafe impl NSInvocation {
#[cfg(feature = "NSMethodSignature")]
#[method_id(@__retain_semantics Other invocationWithMethodSignature:)]
pub unsafe fn invocationWithMethodSignature(
sig: &NSMethodSignature,
) -> Retained<NSInvocation>;
#[cfg(feature = "NSMethodSignature")]
#[method_id(@__retain_semantics Other methodSignature)]
pub unsafe fn methodSignature(&self) -> Retained<NSMethodSignature>;
#[method(retainArguments)]
pub unsafe fn retainArguments(&self);
#[method(argumentsRetained)]
pub unsafe fn argumentsRetained(&self) -> bool;
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(selector)]
pub unsafe fn selector(&self) -> Sel;
#[method(setSelector:)]
pub unsafe fn setSelector(&self, selector: Sel);
#[method(getReturnValue:)]
pub unsafe fn getReturnValue(&self, ret_loc: NonNull<c_void>);
#[method(setReturnValue:)]
pub unsafe fn setReturnValue(&self, ret_loc: NonNull<c_void>);
#[method(getArgument:atIndex:)]
pub unsafe fn getArgument_atIndex(
&self,
argument_location: NonNull<c_void>,
idx: NSInteger,
);
#[method(setArgument:atIndex:)]
pub unsafe fn setArgument_atIndex(
&self,
argument_location: NonNull<c_void>,
idx: NSInteger,
);
#[method(invoke)]
pub unsafe fn invoke(&self);
#[method(invokeWithTarget:)]
pub unsafe fn invokeWithTarget(&self, target: &AnyObject);
#[method(invokeUsingIMP:)]
pub unsafe fn invokeUsingIMP(&self, imp: IMP);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSInvocation {
#[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>;
}
);

View File

@@ -0,0 +1,397 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSItemProviderRepresentationVisibility(pub NSInteger);
impl NSItemProviderRepresentationVisibility {
#[doc(alias = "NSItemProviderRepresentationVisibilityAll")]
pub const All: Self = Self(0);
#[doc(alias = "NSItemProviderRepresentationVisibilityTeam")]
pub const Team: Self = Self(1);
#[doc(alias = "NSItemProviderRepresentationVisibilityGroup")]
pub const Group: Self = Self(2);
#[doc(alias = "NSItemProviderRepresentationVisibilityOwnProcess")]
pub const OwnProcess: Self = Self(3);
}
unsafe impl Encode for NSItemProviderRepresentationVisibility {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSItemProviderRepresentationVisibility {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSItemProviderFileOptions(pub NSInteger);
bitflags::bitflags! {
impl NSItemProviderFileOptions: NSInteger {
const NSItemProviderFileOptionOpenInPlace = 1;
}
}
unsafe impl Encode for NSItemProviderFileOptions {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSItemProviderFileOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait NSItemProviderWriting: NSObjectProtocol {
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other writableTypeIdentifiersForItemProvider)]
unsafe fn writableTypeIdentifiersForItemProvider_class() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[optional]
#[method_id(@__retain_semantics Other writableTypeIdentifiersForItemProvider)]
unsafe fn writableTypeIdentifiersForItemProvider(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[optional]
#[method(itemProviderVisibilityForRepresentationWithTypeIdentifier:)]
unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier_class(
type_identifier: &NSString,
) -> NSItemProviderRepresentationVisibility;
#[cfg(feature = "NSString")]
#[optional]
#[method(itemProviderVisibilityForRepresentationWithTypeIdentifier:)]
unsafe fn itemProviderVisibilityForRepresentationWithTypeIdentifier(
&self,
type_identifier: &NSString,
) -> NSItemProviderRepresentationVisibility;
#[cfg(all(
feature = "NSData",
feature = "NSError",
feature = "NSProgress",
feature = "NSString",
feature = "block2"
))]
#[method_id(@__retain_semantics Other loadDataWithTypeIdentifier:forItemProviderCompletionHandler:)]
unsafe fn loadDataWithTypeIdentifier_forItemProviderCompletionHandler(
&self,
type_identifier: &NSString,
completion_handler: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
) -> Option<Retained<NSProgress>>;
}
unsafe impl ProtocolType for dyn NSItemProviderWriting {}
);
extern_protocol!(
pub unsafe trait NSItemProviderReading: NSObjectProtocol {
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other readableTypeIdentifiersForItemProvider)]
unsafe fn readableTypeIdentifiersForItemProvider() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSData", feature = "NSError", feature = "NSString"))]
#[method_id(@__retain_semantics Other objectWithItemProviderData:typeIdentifier:error:_)]
unsafe fn objectWithItemProviderData_typeIdentifier_error(
data: &NSData,
type_identifier: &NSString,
) -> Result<Retained<Self>, Retained<NSError>>;
}
unsafe impl ProtocolType for dyn NSItemProviderReading {}
);
#[cfg(all(feature = "NSError", feature = "NSObject", feature = "block2"))]
pub type NSItemProviderCompletionHandler =
*mut block2::Block<dyn Fn(*mut ProtocolObject<dyn NSSecureCoding>, *mut NSError)>;
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSObject",
feature = "block2"
))]
pub type NSItemProviderLoadHandler =
*mut block2::Block<dyn Fn(NSItemProviderCompletionHandler, *const AnyClass, *mut NSDictionary)>;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSItemProvider;
unsafe impl ClassType for NSItemProvider {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSItemProvider {}
unsafe impl NSObjectProtocol for NSItemProvider {}
extern_methods!(
unsafe impl NSItemProvider {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(
feature = "NSData",
feature = "NSError",
feature = "NSProgress",
feature = "NSString",
feature = "block2"
))]
#[method(registerDataRepresentationForTypeIdentifier:visibility:loadHandler:)]
pub unsafe fn registerDataRepresentationForTypeIdentifier_visibility_loadHandler(
&self,
type_identifier: &NSString,
visibility: NSItemProviderRepresentationVisibility,
load_handler: &block2::Block<
dyn Fn(
NonNull<block2::Block<dyn Fn(*mut NSData, *mut NSError)>>,
) -> *mut NSProgress,
>,
);
#[cfg(all(
feature = "NSError",
feature = "NSProgress",
feature = "NSString",
feature = "NSURL",
feature = "block2"
))]
#[method(registerFileRepresentationForTypeIdentifier:fileOptions:visibility:loadHandler:)]
pub unsafe fn registerFileRepresentationForTypeIdentifier_fileOptions_visibility_loadHandler(
&self,
type_identifier: &NSString,
file_options: NSItemProviderFileOptions,
visibility: NSItemProviderRepresentationVisibility,
load_handler: &block2::Block<
dyn Fn(
NonNull<block2::Block<dyn Fn(*mut NSURL, Bool, *mut NSError)>>,
) -> *mut NSProgress,
>,
);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other registeredTypeIdentifiers)]
pub unsafe fn registeredTypeIdentifiers(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other registeredTypeIdentifiersWithFileOptions:)]
pub unsafe fn registeredTypeIdentifiersWithFileOptions(
&self,
file_options: NSItemProviderFileOptions,
) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[method(hasItemConformingToTypeIdentifier:)]
pub unsafe fn hasItemConformingToTypeIdentifier(&self, type_identifier: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[method(hasRepresentationConformingToTypeIdentifier:fileOptions:)]
pub unsafe fn hasRepresentationConformingToTypeIdentifier_fileOptions(
&self,
type_identifier: &NSString,
file_options: NSItemProviderFileOptions,
) -> bool;
#[cfg(all(
feature = "NSData",
feature = "NSError",
feature = "NSProgress",
feature = "NSString",
feature = "block2"
))]
#[method_id(@__retain_semantics Other loadDataRepresentationForTypeIdentifier:completionHandler:)]
pub unsafe fn loadDataRepresentationForTypeIdentifier_completionHandler(
&self,
type_identifier: &NSString,
completion_handler: &block2::Block<dyn Fn(*mut NSData, *mut NSError)>,
) -> Retained<NSProgress>;
#[cfg(all(
feature = "NSError",
feature = "NSProgress",
feature = "NSString",
feature = "NSURL",
feature = "block2"
))]
#[method_id(@__retain_semantics Other loadFileRepresentationForTypeIdentifier:completionHandler:)]
pub unsafe fn loadFileRepresentationForTypeIdentifier_completionHandler(
&self,
type_identifier: &NSString,
completion_handler: &block2::Block<dyn Fn(*mut NSURL, *mut NSError)>,
) -> Retained<NSProgress>;
#[cfg(all(
feature = "NSError",
feature = "NSProgress",
feature = "NSString",
feature = "NSURL",
feature = "block2"
))]
#[method_id(@__retain_semantics Other loadInPlaceFileRepresentationForTypeIdentifier:completionHandler:)]
pub unsafe fn loadInPlaceFileRepresentationForTypeIdentifier_completionHandler(
&self,
type_identifier: &NSString,
completion_handler: &block2::Block<dyn Fn(*mut NSURL, Bool, *mut NSError)>,
) -> Retained<NSProgress>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other suggestedName)]
pub unsafe fn suggestedName(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setSuggestedName:)]
pub unsafe fn setSuggestedName(&self, suggested_name: Option<&NSString>);
#[method_id(@__retain_semantics Init initWithObject:)]
pub unsafe fn initWithObject(
this: Allocated<Self>,
object: &ProtocolObject<dyn NSItemProviderWriting>,
) -> Retained<Self>;
#[method(registerObject:visibility:)]
pub unsafe fn registerObject_visibility(
&self,
object: &ProtocolObject<dyn NSItemProviderWriting>,
visibility: NSItemProviderRepresentationVisibility,
);
#[cfg(all(feature = "NSObject", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithItem:typeIdentifier:)]
pub unsafe fn initWithItem_typeIdentifier(
this: Allocated<Self>,
item: Option<&ProtocolObject<dyn NSSecureCoding>>,
type_identifier: Option<&NSString>,
) -> Retained<Self>;
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithContentsOfURL:)]
pub unsafe fn initWithContentsOfURL(
this: Allocated<Self>,
file_url: Option<&NSURL>,
) -> Option<Retained<Self>>;
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSObject",
feature = "NSString",
feature = "block2"
))]
#[method(registerItemForTypeIdentifier:loadHandler:)]
pub unsafe fn registerItemForTypeIdentifier_loadHandler(
&self,
type_identifier: &NSString,
load_handler: NSItemProviderLoadHandler,
);
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSObject",
feature = "NSString",
feature = "block2"
))]
#[method(loadItemForTypeIdentifier:options:completionHandler:)]
pub unsafe fn loadItemForTypeIdentifier_options_completionHandler(
&self,
type_identifier: &NSString,
options: Option<&NSDictionary>,
completion_handler: NSItemProviderCompletionHandler,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSItemProvider {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
#[cfg(feature = "NSString")]
pub static NSItemProviderPreferredImageSizeKey: &'static NSString;
}
extern_methods!(
/// NSPreviewSupport
unsafe impl NSItemProvider {
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSObject",
feature = "block2"
))]
#[method(previewImageHandler)]
pub unsafe fn previewImageHandler(&self) -> NSItemProviderLoadHandler;
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSObject",
feature = "block2"
))]
#[method(setPreviewImageHandler:)]
pub unsafe fn setPreviewImageHandler(
&self,
preview_image_handler: NSItemProviderLoadHandler,
);
#[cfg(all(
feature = "NSDictionary",
feature = "NSError",
feature = "NSObject",
feature = "block2"
))]
#[method(loadPreviewImageWithOptions:completionHandler:)]
pub unsafe fn loadPreviewImageWithOptions_completionHandler(
&self,
options: Option<&NSDictionary>,
completion_handler: NSItemProviderCompletionHandler,
);
}
);
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionJavaScriptPreprocessingResultsKey: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSExtensionJavaScriptFinalizeArgumentKey: Option<&'static NSString>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSItemProviderErrorDomain: &'static NSString;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSItemProviderErrorCode(pub NSInteger);
impl NSItemProviderErrorCode {
pub const NSItemProviderUnknownError: Self = Self(-1);
pub const NSItemProviderItemUnavailableError: Self = Self(-1000);
pub const NSItemProviderUnexpectedValueClassError: Self = Self(-1100);
pub const NSItemProviderUnavailableCoercionError: Self = Self(-1200);
}
unsafe impl Encode for NSItemProviderErrorCode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSItemProviderErrorCode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

View File

@@ -0,0 +1,101 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSJSONReadingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSJSONReadingOptions: NSUInteger {
const NSJSONReadingMutableContainers = 1<<0;
const NSJSONReadingMutableLeaves = 1<<1;
const NSJSONReadingFragmentsAllowed = 1<<2;
const NSJSONReadingJSON5Allowed = 1<<3;
const NSJSONReadingTopLevelDictionaryAssumed = 1<<4;
#[deprecated]
const NSJSONReadingAllowFragments = NSJSONReadingOptions::NSJSONReadingFragmentsAllowed.0;
}
}
unsafe impl Encode for NSJSONReadingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSJSONReadingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSJSONWritingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSJSONWritingOptions: NSUInteger {
const NSJSONWritingPrettyPrinted = 1<<0;
const NSJSONWritingSortedKeys = 1<<1;
const NSJSONWritingFragmentsAllowed = 1<<2;
const NSJSONWritingWithoutEscapingSlashes = 1<<3;
}
}
unsafe impl Encode for NSJSONWritingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSJSONWritingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSJSONSerialization;
unsafe impl ClassType for NSJSONSerialization {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSJSONSerialization {}
extern_methods!(
unsafe impl NSJSONSerialization {
#[method(isValidJSONObject:)]
pub unsafe fn isValidJSONObject(obj: &AnyObject) -> bool;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other dataWithJSONObject:options:error:_)]
pub unsafe fn dataWithJSONObject_options_error(
obj: &AnyObject,
opt: NSJSONWritingOptions,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other JSONObjectWithData:options:error:_)]
pub unsafe fn JSONObjectWithData_options_error(
data: &NSData,
opt: NSJSONReadingOptions,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSError", feature = "NSStream"))]
#[method_id(@__retain_semantics Other JSONObjectWithStream:options:error:_)]
pub unsafe fn JSONObjectWithStream_options_error(
stream: &NSInputStream,
opt: NSJSONReadingOptions,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSJSONSerialization {
#[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>;
}
);

View File

@@ -0,0 +1,233 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSUndefinedKeyException: &'static NSExceptionName;
}
// NS_TYPED_ENUM
#[cfg(feature = "NSString")]
pub type NSKeyValueOperator = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSAverageKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSCountKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSDistinctUnionOfArraysKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSDistinctUnionOfObjectsKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSDistinctUnionOfSetsKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMaximumKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMinimumKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSSumKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSUnionOfArraysKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSUnionOfObjectsKeyValueOperator: &'static NSKeyValueOperator;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSUnionOfSetsKeyValueOperator: &'static NSKeyValueOperator;
}
extern_category!(
/// Category "NSKeyValueCoding" on [`NSObject`].
#[doc(alias = "NSKeyValueCoding")]
pub unsafe trait NSObjectNSKeyValueCoding {
#[method(accessInstanceVariablesDirectly)]
unsafe fn accessInstanceVariablesDirectly() -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForKey:)]
unsafe fn valueForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method(setValue:forKey:)]
unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method(validateValue:forKey:error:_)]
unsafe fn validateValue_forKey_error(
&self,
io_value: &mut Option<Retained<AnyObject>>,
in_key: &NSString,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other mutableArrayValueForKey:)]
unsafe fn mutableArrayValueForKey(&self, key: &NSString) -> Retained<NSMutableArray>;
#[cfg(all(feature = "NSOrderedSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other mutableOrderedSetValueForKey:)]
unsafe fn mutableOrderedSetValueForKey(
&self,
key: &NSString,
) -> Retained<NSMutableOrderedSet>;
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other mutableSetValueForKey:)]
unsafe fn mutableSetValueForKey(&self, key: &NSString) -> Retained<NSMutableSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForKeyPath:)]
unsafe fn valueForKeyPath(&self, key_path: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method(setValue:forKeyPath:)]
unsafe fn setValue_forKeyPath(&self, value: Option<&AnyObject>, key_path: &NSString);
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[method(validateValue:forKeyPath:error:_)]
unsafe fn validateValue_forKeyPath_error(
&self,
io_value: &mut Option<Retained<AnyObject>>,
in_key_path: &NSString,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other mutableArrayValueForKeyPath:)]
unsafe fn mutableArrayValueForKeyPath(
&self,
key_path: &NSString,
) -> Retained<NSMutableArray>;
#[cfg(all(feature = "NSOrderedSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other mutableOrderedSetValueForKeyPath:)]
unsafe fn mutableOrderedSetValueForKeyPath(
&self,
key_path: &NSString,
) -> Retained<NSMutableOrderedSet>;
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other mutableSetValueForKeyPath:)]
unsafe fn mutableSetValueForKeyPath(&self, key_path: &NSString) -> Retained<NSMutableSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForUndefinedKey:)]
unsafe fn valueForUndefinedKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method(setValue:forUndefinedKey:)]
unsafe fn setValue_forUndefinedKey(&self, value: Option<&AnyObject>, key: &NSString);
#[cfg(feature = "NSString")]
#[method(setNilValueForKey:)]
unsafe fn setNilValueForKey(&self, key: &NSString);
#[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other dictionaryWithValuesForKeys:)]
unsafe fn dictionaryWithValuesForKeys(
&self,
keys: &NSArray<NSString>,
) -> Retained<NSDictionary<NSString, AnyObject>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setValuesForKeysWithDictionary:)]
unsafe fn setValuesForKeysWithDictionary(
&self,
keyed_values: &NSDictionary<NSString, AnyObject>,
);
}
unsafe impl NSObjectNSKeyValueCoding for NSObject {}
);
extern_methods!(
/// NSKeyValueCoding
#[cfg(feature = "NSArray")]
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForKey:)]
pub unsafe fn valueForKey(&self, key: &NSString) -> Retained<AnyObject>;
#[cfg(feature = "NSString")]
#[method(setValue:forKey:)]
pub unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
}
);
extern_methods!(
/// NSKeyValueCoding
#[cfg(feature = "NSDictionary")]
unsafe impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForKey:)]
pub unsafe fn valueForKey(&self, key: &NSString) -> Option<Retained<ObjectType>>;
}
);
extern_methods!(
/// NSKeyValueCoding
#[cfg(feature = "NSDictionary")]
unsafe impl<KeyType: Message, ObjectType: Message> NSMutableDictionary<KeyType, ObjectType> {
#[cfg(feature = "NSString")]
#[method(setValue:forKey:)]
pub unsafe fn setValue_forKey(&mut self, value: Option<&ObjectType>, key: &NSString);
}
);
extern_methods!(
/// NSKeyValueCoding
#[cfg(feature = "NSOrderedSet")]
unsafe impl<ObjectType: Message> NSOrderedSet<ObjectType> {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForKey:)]
pub unsafe fn valueForKey(&self, key: &NSString) -> Retained<AnyObject>;
#[cfg(feature = "NSString")]
#[method(setValue:forKey:)]
pub unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
}
);
extern_methods!(
/// NSKeyValueCoding
#[cfg(feature = "NSSet")]
unsafe impl<ObjectType: Message> NSSet<ObjectType> {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForKey:)]
pub unsafe fn valueForKey(&self, key: &NSString) -> Retained<AnyObject>;
#[cfg(feature = "NSString")]
#[method(setValue:forKey:)]
pub unsafe fn setValue_forKey(&self, value: Option<&AnyObject>, key: &NSString);
}
);

View File

@@ -0,0 +1,339 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSKeyValueObservingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSKeyValueObservingOptions: NSUInteger {
const NSKeyValueObservingOptionNew = 0x01;
const NSKeyValueObservingOptionOld = 0x02;
const NSKeyValueObservingOptionInitial = 0x04;
const NSKeyValueObservingOptionPrior = 0x08;
}
}
unsafe impl Encode for NSKeyValueObservingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSKeyValueObservingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSKeyValueChange(pub NSUInteger);
impl NSKeyValueChange {
#[doc(alias = "NSKeyValueChangeSetting")]
pub const Setting: Self = Self(1);
#[doc(alias = "NSKeyValueChangeInsertion")]
pub const Insertion: Self = Self(2);
#[doc(alias = "NSKeyValueChangeRemoval")]
pub const Removal: Self = Self(3);
#[doc(alias = "NSKeyValueChangeReplacement")]
pub const Replacement: Self = Self(4);
}
unsafe impl Encode for NSKeyValueChange {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSKeyValueChange {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSKeyValueSetMutationKind(pub NSUInteger);
impl NSKeyValueSetMutationKind {
pub const NSKeyValueUnionSetMutation: Self = Self(1);
pub const NSKeyValueMinusSetMutation: Self = Self(2);
pub const NSKeyValueIntersectSetMutation: Self = Self(3);
pub const NSKeyValueSetSetMutation: Self = Self(4);
}
unsafe impl Encode for NSKeyValueSetMutationKind {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSKeyValueSetMutationKind {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_ENUM
#[cfg(feature = "NSString")]
pub type NSKeyValueChangeKey = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSKeyValueChangeKindKey: &'static NSKeyValueChangeKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSKeyValueChangeNewKey: &'static NSKeyValueChangeKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSKeyValueChangeOldKey: &'static NSKeyValueChangeKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSKeyValueChangeIndexesKey: &'static NSKeyValueChangeKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSKeyValueChangeNotificationIsPriorKey: &'static NSKeyValueChangeKey;
}
extern_category!(
/// Category "NSKeyValueObserving" on [`NSObject`].
#[doc(alias = "NSKeyValueObserving")]
pub unsafe trait NSObjectNSKeyValueObserving {
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(observeValueForKeyPath:ofObject:change:context:)]
unsafe fn observeValueForKeyPath_ofObject_change_context(
&self,
key_path: Option<&NSString>,
object: Option<&AnyObject>,
change: Option<&NSDictionary<NSKeyValueChangeKey, AnyObject>>,
context: *mut c_void,
);
}
unsafe impl NSObjectNSKeyValueObserving for NSObject {}
);
extern_category!(
/// Category "NSKeyValueObserverRegistration" on [`NSObject`].
#[doc(alias = "NSKeyValueObserverRegistration")]
pub unsafe trait NSObjectNSKeyValueObserverRegistration {
#[cfg(feature = "NSString")]
#[method(addObserver:forKeyPath:options:context:)]
unsafe fn addObserver_forKeyPath_options_context(
&self,
observer: &NSObject,
key_path: &NSString,
options: NSKeyValueObservingOptions,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:context:)]
unsafe fn removeObserver_forKeyPath_context(
&self,
observer: &NSObject,
key_path: &NSString,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:)]
unsafe fn removeObserver_forKeyPath(&self, observer: &NSObject, key_path: &NSString);
}
unsafe impl NSObjectNSKeyValueObserverRegistration for NSObject {}
);
extern_methods!(
/// NSKeyValueObserverRegistration
#[cfg(feature = "NSArray")]
unsafe impl<ObjectType: Message> NSArray<ObjectType> {
#[cfg(all(feature = "NSIndexSet", feature = "NSString"))]
#[method(addObserver:toObjectsAtIndexes:forKeyPath:options:context:)]
pub unsafe fn addObserver_toObjectsAtIndexes_forKeyPath_options_context(
&self,
observer: &NSObject,
indexes: &NSIndexSet,
key_path: &NSString,
options: NSKeyValueObservingOptions,
context: *mut c_void,
);
#[cfg(all(feature = "NSIndexSet", feature = "NSString"))]
#[method(removeObserver:fromObjectsAtIndexes:forKeyPath:context:)]
pub unsafe fn removeObserver_fromObjectsAtIndexes_forKeyPath_context(
&self,
observer: &NSObject,
indexes: &NSIndexSet,
key_path: &NSString,
context: *mut c_void,
);
#[cfg(all(feature = "NSIndexSet", feature = "NSString"))]
#[method(removeObserver:fromObjectsAtIndexes:forKeyPath:)]
pub unsafe fn removeObserver_fromObjectsAtIndexes_forKeyPath(
&self,
observer: &NSObject,
indexes: &NSIndexSet,
key_path: &NSString,
);
#[cfg(feature = "NSString")]
#[method(addObserver:forKeyPath:options:context:)]
pub unsafe fn addObserver_forKeyPath_options_context(
&self,
observer: &NSObject,
key_path: &NSString,
options: NSKeyValueObservingOptions,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:context:)]
pub unsafe fn removeObserver_forKeyPath_context(
&self,
observer: &NSObject,
key_path: &NSString,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:)]
pub unsafe fn removeObserver_forKeyPath(&self, observer: &NSObject, key_path: &NSString);
}
);
extern_methods!(
/// NSKeyValueObserverRegistration
#[cfg(feature = "NSOrderedSet")]
unsafe impl<ObjectType: Message> NSOrderedSet<ObjectType> {
#[cfg(feature = "NSString")]
#[method(addObserver:forKeyPath:options:context:)]
pub unsafe fn addObserver_forKeyPath_options_context(
&self,
observer: &NSObject,
key_path: &NSString,
options: NSKeyValueObservingOptions,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:context:)]
pub unsafe fn removeObserver_forKeyPath_context(
&self,
observer: &NSObject,
key_path: &NSString,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:)]
pub unsafe fn removeObserver_forKeyPath(&self, observer: &NSObject, key_path: &NSString);
}
);
extern_methods!(
/// NSKeyValueObserverRegistration
#[cfg(feature = "NSSet")]
unsafe impl<ObjectType: Message> NSSet<ObjectType> {
#[cfg(feature = "NSString")]
#[method(addObserver:forKeyPath:options:context:)]
pub unsafe fn addObserver_forKeyPath_options_context(
&self,
observer: &NSObject,
key_path: &NSString,
options: NSKeyValueObservingOptions,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:context:)]
pub unsafe fn removeObserver_forKeyPath_context(
&self,
observer: &NSObject,
key_path: &NSString,
context: *mut c_void,
);
#[cfg(feature = "NSString")]
#[method(removeObserver:forKeyPath:)]
pub unsafe fn removeObserver_forKeyPath(&self, observer: &NSObject, key_path: &NSString);
}
);
extern_category!(
/// Category "NSKeyValueObserverNotification" on [`NSObject`].
#[doc(alias = "NSKeyValueObserverNotification")]
pub unsafe trait NSObjectNSKeyValueObserverNotification {
#[cfg(feature = "NSString")]
#[method(willChangeValueForKey:)]
unsafe fn willChangeValueForKey(&self, key: &NSString);
#[cfg(feature = "NSString")]
#[method(didChangeValueForKey:)]
unsafe fn didChangeValueForKey(&self, key: &NSString);
#[cfg(all(feature = "NSIndexSet", feature = "NSString"))]
#[method(willChange:valuesAtIndexes:forKey:)]
unsafe fn willChange_valuesAtIndexes_forKey(
&self,
change_kind: NSKeyValueChange,
indexes: &NSIndexSet,
key: &NSString,
);
#[cfg(all(feature = "NSIndexSet", feature = "NSString"))]
#[method(didChange:valuesAtIndexes:forKey:)]
unsafe fn didChange_valuesAtIndexes_forKey(
&self,
change_kind: NSKeyValueChange,
indexes: &NSIndexSet,
key: &NSString,
);
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method(willChangeValueForKey:withSetMutation:usingObjects:)]
unsafe fn willChangeValueForKey_withSetMutation_usingObjects(
&self,
key: &NSString,
mutation_kind: NSKeyValueSetMutationKind,
objects: &NSSet,
);
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method(didChangeValueForKey:withSetMutation:usingObjects:)]
unsafe fn didChangeValueForKey_withSetMutation_usingObjects(
&self,
key: &NSString,
mutation_kind: NSKeyValueSetMutationKind,
objects: &NSSet,
);
}
unsafe impl NSObjectNSKeyValueObserverNotification for NSObject {}
);
extern_category!(
/// Category "NSKeyValueObservingCustomization" on [`NSObject`].
#[doc(alias = "NSKeyValueObservingCustomization")]
pub unsafe trait NSObjectNSKeyValueObservingCustomization {
#[cfg(all(feature = "NSSet", feature = "NSString"))]
#[method_id(@__retain_semantics Other keyPathsForValuesAffectingValueForKey:)]
unsafe fn keyPathsForValuesAffectingValueForKey(
key: &NSString,
) -> Retained<NSSet<NSString>>;
#[cfg(feature = "NSString")]
#[method(automaticallyNotifiesObserversForKey:)]
unsafe fn automaticallyNotifiesObserversForKey(key: &NSString) -> bool;
#[method(observationInfo)]
unsafe fn observationInfo(&self) -> *mut c_void;
#[method(setObservationInfo:)]
unsafe fn setObservationInfo(&self, observation_info: *mut c_void);
}
unsafe impl NSObjectNSKeyValueObservingCustomization for NSObject {}
);

View File

@@ -0,0 +1,496 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInvalidArchiveOperationException: &'static NSExceptionName;
}
extern "C" {
#[cfg(all(feature = "NSObjCRuntime", feature = "NSString"))]
pub static NSInvalidUnarchiveOperationException: &'static NSExceptionName;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSKeyedArchiveRootObjectKey: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCoder")]
pub struct NSKeyedArchiver;
#[cfg(feature = "NSCoder")]
unsafe impl ClassType for NSKeyedArchiver {
#[inherits(NSObject)]
type Super = NSCoder;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCoder")]
unsafe impl NSObjectProtocol for NSKeyedArchiver {}
extern_methods!(
#[cfg(feature = "NSCoder")]
unsafe impl NSKeyedArchiver {
#[method_id(@__retain_semantics Init initRequiringSecureCoding:)]
pub unsafe fn initRequiringSecureCoding(
this: Allocated<Self>,
requires_secure_coding: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other archivedDataWithRootObject:requiringSecureCoding:error:_)]
pub unsafe fn archivedDataWithRootObject_requiringSecureCoding_error(
object: &AnyObject,
requires_secure_coding: bool,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[deprecated = "Use -initRequiringSecureCoding: instead"]
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[deprecated = "Use -initRequiringSecureCoding: instead"]
#[method_id(@__retain_semantics Init initForWritingWithMutableData:)]
pub unsafe fn initForWritingWithMutableData(
this: Allocated<Self>,
data: &NSMutableData,
) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[deprecated = "Use +archivedDataWithRootObject:requiringSecureCoding:error: instead"]
#[method_id(@__retain_semantics Other archivedDataWithRootObject:)]
pub unsafe fn archivedDataWithRootObject(root_object: &AnyObject) -> Retained<NSData>;
#[cfg(feature = "NSString")]
#[deprecated = "Use +archivedDataWithRootObject:requiringSecureCoding:error: and -writeToURL:options:error: instead"]
#[method(archiveRootObject:toFile:)]
pub unsafe fn archiveRootObject_toFile(root_object: &AnyObject, path: &NSString) -> bool;
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSKeyedArchiverDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSKeyedArchiverDelegate>>,
);
#[cfg(feature = "NSPropertyList")]
#[method(outputFormat)]
pub unsafe fn outputFormat(&self) -> NSPropertyListFormat;
#[cfg(feature = "NSPropertyList")]
#[method(setOutputFormat:)]
pub unsafe fn setOutputFormat(&self, output_format: NSPropertyListFormat);
#[cfg(feature = "NSData")]
#[method_id(@__retain_semantics Other encodedData)]
pub unsafe fn encodedData(&self) -> Retained<NSData>;
#[method(finishEncoding)]
pub unsafe fn finishEncoding(&self);
#[cfg(feature = "NSString")]
#[method(setClassName:forClass:)]
pub unsafe fn setClassName_forClass_class(coded_name: Option<&NSString>, cls: &AnyClass);
#[cfg(feature = "NSString")]
#[method(setClassName:forClass:)]
pub unsafe fn setClassName_forClass(&self, coded_name: Option<&NSString>, cls: &AnyClass);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other classNameForClass:)]
pub unsafe fn classNameForClass_class(cls: &AnyClass) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other classNameForClass:)]
pub unsafe fn classNameForClass(&self, cls: &AnyClass) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(encodeObject:forKey:)]
pub unsafe fn encodeObject_forKey(&self, object: Option<&AnyObject>, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeConditionalObject:forKey:)]
pub unsafe fn encodeConditionalObject_forKey(
&self,
object: Option<&AnyObject>,
key: &NSString,
);
#[cfg(feature = "NSString")]
#[method(encodeBool:forKey:)]
pub unsafe fn encodeBool_forKey(&self, value: bool, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeInt:forKey:)]
pub unsafe fn encodeInt_forKey(&self, value: c_int, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeInt32:forKey:)]
pub unsafe fn encodeInt32_forKey(&self, value: i32, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeInt64:forKey:)]
pub unsafe fn encodeInt64_forKey(&self, value: i64, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeFloat:forKey:)]
pub unsafe fn encodeFloat_forKey(&self, value: c_float, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeDouble:forKey:)]
pub unsafe fn encodeDouble_forKey(&self, value: c_double, key: &NSString);
#[cfg(feature = "NSString")]
#[method(encodeBytes:length:forKey:)]
pub unsafe fn encodeBytes_length_forKey(
&self,
bytes: *mut u8,
length: NSUInteger,
key: &NSString,
);
#[method(requiresSecureCoding)]
pub unsafe fn requiresSecureCoding(&self) -> bool;
#[method(setRequiresSecureCoding:)]
pub unsafe fn setRequiresSecureCoding(&self, requires_secure_coding: bool);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCoder")]
unsafe impl NSKeyedArchiver {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCoder")]
pub struct NSKeyedUnarchiver;
#[cfg(feature = "NSCoder")]
unsafe impl ClassType for NSKeyedUnarchiver {
#[inherits(NSObject)]
type Super = NSCoder;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCoder")]
unsafe impl NSObjectProtocol for NSKeyedUnarchiver {}
extern_methods!(
#[cfg(feature = "NSCoder")]
unsafe impl NSKeyedUnarchiver {
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Init initForReadingFromData:error:_)]
pub unsafe fn initForReadingFromData_error(
this: Allocated<Self>,
data: &NSData,
) -> Result<Retained<Self>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other unarchivedObjectOfClass:fromData:error:_)]
pub unsafe fn unarchivedObjectOfClass_fromData_error(
cls: &AnyClass,
data: &NSData,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(feature = "NSArray", feature = "NSData", feature = "NSError"))]
#[method_id(@__retain_semantics Other unarchivedArrayOfObjectsOfClass:fromData:error:_)]
pub unsafe fn unarchivedArrayOfObjectsOfClass_fromData_error(
cls: &AnyClass,
data: &NSData,
) -> Result<Retained<NSArray>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSDictionary", feature = "NSError"))]
#[method_id(@__retain_semantics Other unarchivedDictionaryWithKeysOfClass:objectsOfClass:fromData:error:_)]
pub unsafe fn unarchivedDictionaryWithKeysOfClass_objectsOfClass_fromData_error(
key_cls: &AnyClass,
value_cls: &AnyClass,
data: &NSData,
) -> Result<Retained<NSDictionary>, Retained<NSError>>;
#[cfg(all(feature = "NSData", feature = "NSError", feature = "NSSet"))]
#[method_id(@__retain_semantics Other unarchivedObjectOfClasses:fromData:error:_)]
pub unsafe fn unarchivedObjectOfClasses_fromData_error(
classes: &NSSet<TodoClass>,
data: &NSData,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(all(
feature = "NSArray",
feature = "NSData",
feature = "NSError",
feature = "NSSet"
))]
#[method_id(@__retain_semantics Other unarchivedArrayOfObjectsOfClasses:fromData:error:_)]
pub unsafe fn unarchivedArrayOfObjectsOfClasses_fromData_error(
classes: &NSSet<TodoClass>,
data: &NSData,
) -> Result<Retained<NSArray>, Retained<NSError>>;
#[cfg(all(
feature = "NSData",
feature = "NSDictionary",
feature = "NSError",
feature = "NSSet"
))]
#[method_id(@__retain_semantics Other unarchivedDictionaryWithKeysOfClasses:objectsOfClasses:fromData:error:_)]
pub unsafe fn unarchivedDictionaryWithKeysOfClasses_objectsOfClasses_fromData_error(
key_classes: &NSSet<TodoClass>,
value_classes: &NSSet<TodoClass>,
data: &NSData,
) -> Result<Retained<NSDictionary>, Retained<NSError>>;
#[deprecated = "Use -initForReadingFromData:error: instead"]
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[deprecated = "Use -initForReadingFromData:error: instead"]
#[method_id(@__retain_semantics Init initForReadingWithData:)]
pub unsafe fn initForReadingWithData(
this: Allocated<Self>,
data: &NSData,
) -> Retained<Self>;
#[cfg(feature = "NSData")]
#[deprecated = "Use +unarchivedObjectOfClass:fromData:error: instead"]
#[method_id(@__retain_semantics Other unarchiveObjectWithData:)]
pub unsafe fn unarchiveObjectWithData(data: &NSData) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSData", feature = "NSError"))]
#[deprecated = "Use +unarchivedObjectOfClass:fromData:error: instead"]
#[method_id(@__retain_semantics Other unarchiveTopLevelObjectWithData:error:_)]
pub unsafe fn unarchiveTopLevelObjectWithData_error(
data: &NSData,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use +unarchivedObjectOfClass:fromData:error: instead"]
#[method_id(@__retain_semantics Other unarchiveObjectWithFile:)]
pub unsafe fn unarchiveObjectWithFile(path: &NSString) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSKeyedUnarchiverDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSKeyedUnarchiverDelegate>>,
);
#[method(finishDecoding)]
pub unsafe fn finishDecoding(&self);
#[cfg(feature = "NSString")]
#[method(setClass:forClassName:)]
pub unsafe fn setClass_forClassName_class(cls: Option<&AnyClass>, coded_name: &NSString);
#[cfg(feature = "NSString")]
#[method(setClass:forClassName:)]
pub unsafe fn setClass_forClassName(&self, cls: Option<&AnyClass>, coded_name: &NSString);
#[cfg(feature = "NSString")]
#[method(classForClassName:)]
pub unsafe fn classForClassName_class(coded_name: &NSString) -> Option<&'static AnyClass>;
#[cfg(feature = "NSString")]
#[method(classForClassName:)]
pub unsafe fn classForClassName(&self, coded_name: &NSString) -> Option<&'static AnyClass>;
#[cfg(feature = "NSString")]
#[method(containsValueForKey:)]
pub unsafe fn containsValueForKey(&self, key: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decodeObjectForKey:)]
pub unsafe fn decodeObjectForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method(decodeBoolForKey:)]
pub unsafe fn decodeBoolForKey(&self, key: &NSString) -> bool;
#[cfg(feature = "NSString")]
#[method(decodeIntForKey:)]
pub unsafe fn decodeIntForKey(&self, key: &NSString) -> c_int;
#[cfg(feature = "NSString")]
#[method(decodeInt32ForKey:)]
pub unsafe fn decodeInt32ForKey(&self, key: &NSString) -> i32;
#[cfg(feature = "NSString")]
#[method(decodeInt64ForKey:)]
pub unsafe fn decodeInt64ForKey(&self, key: &NSString) -> i64;
#[cfg(feature = "NSString")]
#[method(decodeFloatForKey:)]
pub unsafe fn decodeFloatForKey(&self, key: &NSString) -> c_float;
#[cfg(feature = "NSString")]
#[method(decodeDoubleForKey:)]
pub unsafe fn decodeDoubleForKey(&self, key: &NSString) -> c_double;
#[cfg(feature = "NSString")]
#[method(decodeBytesForKey:returnedLength:)]
pub unsafe fn decodeBytesForKey_returnedLength(
&self,
key: &NSString,
lengthp: *mut NSUInteger,
) -> *mut u8;
#[method(requiresSecureCoding)]
pub unsafe fn requiresSecureCoding(&self) -> bool;
#[method(setRequiresSecureCoding:)]
pub unsafe fn setRequiresSecureCoding(&self, requires_secure_coding: bool);
#[method(decodingFailurePolicy)]
pub unsafe fn decodingFailurePolicy(&self) -> NSDecodingFailurePolicy;
#[method(setDecodingFailurePolicy:)]
pub unsafe fn setDecodingFailurePolicy(
&self,
decoding_failure_policy: NSDecodingFailurePolicy,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCoder")]
unsafe impl NSKeyedUnarchiver {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSKeyedArchiverDelegate: NSObjectProtocol {
#[cfg(feature = "NSCoder")]
#[optional]
#[method_id(@__retain_semantics Other archiver:willEncodeObject:)]
unsafe fn archiver_willEncodeObject(
&self,
archiver: &NSKeyedArchiver,
object: &AnyObject,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSCoder")]
#[optional]
#[method(archiver:didEncodeObject:)]
unsafe fn archiver_didEncodeObject(
&self,
archiver: &NSKeyedArchiver,
object: Option<&AnyObject>,
);
#[cfg(feature = "NSCoder")]
#[optional]
#[method(archiver:willReplaceObject:withObject:)]
unsafe fn archiver_willReplaceObject_withObject(
&self,
archiver: &NSKeyedArchiver,
object: Option<&AnyObject>,
new_object: Option<&AnyObject>,
);
#[cfg(feature = "NSCoder")]
#[optional]
#[method(archiverWillFinish:)]
unsafe fn archiverWillFinish(&self, archiver: &NSKeyedArchiver);
#[cfg(feature = "NSCoder")]
#[optional]
#[method(archiverDidFinish:)]
unsafe fn archiverDidFinish(&self, archiver: &NSKeyedArchiver);
}
unsafe impl ProtocolType for dyn NSKeyedArchiverDelegate {}
);
extern_protocol!(
pub unsafe trait NSKeyedUnarchiverDelegate: NSObjectProtocol {
#[cfg(all(feature = "NSArray", feature = "NSCoder", feature = "NSString"))]
#[optional]
#[method(unarchiver:cannotDecodeObjectOfClassName:originalClasses:)]
unsafe fn unarchiver_cannotDecodeObjectOfClassName_originalClasses(
&self,
unarchiver: &NSKeyedUnarchiver,
name: &NSString,
class_names: &NSArray<NSString>,
) -> Option<&'static AnyClass>;
#[cfg(feature = "NSCoder")]
#[optional]
#[method(unarchiver:willReplaceObject:withObject:)]
unsafe fn unarchiver_willReplaceObject_withObject(
&self,
unarchiver: &NSKeyedUnarchiver,
object: &AnyObject,
new_object: &AnyObject,
);
#[cfg(feature = "NSCoder")]
#[optional]
#[method(unarchiverWillFinish:)]
unsafe fn unarchiverWillFinish(&self, unarchiver: &NSKeyedUnarchiver);
#[cfg(feature = "NSCoder")]
#[optional]
#[method(unarchiverDidFinish:)]
unsafe fn unarchiverDidFinish(&self, unarchiver: &NSKeyedUnarchiver);
}
unsafe impl ProtocolType for dyn NSKeyedUnarchiverDelegate {}
);
extern_category!(
/// Category "NSKeyedArchiverObjectSubstitution" on [`NSObject`].
#[doc(alias = "NSKeyedArchiverObjectSubstitution")]
pub unsafe trait NSObjectNSKeyedArchiverObjectSubstitution {
#[method(classForKeyedArchiver)]
unsafe fn classForKeyedArchiver(&self) -> Option<&'static AnyClass>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Other replacementObjectForKeyedArchiver:)]
unsafe fn replacementObjectForKeyedArchiver(
&self,
archiver: &NSKeyedArchiver,
) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other classFallbacksForKeyedArchiver)]
unsafe fn classFallbacksForKeyedArchiver() -> Retained<NSArray<NSString>>;
}
unsafe impl NSObjectNSKeyedArchiverObjectSubstitution for NSObject {}
);
extern_category!(
/// Category "NSKeyedUnarchiverObjectSubstitution" on [`NSObject`].
#[doc(alias = "NSKeyedUnarchiverObjectSubstitution")]
pub unsafe trait NSObjectNSKeyedUnarchiverObjectSubstitution {
#[method(classForKeyedUnarchiver)]
unsafe fn classForKeyedUnarchiver() -> &'static AnyClass;
}
unsafe impl NSObjectNSKeyedUnarchiverObjectSubstitution for NSObject {}
);

View File

@@ -0,0 +1,132 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLengthFormatterUnit(pub NSInteger);
impl NSLengthFormatterUnit {
#[doc(alias = "NSLengthFormatterUnitMillimeter")]
pub const Millimeter: Self = Self(8);
#[doc(alias = "NSLengthFormatterUnitCentimeter")]
pub const Centimeter: Self = Self(9);
#[doc(alias = "NSLengthFormatterUnitMeter")]
pub const Meter: Self = Self(11);
#[doc(alias = "NSLengthFormatterUnitKilometer")]
pub const Kilometer: Self = Self(14);
#[doc(alias = "NSLengthFormatterUnitInch")]
pub const Inch: Self = Self((5 << 8) + 1);
#[doc(alias = "NSLengthFormatterUnitFoot")]
pub const Foot: Self = Self((5 << 8) + 2);
#[doc(alias = "NSLengthFormatterUnitYard")]
pub const Yard: Self = Self((5 << 8) + 3);
#[doc(alias = "NSLengthFormatterUnitMile")]
pub const Mile: Self = Self((5 << 8) + 4);
}
unsafe impl Encode for NSLengthFormatterUnit {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSLengthFormatterUnit {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSLengthFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSLengthFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSLengthFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSLengthFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSLengthFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSLengthFormatter {
#[cfg(feature = "NSNumberFormatter")]
#[method_id(@__retain_semantics Other numberFormatter)]
pub unsafe fn numberFormatter(&self) -> Retained<NSNumberFormatter>;
#[cfg(feature = "NSNumberFormatter")]
#[method(setNumberFormatter:)]
pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
#[method(unitStyle)]
pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
#[method(setUnitStyle:)]
pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
#[method(isForPersonHeightUse)]
pub unsafe fn isForPersonHeightUse(&self) -> bool;
#[method(setForPersonHeightUse:)]
pub unsafe fn setForPersonHeightUse(&self, for_person_height_use: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromValue:unit:)]
pub unsafe fn stringFromValue_unit(
&self,
value: c_double,
unit: NSLengthFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromMeters:)]
pub unsafe fn stringFromMeters(&self, number_in_meters: c_double) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other unitStringFromValue:unit:)]
pub unsafe fn unitStringFromValue_unit(
&self,
value: c_double,
unit: NSLengthFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other unitStringFromMeters:usedUnit:)]
pub unsafe fn unitStringFromMeters_usedUnit(
&self,
number_in_meters: c_double,
unitp: *mut NSLengthFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(getObjectValue:forString:errorDescription:)]
pub unsafe fn getObjectValue_forString_errorDescription(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSLengthFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,549 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSLinguisticTagScheme = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeTokenType: &'static NSLinguisticTagScheme;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeLexicalClass: &'static NSLinguisticTagScheme;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeNameType: &'static NSLinguisticTagScheme;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeNameTypeOrLexicalClass: &'static NSLinguisticTagScheme;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeLemma: &'static NSLinguisticTagScheme;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeLanguage: &'static NSLinguisticTagScheme;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSchemeScript: &'static NSLinguisticTagScheme;
}
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSLinguisticTag = NSString;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagWord: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagPunctuation: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagWhitespace: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOther: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagNoun: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagVerb: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagAdjective: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagAdverb: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagPronoun: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagDeterminer: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagParticle: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagPreposition: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagNumber: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagConjunction: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagInterjection: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagClassifier: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagIdiom: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOtherWord: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagSentenceTerminator: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOpenQuote: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagCloseQuote: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOpenParenthesis: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagCloseParenthesis: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagWordJoiner: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagDash: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOtherPunctuation: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagParagraphBreak: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOtherWhitespace: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagPersonalName: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagPlaceName: &'static NSLinguisticTag;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLinguisticTagOrganizationName: &'static NSLinguisticTag;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLinguisticTaggerUnit(pub NSInteger);
impl NSLinguisticTaggerUnit {
#[doc(alias = "NSLinguisticTaggerUnitWord")]
pub const Word: Self = Self(0);
#[doc(alias = "NSLinguisticTaggerUnitSentence")]
pub const Sentence: Self = Self(1);
#[doc(alias = "NSLinguisticTaggerUnitParagraph")]
pub const Paragraph: Self = Self(2);
#[doc(alias = "NSLinguisticTaggerUnitDocument")]
pub const Document: Self = Self(3);
}
unsafe impl Encode for NSLinguisticTaggerUnit {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSLinguisticTaggerUnit {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLinguisticTaggerOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSLinguisticTaggerOptions: NSUInteger {
const NSLinguisticTaggerOmitWords = 1<<0;
const NSLinguisticTaggerOmitPunctuation = 1<<1;
const NSLinguisticTaggerOmitWhitespace = 1<<2;
const NSLinguisticTaggerOmitOther = 1<<3;
const NSLinguisticTaggerJoinNames = 1<<4;
}
}
unsafe impl Encode for NSLinguisticTaggerOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLinguisticTaggerOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
pub struct NSLinguisticTagger;
unsafe impl ClassType for NSLinguisticTagger {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSLinguisticTagger {}
extern_methods!(
unsafe impl NSLinguisticTagger {
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Init initWithTagSchemes:options:)]
pub unsafe fn initWithTagSchemes_options(
this: Allocated<Self>,
tag_schemes: &NSArray<NSLinguisticTagScheme>,
opts: NSUInteger,
) -> Retained<Self>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagSchemes)]
pub unsafe fn tagSchemes(&self) -> Retained<NSArray<NSLinguisticTagScheme>>;
#[cfg(feature = "NSString")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other string)]
pub unsafe fn string(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(setString:)]
pub unsafe fn setString(&self, string: Option<&NSString>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other availableTagSchemesForUnit:language:)]
pub unsafe fn availableTagSchemesForUnit_language(
unit: NSLinguisticTaggerUnit,
language: &NSString,
) -> Retained<NSArray<NSLinguisticTagScheme>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other availableTagSchemesForLanguage:)]
pub unsafe fn availableTagSchemesForLanguage(
language: &NSString,
) -> Retained<NSArray<NSLinguisticTagScheme>>;
#[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(setOrthography:range:)]
pub unsafe fn setOrthography_range(
&self,
orthography: Option<&NSOrthography>,
range: NSRange,
);
#[cfg(all(feature = "NSOrthography", feature = "NSRange"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other orthographyAtIndex:effectiveRange:)]
pub unsafe fn orthographyAtIndex_effectiveRange(
&self,
char_index: NSUInteger,
effective_range: NSRangePointer,
) -> Option<Retained<NSOrthography>>;
#[cfg(feature = "NSRange")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(stringEditedInRange:changeInLength:)]
pub unsafe fn stringEditedInRange_changeInLength(
&self,
new_range: NSRange,
delta: NSInteger,
);
#[cfg(feature = "NSRange")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(tokenRangeAtIndex:unit:)]
pub unsafe fn tokenRangeAtIndex_unit(
&self,
char_index: NSUInteger,
unit: NSLinguisticTaggerUnit,
) -> NSRange;
#[cfg(feature = "NSRange")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(sentenceRangeForRange:)]
pub unsafe fn sentenceRangeForRange(&self, range: NSRange) -> NSRange;
#[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(enumerateTagsInRange:unit:scheme:options:usingBlock:)]
pub unsafe fn enumerateTagsInRange_unit_scheme_options_usingBlock(
&self,
range: NSRange,
unit: NSLinguisticTaggerUnit,
scheme: &NSLinguisticTagScheme,
options: NSLinguisticTaggerOptions,
block: &block2::Block<dyn Fn(*mut NSLinguisticTag, NSRange, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagAtIndex:unit:scheme:tokenRange:)]
pub unsafe fn tagAtIndex_unit_scheme_tokenRange(
&self,
char_index: NSUInteger,
unit: NSLinguisticTaggerUnit,
scheme: &NSLinguisticTagScheme,
token_range: NSRangePointer,
) -> Option<Retained<NSLinguisticTag>>;
#[cfg(all(
feature = "NSArray",
feature = "NSRange",
feature = "NSString",
feature = "NSValue"
))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagsInRange:unit:scheme:options:tokenRanges:)]
pub unsafe fn tagsInRange_unit_scheme_options_tokenRanges(
&self,
range: NSRange,
unit: NSLinguisticTaggerUnit,
scheme: &NSLinguisticTagScheme,
options: NSLinguisticTaggerOptions,
token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
) -> Retained<NSArray<NSLinguisticTag>>;
#[cfg(all(feature = "NSRange", feature = "NSString", feature = "block2"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(enumerateTagsInRange:scheme:options:usingBlock:)]
pub unsafe fn enumerateTagsInRange_scheme_options_usingBlock(
&self,
range: NSRange,
tag_scheme: &NSLinguisticTagScheme,
opts: NSLinguisticTaggerOptions,
block: &block2::Block<
dyn Fn(*mut NSLinguisticTag, NSRange, NSRange, NonNull<Bool>) + '_,
>,
);
#[cfg(all(feature = "NSRange", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagAtIndex:scheme:tokenRange:sentenceRange:)]
pub unsafe fn tagAtIndex_scheme_tokenRange_sentenceRange(
&self,
char_index: NSUInteger,
scheme: &NSLinguisticTagScheme,
token_range: NSRangePointer,
sentence_range: NSRangePointer,
) -> Option<Retained<NSLinguisticTag>>;
#[cfg(all(
feature = "NSArray",
feature = "NSRange",
feature = "NSString",
feature = "NSValue"
))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagsInRange:scheme:options:tokenRanges:)]
pub unsafe fn tagsInRange_scheme_options_tokenRanges(
&self,
range: NSRange,
tag_scheme: &NSString,
opts: NSLinguisticTaggerOptions,
token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other dominantLanguage)]
pub unsafe fn dominantLanguage(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other dominantLanguageForString:)]
pub unsafe fn dominantLanguageForString(string: &NSString) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSOrthography", feature = "NSRange", feature = "NSString"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagForString:atIndex:unit:scheme:orthography:tokenRange:)]
pub unsafe fn tagForString_atIndex_unit_scheme_orthography_tokenRange(
string: &NSString,
char_index: NSUInteger,
unit: NSLinguisticTaggerUnit,
scheme: &NSLinguisticTagScheme,
orthography: Option<&NSOrthography>,
token_range: NSRangePointer,
) -> Option<Retained<NSLinguisticTag>>;
#[cfg(all(
feature = "NSArray",
feature = "NSOrthography",
feature = "NSRange",
feature = "NSString",
feature = "NSValue"
))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other tagsForString:range:unit:scheme:options:orthography:tokenRanges:)]
pub unsafe fn tagsForString_range_unit_scheme_options_orthography_tokenRanges(
string: &NSString,
range: NSRange,
unit: NSLinguisticTaggerUnit,
scheme: &NSLinguisticTagScheme,
options: NSLinguisticTaggerOptions,
orthography: Option<&NSOrthography>,
token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
) -> Retained<NSArray<NSLinguisticTag>>;
#[cfg(all(
feature = "NSOrthography",
feature = "NSRange",
feature = "NSString",
feature = "block2"
))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(enumerateTagsForString:range:unit:scheme:options:orthography:usingBlock:)]
pub unsafe fn enumerateTagsForString_range_unit_scheme_options_orthography_usingBlock(
string: &NSString,
range: NSRange,
unit: NSLinguisticTaggerUnit,
scheme: &NSLinguisticTagScheme,
options: NSLinguisticTaggerOptions,
orthography: Option<&NSOrthography>,
block: &block2::Block<dyn Fn(*mut NSLinguisticTag, NSRange, NonNull<Bool>) + '_>,
);
#[cfg(all(
feature = "NSArray",
feature = "NSRange",
feature = "NSString",
feature = "NSValue"
))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other possibleTagsAtIndex:scheme:tokenRange:sentenceRange:scores:)]
pub unsafe fn possibleTagsAtIndex_scheme_tokenRange_sentenceRange_scores(
&self,
char_index: NSUInteger,
tag_scheme: &NSString,
token_range: NSRangePointer,
sentence_range: NSRangePointer,
scores: Option<&mut Option<Retained<NSArray<NSValue>>>>,
) -> Option<Retained<NSArray<NSString>>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSLinguisticTagger {
#[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!(
/// NSLinguisticAnalysis
#[cfg(feature = "NSString")]
unsafe impl NSString {
#[cfg(all(
feature = "NSArray",
feature = "NSOrthography",
feature = "NSRange",
feature = "NSValue"
))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method_id(@__retain_semantics Other linguisticTagsInRange:scheme:options:orthography:tokenRanges:)]
pub unsafe fn linguisticTagsInRange_scheme_options_orthography_tokenRanges(
&self,
range: NSRange,
scheme: &NSLinguisticTagScheme,
options: NSLinguisticTaggerOptions,
orthography: Option<&NSOrthography>,
token_ranges: Option<&mut Option<Retained<NSArray<NSValue>>>>,
) -> Retained<NSArray<NSLinguisticTag>>;
#[cfg(all(feature = "NSOrthography", feature = "NSRange", feature = "block2"))]
#[deprecated = "All NSLinguisticTagger API should be replaced with NaturalLanguage.framework API"]
#[method(enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:)]
pub unsafe fn enumerateLinguisticTagsInRange_scheme_options_orthography_usingBlock(
&self,
range: NSRange,
scheme: &NSLinguisticTagScheme,
options: NSLinguisticTaggerOptions,
orthography: Option<&NSOrthography>,
block: &block2::Block<
dyn Fn(*mut NSLinguisticTag, NSRange, NSRange, NonNull<Bool>) + '_,
>,
);
}
);

View File

@@ -0,0 +1,75 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSListFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSListFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSListFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSListFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSListFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSListFormatter {
#[cfg(feature = "NSLocale")]
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Retained<NSLocale>;
#[cfg(feature = "NSLocale")]
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[method_id(@__retain_semantics Other itemFormatter)]
pub unsafe fn itemFormatter(&self) -> Option<Retained<NSFormatter>>;
#[method(setItemFormatter:)]
pub unsafe fn setItemFormatter(&self, item_formatter: Option<&NSFormatter>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other localizedStringByJoiningStrings:)]
pub unsafe fn localizedStringByJoiningStrings(
strings: &NSArray<NSString>,
) -> Retained<NSString>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromItems:)]
pub unsafe fn stringFromItems(&self, items: &NSArray) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringForObjectValue:)]
pub unsafe fn stringForObjectValue(
&self,
obj: Option<&AnyObject>,
) -> Option<Retained<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSListFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,483 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_ENUM
#[cfg(feature = "NSString")]
pub type NSLocaleKey = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSLocale;
unsafe impl ClassType for NSLocale {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSLocale {}
unsafe impl Sync for NSLocale {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSLocale {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSLocale {}
unsafe impl NSObjectProtocol for NSLocale {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSLocale {}
extern_methods!(
unsafe impl NSLocale {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other objectForKey:)]
pub unsafe fn objectForKey(&self, key: &NSLocaleKey) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other displayNameForKey:value:)]
pub unsafe fn displayNameForKey_value(
&self,
key: &NSLocaleKey,
value: &AnyObject,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithLocaleIdentifier:)]
pub unsafe fn initWithLocaleIdentifier(
this: Allocated<Self>,
string: &NSString,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// NSExtendedLocale
unsafe impl NSLocale {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localeIdentifier)]
pub unsafe fn localeIdentifier(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForLocaleIdentifier:)]
pub unsafe fn localizedStringForLocaleIdentifier(
&self,
locale_identifier: &NSString,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other languageCode)]
pub unsafe fn languageCode(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForLanguageCode:)]
pub unsafe fn localizedStringForLanguageCode(
&self,
language_code: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other languageIdentifier)]
pub unsafe fn languageIdentifier(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated]
#[method_id(@__retain_semantics Other countryCode)]
pub unsafe fn countryCode(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForCountryCode:)]
pub unsafe fn localizedStringForCountryCode(
&self,
country_code: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other regionCode)]
pub unsafe fn regionCode(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other scriptCode)]
pub unsafe fn scriptCode(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForScriptCode:)]
pub unsafe fn localizedStringForScriptCode(
&self,
script_code: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other variantCode)]
pub unsafe fn variantCode(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForVariantCode:)]
pub unsafe fn localizedStringForVariantCode(
&self,
variant_code: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSCharacterSet")]
#[method_id(@__retain_semantics Other exemplarCharacterSet)]
pub unsafe fn exemplarCharacterSet(&self) -> Retained<NSCharacterSet>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other calendarIdentifier)]
pub unsafe fn calendarIdentifier(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForCalendarIdentifier:)]
pub unsafe fn localizedStringForCalendarIdentifier(
&self,
calendar_identifier: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other collationIdentifier)]
pub unsafe fn collationIdentifier(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForCollationIdentifier:)]
pub unsafe fn localizedStringForCollationIdentifier(
&self,
collation_identifier: &NSString,
) -> Option<Retained<NSString>>;
#[method(usesMetricSystem)]
pub unsafe fn usesMetricSystem(&self) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decimalSeparator)]
pub unsafe fn decimalSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other groupingSeparator)]
pub unsafe fn groupingSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other currencySymbol)]
pub unsafe fn currencySymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other currencyCode)]
pub unsafe fn currencyCode(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForCurrencyCode:)]
pub unsafe fn localizedStringForCurrencyCode(
&self,
currency_code: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other collatorIdentifier)]
pub unsafe fn collatorIdentifier(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localizedStringForCollatorIdentifier:)]
pub unsafe fn localizedStringForCollatorIdentifier(
&self,
collator_identifier: &NSString,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other quotationBeginDelimiter)]
pub unsafe fn quotationBeginDelimiter(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other quotationEndDelimiter)]
pub unsafe fn quotationEndDelimiter(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other alternateQuotationBeginDelimiter)]
pub unsafe fn alternateQuotationBeginDelimiter(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other alternateQuotationEndDelimiter)]
pub unsafe fn alternateQuotationEndDelimiter(&self) -> Retained<NSString>;
}
);
extern_methods!(
/// NSLocaleCreation
unsafe impl NSLocale {
#[method_id(@__retain_semantics Other autoupdatingCurrentLocale)]
pub unsafe fn autoupdatingCurrentLocale() -> Retained<NSLocale>;
#[method_id(@__retain_semantics Other currentLocale)]
pub unsafe fn currentLocale() -> Retained<NSLocale>;
#[method_id(@__retain_semantics Other systemLocale)]
pub unsafe fn systemLocale() -> Retained<NSLocale>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localeWithLocaleIdentifier:)]
pub unsafe fn localeWithLocaleIdentifier(ident: &NSString) -> Retained<Self>;
}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLocaleLanguageDirection(pub NSUInteger);
impl NSLocaleLanguageDirection {
#[doc(alias = "NSLocaleLanguageDirectionUnknown")]
pub const Unknown: Self = Self(0);
#[doc(alias = "NSLocaleLanguageDirectionLeftToRight")]
pub const LeftToRight: Self = Self(1);
#[doc(alias = "NSLocaleLanguageDirectionRightToLeft")]
pub const RightToLeft: Self = Self(2);
#[doc(alias = "NSLocaleLanguageDirectionTopToBottom")]
pub const TopToBottom: Self = Self(3);
#[doc(alias = "NSLocaleLanguageDirectionBottomToTop")]
pub const BottomToTop: Self = Self(4);
}
unsafe impl Encode for NSLocaleLanguageDirection {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLocaleLanguageDirection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSLocaleGeneralInfo
unsafe impl NSLocale {
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other availableLocaleIdentifiers)]
pub unsafe fn availableLocaleIdentifiers() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other ISOLanguageCodes)]
pub unsafe fn ISOLanguageCodes() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other ISOCountryCodes)]
pub unsafe fn ISOCountryCodes() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other ISOCurrencyCodes)]
pub unsafe fn ISOCurrencyCodes() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other commonISOCurrencyCodes)]
pub unsafe fn commonISOCurrencyCodes() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other preferredLanguages)]
pub unsafe fn preferredLanguages() -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other componentsFromLocaleIdentifier:)]
pub unsafe fn componentsFromLocaleIdentifier(
string: &NSString,
) -> Retained<NSDictionary<NSString, NSString>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other localeIdentifierFromComponents:)]
pub unsafe fn localeIdentifierFromComponents(
dict: &NSDictionary<NSString, NSString>,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other canonicalLocaleIdentifierFromString:)]
pub unsafe fn canonicalLocaleIdentifierFromString(string: &NSString) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other canonicalLanguageIdentifierFromString:)]
pub unsafe fn canonicalLanguageIdentifierFromString(
string: &NSString,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other localeIdentifierFromWindowsLocaleCode:)]
pub unsafe fn localeIdentifierFromWindowsLocaleCode(
lcid: u32,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(windowsLocaleCodeFromLocaleIdentifier:)]
pub unsafe fn windowsLocaleCodeFromLocaleIdentifier(locale_identifier: &NSString) -> u32;
#[cfg(feature = "NSString")]
#[method(characterDirectionForLanguage:)]
pub unsafe fn characterDirectionForLanguage(
iso_lang_code: &NSString,
) -> NSLocaleLanguageDirection;
#[cfg(feature = "NSString")]
#[method(lineDirectionForLanguage:)]
pub unsafe fn lineDirectionForLanguage(
iso_lang_code: &NSString,
) -> NSLocaleLanguageDirection;
}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSCurrentLocaleDidChangeNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleIdentifier: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleLanguageCode: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleCountryCode: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleScriptCode: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleVariantCode: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleExemplarCharacterSet: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleCalendar: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleCollationIdentifier: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleUsesMetricSystem: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleMeasurementSystem: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleDecimalSeparator: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleGroupingSeparator: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleCurrencySymbol: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleCurrencyCode: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleCollatorIdentifier: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleQuotationBeginDelimiterKey: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleQuotationEndDelimiterKey: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleAlternateQuotationBeginDelimiterKey: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSLocaleAlternateQuotationEndDelimiterKey: &'static NSLocaleKey;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSGregorianCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSBuddhistCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSChineseCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSHebrewCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIslamicCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIslamicCivilCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSJapaneseCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSRepublicOfChinaCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSPersianCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIndianCalendar: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSISO8601Calendar: &'static NSString;
}

View File

@@ -0,0 +1,248 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSLocking {
#[method(lock)]
unsafe fn lock(&self);
#[method(unlock)]
unsafe fn unlock(&self);
}
unsafe impl ProtocolType for dyn NSLocking {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSLock;
unsafe impl ClassType for NSLock {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSLock {}
unsafe impl Sync for NSLock {}
unsafe impl NSLocking for NSLock {}
unsafe impl NSObjectProtocol for NSLock {}
extern_methods!(
unsafe impl NSLock {
#[method(tryLock)]
pub unsafe fn tryLock(&self) -> bool;
#[cfg(feature = "NSDate")]
#[method(lockBeforeDate:)]
pub unsafe fn lockBeforeDate(&self, limit: &NSDate) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setName:)]
pub fn setName(&self, name: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSLock {
#[method_id(@__retain_semantics Init init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub fn new() -> Retained<Self>;
}
);
impl DefaultRetained for NSLock {
#[inline]
fn default_id() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSConditionLock;
unsafe impl ClassType for NSConditionLock {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSConditionLock {}
unsafe impl Sync for NSConditionLock {}
unsafe impl NSLocking for NSConditionLock {}
unsafe impl NSObjectProtocol for NSConditionLock {}
extern_methods!(
unsafe impl NSConditionLock {
#[method_id(@__retain_semantics Init initWithCondition:)]
pub unsafe fn initWithCondition(
this: Allocated<Self>,
condition: NSInteger,
) -> Retained<Self>;
#[method(condition)]
pub unsafe fn condition(&self) -> NSInteger;
#[method(lockWhenCondition:)]
pub unsafe fn lockWhenCondition(&self, condition: NSInteger);
#[method(tryLock)]
pub unsafe fn tryLock(&self) -> bool;
#[method(tryLockWhenCondition:)]
pub unsafe fn tryLockWhenCondition(&self, condition: NSInteger) -> bool;
#[method(unlockWithCondition:)]
pub unsafe fn unlockWithCondition(&self, condition: NSInteger);
#[cfg(feature = "NSDate")]
#[method(lockBeforeDate:)]
pub unsafe fn lockBeforeDate(&self, limit: &NSDate) -> bool;
#[cfg(feature = "NSDate")]
#[method(lockWhenCondition:beforeDate:)]
pub unsafe fn lockWhenCondition_beforeDate(
&self,
condition: NSInteger,
limit: &NSDate,
) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setName:)]
pub unsafe fn setName(&self, name: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSConditionLock {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSRecursiveLock;
unsafe impl ClassType for NSRecursiveLock {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSRecursiveLock {}
unsafe impl Sync for NSRecursiveLock {}
unsafe impl NSLocking for NSRecursiveLock {}
unsafe impl NSObjectProtocol for NSRecursiveLock {}
extern_methods!(
unsafe impl NSRecursiveLock {
#[method(tryLock)]
pub unsafe fn tryLock(&self) -> bool;
#[cfg(feature = "NSDate")]
#[method(lockBeforeDate:)]
pub unsafe fn lockBeforeDate(&self, limit: &NSDate) -> bool;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setName:)]
pub unsafe fn setName(&self, name: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSRecursiveLock {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCondition;
unsafe impl ClassType for NSCondition {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSCondition {}
unsafe impl Sync for NSCondition {}
unsafe impl NSLocking for NSCondition {}
unsafe impl NSObjectProtocol for NSCondition {}
extern_methods!(
unsafe impl NSCondition {
#[method(wait)]
pub unsafe fn wait(&self);
#[cfg(feature = "NSDate")]
#[method(waitUntilDate:)]
pub unsafe fn waitUntilDate(&self, limit: &NSDate) -> bool;
#[method(signal)]
pub unsafe fn signal(&self);
#[method(broadcast)]
pub unsafe fn broadcast(&self);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setName:)]
pub unsafe fn setName(&self, name: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCondition {
#[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>;
}
);

View File

@@ -0,0 +1,424 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
#[cfg(feature = "NSPointerFunctions")]
pub static NSMapTableStrongMemory: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsStrongMemory.0);
#[cfg(feature = "NSPointerFunctions")]
pub static NSMapTableZeroingWeakMemory: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsZeroingWeakMemory.0);
#[cfg(feature = "NSPointerFunctions")]
pub static NSMapTableCopyIn: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsCopyIn.0);
#[cfg(feature = "NSPointerFunctions")]
pub static NSMapTableObjectPointerPersonality: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(
NSPointerFunctionsOptions::NSPointerFunctionsObjectPointerPersonality.0,
);
#[cfg(feature = "NSPointerFunctions")]
pub static NSMapTableWeakMemory: NSPointerFunctionsOptions =
NSPointerFunctionsOptions(NSPointerFunctionsOptions::NSPointerFunctionsWeakMemory.0);
pub type NSMapTableOptions = NSUInteger;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMapTable<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject> {
__superclass: NSObject,
_inner0: PhantomData<*mut KeyType>,
_inner1: PhantomData<*mut ObjectType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> ClassType
for NSMapTable<KeyType, ObjectType>
{
type Super = NSObject;
type Mutability = InteriorMutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSCoding, ObjectType: ?Sized + NSCoding> NSCoding
for NSMapTable<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + IsIdCloneable, ObjectType: ?Sized + IsIdCloneable> NSCopying
for NSMapTable<KeyType, ObjectType>
{
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSFastEnumeration
for NSMapTable<KeyType, ObjectType>
{
}
unsafe impl<KeyType: ?Sized, ObjectType: ?Sized> NSObjectProtocol
for NSMapTable<KeyType, ObjectType>
{
}
#[cfg(feature = "NSObject")]
unsafe impl<KeyType: ?Sized + NSSecureCoding, ObjectType: ?Sized + NSSecureCoding> NSSecureCoding
for NSMapTable<KeyType, ObjectType>
{
}
extern_methods!(
unsafe impl<KeyType: Message, ObjectType: Message> NSMapTable<KeyType, ObjectType> {
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Init initWithKeyOptions:valueOptions:capacity:)]
pub unsafe fn initWithKeyOptions_valueOptions_capacity(
this: Allocated<Self>,
key_options: NSPointerFunctionsOptions,
value_options: NSPointerFunctionsOptions,
initial_capacity: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Init initWithKeyPointerFunctions:valuePointerFunctions:capacity:)]
pub unsafe fn initWithKeyPointerFunctions_valuePointerFunctions_capacity(
this: Allocated<Self>,
key_functions: &NSPointerFunctions,
value_functions: &NSPointerFunctions,
initial_capacity: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Other mapTableWithKeyOptions:valueOptions:)]
pub unsafe fn mapTableWithKeyOptions_valueOptions(
key_options: NSPointerFunctionsOptions,
value_options: NSPointerFunctionsOptions,
) -> Retained<NSMapTable<KeyType, ObjectType>>;
#[deprecated = "GC no longer supported"]
#[method_id(@__retain_semantics Other mapTableWithStrongToStrongObjects)]
pub unsafe fn mapTableWithStrongToStrongObjects() -> Retained<AnyObject>;
#[deprecated = "GC no longer supported"]
#[method_id(@__retain_semantics Other mapTableWithWeakToStrongObjects)]
pub unsafe fn mapTableWithWeakToStrongObjects() -> Retained<AnyObject>;
#[deprecated = "GC no longer supported"]
#[method_id(@__retain_semantics Other mapTableWithStrongToWeakObjects)]
pub unsafe fn mapTableWithStrongToWeakObjects() -> Retained<AnyObject>;
#[deprecated = "GC no longer supported"]
#[method_id(@__retain_semantics Other mapTableWithWeakToWeakObjects)]
pub unsafe fn mapTableWithWeakToWeakObjects() -> Retained<AnyObject>;
#[method_id(@__retain_semantics Other strongToStrongObjectsMapTable)]
pub unsafe fn strongToStrongObjectsMapTable() -> Retained<NSMapTable<KeyType, ObjectType>>;
#[method_id(@__retain_semantics Other weakToStrongObjectsMapTable)]
pub unsafe fn weakToStrongObjectsMapTable() -> Retained<NSMapTable<KeyType, ObjectType>>;
#[method_id(@__retain_semantics Other strongToWeakObjectsMapTable)]
pub unsafe fn strongToWeakObjectsMapTable() -> Retained<NSMapTable<KeyType, ObjectType>>;
#[method_id(@__retain_semantics Other weakToWeakObjectsMapTable)]
pub unsafe fn weakToWeakObjectsMapTable() -> Retained<NSMapTable<KeyType, ObjectType>>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Other keyPointerFunctions)]
pub unsafe fn keyPointerFunctions(&self) -> Retained<NSPointerFunctions>;
#[cfg(feature = "NSPointerFunctions")]
#[method_id(@__retain_semantics Other valuePointerFunctions)]
pub unsafe fn valuePointerFunctions(&self) -> Retained<NSPointerFunctions>;
#[method_id(@__retain_semantics Other objectForKey:)]
pub unsafe fn objectForKey(&self, a_key: Option<&KeyType>) -> Option<Retained<ObjectType>>;
#[method(removeObjectForKey:)]
pub unsafe fn removeObjectForKey(&self, a_key: Option<&KeyType>);
#[method(setObject:forKey:)]
pub unsafe fn setObject_forKey(
&self,
an_object: Option<&ObjectType>,
a_key: Option<&KeyType>,
);
#[method(count)]
pub unsafe fn count(&self) -> NSUInteger;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other keyEnumerator)]
pub unsafe fn keyEnumerator(&self) -> Retained<NSEnumerator<KeyType>>;
#[cfg(feature = "NSEnumerator")]
#[method_id(@__retain_semantics Other objectEnumerator)]
pub unsafe fn objectEnumerator(&self) -> Option<Retained<NSEnumerator<ObjectType>>>;
#[method(removeAllObjects)]
pub unsafe fn removeAllObjects(&self);
#[cfg(feature = "NSDictionary")]
#[method_id(@__retain_semantics Other dictionaryRepresentation)]
pub unsafe fn dictionaryRepresentation(
&self,
) -> Retained<NSDictionary<KeyType, ObjectType>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<KeyType: Message, ObjectType: Message> NSMapTable<KeyType, ObjectType> {
#[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>;
}
);
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSMapEnumerator {
_pi: NSUInteger,
_si: NSUInteger,
_bs: *mut c_void,
}
unsafe impl Encode for NSMapEnumerator {
const ENCODING: Encoding = Encoding::Struct(
"?",
&[
<NSUInteger>::ENCODING,
<NSUInteger>::ENCODING,
<*mut c_void>::ENCODING,
],
);
}
unsafe impl RefEncode for NSMapEnumerator {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub fn NSResetMapTable(table: &NSMapTable);
}
extern "C" {
pub fn NSCompareMapTables(table1: &NSMapTable, table2: &NSMapTable) -> Bool;
}
extern "C" {
#[cfg(feature = "NSZone")]
pub fn NSCopyMapTableWithZone(table: &NSMapTable, zone: *mut NSZone) -> NonNull<NSMapTable>;
}
extern "C" {
pub fn NSMapMember(
table: &NSMapTable,
key: NonNull<c_void>,
original_key: *mut *mut c_void,
value: *mut *mut c_void,
) -> Bool;
}
extern "C" {
pub fn NSMapGet(table: &NSMapTable, key: *mut c_void) -> *mut c_void;
}
extern "C" {
pub fn NSMapInsert(table: &NSMapTable, key: *mut c_void, value: *mut c_void);
}
extern "C" {
pub fn NSMapInsertKnownAbsent(table: &NSMapTable, key: *mut c_void, value: *mut c_void);
}
extern "C" {
pub fn NSMapInsertIfAbsent(
table: &NSMapTable,
key: *mut c_void,
value: *mut c_void,
) -> *mut c_void;
}
extern "C" {
pub fn NSMapRemove(table: &NSMapTable, key: *mut c_void);
}
extern "C" {
pub fn NSEnumerateMapTable(table: &NSMapTable) -> NSMapEnumerator;
}
extern "C" {
pub fn NSNextMapEnumeratorPair(
enumerator: NonNull<NSMapEnumerator>,
key: *mut *mut c_void,
value: *mut *mut c_void,
) -> Bool;
}
extern "C" {
pub fn NSEndMapTableEnumeration(enumerator: NonNull<NSMapEnumerator>);
}
extern "C" {
pub fn NSCountMapTable(table: &NSMapTable) -> NSUInteger;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSStringFromMapTable(table: &NSMapTable) -> NonNull<NSString>;
}
extern "C" {
#[cfg(feature = "NSArray")]
pub fn NSAllMapTableKeys(table: &NSMapTable) -> NonNull<NSArray>;
}
extern "C" {
#[cfg(feature = "NSArray")]
pub fn NSAllMapTableValues(table: &NSMapTable) -> NonNull<NSArray>;
}
#[cfg(feature = "NSString")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSMapTableKeyCallBacks {
pub hash: Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>) -> NSUInteger>,
pub isEqual:
Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>, NonNull<c_void>) -> Bool>,
pub retain: Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>)>,
pub release: Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>)>,
pub describe:
Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>) -> *mut NSString>,
pub notAKeyMarker: *mut c_void,
}
#[cfg(feature = "NSString")]
unsafe impl Encode for NSMapTableKeyCallBacks {
const ENCODING: Encoding = Encoding::Struct("?", &[<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,) -> NSUInteger>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,NonNull<c_void>,) -> Bool>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,)>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,)>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,) -> *mut NSString>>::ENCODING,<*mut c_void>::ENCODING,]);
}
#[cfg(feature = "NSString")]
unsafe impl RefEncode for NSMapTableKeyCallBacks {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "NSString")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSMapTableValueCallBacks {
pub retain: Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>)>,
pub release: Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>)>,
pub describe:
Option<unsafe extern "C" fn(NonNull<NSMapTable>, NonNull<c_void>) -> *mut NSString>,
}
#[cfg(feature = "NSString")]
unsafe impl Encode for NSMapTableValueCallBacks {
const ENCODING: Encoding = Encoding::Struct("?", &[<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,)>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,)>>::ENCODING,<Option<unsafe extern "C" fn(NonNull<NSMapTable>,NonNull<c_void>,) -> *mut NSString>>::ENCODING,]);
}
#[cfg(feature = "NSString")]
unsafe impl RefEncode for NSMapTableValueCallBacks {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[cfg(all(feature = "NSString", feature = "NSZone"))]
pub fn NSCreateMapTableWithZone(
key_call_backs: NSMapTableKeyCallBacks,
value_call_backs: NSMapTableValueCallBacks,
capacity: NSUInteger,
zone: *mut NSZone,
) -> NonNull<NSMapTable>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub fn NSCreateMapTable(
key_call_backs: NSMapTableKeyCallBacks,
value_call_backs: NSMapTableValueCallBacks,
capacity: NSUInteger,
) -> NonNull<NSMapTable>;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIntegerMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonOwnedPointerMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonOwnedPointerOrNullMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonRetainedObjectMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSObjectMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSOwnedPointerMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIntMapKeyCallBacks: NSMapTableKeyCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIntegerMapValueCallBacks: NSMapTableValueCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonOwnedPointerMapValueCallBacks: NSMapTableValueCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSObjectMapValueCallBacks: NSMapTableValueCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNonRetainedObjectMapValueCallBacks: NSMapTableValueCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSOwnedPointerMapValueCallBacks: NSMapTableValueCallBacks;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSIntMapValueCallBacks: NSMapTableValueCallBacks;
}

View File

@@ -0,0 +1,129 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMassFormatterUnit(pub NSInteger);
impl NSMassFormatterUnit {
#[doc(alias = "NSMassFormatterUnitGram")]
pub const Gram: Self = Self(11);
#[doc(alias = "NSMassFormatterUnitKilogram")]
pub const Kilogram: Self = Self(14);
#[doc(alias = "NSMassFormatterUnitOunce")]
pub const Ounce: Self = Self((6 << 8) + 1);
#[doc(alias = "NSMassFormatterUnitPound")]
pub const Pound: Self = Self((6 << 8) + 2);
#[doc(alias = "NSMassFormatterUnitStone")]
pub const Stone: Self = Self((6 << 8) + 3);
}
unsafe impl Encode for NSMassFormatterUnit {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSMassFormatterUnit {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSMassFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSMassFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSMassFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSMassFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSMassFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSMassFormatter {
#[cfg(feature = "NSNumberFormatter")]
#[method_id(@__retain_semantics Other numberFormatter)]
pub unsafe fn numberFormatter(&self) -> Retained<NSNumberFormatter>;
#[cfg(feature = "NSNumberFormatter")]
#[method(setNumberFormatter:)]
pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
#[method(unitStyle)]
pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
#[method(setUnitStyle:)]
pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
#[method(isForPersonMassUse)]
pub unsafe fn isForPersonMassUse(&self) -> bool;
#[method(setForPersonMassUse:)]
pub unsafe fn setForPersonMassUse(&self, for_person_mass_use: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromValue:unit:)]
pub unsafe fn stringFromValue_unit(
&self,
value: c_double,
unit: NSMassFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other stringFromKilograms:)]
pub unsafe fn stringFromKilograms(
&self,
number_in_kilograms: c_double,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other unitStringFromValue:unit:)]
pub unsafe fn unitStringFromValue_unit(
&self,
value: c_double,
unit: NSMassFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other unitStringFromKilograms:usedUnit:)]
pub unsafe fn unitStringFromKilograms_usedUnit(
&self,
number_in_kilograms: c_double,
unitp: *mut NSMassFormatterUnit,
) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(getObjectValue:forString:errorDescription:)]
pub unsafe fn getObjectValue_forString_errorDescription(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
error: Option<&mut Option<Retained<NSString>>>,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSMassFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,89 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMeasurement<UnitType: ?Sized = AnyObject> {
__superclass: NSObject,
_inner0: PhantomData<*mut UnitType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<UnitType: ?Sized + Message> ClassType for NSMeasurement<UnitType> {
type Super = NSObject;
type Mutability = InteriorMutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
#[cfg(feature = "NSObject")]
unsafe impl<UnitType: ?Sized + NSCoding> NSCoding for NSMeasurement<UnitType> {}
#[cfg(feature = "NSObject")]
unsafe impl<UnitType: ?Sized + IsIdCloneable> NSCopying for NSMeasurement<UnitType> {}
unsafe impl<UnitType: ?Sized> NSObjectProtocol for NSMeasurement<UnitType> {}
#[cfg(feature = "NSObject")]
unsafe impl<UnitType: ?Sized + NSSecureCoding> NSSecureCoding for NSMeasurement<UnitType> {}
extern_methods!(
unsafe impl<UnitType: Message> NSMeasurement<UnitType> {
#[method_id(@__retain_semantics Other unit)]
pub unsafe fn unit(&self) -> Retained<UnitType>;
#[method(doubleValue)]
pub unsafe fn doubleValue(&self) -> c_double;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithDoubleValue:unit:)]
pub unsafe fn initWithDoubleValue_unit(
this: Allocated<Self>,
double_value: c_double,
unit: &UnitType,
) -> Retained<Self>;
#[cfg(feature = "NSUnit")]
#[method(canBeConvertedToUnit:)]
pub unsafe fn canBeConvertedToUnit(&self, unit: &NSUnit) -> bool;
#[cfg(feature = "NSUnit")]
#[method_id(@__retain_semantics Other measurementByConvertingToUnit:)]
pub unsafe fn measurementByConvertingToUnit(
&self,
unit: &NSUnit,
) -> Retained<NSMeasurement>;
#[method_id(@__retain_semantics Other measurementByAddingMeasurement:)]
pub unsafe fn measurementByAddingMeasurement(
&self,
measurement: &NSMeasurement<UnitType>,
) -> Retained<NSMeasurement<UnitType>>;
#[method_id(@__retain_semantics Other measurementBySubtractingMeasurement:)]
pub unsafe fn measurementBySubtractingMeasurement(
&self,
measurement: &NSMeasurement<UnitType>,
) -> Retained<NSMeasurement<UnitType>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<UnitType: Message> NSMeasurement<UnitType> {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,109 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMeasurementFormatterUnitOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSMeasurementFormatterUnitOptions: NSUInteger {
#[doc(alias = "NSMeasurementFormatterUnitOptionsProvidedUnit")]
const ProvidedUnit = 1<<0;
#[doc(alias = "NSMeasurementFormatterUnitOptionsNaturalScale")]
const NaturalScale = 1<<1;
#[doc(alias = "NSMeasurementFormatterUnitOptionsTemperatureWithoutUnit")]
const TemperatureWithoutUnit = 1<<2;
}
}
unsafe impl Encode for NSMeasurementFormatterUnitOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSMeasurementFormatterUnitOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSMeasurementFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSMeasurementFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSMeasurementFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSMeasurementFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSMeasurementFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSSecureCoding for NSMeasurementFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSMeasurementFormatter {
#[method(unitOptions)]
pub unsafe fn unitOptions(&self) -> NSMeasurementFormatterUnitOptions;
#[method(setUnitOptions:)]
pub unsafe fn setUnitOptions(&self, unit_options: NSMeasurementFormatterUnitOptions);
#[method(unitStyle)]
pub unsafe fn unitStyle(&self) -> NSFormattingUnitStyle;
#[method(setUnitStyle:)]
pub unsafe fn setUnitStyle(&self, unit_style: NSFormattingUnitStyle);
#[cfg(feature = "NSLocale")]
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Retained<NSLocale>;
#[cfg(feature = "NSLocale")]
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[cfg(feature = "NSNumberFormatter")]
#[method_id(@__retain_semantics Other numberFormatter)]
pub unsafe fn numberFormatter(&self) -> Retained<NSNumberFormatter>;
#[cfg(feature = "NSNumberFormatter")]
#[method(setNumberFormatter:)]
pub unsafe fn setNumberFormatter(&self, number_formatter: Option<&NSNumberFormatter>);
#[cfg(all(feature = "NSMeasurement", feature = "NSString"))]
#[method_id(@__retain_semantics Other stringFromMeasurement:)]
pub unsafe fn stringFromMeasurement(
&self,
measurement: &NSMeasurement,
) -> Retained<NSString>;
#[cfg(all(feature = "NSString", feature = "NSUnit"))]
#[method_id(@__retain_semantics Other stringFromUnit:)]
pub unsafe fn stringFromUnit(&self, unit: &NSUnit) -> Retained<NSString>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSMeasurementFormatter {
#[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>;
}
);

View File

@@ -0,0 +1,412 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataQuery;
unsafe impl ClassType for NSMetadataQuery {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMetadataQuery {}
extern_methods!(
unsafe impl NSMetadataQuery {
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSMetadataQueryDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSMetadataQueryDelegate>>,
);
#[cfg(feature = "NSPredicate")]
#[method_id(@__retain_semantics Other predicate)]
pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>;
#[cfg(feature = "NSPredicate")]
#[method(setPredicate:)]
pub unsafe fn setPredicate(&self, predicate: Option<&NSPredicate>);
#[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
#[method_id(@__retain_semantics Other sortDescriptors)]
pub unsafe fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;
#[cfg(all(feature = "NSArray", feature = "NSSortDescriptor"))]
#[method(setSortDescriptors:)]
pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other valueListAttributes)]
pub unsafe fn valueListAttributes(&self) -> Retained<NSArray<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setValueListAttributes:)]
pub unsafe fn setValueListAttributes(&self, value_list_attributes: &NSArray<NSString>);
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other groupingAttributes)]
pub unsafe fn groupingAttributes(&self) -> Option<Retained<NSArray<NSString>>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method(setGroupingAttributes:)]
pub unsafe fn setGroupingAttributes(&self, grouping_attributes: Option<&NSArray<NSString>>);
#[cfg(feature = "NSDate")]
#[method(notificationBatchingInterval)]
pub unsafe fn notificationBatchingInterval(&self) -> NSTimeInterval;
#[cfg(feature = "NSDate")]
#[method(setNotificationBatchingInterval:)]
pub unsafe fn setNotificationBatchingInterval(
&self,
notification_batching_interval: NSTimeInterval,
);
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other searchScopes)]
pub unsafe fn searchScopes(&self) -> Retained<NSArray>;
#[cfg(feature = "NSArray")]
#[method(setSearchScopes:)]
pub unsafe fn setSearchScopes(&self, search_scopes: &NSArray);
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other searchItems)]
pub unsafe fn searchItems(&self) -> Option<Retained<NSArray>>;
#[cfg(feature = "NSArray")]
#[method(setSearchItems:)]
pub unsafe fn setSearchItems(&self, search_items: Option<&NSArray>);
#[cfg(feature = "NSOperation")]
#[method_id(@__retain_semantics Other operationQueue)]
pub unsafe fn operationQueue(&self) -> Option<Retained<NSOperationQueue>>;
#[cfg(feature = "NSOperation")]
#[method(setOperationQueue:)]
pub unsafe fn setOperationQueue(&self, operation_queue: Option<&NSOperationQueue>);
#[method(startQuery)]
pub unsafe fn startQuery(&self) -> bool;
#[method(stopQuery)]
pub unsafe fn stopQuery(&self);
#[method(isStarted)]
pub unsafe fn isStarted(&self) -> bool;
#[method(isGathering)]
pub unsafe fn isGathering(&self) -> bool;
#[method(isStopped)]
pub unsafe fn isStopped(&self) -> bool;
#[method(disableUpdates)]
pub unsafe fn disableUpdates(&self);
#[method(enableUpdates)]
pub unsafe fn enableUpdates(&self);
#[method(resultCount)]
pub unsafe fn resultCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other resultAtIndex:)]
pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;
#[cfg(feature = "block2")]
#[method(enumerateResultsUsingBlock:)]
pub unsafe fn enumerateResultsUsingBlock(
&self,
block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
#[method(enumerateResultsWithOptions:usingBlock:)]
pub unsafe fn enumerateResultsWithOptions_usingBlock(
&self,
opts: NSEnumerationOptions,
block: &block2::Block<dyn Fn(NonNull<AnyObject>, NSUInteger, NonNull<Bool>) + '_>,
);
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other results)]
pub unsafe fn results(&self) -> Retained<NSArray>;
#[method(indexOfResult:)]
pub unsafe fn indexOfResult(&self, result: &AnyObject) -> NSUInteger;
#[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other valueLists)]
pub unsafe fn valueLists(
&self,
) -> Retained<NSDictionary<NSString, NSArray<NSMetadataQueryAttributeValueTuple>>>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other groupedResults)]
pub unsafe fn groupedResults(&self) -> Retained<NSArray<NSMetadataQueryResultGroup>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueOfAttribute:forResultAtIndex:)]
pub unsafe fn valueOfAttribute_forResultAtIndex(
&self,
attr_name: &NSString,
idx: NSUInteger,
) -> Option<Retained<AnyObject>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMetadataQuery {
#[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_protocol!(
pub unsafe trait NSMetadataQueryDelegate: NSObjectProtocol {
#[optional]
#[method_id(@__retain_semantics Other metadataQuery:replacementObjectForResultObject:)]
unsafe fn metadataQuery_replacementObjectForResultObject(
&self,
query: &NSMetadataQuery,
result: &NSMetadataItem,
) -> Retained<AnyObject>;
#[cfg(feature = "NSString")]
#[optional]
#[method_id(@__retain_semantics Other metadataQuery:replacementValueForAttribute:value:)]
unsafe fn metadataQuery_replacementValueForAttribute_value(
&self,
query: &NSMetadataQuery,
attr_name: &NSString,
attr_value: &AnyObject,
) -> Retained<AnyObject>;
}
unsafe impl ProtocolType for dyn NSMetadataQueryDelegate {}
);
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSMetadataQueryDidStartGatheringNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSMetadataQueryGatheringProgressNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSMetadataQueryDidFinishGatheringNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSNotification", feature = "NSString"))]
pub static NSMetadataQueryDidUpdateNotification: &'static NSNotificationName;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryUpdateAddedItemsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryUpdateChangedItemsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryUpdateRemovedItemsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryResultContentRelevanceAttribute: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryUserHomeScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryLocalComputerScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryNetworkScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryIndexedLocalComputerScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryIndexedNetworkScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryUbiquitousDocumentsScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryUbiquitousDataScope: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataItem;
unsafe impl ClassType for NSMetadataItem {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMetadataItem {}
extern_methods!(
unsafe impl NSMetadataItem {
#[cfg(feature = "NSURL")]
#[method_id(@__retain_semantics Init initWithURL:)]
pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other valueForAttribute:)]
pub unsafe fn valueForAttribute(&self, key: &NSString) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSArray", feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other valuesForAttributes:)]
pub unsafe fn valuesForAttributes(
&self,
keys: &NSArray<NSString>,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[method_id(@__retain_semantics Other attributes)]
pub unsafe fn attributes(&self) -> Retained<NSArray<NSString>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMetadataItem {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataQueryAttributeValueTuple;
unsafe impl ClassType for NSMetadataQueryAttributeValueTuple {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMetadataQueryAttributeValueTuple {}
extern_methods!(
unsafe impl NSMetadataQueryAttributeValueTuple {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other attribute)]
pub unsafe fn attribute(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Option<Retained<AnyObject>>;
#[method(count)]
pub unsafe fn count(&self) -> NSUInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMetadataQueryAttributeValueTuple {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMetadataQueryResultGroup;
unsafe impl ClassType for NSMetadataQueryResultGroup {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMetadataQueryResultGroup {}
extern_methods!(
unsafe impl NSMetadataQueryResultGroup {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other attribute)]
pub unsafe fn attribute(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Retained<AnyObject>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other subgroups)]
pub unsafe fn subgroups(&self) -> Option<Retained<NSArray<NSMetadataQueryResultGroup>>>;
#[method(resultCount)]
pub unsafe fn resultCount(&self) -> NSUInteger;
#[method_id(@__retain_semantics Other resultAtIndex:)]
pub unsafe fn resultAtIndex(&self, idx: NSUInteger) -> Retained<AnyObject>;
#[cfg(feature = "NSArray")]
#[method_id(@__retain_semantics Other results)]
pub unsafe fn results(&self) -> Retained<NSArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMetadataQueryResultGroup {
#[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>;
}
);

View File

@@ -0,0 +1,910 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFSNameKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDisplayNameKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemURLKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPathKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFSSizeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFSCreationDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFSContentChangeDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemContentTypeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemContentTypeTreeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemIsUbiquitousKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemHasUnresolvedConflictsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemIsDownloadedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemDownloadingStatusKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemDownloadingStatusNotDownloaded: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemDownloadingStatusDownloaded: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemDownloadingStatusCurrent: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemIsDownloadingKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemIsUploadedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemIsUploadingKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemPercentDownloadedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemPercentUploadedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemDownloadingErrorKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemUploadingErrorKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemDownloadRequestedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemIsExternalDocumentKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemContainerDisplayNameKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemURLInLocalContainerKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousItemIsSharedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemCurrentUserRoleKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemOwnerNameComponentsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemRoleOwner: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemRoleParticipant: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemPermissionsReadOnly: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataUbiquitousSharedItemPermissionsReadWrite: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAttributeChangeDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemKeywordsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemTitleKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAuthorsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemEditorsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemParticipantsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemProjectsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDownloadedDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemWhereFromsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCommentKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCopyrightKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLastUsedDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemContentCreationDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemContentModificationDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDateAddedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDurationSecondsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemContactKeywordsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemVersionKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPixelHeightKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPixelWidthKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPixelCountKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemColorSpaceKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemBitsPerSampleKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFlashOnOffKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFocalLengthKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAcquisitionMakeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAcquisitionModelKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemISOSpeedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemOrientationKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLayerNamesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemWhiteBalanceKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemApertureKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemProfileNameKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemResolutionWidthDPIKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemResolutionHeightDPIKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemExposureModeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemExposureTimeSecondsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemEXIFVersionKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCameraOwnerKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFocalLength35mmKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLensModelKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemEXIFGPSVersionKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAltitudeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLatitudeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLongitudeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemSpeedKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemTimestampKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSTrackKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemImageDirectionKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemNamedLocationKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSStatusKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSMeasureModeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDOPKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSMapDatumKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDestLatitudeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDestLongitudeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDestBearingKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDestDistanceKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSProcessingMethodKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSAreaInformationKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDateStampKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGPSDifferentalKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCodecsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemMediaTypesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemStreamableKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemTotalBitRateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemVideoBitRateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAudioBitRateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDeliveryTypeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAlbumKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemHasAlphaChannelKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRedEyeOnOffKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemMeteringModeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemMaxApertureKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFNumberKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemExposureProgramKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemExposureTimeStringKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemHeadlineKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemInstructionsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCityKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemStateOrProvinceKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCountryKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemTextContentKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAudioSampleRateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAudioChannelCountKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemTempoKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemKeySignatureKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemTimeSignatureKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAudioEncodingApplicationKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemComposerKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLyricistKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAudioTrackNumberKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRecordingDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemMusicalGenreKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemIsGeneralMIDISequenceKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRecordingYearKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemOrganizationsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemLanguagesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRightsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPublishersKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemContributorsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCoverageKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemSubjectKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemThemeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDescriptionKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemIdentifierKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAudiencesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemNumberOfPagesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPageWidthKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPageHeightKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemSecurityMethodKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCreatorKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemEncodingApplicationsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDueDateKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemStarRatingKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPhoneNumbersKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemEmailAddressesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemInstantMessageAddressesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemKindKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRecipientsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFinderCommentKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemFontsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAppleLoopsRootKeyKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAppleLoopsKeyFilterTypeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAppleLoopsLoopModeKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAppleLoopDescriptorsKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemMusicalInstrumentCategoryKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemMusicalInstrumentNameKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemCFBundleIdentifierKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemInformationKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemDirectorKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemProducerKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemGenreKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemPerformersKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemOriginalFormatKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemOriginalSourceKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAuthorEmailAddressesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRecipientEmailAddressesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemAuthorAddressesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemRecipientAddressesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemIsLikelyJunkKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemExecutableArchitecturesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemExecutablePlatformKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemApplicationCategoriesKey: &'static NSString;
}
extern "C" {
#[cfg(feature = "NSString")]
pub static NSMetadataItemIsApplicationManagedKey: &'static NSString;
}

View File

@@ -0,0 +1,55 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMethodSignature;
unsafe impl ClassType for NSMethodSignature {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMethodSignature {}
extern_methods!(
unsafe impl NSMethodSignature {
#[method_id(@__retain_semantics Other signatureWithObjCTypes:)]
pub unsafe fn signatureWithObjCTypes(
types: NonNull<c_char>,
) -> Option<Retained<NSMethodSignature>>;
#[method(numberOfArguments)]
pub unsafe fn numberOfArguments(&self) -> NSUInteger;
#[method(getArgumentTypeAtIndex:)]
pub unsafe fn getArgumentTypeAtIndex(&self, idx: NSUInteger) -> NonNull<c_char>;
#[method(frameLength)]
pub unsafe fn frameLength(&self) -> NSUInteger;
#[method(isOneway)]
pub unsafe fn isOneway(&self) -> bool;
#[method(methodReturnType)]
pub unsafe fn methodReturnType(&self) -> NonNull<c_char>;
#[method(methodReturnLength)]
pub unsafe fn methodReturnLength(&self) -> NSUInteger;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMethodSignature {
#[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>;
}
);

View File

@@ -0,0 +1,502 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalGender(pub NSInteger);
impl NSGrammaticalGender {
#[doc(alias = "NSGrammaticalGenderNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalGenderFeminine")]
pub const Feminine: Self = Self(1);
#[doc(alias = "NSGrammaticalGenderMasculine")]
pub const Masculine: Self = Self(2);
#[doc(alias = "NSGrammaticalGenderNeuter")]
pub const Neuter: Self = Self(3);
}
unsafe impl Encode for NSGrammaticalGender {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalGender {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalPartOfSpeech(pub NSInteger);
impl NSGrammaticalPartOfSpeech {
#[doc(alias = "NSGrammaticalPartOfSpeechNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalPartOfSpeechDeterminer")]
pub const Determiner: Self = Self(1);
#[doc(alias = "NSGrammaticalPartOfSpeechPronoun")]
pub const Pronoun: Self = Self(2);
#[doc(alias = "NSGrammaticalPartOfSpeechLetter")]
pub const Letter: Self = Self(3);
#[doc(alias = "NSGrammaticalPartOfSpeechAdverb")]
pub const Adverb: Self = Self(4);
#[doc(alias = "NSGrammaticalPartOfSpeechParticle")]
pub const Particle: Self = Self(5);
#[doc(alias = "NSGrammaticalPartOfSpeechAdjective")]
pub const Adjective: Self = Self(6);
#[doc(alias = "NSGrammaticalPartOfSpeechAdposition")]
pub const Adposition: Self = Self(7);
#[doc(alias = "NSGrammaticalPartOfSpeechVerb")]
pub const Verb: Self = Self(8);
#[doc(alias = "NSGrammaticalPartOfSpeechNoun")]
pub const Noun: Self = Self(9);
#[doc(alias = "NSGrammaticalPartOfSpeechConjunction")]
pub const Conjunction: Self = Self(10);
#[doc(alias = "NSGrammaticalPartOfSpeechNumeral")]
pub const Numeral: Self = Self(11);
#[doc(alias = "NSGrammaticalPartOfSpeechInterjection")]
pub const Interjection: Self = Self(12);
#[doc(alias = "NSGrammaticalPartOfSpeechPreposition")]
pub const Preposition: Self = Self(13);
#[doc(alias = "NSGrammaticalPartOfSpeechAbbreviation")]
pub const Abbreviation: Self = Self(14);
}
unsafe impl Encode for NSGrammaticalPartOfSpeech {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalPartOfSpeech {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalNumber(pub NSInteger);
impl NSGrammaticalNumber {
#[doc(alias = "NSGrammaticalNumberNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalNumberSingular")]
pub const Singular: Self = Self(1);
#[doc(alias = "NSGrammaticalNumberZero")]
pub const Zero: Self = Self(2);
#[doc(alias = "NSGrammaticalNumberPlural")]
pub const Plural: Self = Self(3);
#[doc(alias = "NSGrammaticalNumberPluralTwo")]
pub const PluralTwo: Self = Self(4);
#[doc(alias = "NSGrammaticalNumberPluralFew")]
pub const PluralFew: Self = Self(5);
#[doc(alias = "NSGrammaticalNumberPluralMany")]
pub const PluralMany: Self = Self(6);
}
unsafe impl Encode for NSGrammaticalNumber {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalNumber {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalCase(pub NSInteger);
impl NSGrammaticalCase {
#[doc(alias = "NSGrammaticalCaseNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalCaseNominative")]
pub const Nominative: Self = Self(1);
#[doc(alias = "NSGrammaticalCaseAccusative")]
pub const Accusative: Self = Self(2);
#[doc(alias = "NSGrammaticalCaseDative")]
pub const Dative: Self = Self(3);
#[doc(alias = "NSGrammaticalCaseGenitive")]
pub const Genitive: Self = Self(4);
#[doc(alias = "NSGrammaticalCasePrepositional")]
pub const Prepositional: Self = Self(5);
#[doc(alias = "NSGrammaticalCaseAblative")]
pub const Ablative: Self = Self(6);
#[doc(alias = "NSGrammaticalCaseAdessive")]
pub const Adessive: Self = Self(7);
#[doc(alias = "NSGrammaticalCaseAllative")]
pub const Allative: Self = Self(8);
#[doc(alias = "NSGrammaticalCaseElative")]
pub const Elative: Self = Self(9);
#[doc(alias = "NSGrammaticalCaseIllative")]
pub const Illative: Self = Self(10);
#[doc(alias = "NSGrammaticalCaseEssive")]
pub const Essive: Self = Self(11);
#[doc(alias = "NSGrammaticalCaseInessive")]
pub const Inessive: Self = Self(12);
#[doc(alias = "NSGrammaticalCaseLocative")]
pub const Locative: Self = Self(13);
#[doc(alias = "NSGrammaticalCaseTranslative")]
pub const Translative: Self = Self(14);
}
unsafe impl Encode for NSGrammaticalCase {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalCase {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalPronounType(pub NSInteger);
impl NSGrammaticalPronounType {
#[doc(alias = "NSGrammaticalPronounTypeNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalPronounTypePersonal")]
pub const Personal: Self = Self(1);
#[doc(alias = "NSGrammaticalPronounTypeReflexive")]
pub const Reflexive: Self = Self(2);
#[doc(alias = "NSGrammaticalPronounTypePossessive")]
pub const Possessive: Self = Self(3);
}
unsafe impl Encode for NSGrammaticalPronounType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalPronounType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalPerson(pub NSInteger);
impl NSGrammaticalPerson {
#[doc(alias = "NSGrammaticalPersonNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalPersonFirst")]
pub const First: Self = Self(1);
#[doc(alias = "NSGrammaticalPersonSecond")]
pub const Second: Self = Self(2);
#[doc(alias = "NSGrammaticalPersonThird")]
pub const Third: Self = Self(3);
}
unsafe impl Encode for NSGrammaticalPerson {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalPerson {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalDetermination(pub NSInteger);
impl NSGrammaticalDetermination {
#[doc(alias = "NSGrammaticalDeterminationNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalDeterminationIndependent")]
pub const Independent: Self = Self(1);
#[doc(alias = "NSGrammaticalDeterminationDependent")]
pub const Dependent: Self = Self(2);
}
unsafe impl Encode for NSGrammaticalDetermination {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalDetermination {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGrammaticalDefiniteness(pub NSInteger);
impl NSGrammaticalDefiniteness {
#[doc(alias = "NSGrammaticalDefinitenessNotSet")]
pub const NotSet: Self = Self(0);
#[doc(alias = "NSGrammaticalDefinitenessIndefinite")]
pub const Indefinite: Self = Self(1);
#[doc(alias = "NSGrammaticalDefinitenessDefinite")]
pub const Definite: Self = Self(2);
}
unsafe impl Encode for NSGrammaticalDefiniteness {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGrammaticalDefiniteness {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMorphology;
unsafe impl ClassType for NSMorphology {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMorphology {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMorphology {}
unsafe impl NSObjectProtocol for NSMorphology {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMorphology {}
extern_methods!(
unsafe impl NSMorphology {
#[method(grammaticalGender)]
pub unsafe fn grammaticalGender(&self) -> NSGrammaticalGender;
#[method(setGrammaticalGender:)]
pub unsafe fn setGrammaticalGender(&self, grammatical_gender: NSGrammaticalGender);
#[method(partOfSpeech)]
pub unsafe fn partOfSpeech(&self) -> NSGrammaticalPartOfSpeech;
#[method(setPartOfSpeech:)]
pub unsafe fn setPartOfSpeech(&self, part_of_speech: NSGrammaticalPartOfSpeech);
#[method(number)]
pub unsafe fn number(&self) -> NSGrammaticalNumber;
#[method(setNumber:)]
pub unsafe fn setNumber(&self, number: NSGrammaticalNumber);
#[method(grammaticalCase)]
pub unsafe fn grammaticalCase(&self) -> NSGrammaticalCase;
#[method(setGrammaticalCase:)]
pub unsafe fn setGrammaticalCase(&self, grammatical_case: NSGrammaticalCase);
#[method(determination)]
pub unsafe fn determination(&self) -> NSGrammaticalDetermination;
#[method(setDetermination:)]
pub unsafe fn setDetermination(&self, determination: NSGrammaticalDetermination);
#[method(grammaticalPerson)]
pub unsafe fn grammaticalPerson(&self) -> NSGrammaticalPerson;
#[method(setGrammaticalPerson:)]
pub unsafe fn setGrammaticalPerson(&self, grammatical_person: NSGrammaticalPerson);
#[method(pronounType)]
pub unsafe fn pronounType(&self) -> NSGrammaticalPronounType;
#[method(setPronounType:)]
pub unsafe fn setPronounType(&self, pronoun_type: NSGrammaticalPronounType);
#[method(definiteness)]
pub unsafe fn definiteness(&self) -> NSGrammaticalDefiniteness;
#[method(setDefiniteness:)]
pub unsafe fn setDefiniteness(&self, definiteness: NSGrammaticalDefiniteness);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMorphology {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMorphologyPronoun;
unsafe impl ClassType for NSMorphologyPronoun {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMorphologyPronoun {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMorphologyPronoun {}
unsafe impl NSObjectProtocol for NSMorphologyPronoun {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMorphologyPronoun {}
extern_methods!(
unsafe impl NSMorphologyPronoun {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Init initWithPronoun:morphology:dependentMorphology:)]
pub unsafe fn initWithPronoun_morphology_dependentMorphology(
this: Allocated<Self>,
pronoun: &NSString,
morphology: &NSMorphology,
dependent_morphology: Option<&NSMorphology>,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other pronoun)]
pub unsafe fn pronoun(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other morphology)]
pub unsafe fn morphology(&self) -> Retained<NSMorphology>;
#[method_id(@__retain_semantics Other dependentMorphology)]
pub unsafe fn dependentMorphology(&self) -> Option<Retained<NSMorphology>>;
}
);
extern_methods!(
/// NSCustomPronouns
unsafe impl NSMorphology {
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other customPronounForLanguage:)]
pub unsafe fn customPronounForLanguage(
&self,
language: &NSString,
) -> Option<Retained<NSMorphologyCustomPronoun>>;
#[cfg(all(feature = "NSError", feature = "NSString"))]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(setCustomPronoun:forLanguage:error:_)]
pub unsafe fn setCustomPronoun_forLanguage_error(
&self,
features: Option<&NSMorphologyCustomPronoun>,
language: &NSString,
) -> Result<(), Retained<NSError>>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use NSTermOfAddress instead"]
pub struct NSMorphologyCustomPronoun;
unsafe impl ClassType for NSMorphologyCustomPronoun {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSMorphologyCustomPronoun {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSMorphologyCustomPronoun {}
unsafe impl NSObjectProtocol for NSMorphologyCustomPronoun {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSMorphologyCustomPronoun {}
extern_methods!(
unsafe impl NSMorphologyCustomPronoun {
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(isSupportedForLanguage:)]
pub unsafe fn isSupportedForLanguage(language: &NSString) -> bool;
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other requiredKeysForLanguage:)]
pub unsafe fn requiredKeysForLanguage(language: &NSString) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other subjectForm)]
pub unsafe fn subjectForm(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(setSubjectForm:)]
pub unsafe fn setSubjectForm(&self, subject_form: Option<&NSString>);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other objectForm)]
pub unsafe fn objectForm(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(setObjectForm:)]
pub unsafe fn setObjectForm(&self, object_form: Option<&NSString>);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other possessiveForm)]
pub unsafe fn possessiveForm(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(setPossessiveForm:)]
pub unsafe fn setPossessiveForm(&self, possessive_form: Option<&NSString>);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other possessiveAdjectiveForm)]
pub unsafe fn possessiveAdjectiveForm(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(setPossessiveAdjectiveForm:)]
pub unsafe fn setPossessiveAdjectiveForm(
&self,
possessive_adjective_form: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method_id(@__retain_semantics Other reflexiveForm)]
pub unsafe fn reflexiveForm(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[deprecated = "Use NSTermOfAddress instead"]
#[method(setReflexiveForm:)]
pub unsafe fn setReflexiveForm(&self, reflexive_form: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMorphologyCustomPronoun {
#[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!(
/// NSMorphologyUserSettings
unsafe impl NSMorphology {
#[method(isUnspecified)]
pub unsafe fn isUnspecified(&self) -> bool;
#[method_id(@__retain_semantics Other userMorphology)]
pub unsafe fn userMorphology() -> Retained<NSMorphology>;
}
);

View File

@@ -0,0 +1,430 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern "C" {
#[cfg(feature = "NSString")]
pub static NSNetServicesErrorCode: &'static NSString;
}
extern "C" {
#[cfg(all(feature = "NSError", feature = "NSString"))]
pub static NSNetServicesErrorDomain: &'static NSErrorDomain;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNetServicesError(pub NSInteger);
impl NSNetServicesError {
pub const NSNetServicesUnknownError: Self = Self(-72000);
pub const NSNetServicesCollisionError: Self = Self(-72001);
pub const NSNetServicesNotFoundError: Self = Self(-72002);
pub const NSNetServicesActivityInProgress: Self = Self(-72003);
pub const NSNetServicesBadArgumentError: Self = Self(-72004);
pub const NSNetServicesCancelledError: Self = Self(-72005);
pub const NSNetServicesInvalidError: Self = Self(-72006);
pub const NSNetServicesTimeoutError: Self = Self(-72007);
pub const NSNetServicesMissingRequiredConfigurationError: Self = Self(-72008);
}
unsafe impl Encode for NSNetServicesError {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSNetServicesError {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNetServiceOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSNetServiceOptions: NSUInteger {
const NSNetServiceNoAutoRename = 1<<0;
const NSNetServiceListenForConnections = 1<<1;
}
}
unsafe impl Encode for NSNetServiceOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNetServiceOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
pub struct NSNetService;
unsafe impl ClassType for NSNetService {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSNetService {}
extern_methods!(
unsafe impl NSNetService {
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Init initWithDomain:type:name:port:)]
pub unsafe fn initWithDomain_type_name_port(
this: Allocated<Self>,
domain: &NSString,
r#type: &NSString,
name: &NSString,
port: c_int,
) -> Retained<Self>;
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Init initWithDomain:type:name:)]
pub unsafe fn initWithDomain_type_name(
this: Allocated<Self>,
domain: &NSString,
r#type: &NSString,
name: &NSString,
) -> Retained<Self>;
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(scheduleInRunLoop:forMode:)]
pub unsafe fn scheduleInRunLoop_forMode(
&self,
a_run_loop: &NSRunLoop,
mode: &NSRunLoopMode,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(removeFromRunLoop:forMode:)]
pub unsafe fn removeFromRunLoop_forMode(
&self,
a_run_loop: &NSRunLoop,
mode: &NSRunLoopMode,
);
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self)
-> Option<Retained<ProtocolObject<dyn NSNetServiceDelegate>>>;
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSNetServiceDelegate>>,
);
#[method(includesPeerToPeer)]
pub unsafe fn includesPeerToPeer(&self) -> bool;
#[method(setIncludesPeerToPeer:)]
pub unsafe fn setIncludesPeerToPeer(&self, includes_peer_to_peer: bool);
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other type)]
pub unsafe fn r#type(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other domain)]
pub unsafe fn domain(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other hostName)]
pub unsafe fn hostName(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSArray", feature = "NSData"))]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other addresses)]
pub unsafe fn addresses(&self) -> Option<Retained<NSArray<NSData>>>;
#[method(port)]
pub unsafe fn port(&self) -> NSInteger;
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(publish)]
pub unsafe fn publish(&self);
#[method(publishWithOptions:)]
pub unsafe fn publishWithOptions(&self, options: NSNetServiceOptions);
#[deprecated = "Not supported"]
#[method(resolve)]
pub unsafe fn resolve(&self);
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(stop)]
pub unsafe fn stop(&self);
#[cfg(all(feature = "NSData", feature = "NSDictionary", feature = "NSString"))]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other dictionaryFromTXTRecordData:)]
pub unsafe fn dictionaryFromTXTRecordData(
txt_data: &NSData,
) -> Retained<NSDictionary<NSString, NSData>>;
#[cfg(all(feature = "NSData", feature = "NSDictionary", feature = "NSString"))]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other dataFromTXTRecordDictionary:)]
pub unsafe fn dataFromTXTRecordDictionary(
txt_dictionary: &NSDictionary<NSString, NSData>,
) -> Retained<NSData>;
#[cfg(feature = "NSDate")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(resolveWithTimeout:)]
pub unsafe fn resolveWithTimeout(&self, timeout: NSTimeInterval);
#[cfg(feature = "NSData")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(setTXTRecordData:)]
pub unsafe fn setTXTRecordData(&self, record_data: Option<&NSData>) -> bool;
#[cfg(feature = "NSData")]
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method_id(@__retain_semantics Other TXTRecordData)]
pub unsafe fn TXTRecordData(&self) -> Option<Retained<NSData>>;
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(startMonitoring)]
pub unsafe fn startMonitoring(&self);
#[deprecated = "Use nw_connection_t or nw_listener_t in Network framework instead"]
#[method(stopMonitoring)]
pub unsafe fn stopMonitoring(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSNetService {
#[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_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "Use nw_browser_t in Network framework instead"]
pub struct NSNetServiceBrowser;
unsafe impl ClassType for NSNetServiceBrowser {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSNetServiceBrowser {}
extern_methods!(
unsafe impl NSNetServiceBrowser {
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSNetServiceBrowserDelegate>>>;
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSNetServiceBrowserDelegate>>,
);
#[method(includesPeerToPeer)]
pub unsafe fn includesPeerToPeer(&self) -> bool;
#[method(setIncludesPeerToPeer:)]
pub unsafe fn setIncludesPeerToPeer(&self, includes_peer_to_peer: bool);
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))]
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(scheduleInRunLoop:forMode:)]
pub unsafe fn scheduleInRunLoop_forMode(
&self,
a_run_loop: &NSRunLoop,
mode: &NSRunLoopMode,
);
#[cfg(all(feature = "NSObjCRuntime", feature = "NSRunLoop", feature = "NSString"))]
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(removeFromRunLoop:forMode:)]
pub unsafe fn removeFromRunLoop_forMode(
&self,
a_run_loop: &NSRunLoop,
mode: &NSRunLoopMode,
);
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(searchForBrowsableDomains)]
pub unsafe fn searchForBrowsableDomains(&self);
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(searchForRegistrationDomains)]
pub unsafe fn searchForRegistrationDomains(&self);
#[cfg(feature = "NSString")]
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(searchForServicesOfType:inDomain:)]
pub unsafe fn searchForServicesOfType_inDomain(
&self,
r#type: &NSString,
domain_string: &NSString,
);
#[deprecated = "Use nw_browser_t in Network framework instead"]
#[method(stop)]
pub unsafe fn stop(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSNetServiceBrowser {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSNetServiceDelegate: NSObjectProtocol {
#[optional]
#[method(netServiceWillPublish:)]
unsafe fn netServiceWillPublish(&self, sender: &NSNetService);
#[optional]
#[method(netServiceDidPublish:)]
unsafe fn netServiceDidPublish(&self, sender: &NSNetService);
#[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))]
#[optional]
#[method(netService:didNotPublish:)]
unsafe fn netService_didNotPublish(
&self,
sender: &NSNetService,
error_dict: &NSDictionary<NSString, NSNumber>,
);
#[optional]
#[method(netServiceWillResolve:)]
unsafe fn netServiceWillResolve(&self, sender: &NSNetService);
#[optional]
#[method(netServiceDidResolveAddress:)]
unsafe fn netServiceDidResolveAddress(&self, sender: &NSNetService);
#[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))]
#[optional]
#[method(netService:didNotResolve:)]
unsafe fn netService_didNotResolve(
&self,
sender: &NSNetService,
error_dict: &NSDictionary<NSString, NSNumber>,
);
#[optional]
#[method(netServiceDidStop:)]
unsafe fn netServiceDidStop(&self, sender: &NSNetService);
#[cfg(feature = "NSData")]
#[optional]
#[method(netService:didUpdateTXTRecordData:)]
unsafe fn netService_didUpdateTXTRecordData(&self, sender: &NSNetService, data: &NSData);
#[cfg(feature = "NSStream")]
#[optional]
#[method(netService:didAcceptConnectionWithInputStream:outputStream:)]
unsafe fn netService_didAcceptConnectionWithInputStream_outputStream(
&self,
sender: &NSNetService,
input_stream: &NSInputStream,
output_stream: &NSOutputStream,
);
}
unsafe impl ProtocolType for dyn NSNetServiceDelegate {}
);
extern_protocol!(
pub unsafe trait NSNetServiceBrowserDelegate: NSObjectProtocol {
#[optional]
#[method(netServiceBrowserWillSearch:)]
unsafe fn netServiceBrowserWillSearch(&self, browser: &NSNetServiceBrowser);
#[optional]
#[method(netServiceBrowserDidStopSearch:)]
unsafe fn netServiceBrowserDidStopSearch(&self, browser: &NSNetServiceBrowser);
#[cfg(all(feature = "NSDictionary", feature = "NSString", feature = "NSValue"))]
#[optional]
#[method(netServiceBrowser:didNotSearch:)]
unsafe fn netServiceBrowser_didNotSearch(
&self,
browser: &NSNetServiceBrowser,
error_dict: &NSDictionary<NSString, NSNumber>,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(netServiceBrowser:didFindDomain:moreComing:)]
unsafe fn netServiceBrowser_didFindDomain_moreComing(
&self,
browser: &NSNetServiceBrowser,
domain_string: &NSString,
more_coming: bool,
);
#[optional]
#[method(netServiceBrowser:didFindService:moreComing:)]
unsafe fn netServiceBrowser_didFindService_moreComing(
&self,
browser: &NSNetServiceBrowser,
service: &NSNetService,
more_coming: bool,
);
#[cfg(feature = "NSString")]
#[optional]
#[method(netServiceBrowser:didRemoveDomain:moreComing:)]
unsafe fn netServiceBrowser_didRemoveDomain_moreComing(
&self,
browser: &NSNetServiceBrowser,
domain_string: &NSString,
more_coming: bool,
);
#[optional]
#[method(netServiceBrowser:didRemoveService:moreComing:)]
unsafe fn netServiceBrowser_didRemoveService_moreComing(
&self,
browser: &NSNetServiceBrowser,
service: &NSNetService,
more_coming: bool,
);
}
unsafe impl ProtocolType for dyn NSNetServiceBrowserDelegate {}
);

View File

@@ -0,0 +1,164 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "NSString")]
pub type NSNotificationName = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSNotification;
unsafe impl ClassType for NSNotification {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSNotification {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSNotification {}
unsafe impl NSObjectProtocol for NSNotification {}
extern_methods!(
unsafe impl NSNotification {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSNotificationName>;
#[method_id(@__retain_semantics Other object)]
pub unsafe fn object(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSDictionary")]
#[method_id(@__retain_semantics Other userInfo)]
pub unsafe fn userInfo(&self) -> Option<Retained<NSDictionary>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Init initWithName:object:userInfo:)]
pub unsafe fn initWithName_object_userInfo(
this: Allocated<Self>,
name: &NSNotificationName,
object: Option<&AnyObject>,
user_info: Option<&NSDictionary>,
) -> Retained<Self>;
#[cfg(feature = "NSCoder")]
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// NSNotificationCreation
unsafe impl NSNotification {
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other notificationWithName:object:)]
pub unsafe fn notificationWithName_object(
a_name: &NSNotificationName,
an_object: Option<&AnyObject>,
) -> Retained<Self>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other notificationWithName:object:userInfo:)]
pub unsafe fn notificationWithName_object_userInfo(
a_name: &NSNotificationName,
an_object: Option<&AnyObject>,
a_user_info: Option<&NSDictionary>,
) -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSNotificationCenter;
unsafe impl ClassType for NSNotificationCenter {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSNotificationCenter {}
unsafe impl Sync for NSNotificationCenter {}
unsafe impl NSObjectProtocol for NSNotificationCenter {}
extern_methods!(
unsafe impl NSNotificationCenter {
#[method_id(@__retain_semantics Other defaultCenter)]
pub unsafe fn defaultCenter() -> Retained<NSNotificationCenter>;
#[cfg(feature = "NSString")]
#[method(addObserver:selector:name:object:)]
pub unsafe fn addObserver_selector_name_object(
&self,
observer: &AnyObject,
a_selector: Sel,
a_name: Option<&NSNotificationName>,
an_object: Option<&AnyObject>,
);
#[method(postNotification:)]
pub unsafe fn postNotification(&self, notification: &NSNotification);
#[cfg(feature = "NSString")]
#[method(postNotificationName:object:)]
pub unsafe fn postNotificationName_object(
&self,
a_name: &NSNotificationName,
an_object: Option<&AnyObject>,
);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(postNotificationName:object:userInfo:)]
pub unsafe fn postNotificationName_object_userInfo(
&self,
a_name: &NSNotificationName,
an_object: Option<&AnyObject>,
a_user_info: Option<&NSDictionary>,
);
#[method(removeObserver:)]
pub unsafe fn removeObserver(&self, observer: &AnyObject);
#[cfg(feature = "NSString")]
#[method(removeObserver:name:object:)]
pub unsafe fn removeObserver_name_object(
&self,
observer: &AnyObject,
a_name: Option<&NSNotificationName>,
an_object: Option<&AnyObject>,
);
#[cfg(all(feature = "NSOperation", feature = "NSString", feature = "block2"))]
#[method_id(@__retain_semantics Other addObserverForName:object:queue:usingBlock:)]
pub unsafe fn addObserverForName_object_queue_usingBlock(
&self,
name: Option<&NSNotificationName>,
obj: Option<&AnyObject>,
queue: Option<&NSOperationQueue>,
block: &block2::Block<dyn Fn(NonNull<NSNotification>)>,
) -> Retained<NSObject>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSNotificationCenter {
#[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>;
}
);

View File

@@ -0,0 +1,113 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPostingStyle(pub NSUInteger);
impl NSPostingStyle {
pub const NSPostWhenIdle: Self = Self(1);
pub const NSPostASAP: Self = Self(2);
pub const NSPostNow: Self = Self(3);
}
unsafe impl Encode for NSPostingStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPostingStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNotificationCoalescing(pub NSUInteger);
bitflags::bitflags! {
impl NSNotificationCoalescing: NSUInteger {
const NSNotificationNoCoalescing = 0;
#[doc(alias = "NSNotificationCoalescingOnName")]
const OnName = 1;
#[doc(alias = "NSNotificationCoalescingOnSender")]
const OnSender = 2;
}
}
unsafe impl Encode for NSNotificationCoalescing {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNotificationCoalescing {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSNotificationQueue;
unsafe impl ClassType for NSNotificationQueue {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSNotificationQueue {}
extern_methods!(
unsafe impl NSNotificationQueue {
#[method_id(@__retain_semantics Other defaultQueue)]
pub unsafe fn defaultQueue() -> Retained<NSNotificationQueue>;
#[cfg(feature = "NSNotification")]
#[method_id(@__retain_semantics Init initWithNotificationCenter:)]
pub unsafe fn initWithNotificationCenter(
this: Allocated<Self>,
notification_center: &NSNotificationCenter,
) -> Retained<Self>;
#[cfg(feature = "NSNotification")]
#[method(enqueueNotification:postingStyle:)]
pub unsafe fn enqueueNotification_postingStyle(
&self,
notification: &NSNotification,
posting_style: NSPostingStyle,
);
#[cfg(all(
feature = "NSArray",
feature = "NSNotification",
feature = "NSObjCRuntime",
feature = "NSString"
))]
#[method(enqueueNotification:postingStyle:coalesceMask:forModes:)]
pub unsafe fn enqueueNotification_postingStyle_coalesceMask_forModes(
&self,
notification: &NSNotification,
posting_style: NSPostingStyle,
coalesce_mask: NSNotificationCoalescing,
modes: Option<&NSArray<NSRunLoopMode>>,
);
#[cfg(feature = "NSNotification")]
#[method(dequeueNotificationsMatching:coalesceMask:)]
pub unsafe fn dequeueNotificationsMatching_coalesceMask(
&self,
notification: &NSNotification,
coalesce_mask: NSUInteger,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSNotificationQueue {
#[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>;
}
);

View File

@@ -0,0 +1,48 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSNull;
unsafe impl ClassType for NSNull {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSNull {}
unsafe impl Sync for NSNull {}
#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSNull {}
#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSNull {}
unsafe impl NSObjectProtocol for NSNull {}
#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSNull {}
extern_methods!(
unsafe impl NSNull {
#[method_id(@__retain_semantics Other null)]
pub unsafe fn null() -> Retained<NSNull>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSNull {
#[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>;
}
);

View File

@@ -0,0 +1,701 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNumberFormatterBehavior(pub NSUInteger);
impl NSNumberFormatterBehavior {
#[doc(alias = "NSNumberFormatterBehaviorDefault")]
pub const Default: Self = Self(0);
pub const NSNumberFormatterBehavior10_0: Self = Self(1000);
pub const NSNumberFormatterBehavior10_4: Self = Self(1040);
}
unsafe impl Encode for NSNumberFormatterBehavior {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNumberFormatterBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNumberFormatterStyle(pub NSUInteger);
impl NSNumberFormatterStyle {
pub const NSNumberFormatterNoStyle: Self = Self(0);
pub const NSNumberFormatterDecimalStyle: Self = Self(1);
pub const NSNumberFormatterCurrencyStyle: Self = Self(2);
pub const NSNumberFormatterPercentStyle: Self = Self(3);
pub const NSNumberFormatterScientificStyle: Self = Self(4);
pub const NSNumberFormatterSpellOutStyle: Self = Self(5);
pub const NSNumberFormatterOrdinalStyle: Self = Self(6);
pub const NSNumberFormatterCurrencyISOCodeStyle: Self = Self(8);
pub const NSNumberFormatterCurrencyPluralStyle: Self = Self(9);
pub const NSNumberFormatterCurrencyAccountingStyle: Self = Self(10);
}
unsafe impl Encode for NSNumberFormatterStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNumberFormatterStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNumberFormatterPadPosition(pub NSUInteger);
impl NSNumberFormatterPadPosition {
pub const NSNumberFormatterPadBeforePrefix: Self = Self(0);
pub const NSNumberFormatterPadAfterPrefix: Self = Self(1);
pub const NSNumberFormatterPadBeforeSuffix: Self = Self(2);
pub const NSNumberFormatterPadAfterSuffix: Self = Self(3);
}
unsafe impl Encode for NSNumberFormatterPadPosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNumberFormatterPadPosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNumberFormatterRoundingMode(pub NSUInteger);
impl NSNumberFormatterRoundingMode {
pub const NSNumberFormatterRoundCeiling: Self = Self(0);
pub const NSNumberFormatterRoundFloor: Self = Self(1);
pub const NSNumberFormatterRoundDown: Self = Self(2);
pub const NSNumberFormatterRoundUp: Self = Self(3);
pub const NSNumberFormatterRoundHalfEven: Self = Self(4);
pub const NSNumberFormatterRoundHalfDown: Self = Self(5);
pub const NSNumberFormatterRoundHalfUp: Self = Self(6);
}
unsafe impl Encode for NSNumberFormatterRoundingMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSNumberFormatterRoundingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSFormatter")]
pub struct NSNumberFormatter;
#[cfg(feature = "NSFormatter")]
unsafe impl ClassType for NSNumberFormatter {
#[inherits(NSObject)]
type Super = NSFormatter;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSFormatter")]
unsafe impl Send for NSNumberFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl Sync for NSNumberFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCoding for NSNumberFormatter {}
#[cfg(all(feature = "NSFormatter", feature = "NSObject"))]
unsafe impl NSCopying for NSNumberFormatter {}
#[cfg(feature = "NSFormatter")]
unsafe impl NSObjectProtocol for NSNumberFormatter {}
extern_methods!(
#[cfg(feature = "NSFormatter")]
unsafe impl NSNumberFormatter {
#[method(formattingContext)]
pub unsafe fn formattingContext(&self) -> NSFormattingContext;
#[method(setFormattingContext:)]
pub unsafe fn setFormattingContext(&self, formatting_context: NSFormattingContext);
#[cfg(all(feature = "NSError", feature = "NSRange", feature = "NSString"))]
#[method(getObjectValue:forString:range:error:_)]
pub unsafe fn getObjectValue_forString_range_error(
&self,
obj: Option<&mut Option<Retained<AnyObject>>>,
string: &NSString,
rangep: *mut NSRange,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "NSString", feature = "NSValue"))]
#[method_id(@__retain_semantics Other stringFromNumber:)]
pub unsafe fn stringFromNumber(&self, number: &NSNumber) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSString", feature = "NSValue"))]
#[method_id(@__retain_semantics Other numberFromString:)]
pub unsafe fn numberFromString(&self, string: &NSString) -> Option<Retained<NSNumber>>;
#[cfg(all(feature = "NSString", feature = "NSValue"))]
#[method_id(@__retain_semantics Other localizedStringFromNumber:numberStyle:)]
pub unsafe fn localizedStringFromNumber_numberStyle(
num: &NSNumber,
nstyle: NSNumberFormatterStyle,
) -> Retained<NSString>;
#[method(defaultFormatterBehavior)]
pub unsafe fn defaultFormatterBehavior() -> NSNumberFormatterBehavior;
#[method(setDefaultFormatterBehavior:)]
pub unsafe fn setDefaultFormatterBehavior(behavior: NSNumberFormatterBehavior);
#[method(numberStyle)]
pub unsafe fn numberStyle(&self) -> NSNumberFormatterStyle;
#[method(setNumberStyle:)]
pub unsafe fn setNumberStyle(&self, number_style: NSNumberFormatterStyle);
#[cfg(feature = "NSLocale")]
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Retained<NSLocale>;
#[cfg(feature = "NSLocale")]
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[method(generatesDecimalNumbers)]
pub unsafe fn generatesDecimalNumbers(&self) -> bool;
#[method(setGeneratesDecimalNumbers:)]
pub unsafe fn setGeneratesDecimalNumbers(&self, generates_decimal_numbers: bool);
#[method(formatterBehavior)]
pub unsafe fn formatterBehavior(&self) -> NSNumberFormatterBehavior;
#[method(setFormatterBehavior:)]
pub unsafe fn setFormatterBehavior(&self, formatter_behavior: NSNumberFormatterBehavior);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other negativeFormat)]
pub unsafe fn negativeFormat(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setNegativeFormat:)]
pub unsafe fn setNegativeFormat(&self, negative_format: Option<&NSString>);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForNegativeValues)]
pub unsafe fn textAttributesForNegativeValues(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForNegativeValues:)]
pub unsafe fn setTextAttributesForNegativeValues(
&self,
text_attributes_for_negative_values: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other positiveFormat)]
pub unsafe fn positiveFormat(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPositiveFormat:)]
pub unsafe fn setPositiveFormat(&self, positive_format: Option<&NSString>);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForPositiveValues)]
pub unsafe fn textAttributesForPositiveValues(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForPositiveValues:)]
pub unsafe fn setTextAttributesForPositiveValues(
&self,
text_attributes_for_positive_values: Option<&NSDictionary<NSString, AnyObject>>,
);
#[method(allowsFloats)]
pub unsafe fn allowsFloats(&self) -> bool;
#[method(setAllowsFloats:)]
pub unsafe fn setAllowsFloats(&self, allows_floats: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other decimalSeparator)]
pub unsafe fn decimalSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setDecimalSeparator:)]
pub unsafe fn setDecimalSeparator(&self, decimal_separator: Option<&NSString>);
#[method(alwaysShowsDecimalSeparator)]
pub unsafe fn alwaysShowsDecimalSeparator(&self) -> bool;
#[method(setAlwaysShowsDecimalSeparator:)]
pub unsafe fn setAlwaysShowsDecimalSeparator(&self, always_shows_decimal_separator: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other currencyDecimalSeparator)]
pub unsafe fn currencyDecimalSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setCurrencyDecimalSeparator:)]
pub unsafe fn setCurrencyDecimalSeparator(
&self,
currency_decimal_separator: Option<&NSString>,
);
#[method(usesGroupingSeparator)]
pub unsafe fn usesGroupingSeparator(&self) -> bool;
#[method(setUsesGroupingSeparator:)]
pub unsafe fn setUsesGroupingSeparator(&self, uses_grouping_separator: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other groupingSeparator)]
pub unsafe fn groupingSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setGroupingSeparator:)]
pub unsafe fn setGroupingSeparator(&self, grouping_separator: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other zeroSymbol)]
pub unsafe fn zeroSymbol(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSString")]
#[method(setZeroSymbol:)]
pub unsafe fn setZeroSymbol(&self, zero_symbol: Option<&NSString>);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForZero)]
pub unsafe fn textAttributesForZero(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForZero:)]
pub unsafe fn setTextAttributesForZero(
&self,
text_attributes_for_zero: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other nilSymbol)]
pub unsafe fn nilSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setNilSymbol:)]
pub unsafe fn setNilSymbol(&self, nil_symbol: &NSString);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForNil)]
pub unsafe fn textAttributesForNil(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForNil:)]
pub unsafe fn setTextAttributesForNil(
&self,
text_attributes_for_nil: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other notANumberSymbol)]
pub unsafe fn notANumberSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setNotANumberSymbol:)]
pub unsafe fn setNotANumberSymbol(&self, not_a_number_symbol: Option<&NSString>);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForNotANumber)]
pub unsafe fn textAttributesForNotANumber(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForNotANumber:)]
pub unsafe fn setTextAttributesForNotANumber(
&self,
text_attributes_for_not_a_number: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other positiveInfinitySymbol)]
pub unsafe fn positiveInfinitySymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPositiveInfinitySymbol:)]
pub unsafe fn setPositiveInfinitySymbol(&self, positive_infinity_symbol: &NSString);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForPositiveInfinity)]
pub unsafe fn textAttributesForPositiveInfinity(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForPositiveInfinity:)]
pub unsafe fn setTextAttributesForPositiveInfinity(
&self,
text_attributes_for_positive_infinity: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other negativeInfinitySymbol)]
pub unsafe fn negativeInfinitySymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setNegativeInfinitySymbol:)]
pub unsafe fn setNegativeInfinitySymbol(&self, negative_infinity_symbol: &NSString);
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method_id(@__retain_semantics Other textAttributesForNegativeInfinity)]
pub unsafe fn textAttributesForNegativeInfinity(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(all(feature = "NSDictionary", feature = "NSString"))]
#[method(setTextAttributesForNegativeInfinity:)]
pub unsafe fn setTextAttributesForNegativeInfinity(
&self,
text_attributes_for_negative_infinity: Option<&NSDictionary<NSString, AnyObject>>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other positivePrefix)]
pub unsafe fn positivePrefix(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPositivePrefix:)]
pub unsafe fn setPositivePrefix(&self, positive_prefix: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other positiveSuffix)]
pub unsafe fn positiveSuffix(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPositiveSuffix:)]
pub unsafe fn setPositiveSuffix(&self, positive_suffix: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other negativePrefix)]
pub unsafe fn negativePrefix(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setNegativePrefix:)]
pub unsafe fn setNegativePrefix(&self, negative_prefix: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other negativeSuffix)]
pub unsafe fn negativeSuffix(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setNegativeSuffix:)]
pub unsafe fn setNegativeSuffix(&self, negative_suffix: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other currencyCode)]
pub unsafe fn currencyCode(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setCurrencyCode:)]
pub unsafe fn setCurrencyCode(&self, currency_code: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other currencySymbol)]
pub unsafe fn currencySymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setCurrencySymbol:)]
pub unsafe fn setCurrencySymbol(&self, currency_symbol: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other internationalCurrencySymbol)]
pub unsafe fn internationalCurrencySymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setInternationalCurrencySymbol:)]
pub unsafe fn setInternationalCurrencySymbol(
&self,
international_currency_symbol: Option<&NSString>,
);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other percentSymbol)]
pub unsafe fn percentSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPercentSymbol:)]
pub unsafe fn setPercentSymbol(&self, percent_symbol: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other perMillSymbol)]
pub unsafe fn perMillSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPerMillSymbol:)]
pub unsafe fn setPerMillSymbol(&self, per_mill_symbol: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other minusSign)]
pub unsafe fn minusSign(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setMinusSign:)]
pub unsafe fn setMinusSign(&self, minus_sign: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other plusSign)]
pub unsafe fn plusSign(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPlusSign:)]
pub unsafe fn setPlusSign(&self, plus_sign: Option<&NSString>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other exponentSymbol)]
pub unsafe fn exponentSymbol(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setExponentSymbol:)]
pub unsafe fn setExponentSymbol(&self, exponent_symbol: Option<&NSString>);
#[method(groupingSize)]
pub unsafe fn groupingSize(&self) -> NSUInteger;
#[method(setGroupingSize:)]
pub unsafe fn setGroupingSize(&self, grouping_size: NSUInteger);
#[method(secondaryGroupingSize)]
pub unsafe fn secondaryGroupingSize(&self) -> NSUInteger;
#[method(setSecondaryGroupingSize:)]
pub unsafe fn setSecondaryGroupingSize(&self, secondary_grouping_size: NSUInteger);
#[cfg(feature = "NSValue")]
#[method_id(@__retain_semantics Other multiplier)]
pub unsafe fn multiplier(&self) -> Option<Retained<NSNumber>>;
#[cfg(feature = "NSValue")]
#[method(setMultiplier:)]
pub unsafe fn setMultiplier(&self, multiplier: Option<&NSNumber>);
#[method(formatWidth)]
pub unsafe fn formatWidth(&self) -> NSUInteger;
#[method(setFormatWidth:)]
pub unsafe fn setFormatWidth(&self, format_width: NSUInteger);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other paddingCharacter)]
pub unsafe fn paddingCharacter(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setPaddingCharacter:)]
pub unsafe fn setPaddingCharacter(&self, padding_character: Option<&NSString>);
#[method(paddingPosition)]
pub unsafe fn paddingPosition(&self) -> NSNumberFormatterPadPosition;
#[method(setPaddingPosition:)]
pub unsafe fn setPaddingPosition(&self, padding_position: NSNumberFormatterPadPosition);
#[method(roundingMode)]
pub unsafe fn roundingMode(&self) -> NSNumberFormatterRoundingMode;
#[method(setRoundingMode:)]
pub unsafe fn setRoundingMode(&self, rounding_mode: NSNumberFormatterRoundingMode);
#[cfg(feature = "NSValue")]
#[method_id(@__retain_semantics Other roundingIncrement)]
pub unsafe fn roundingIncrement(&self) -> Retained<NSNumber>;
#[cfg(feature = "NSValue")]
#[method(setRoundingIncrement:)]
pub unsafe fn setRoundingIncrement(&self, rounding_increment: Option<&NSNumber>);
#[method(minimumIntegerDigits)]
pub unsafe fn minimumIntegerDigits(&self) -> NSUInteger;
#[method(setMinimumIntegerDigits:)]
pub unsafe fn setMinimumIntegerDigits(&self, minimum_integer_digits: NSUInteger);
#[method(maximumIntegerDigits)]
pub unsafe fn maximumIntegerDigits(&self) -> NSUInteger;
#[method(setMaximumIntegerDigits:)]
pub unsafe fn setMaximumIntegerDigits(&self, maximum_integer_digits: NSUInteger);
#[method(minimumFractionDigits)]
pub unsafe fn minimumFractionDigits(&self) -> NSUInteger;
#[method(setMinimumFractionDigits:)]
pub unsafe fn setMinimumFractionDigits(&self, minimum_fraction_digits: NSUInteger);
#[method(maximumFractionDigits)]
pub unsafe fn maximumFractionDigits(&self) -> NSUInteger;
#[method(setMaximumFractionDigits:)]
pub unsafe fn setMaximumFractionDigits(&self, maximum_fraction_digits: NSUInteger);
#[cfg(feature = "NSValue")]
#[method_id(@__retain_semantics Other minimum)]
pub unsafe fn minimum(&self) -> Option<Retained<NSNumber>>;
#[cfg(feature = "NSValue")]
#[method(setMinimum:)]
pub unsafe fn setMinimum(&self, minimum: Option<&NSNumber>);
#[cfg(feature = "NSValue")]
#[method_id(@__retain_semantics Other maximum)]
pub unsafe fn maximum(&self) -> Option<Retained<NSNumber>>;
#[cfg(feature = "NSValue")]
#[method(setMaximum:)]
pub unsafe fn setMaximum(&self, maximum: Option<&NSNumber>);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other currencyGroupingSeparator)]
pub unsafe fn currencyGroupingSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setCurrencyGroupingSeparator:)]
pub unsafe fn setCurrencyGroupingSeparator(
&self,
currency_grouping_separator: Option<&NSString>,
);
#[method(isLenient)]
pub unsafe fn isLenient(&self) -> bool;
#[method(setLenient:)]
pub unsafe fn setLenient(&self, lenient: bool);
#[method(usesSignificantDigits)]
pub unsafe fn usesSignificantDigits(&self) -> bool;
#[method(setUsesSignificantDigits:)]
pub unsafe fn setUsesSignificantDigits(&self, uses_significant_digits: bool);
#[method(minimumSignificantDigits)]
pub unsafe fn minimumSignificantDigits(&self) -> NSUInteger;
#[method(setMinimumSignificantDigits:)]
pub unsafe fn setMinimumSignificantDigits(&self, minimum_significant_digits: NSUInteger);
#[method(maximumSignificantDigits)]
pub unsafe fn maximumSignificantDigits(&self) -> NSUInteger;
#[method(setMaximumSignificantDigits:)]
pub unsafe fn setMaximumSignificantDigits(&self, maximum_significant_digits: NSUInteger);
#[method(isPartialStringValidationEnabled)]
pub unsafe fn isPartialStringValidationEnabled(&self) -> bool;
#[method(setPartialStringValidationEnabled:)]
pub unsafe fn setPartialStringValidationEnabled(
&self,
partial_string_validation_enabled: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSFormatter")]
unsafe impl NSNumberFormatter {
#[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!(
/// NSNumberFormatterCompatibility
#[cfg(feature = "NSFormatter")]
unsafe impl NSNumberFormatter {
#[method(hasThousandSeparators)]
pub unsafe fn hasThousandSeparators(&self) -> bool;
#[method(setHasThousandSeparators:)]
pub unsafe fn setHasThousandSeparators(&self, has_thousand_separators: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other thousandSeparator)]
pub unsafe fn thousandSeparator(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setThousandSeparator:)]
pub unsafe fn setThousandSeparator(&self, thousand_separator: Option<&NSString>);
#[method(localizesFormat)]
pub unsafe fn localizesFormat(&self) -> bool;
#[method(setLocalizesFormat:)]
pub unsafe fn setLocalizesFormat(&self, localizes_format: bool);
#[cfg(feature = "NSString")]
#[method_id(@__retain_semantics Other format)]
pub unsafe fn format(&self) -> Retained<NSString>;
#[cfg(feature = "NSString")]
#[method(setFormat:)]
pub unsafe fn setFormat(&self, format: &NSString);
#[cfg(feature = "NSAttributedString")]
#[method_id(@__retain_semantics Other attributedStringForZero)]
pub unsafe fn attributedStringForZero(&self) -> Retained<NSAttributedString>;
#[cfg(feature = "NSAttributedString")]
#[method(setAttributedStringForZero:)]
pub unsafe fn setAttributedStringForZero(
&self,
attributed_string_for_zero: &NSAttributedString,
);
#[cfg(feature = "NSAttributedString")]
#[method_id(@__retain_semantics Other attributedStringForNil)]
pub unsafe fn attributedStringForNil(&self) -> Retained<NSAttributedString>;
#[cfg(feature = "NSAttributedString")]
#[method(setAttributedStringForNil:)]
pub unsafe fn setAttributedStringForNil(
&self,
attributed_string_for_nil: &NSAttributedString,
);
#[cfg(feature = "NSAttributedString")]
#[method_id(@__retain_semantics Other attributedStringForNotANumber)]
pub unsafe fn attributedStringForNotANumber(&self) -> Retained<NSAttributedString>;
#[cfg(feature = "NSAttributedString")]
#[method(setAttributedStringForNotANumber:)]
pub unsafe fn setAttributedStringForNotANumber(
&self,
attributed_string_for_not_a_number: &NSAttributedString,
);
#[cfg(feature = "NSDecimalNumber")]
#[method_id(@__retain_semantics Other roundingBehavior)]
pub unsafe fn roundingBehavior(&self) -> Retained<NSDecimalNumberHandler>;
#[cfg(feature = "NSDecimalNumber")]
#[method(setRoundingBehavior:)]
pub unsafe fn setRoundingBehavior(&self, rounding_behavior: &NSDecimalNumberHandler);
}
);

Some files were not shown because too many files have changed in this diff Show More