//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsopenstepunicodereservedbase?language=objc)
pub const NSOpenStepUnicodeReservedBase: c_uint = 0xF400;

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

#[cfg(feature = "objc2-core-foundation")]
impl AsRef<NSCharacterSet> for CFCharacterSet {
    #[inline]
    fn as_ref(&self) -> &NSCharacterSet {
        unsafe { &*((self as *const Self).cast()) }
    }
}

#[cfg(feature = "objc2-core-foundation")]
impl AsRef<CFCharacterSet> for NSCharacterSet {
    #[inline]
    fn as_ref(&self) -> &CFCharacterSet {
        unsafe { &*((self as *const Self).cast()) }
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        #[cfg(feature = "NSRange")]
        #[unsafe(method(characterSetWithRange:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithRange(a_range: NSRange) -> Retained<NSCharacterSet>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(characterSetWithCharactersInString:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithCharactersInString(a_string: &NSString) -> Retained<NSCharacterSet>;

        #[cfg(feature = "NSData")]
        #[unsafe(method(characterSetWithBitmapRepresentation:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithBitmapRepresentation(data: &NSData) -> Retained<NSCharacterSet>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(characterSetWithContentsOfFile:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithContentsOfFile(
            f_name: &NSString,
        ) -> Option<Retained<NSCharacterSet>>;

        #[cfg(feature = "NSCoder")]
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(characterIsMember:))]
        #[unsafe(method_family = none)]
        pub fn characterIsMember(&self, a_character: unichar) -> bool;

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

        #[unsafe(method(invertedSet))]
        #[unsafe(method_family = none)]
        pub fn invertedSet(&self) -> Retained<NSCharacterSet>;

        #[unsafe(method(longCharacterIsMember:))]
        #[unsafe(method_family = none)]
        pub fn longCharacterIsMember(&self, the_long_char: UTF32Char) -> bool;

        #[unsafe(method(isSupersetOfSet:))]
        #[unsafe(method_family = none)]
        pub fn isSupersetOfSet(&self, the_other_set: &NSCharacterSet) -> bool;

        #[unsafe(method(hasMemberInPlane:))]
        #[unsafe(method_family = none)]
        pub fn hasMemberInPlane(&self, the_plane: u8) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSCharacterSet {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSCharacterSet {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "objc2-core-foundation")]
impl AsRef<NSMutableCharacterSet> for CFMutableCharacterSet {
    #[inline]
    fn as_ref(&self) -> &NSMutableCharacterSet {
        unsafe { &*((self as *const Self).cast()) }
    }
}

#[cfg(feature = "objc2-core-foundation")]
impl AsRef<CFMutableCharacterSet> for NSMutableCharacterSet {
    #[inline]
    fn as_ref(&self) -> &CFMutableCharacterSet {
        unsafe { &*((self as *const Self).cast()) }
    }
}

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

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

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

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

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

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

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

impl NSMutableCharacterSet {
    extern_methods!(
        #[cfg(feature = "NSRange")]
        #[unsafe(method(addCharactersInRange:))]
        #[unsafe(method_family = none)]
        pub fn addCharactersInRange(&self, a_range: NSRange);

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

        #[cfg(feature = "NSString")]
        #[unsafe(method(addCharactersInString:))]
        #[unsafe(method_family = none)]
        pub fn addCharactersInString(&self, a_string: &NSString);

        #[cfg(feature = "NSString")]
        #[unsafe(method(removeCharactersInString:))]
        #[unsafe(method_family = none)]
        pub fn removeCharactersInString(&self, a_string: &NSString);

        #[unsafe(method(formUnionWithCharacterSet:))]
        #[unsafe(method_family = none)]
        pub fn formUnionWithCharacterSet(&self, other_set: &NSCharacterSet);

        #[unsafe(method(formIntersectionWithCharacterSet:))]
        #[unsafe(method_family = none)]
        pub fn formIntersectionWithCharacterSet(&self, other_set: &NSCharacterSet);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        #[cfg(feature = "NSRange")]
        #[unsafe(method(characterSetWithRange:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithRange(a_range: NSRange) -> Retained<NSMutableCharacterSet>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(characterSetWithCharactersInString:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithCharactersInString(
            a_string: &NSString,
        ) -> Retained<NSMutableCharacterSet>;

        #[cfg(feature = "NSData")]
        #[unsafe(method(characterSetWithBitmapRepresentation:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithBitmapRepresentation(
            data: &NSData,
        ) -> Retained<NSMutableCharacterSet>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(characterSetWithContentsOfFile:))]
        #[unsafe(method_family = none)]
        pub fn characterSetWithContentsOfFile(
            f_name: &NSString,
        ) -> Option<Retained<NSMutableCharacterSet>>;
    );
}

/// Methods declared on superclass `NSCharacterSet`.
impl NSMutableCharacterSet {
    extern_methods!(
        #[cfg(feature = "NSCoder")]
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMutableCharacterSet {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSMutableCharacterSet {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
