#[cfg(feature = "block2")]
use block2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PHChange;
unsafe impl ClassType for PHChange {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for PHChange {}
unsafe impl Sync for PHChange {}
unsafe impl NSObjectProtocol for PHChange {}
extern_methods!(
unsafe impl PHChange {
#[cfg(feature = "PHObject")]
#[method_id(@__retain_semantics Other changeDetailsForObject:)]
pub unsafe fn changeDetailsForObject(
&self,
object: &PHObject,
) -> Option<Id<PHObjectChangeDetails>>;
#[cfg(feature = "PHFetchResult")]
#[method_id(@__retain_semantics Other changeDetailsForFetchResult:)]
pub unsafe fn changeDetailsForFetchResult(
&self,
object: &PHFetchResult,
) -> Option<Id<PHFetchResultChangeDetails>>;
}
);
extern_methods!(
unsafe impl PHChange {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PHObjectChangeDetails<ObjectType: ?Sized = AnyObject> {
__superclass: NSObject,
_inner0: PhantomData<*mut ObjectType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<ObjectType: ?Sized + Message> ClassType for PHObjectChangeDetails<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<ObjectType: ?Sized> NSObjectProtocol for PHObjectChangeDetails<ObjectType> {}
extern_methods!(
unsafe impl<ObjectType: Message> PHObjectChangeDetails<ObjectType> {
#[method_id(@__retain_semantics Other objectBeforeChanges)]
pub unsafe fn objectBeforeChanges(&self) -> Id<ObjectType>;
#[method_id(@__retain_semantics Other objectAfterChanges)]
pub unsafe fn objectAfterChanges(&self) -> Option<Id<ObjectType>>;
#[method(assetContentChanged)]
pub unsafe fn assetContentChanged(&self) -> bool;
#[method(objectWasDeleted)]
pub unsafe fn objectWasDeleted(&self) -> bool;
}
);
extern_methods!(
unsafe impl<ObjectType: Message> PHObjectChangeDetails<ObjectType> {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PHFetchResultChangeDetails<ObjectType: ?Sized = AnyObject> {
__superclass: NSObject,
_inner0: PhantomData<*mut ObjectType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<ObjectType: ?Sized + Message> ClassType for PHFetchResultChangeDetails<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<ObjectType: ?Sized> NSObjectProtocol for PHFetchResultChangeDetails<ObjectType> {}
extern_methods!(
unsafe impl<ObjectType: Message> PHFetchResultChangeDetails<ObjectType> {
#[cfg(feature = "PHFetchResult")]
#[method_id(@__retain_semantics Other fetchResultBeforeChanges)]
pub unsafe fn fetchResultBeforeChanges(&self) -> Id<PHFetchResult<ObjectType>>;
#[cfg(feature = "PHFetchResult")]
#[method_id(@__retain_semantics Other fetchResultAfterChanges)]
pub unsafe fn fetchResultAfterChanges(&self) -> Id<PHFetchResult<ObjectType>>;
#[method(hasIncrementalChanges)]
pub unsafe fn hasIncrementalChanges(&self) -> bool;
#[method_id(@__retain_semantics Other removedIndexes)]
pub unsafe fn removedIndexes(&self) -> Option<Id<NSIndexSet>>;
#[method_id(@__retain_semantics Other removedObjects)]
pub unsafe fn removedObjects(&self) -> Id<NSArray<ObjectType>>;
#[method_id(@__retain_semantics Other insertedIndexes)]
pub unsafe fn insertedIndexes(&self) -> Option<Id<NSIndexSet>>;
#[method_id(@__retain_semantics Other insertedObjects)]
pub unsafe fn insertedObjects(&self) -> Id<NSArray<ObjectType>>;
#[method_id(@__retain_semantics Other changedIndexes)]
pub unsafe fn changedIndexes(&self) -> Option<Id<NSIndexSet>>;
#[method_id(@__retain_semantics Other changedObjects)]
pub unsafe fn changedObjects(&self) -> Id<NSArray<ObjectType>>;
#[cfg(feature = "block2")]
#[method(enumerateMovesWithBlock:)]
pub unsafe fn enumerateMovesWithBlock(
&self,
handler: &Block<dyn Fn(NSUInteger, NSUInteger)>,
);
#[method(hasMoves)]
pub unsafe fn hasMoves(&self) -> bool;
#[cfg(feature = "PHFetchResult")]
#[method_id(@__retain_semantics Other changeDetailsFromFetchResult:toFetchResult:changedObjects:)]
pub unsafe fn changeDetailsFromFetchResult_toFetchResult_changedObjects(
from_result: &PHFetchResult<ObjectType>,
to_result: &PHFetchResult<ObjectType>,
changed_objects: &NSArray<ObjectType>,
) -> Id<Self>;
}
);
extern_methods!(
unsafe impl<ObjectType: Message> PHFetchResultChangeDetails<ObjectType> {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Id<Self>;
}
);