//! 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/nsscanner?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSScanner;
);

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

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

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

impl NSScanner {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[unsafe(method(string))]
        #[unsafe(method_family = none)]
        pub fn string(&self) -> Retained<NSString>;

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

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

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

        #[cfg(feature = "NSCharacterSet")]
        /// Setter for [`charactersToBeSkipped`][Self::charactersToBeSkipped].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setCharactersToBeSkipped:))]
        #[unsafe(method_family = none)]
        pub fn setCharactersToBeSkipped(&self, characters_to_be_skipped: Option<&NSCharacterSet>);

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

        /// Setter for [`caseSensitive`][Self::caseSensitive].
        #[unsafe(method(setCaseSensitive:))]
        #[unsafe(method_family = none)]
        pub fn setCaseSensitive(&self, case_sensitive: bool);

        #[unsafe(method(locale))]
        #[unsafe(method_family = none)]
        pub fn locale(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`locale`][Self::locale].
        ///
        /// # Safety
        ///
        /// `locale` should be of the correct type.
        #[unsafe(method(setLocale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLocale(&self, locale: Option<&AnyObject>);

        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithString:))]
        #[unsafe(method_family = init)]
        pub fn initWithString(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSScanner {
    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 NSScanner {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// NSExtendedScanner.
impl NSScanner {
    extern_methods!(
        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanInt:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanInt(&self, result: *mut c_int) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanInteger:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanInteger(&self, result: *mut NSInteger) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanLongLong:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanLongLong(&self, result: *mut c_longlong) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanUnsignedLongLong:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanUnsignedLongLong(&self, result: *mut c_ulonglong) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanFloat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanFloat(&self, result: *mut c_float) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanDouble:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanDouble(&self, result: *mut c_double) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanHexInt:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanHexInt(&self, result: *mut c_uint) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanHexLongLong:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanHexLongLong(&self, result: *mut c_ulonglong) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanHexFloat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanHexFloat(&self, result: *mut c_float) -> bool;

        /// # Safety
        ///
        /// `result` must be a valid pointer or null.
        #[unsafe(method(scanHexDouble:))]
        #[unsafe(method_family = none)]
        pub unsafe fn scanHexDouble(&self, result: *mut c_double) -> bool;

        #[cfg(feature = "NSString")]
        #[unsafe(method(scanString:intoString:))]
        #[unsafe(method_family = none)]
        pub fn scanString_intoString(
            &self,
            string: &NSString,
            result: Option<&mut Option<Retained<NSString>>>,
        ) -> bool;

        #[cfg(all(feature = "NSCharacterSet", feature = "NSString"))]
        #[unsafe(method(scanCharactersFromSet:intoString:))]
        #[unsafe(method_family = none)]
        pub fn scanCharactersFromSet_intoString(
            &self,
            set: &NSCharacterSet,
            result: Option<&mut Option<Retained<NSString>>>,
        ) -> bool;

        #[cfg(feature = "NSString")]
        #[unsafe(method(scanUpToString:intoString:))]
        #[unsafe(method_family = none)]
        pub fn scanUpToString_intoString(
            &self,
            string: &NSString,
            result: Option<&mut Option<Retained<NSString>>>,
        ) -> bool;

        #[cfg(all(feature = "NSCharacterSet", feature = "NSString"))]
        #[unsafe(method(scanUpToCharactersFromSet:intoString:))]
        #[unsafe(method_family = none)]
        pub fn scanUpToCharactersFromSet_intoString(
            &self,
            set: &NSCharacterSet,
            result: Option<&mut Option<Retained<NSString>>>,
        ) -> bool;

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

        #[cfg(feature = "NSString")]
        #[unsafe(method(scannerWithString:))]
        #[unsafe(method_family = none)]
        pub fn scannerWithString(string: &NSString) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(localizedScannerWithString:))]
        #[unsafe(method_family = none)]
        pub fn localizedScannerWithString(string: &NSString) -> Retained<AnyObject>;
    );
}
