//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspointerarray?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSPointerArray;
);

#[cfg(feature = "NSObject")]
unsafe impl NSCoding for NSPointerArray {}

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSPointerArray {}

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSPointerArray {
    type Result = Self;
}

#[cfg(feature = "NSEnumerator")]
unsafe impl NSFastEnumeration for NSPointerArray {}

unsafe impl NSObjectProtocol for NSPointerArray {}

#[cfg(feature = "NSObject")]
unsafe impl NSSecureCoding for NSPointerArray {}

impl NSPointerArray {
    extern_methods!(
        #[cfg(feature = "NSPointerFunctions")]
        #[unsafe(method(initWithOptions:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithOptions(
            this: Allocated<Self>,
            options: NSPointerFunctionsOptions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSPointerFunctions")]
        #[unsafe(method(initWithPointerFunctions:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPointerFunctions(
            this: Allocated<Self>,
            functions: &NSPointerFunctions,
        ) -> Retained<Self>;

        #[cfg(feature = "NSPointerFunctions")]
        #[unsafe(method(pointerArrayWithOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointerArrayWithOptions(
            options: NSPointerFunctionsOptions,
        ) -> Retained<NSPointerArray>;

        #[cfg(feature = "NSPointerFunctions")]
        #[unsafe(method(pointerArrayWithPointerFunctions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointerArrayWithPointerFunctions(
            functions: &NSPointerFunctions,
        ) -> Retained<NSPointerArray>;

        #[cfg(feature = "NSPointerFunctions")]
        #[unsafe(method(pointerFunctions))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointerFunctions(&self) -> Retained<NSPointerFunctions>;

        #[unsafe(method(pointerAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointerAtIndex(&self, index: NSUInteger) -> *mut c_void;

        #[unsafe(method(addPointer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addPointer(&self, pointer: *mut c_void);

        #[unsafe(method(removePointerAtIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removePointerAtIndex(&self, index: NSUInteger);

        #[unsafe(method(insertPointer:atIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertPointer_atIndex(&self, item: *mut c_void, index: NSUInteger);

        #[unsafe(method(replacePointerAtIndex:withPointer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn replacePointerAtIndex_withPointer(
            &self,
            index: NSUInteger,
            item: *mut c_void,
        );

        #[unsafe(method(compact))]
        #[unsafe(method_family = none)]
        pub unsafe fn compact(&self);

        #[unsafe(method(count))]
        #[unsafe(method_family = none)]
        pub unsafe fn count(&self) -> NSUInteger;

        /// Setter for [`count`][Self::count].
        #[unsafe(method(setCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCount(&self, count: NSUInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSPointerArray {
    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>;
    );
}

/// NSPointerArrayConveniences.
impl NSPointerArray {
    extern_methods!(
        #[deprecated = "GC no longer supported"]
        #[unsafe(method(pointerArrayWithStrongObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointerArrayWithStrongObjects() -> Retained<AnyObject>;

        #[deprecated = "GC no longer supported"]
        #[unsafe(method(pointerArrayWithWeakObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointerArrayWithWeakObjects() -> Retained<AnyObject>;

        #[unsafe(method(strongObjectsPointerArray))]
        #[unsafe(method_family = none)]
        pub unsafe fn strongObjectsPointerArray() -> Retained<NSPointerArray>;

        #[unsafe(method(weakObjectsPointerArray))]
        #[unsafe(method_family = none)]
        pub unsafe fn weakObjectsPointerArray() -> Retained<NSPointerArray>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(allObjects))]
        #[unsafe(method_family = none)]
        pub unsafe fn allObjects(&self) -> Retained<NSArray>;
    );
}
