objc2-uniform-type-identifiers 0.3.2

Bindings to the UniformTypeIdentifiers framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

mod private_NSStringUTAdditions {
    pub trait Sealed {}
}

/// Category "UTAdditions" on [`NSString`].
#[doc(alias = "UTAdditions")]
pub unsafe trait NSStringUTAdditions:
    ClassType + Sized + private_NSStringUTAdditions::Sealed
{
    extern_methods!(
        #[cfg(feature = "UTType")]
        /// Generate a path component based on a partial filename and a file
        /// type, then append it to a copy of the receiver.
        ///
        ///
        /// Parameter `partialName`: The partial filename that should be expanded upon,
        /// e.g.
        /// `"readme".`
        /// Parameter `contentType`: The type the resulting file should conform to, e.g.
        /// `UTTypePlainText.`
        ///
        /// Returns: A complete file path. Using the argument examples above, this method
        /// would return a string with a last path component of
        /// `"readme.txt".`
        /// Use this method when you have partial input from a user or other source and
        /// need to produce a complete filename suitable for that input. For example, if
        /// you are downloading a file from the Internet and know its MIME type, you can
        /// use this method to ensure the correct filename extension is applied to the
        /// URL where you save the file.
        ///
        /// If
        /// _partialName_already has a path extension, and that path extension is
        /// valid for file system objects of type
        /// _contentType,_no additional
        /// extension is appended to the path component before constructing the string.
        /// For example, if the inputs are
        /// `"puppy.jpg"`and
        /// `UTTypeImage`respectively, then the resulting string will have a last path component of
        /// `"puppy.jpg"`. On the other hand, if the inputs are
        /// `"puppy.jpg"`and
        /// `UTTypePlainText`respectively, the resulting string will have a last path
        /// component of
        /// `"puppy.jpg.txt"`. If you want to ensure any existing path
        /// extension is replaced, you can use the
        /// `stringByDeletingPathExtension`property first.
        ///
        /// If the path component could not be appended, this method returns a copy of
        /// `self`.
        #[unsafe(method(stringByAppendingPathComponent:conformingToType:))]
        #[unsafe(method_family = none)]
        fn stringByAppendingPathComponent_conformingToType(
            &self,
            partial_name: &NSString,
            content_type: &UTType,
        ) -> Retained<NSString>;

        #[cfg(feature = "UTType")]
        /// Generate a string based on a partial filename or path and a
        /// file type.
        ///
        ///
        /// Parameter `contentType`: The type the resulting file should conform to, e.g.
        /// `UTTypePlainText.`
        ///
        /// Returns: A complete file path. Using the argument example above and assuming
        /// the receiver equals
        /// `"readme"`, this method would return
        /// `"readme.txt".`
        /// Use this method when you have partial input from a user or other source and
        /// need to produce a complete filename suitable for that input. For example, if
        /// you are downloading a file from the Internet and know its MIME type, you can
        /// use this method to ensure the correct filename extension is applied to the
        /// URL where you save the file.
        ///
        /// If the receiver already has a path extension, and that path extension is
        /// valid for file system objects of type
        /// _contentType,_no additional
        /// extension is appended to the receiver before constructing the result.
        /// For example, if the receiver equals
        /// `"puppy.jpg"`and
        /// _contentType_equals
        /// `UTTypeImage`, then the resulting string will equal
        /// `"puppy.jpg"`. On
        /// the other hand, if the inputs are
        /// `"puppy.jpg"`and
        /// `UTTypePlainText`respectively, the resulting string will equal
        /// `"puppy.jpg.txt"`. If you
        /// want to ensure any existing path extension is replaced, you can use the
        /// `stringByDeletingPathExtension`property first.
        ///
        /// If the extension could not be appended, this method returns a copy of
        /// `self`.
        #[unsafe(method(stringByAppendingPathExtensionForType:))]
        #[unsafe(method_family = none)]
        fn stringByAppendingPathExtensionForType(
            &self,
            content_type: &UTType,
        ) -> Retained<NSString>;
    );
}

impl private_NSStringUTAdditions::Sealed for NSString {}
unsafe impl NSStringUTAdditions for NSString {}

mod private_NSURLUTAdditions {
    pub trait Sealed {}
}

/// Category "UTAdditions" on [`NSURL`].
#[doc(alias = "UTAdditions")]
pub unsafe trait NSURLUTAdditions:
    ClassType + Sized + private_NSURLUTAdditions::Sealed
{
    extern_methods!(
        #[cfg(feature = "UTType")]
        /// Generate a path component based on a partial filename and a file
        /// type, then append it to a copy of the receiver.
        ///
        ///
        /// Parameter `partialName`: The partial filename that should be expanded upon,
        /// e.g.
        /// `"readme".`
        /// Parameter `contentType`: The type the resulting file should conform to, e.g.
        /// `UTTypePlainText.`
        ///
        /// Returns: A complete URL. Using the argument examples above, this method would
        /// return a URL with a last path component of
        /// `"readme.txt".`
        /// Use this method when you have partial input from a user or other source and
        /// need to produce a complete filename suitable for that input. For example, if
        /// you are downloading a file from the Internet and know its MIME type, you can
        /// use this method to ensure the correct filename extension is applied to the
        /// URL where you save the file.
        ///
        /// If
        /// _partialName_already has a path extension, and that path extension is
        /// valid for file system objects of type
        /// _contentType,_no additional
        /// extension is appended to the path component before constructing the URL. For
        /// example, if the inputs are
        /// `"puppy.jpg"`and
        /// `UTTypeImage`respectively,
        /// then the resulting URL will have a last path component of
        /// `"puppy.jpg"`.
        /// On the other hand, if the inputs are
        /// `"puppy.jpg"`and
        /// `UTTypePlainText`respectively, the resulting URL will have a last path component of
        /// `"puppy.jpg.txt"`. If you want to ensure any existing path extension is
        /// replaced, you can use the
        /// `URLByDeletingPathExtension`property first.
        ///
        /// If the path component could not be appended, this method returns a copy of
        /// `self`.
        ///
        ///
        /// Note: The resulting URL has a directory path if
        /// `contentType`conforms to
        /// `UTTypeDirectory`.
        #[unsafe(method(URLByAppendingPathComponent:conformingToType:))]
        #[unsafe(method_family = none)]
        fn URLByAppendingPathComponent_conformingToType(
            &self,
            partial_name: &NSString,
            content_type: &UTType,
        ) -> Retained<NSURL>;

        #[cfg(feature = "UTType")]
        /// Generate a path component based on the last path component of the
        /// receiver and a file type, then append it to a copy of the receiver.
        ///
        ///
        /// Parameter `contentType`: The type the resulting file should conform to, e.g.
        /// `UTTypePlainText.`
        ///
        /// Returns: A complete URL. Using the argument example above and assuming
        /// the receiver equals
        /// `"file:///readme"`, this method would return
        /// `"file:///readme.txt".`
        /// Use this method when you have partial input from a user or other source and
        /// need to produce a complete filename suitable for that input. For example, if
        /// you are downloading a file from the Internet and know its MIME type, you can
        /// use this method to ensure the correct filename extension is applied to the
        /// URL where you save the file.
        ///
        /// If the receiver already has a path extension, and that path extension is
        /// valid for file system objects of type
        /// _contentType,_no additional
        /// extension is appended to the path component before constructing the URL.
        /// For example, if the receiver's last path component equals
        /// `"puppy.jpg"`and
        /// _contentType_equals
        /// `UTTypeImage`, then the resulting URL will have a
        /// last path component of
        /// `"puppy.jpg"`. On the other hand, if the inputs are
        /// `"puppy.jpg"`and
        /// `UTTypePlainText`respectively, the resulting URL will
        /// have a last path component of
        /// `"puppy.jpg.txt"`. If you want to ensure any
        /// existing path extension is replaced, you can use the
        /// `URLByDeletingPathExtension`property first.
        ///
        /// If the extension could not be appended, this method returns a copy of
        /// `self`.
        ///
        ///
        /// Note: The resulting URL has a directory path if
        /// `contentType`conforms to
        /// `UTTypeDirectory`.
        #[unsafe(method(URLByAppendingPathExtensionForType:))]
        #[unsafe(method_family = none)]
        fn URLByAppendingPathExtensionForType(&self, content_type: &UTType) -> Retained<NSURL>;
    );
}

impl private_NSURLUTAdditions::Sealed for NSURL {}
unsafe impl NSURLUTAdditions for NSURL {}