use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PHChange;
);
unsafe impl Send for PHChange {}
unsafe impl Sync for PHChange {}
extern_conformance!(
unsafe impl NSObjectProtocol for PHChange {}
);
impl PHChange {
extern_methods!(
#[cfg(feature = "PHObject")]
#[unsafe(method(changeDetailsForObject:))]
#[unsafe(method_family = none)]
pub unsafe fn changeDetailsForObject(
&self,
object: &PHObject,
) -> Option<Retained<PHObjectChangeDetails>>;
#[cfg(all(feature = "PHFetchResult", feature = "PHObject"))]
#[unsafe(method(changeDetailsForFetchResult:))]
#[unsafe(method_family = none)]
pub unsafe fn changeDetailsForFetchResult(
&self,
object: &PHFetchResult,
) -> Option<Retained<PHFetchResultChangeDetails>>;
);
}
impl PHChange {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "PHObject")]
pub struct PHObjectChangeDetails<ObjectType: ?Sized = AnyObject>;
);
#[cfg(feature = "PHObject")]
impl<ObjectType: ?Sized + Message + AsRef<PHObject>> PHObjectChangeDetails<ObjectType> {
#[inline]
pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message + AsRef<PHObject>>(
&self,
) -> &PHObjectChangeDetails<NewObjectType> {
unsafe { &*((self as *const Self).cast()) }
}
}
#[cfg(feature = "PHObject")]
extern_conformance!(
unsafe impl<ObjectType: ?Sized + AsRef<PHObject>> NSObjectProtocol
for PHObjectChangeDetails<ObjectType>
{
}
);
#[cfg(feature = "PHObject")]
impl<ObjectType: Message + AsRef<PHObject>> PHObjectChangeDetails<ObjectType> {
extern_methods!(
#[unsafe(method(objectBeforeChanges))]
#[unsafe(method_family = none)]
pub unsafe fn objectBeforeChanges(&self) -> Retained<ObjectType>;
#[unsafe(method(objectAfterChanges))]
#[unsafe(method_family = none)]
pub unsafe fn objectAfterChanges(&self) -> Option<Retained<ObjectType>>;
#[unsafe(method(assetContentChanged))]
#[unsafe(method_family = none)]
pub unsafe fn assetContentChanged(&self) -> bool;
#[unsafe(method(objectWasDeleted))]
#[unsafe(method_family = none)]
pub unsafe fn objectWasDeleted(&self) -> bool;
);
}
#[cfg(feature = "PHObject")]
impl<ObjectType: Message + AsRef<PHObject>> PHObjectChangeDetails<ObjectType> {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "PHObject")]
pub struct PHFetchResultChangeDetails<ObjectType: ?Sized = AnyObject>;
);
#[cfg(feature = "PHObject")]
impl<ObjectType: ?Sized + Message + AsRef<PHObject>> PHFetchResultChangeDetails<ObjectType> {
#[inline]
pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message + AsRef<PHObject>>(
&self,
) -> &PHFetchResultChangeDetails<NewObjectType> {
unsafe { &*((self as *const Self).cast()) }
}
}
#[cfg(feature = "PHObject")]
extern_conformance!(
unsafe impl<ObjectType: ?Sized + AsRef<PHObject>> NSObjectProtocol
for PHFetchResultChangeDetails<ObjectType>
{
}
);
#[cfg(feature = "PHObject")]
impl<ObjectType: Message + AsRef<PHObject>> PHFetchResultChangeDetails<ObjectType> {
extern_methods!(
#[cfg(feature = "PHFetchResult")]
#[unsafe(method(fetchResultBeforeChanges))]
#[unsafe(method_family = none)]
pub unsafe fn fetchResultBeforeChanges(&self) -> Retained<PHFetchResult<ObjectType>>;
#[cfg(feature = "PHFetchResult")]
#[unsafe(method(fetchResultAfterChanges))]
#[unsafe(method_family = none)]
pub unsafe fn fetchResultAfterChanges(&self) -> Retained<PHFetchResult<ObjectType>>;
#[unsafe(method(hasIncrementalChanges))]
#[unsafe(method_family = none)]
pub unsafe fn hasIncrementalChanges(&self) -> bool;
#[unsafe(method(removedIndexes))]
#[unsafe(method_family = none)]
pub unsafe fn removedIndexes(&self) -> Option<Retained<NSIndexSet>>;
#[unsafe(method(removedObjects))]
#[unsafe(method_family = none)]
pub unsafe fn removedObjects(&self) -> Retained<NSArray<ObjectType>>;
#[unsafe(method(insertedIndexes))]
#[unsafe(method_family = none)]
pub unsafe fn insertedIndexes(&self) -> Option<Retained<NSIndexSet>>;
#[unsafe(method(insertedObjects))]
#[unsafe(method_family = none)]
pub unsafe fn insertedObjects(&self) -> Retained<NSArray<ObjectType>>;
#[unsafe(method(changedIndexes))]
#[unsafe(method_family = none)]
pub unsafe fn changedIndexes(&self) -> Option<Retained<NSIndexSet>>;
#[unsafe(method(changedObjects))]
#[unsafe(method_family = none)]
pub unsafe fn changedObjects(&self) -> Retained<NSArray<ObjectType>>;
#[cfg(feature = "block2")]
#[unsafe(method(enumerateMovesWithBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateMovesWithBlock(
&self,
handler: &block2::DynBlock<dyn Fn(NSUInteger, NSUInteger)>,
);
#[unsafe(method(hasMoves))]
#[unsafe(method_family = none)]
pub unsafe fn hasMoves(&self) -> bool;
#[cfg(feature = "PHFetchResult")]
#[unsafe(method(changeDetailsFromFetchResult:toFetchResult:changedObjects:))]
#[unsafe(method_family = none)]
pub unsafe fn changeDetailsFromFetchResult_toFetchResult_changedObjects(
from_result: &PHFetchResult<ObjectType>,
to_result: &PHFetchResult<ObjectType>,
changed_objects: &NSArray<ObjectType>,
) -> Retained<Self>;
);
}
#[cfg(feature = "PHObject")]
impl<ObjectType: Message + AsRef<PHObject>> PHFetchResultChangeDetails<ObjectType> {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}