objc2-foundation 0.3.1

Bindings to the Foundation framework
Documentation
//! 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/nsindexset?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSIndexSet;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSIndexSet {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSIndexSet {}
);

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSMutableCopying for NSIndexSet {}
);

#[cfg(feature = "NSObject")]
unsafe impl MutableCopyingHelper for NSIndexSet {
    type Result = NSMutableIndexSet;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSIndexSet {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSIndexSet {}
);

impl NSIndexSet {
    extern_methods!(
        #[unsafe(method(indexSet))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexSet() -> Retained<Self>;

        #[unsafe(method(indexSetWithIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(indexSetWithIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(initWithIndexesInRange:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIndexesInRange(
            this: Allocated<Self>,
            range: NSRange,
        ) -> Retained<Self>;

        #[unsafe(method(initWithIndexSet:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIndexSet(
            this: Allocated<Self>,
            index_set: &NSIndexSet,
        ) -> Retained<Self>;

        #[unsafe(method(initWithIndex:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;

        #[unsafe(method(isEqualToIndexSet:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEqualToIndexSet(&self, index_set: &NSIndexSet) -> bool;

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

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

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

        #[unsafe(method(indexGreaterThanIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexGreaterThanIndex(&self, value: NSUInteger) -> NSUInteger;

        #[unsafe(method(indexLessThanIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexLessThanIndex(&self, value: NSUInteger) -> NSUInteger;

        #[unsafe(method(indexGreaterThanOrEqualToIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexGreaterThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;

        #[unsafe(method(indexLessThanOrEqualToIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexLessThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(getIndexes:maxCount:inIndexRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getIndexes_maxCount_inIndexRange(
            &self,
            index_buffer: NonNull<NSUInteger>,
            buffer_size: NSUInteger,
            range: NSRangePointer,
        ) -> NSUInteger;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(countOfIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn countOfIndexesInRange(&self, range: NSRange) -> NSUInteger;

        #[unsafe(method(containsIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsIndex(&self, value: NSUInteger) -> bool;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(containsIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsIndexesInRange(&self, range: NSRange) -> bool;

        #[unsafe(method(containsIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsIndexes(&self, index_set: &NSIndexSet) -> bool;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(intersectsIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn intersectsIndexesInRange(&self, range: NSRange) -> bool;

        #[cfg(feature = "block2")]
        #[unsafe(method(enumerateIndexesUsingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateIndexesUsingBlock(
            &self,
            block: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(enumerateIndexesWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateIndexesWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateIndexesInRange:options:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateIndexesInRange_options_usingBlock(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(indexPassingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexPassingTest(
            &self,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> NSUInteger;

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(indexWithOptions:passingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexWithOptions_passingTest(
            &self,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> NSUInteger;

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(indexInRange:options:passingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexInRange_options_passingTest(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> NSUInteger;

        #[cfg(feature = "block2")]
        #[unsafe(method(indexesPassingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexesPassingTest(
            &self,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> Retained<NSIndexSet>;

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(indexesWithOptions:passingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexesWithOptions_passingTest(
            &self,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> Retained<NSIndexSet>;

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(indexesInRange:options:passingTest:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexesInRange_options_passingTest(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> Retained<NSIndexSet>;

        #[cfg(all(feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateRangesUsingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateRangesUsingBlock(
            &self,
            block: &block2::DynBlock<dyn Fn(NSRange, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateRangesWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateRangesWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSRange, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateRangesInRange:options:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateRangesInRange_options_usingBlock(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSRange, NonNull<Bool>) + '_>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSIndexSet {
    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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsmutableindexset?language=objc)
    #[unsafe(super(NSIndexSet, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMutableIndexSet;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSMutableIndexSet {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSMutableIndexSet {}
);

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSMutableCopying for NSMutableIndexSet {}
);

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

extern_conformance!(
    unsafe impl NSObjectProtocol for NSMutableIndexSet {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSMutableIndexSet {}
);

impl NSMutableIndexSet {
    extern_methods!(
        #[unsafe(method(addIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addIndexes(&self, index_set: &NSIndexSet);

        #[unsafe(method(removeIndexes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeIndexes(&self, index_set: &NSIndexSet);

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

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

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

        #[cfg(feature = "NSRange")]
        #[unsafe(method(addIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addIndexesInRange(&self, range: NSRange);

        #[cfg(feature = "NSRange")]
        #[unsafe(method(removeIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeIndexesInRange(&self, range: NSRange);

        #[unsafe(method(shiftIndexesStartingAtIndex:by:))]
        #[unsafe(method_family = none)]
        pub unsafe fn shiftIndexesStartingAtIndex_by(&self, index: NSUInteger, delta: NSInteger);
    );
}

/// Methods declared on superclass `NSIndexSet`.
impl NSMutableIndexSet {
    extern_methods!(
        #[unsafe(method(indexSet))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexSet() -> Retained<Self>;

        #[unsafe(method(indexSetWithIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(indexSetWithIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(initWithIndexesInRange:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIndexesInRange(
            this: Allocated<Self>,
            range: NSRange,
        ) -> Retained<Self>;

        #[unsafe(method(initWithIndexSet:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIndexSet(
            this: Allocated<Self>,
            index_set: &NSIndexSet,
        ) -> Retained<Self>;

        #[unsafe(method(initWithIndex:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;
    );
}

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