Source code

Revision control

Copy as Markdown

Other Tools

//! 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::*;
/// NSStringPathExtensions.
#[cfg(feature = "NSString")]
impl NSString {
extern_methods!(
#[cfg(feature = "NSArray")]
#[unsafe(method(pathWithComponents:))]
#[unsafe(method_family = none)]
pub fn pathWithComponents(components: &NSArray<NSString>) -> Retained<NSString>;
#[cfg(feature = "NSArray")]
#[unsafe(method(pathComponents))]
#[unsafe(method_family = none)]
pub fn pathComponents(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(isAbsolutePath))]
#[unsafe(method_family = none)]
pub fn isAbsolutePath(&self) -> bool;
#[unsafe(method(lastPathComponent))]
#[unsafe(method_family = none)]
pub fn lastPathComponent(&self) -> Retained<NSString>;
#[unsafe(method(stringByDeletingLastPathComponent))]
#[unsafe(method_family = none)]
pub fn stringByDeletingLastPathComponent(&self) -> Retained<NSString>;
#[unsafe(method(stringByAppendingPathComponent:))]
#[unsafe(method_family = none)]
pub fn stringByAppendingPathComponent(&self, str: &NSString) -> Retained<NSString>;
#[unsafe(method(pathExtension))]
#[unsafe(method_family = none)]
pub fn pathExtension(&self) -> Retained<NSString>;
#[unsafe(method(stringByDeletingPathExtension))]
#[unsafe(method_family = none)]
pub fn stringByDeletingPathExtension(&self) -> Retained<NSString>;
#[unsafe(method(stringByAppendingPathExtension:))]
#[unsafe(method_family = none)]
pub fn stringByAppendingPathExtension(&self, str: &NSString) -> Option<Retained<NSString>>;
#[unsafe(method(stringByAbbreviatingWithTildeInPath))]
#[unsafe(method_family = none)]
pub fn stringByAbbreviatingWithTildeInPath(&self) -> Retained<NSString>;
#[unsafe(method(stringByExpandingTildeInPath))]
#[unsafe(method_family = none)]
pub fn stringByExpandingTildeInPath(&self) -> Retained<NSString>;
#[unsafe(method(stringByStandardizingPath))]
#[unsafe(method_family = none)]
pub fn stringByStandardizingPath(&self) -> Retained<NSString>;
#[unsafe(method(stringByResolvingSymlinksInPath))]
#[unsafe(method_family = none)]
pub fn stringByResolvingSymlinksInPath(&self) -> Retained<NSString>;
#[cfg(feature = "NSArray")]
#[unsafe(method(stringsByAppendingPaths:))]
#[unsafe(method_family = none)]
pub fn stringsByAppendingPaths(
&self,
paths: &NSArray<NSString>,
) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSArray")]
#[unsafe(method(completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:))]
#[unsafe(method_family = none)]
pub fn completePathIntoString_caseSensitive_matchesIntoArray_filterTypes(
&self,
output_name: Option<&mut Option<Retained<NSString>>>,
flag: bool,
output_array: Option<&mut Option<Retained<NSArray<NSString>>>>,
filter_types: Option<&NSArray<NSString>>,
) -> NSUInteger;
#[unsafe(method(fileSystemRepresentation))]
#[unsafe(method_family = none)]
pub fn fileSystemRepresentation(&self) -> NonNull<c_char>;
/// # Safety
///
/// `cname` must be a valid pointer.
#[unsafe(method(getFileSystemRepresentation:maxLength:))]
#[unsafe(method_family = none)]
pub unsafe fn getFileSystemRepresentation_maxLength(
&self,
cname: NonNull<c_char>,
max: NSUInteger,
) -> bool;
);
}
/// NSArrayPathExtensions.
#[cfg(feature = "NSArray")]
impl<ObjectType: Message> NSArray<ObjectType> {
extern_methods!(
#[cfg(feature = "NSString")]
#[unsafe(method(pathsMatchingExtensions:))]
#[unsafe(method_family = none)]
pub fn pathsMatchingExtensions(
&self,
filter_types: &NSArray<NSString>,
) -> Retained<NSArray<NSString>>;
);
}
#[cfg(feature = "NSString")]
#[inline]
pub extern "C-unwind" fn NSUserName() -> Retained<NSString> {
extern "C-unwind" {
fn NSUserName() -> *mut NSString;
}
let ret = unsafe { NSUserName() };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "NSString")]
#[inline]
pub extern "C-unwind" fn NSFullUserName() -> Retained<NSString> {
extern "C-unwind" {
fn NSFullUserName() -> *mut NSString;
}
let ret = unsafe { NSFullUserName() };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "NSString")]
#[inline]
pub extern "C-unwind" fn NSHomeDirectory() -> Retained<NSString> {
extern "C-unwind" {
fn NSHomeDirectory() -> *mut NSString;
}
let ret = unsafe { NSHomeDirectory() };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "NSString")]
#[inline]
pub extern "C-unwind" fn NSHomeDirectoryForUser(
user_name: Option<&NSString>,
) -> Option<Retained<NSString>> {
extern "C-unwind" {
fn NSHomeDirectoryForUser(user_name: Option<&NSString>) -> *mut NSString;
}
let ret = unsafe { NSHomeDirectoryForUser(user_name) };
unsafe { Retained::retain_autoreleased(ret) }
}
#[cfg(feature = "NSString")]
#[inline]
pub extern "C-unwind" fn NSTemporaryDirectory() -> Retained<NSString> {
extern "C-unwind" {
fn NSTemporaryDirectory() -> *mut NSString;
}
let ret = unsafe { NSTemporaryDirectory() };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
#[cfg(feature = "NSString")]
#[inline]
pub extern "C-unwind" fn NSOpenStepRootDirectory() -> Retained<NSString> {
extern "C-unwind" {
fn NSOpenStepRootDirectory() -> *mut NSString;
}
let ret = unsafe { NSOpenStepRootDirectory() };
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSearchPathDirectory(pub NSUInteger);
impl NSSearchPathDirectory {
#[doc(alias = "NSApplicationDirectory")]
pub const ApplicationDirectory: Self = Self(1);
#[doc(alias = "NSDemoApplicationDirectory")]
pub const DemoApplicationDirectory: Self = Self(2);
#[doc(alias = "NSDeveloperApplicationDirectory")]
pub const DeveloperApplicationDirectory: Self = Self(3);
#[doc(alias = "NSAdminApplicationDirectory")]
pub const AdminApplicationDirectory: Self = Self(4);
#[doc(alias = "NSLibraryDirectory")]
pub const LibraryDirectory: Self = Self(5);
#[doc(alias = "NSDeveloperDirectory")]
pub const DeveloperDirectory: Self = Self(6);
#[doc(alias = "NSUserDirectory")]
pub const UserDirectory: Self = Self(7);
#[doc(alias = "NSDocumentationDirectory")]
pub const DocumentationDirectory: Self = Self(8);
#[doc(alias = "NSDocumentDirectory")]
pub const DocumentDirectory: Self = Self(9);
#[doc(alias = "NSCoreServiceDirectory")]
pub const CoreServiceDirectory: Self = Self(10);
#[doc(alias = "NSAutosavedInformationDirectory")]
pub const AutosavedInformationDirectory: Self = Self(11);
#[doc(alias = "NSDesktopDirectory")]
pub const DesktopDirectory: Self = Self(12);
#[doc(alias = "NSCachesDirectory")]
pub const CachesDirectory: Self = Self(13);
#[doc(alias = "NSApplicationSupportDirectory")]
pub const ApplicationSupportDirectory: Self = Self(14);
#[doc(alias = "NSDownloadsDirectory")]
pub const DownloadsDirectory: Self = Self(15);
#[doc(alias = "NSInputMethodsDirectory")]
pub const InputMethodsDirectory: Self = Self(16);
#[doc(alias = "NSMoviesDirectory")]
pub const MoviesDirectory: Self = Self(17);
#[doc(alias = "NSMusicDirectory")]
pub const MusicDirectory: Self = Self(18);
#[doc(alias = "NSPicturesDirectory")]
pub const PicturesDirectory: Self = Self(19);
#[doc(alias = "NSPrinterDescriptionDirectory")]
pub const PrinterDescriptionDirectory: Self = Self(20);
#[doc(alias = "NSSharedPublicDirectory")]
pub const SharedPublicDirectory: Self = Self(21);
#[doc(alias = "NSPreferencePanesDirectory")]
pub const PreferencePanesDirectory: Self = Self(22);
#[doc(alias = "NSApplicationScriptsDirectory")]
pub const ApplicationScriptsDirectory: Self = Self(23);
#[doc(alias = "NSItemReplacementDirectory")]
pub const ItemReplacementDirectory: Self = Self(99);
#[doc(alias = "NSAllApplicationsDirectory")]
pub const AllApplicationsDirectory: Self = Self(100);
#[doc(alias = "NSAllLibrariesDirectory")]
pub const AllLibrariesDirectory: Self = Self(101);
#[doc(alias = "NSTrashDirectory")]
pub const TrashDirectory: Self = Self(102);
}
unsafe impl Encode for NSSearchPathDirectory {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSSearchPathDirectory {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSearchPathDomainMask(pub NSUInteger);
bitflags::bitflags! {
impl NSSearchPathDomainMask: NSUInteger {
#[doc(alias = "NSUserDomainMask")]
const UserDomainMask = 1;
#[doc(alias = "NSLocalDomainMask")]
const LocalDomainMask = 2;
#[doc(alias = "NSNetworkDomainMask")]
const NetworkDomainMask = 4;
#[doc(alias = "NSSystemDomainMask")]
const SystemDomainMask = 8;
#[doc(alias = "NSAllDomainsMask")]
const AllDomainsMask = 0x0ffff;
}
}
unsafe impl Encode for NSSearchPathDomainMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSSearchPathDomainMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(all(feature = "NSArray", feature = "NSString"))]
#[inline]
pub extern "C-unwind" fn NSSearchPathForDirectoriesInDomains(
directory: NSSearchPathDirectory,
domain_mask: NSSearchPathDomainMask,
expand_tilde: bool,
) -> Retained<NSArray<NSString>> {
extern "C-unwind" {
fn NSSearchPathForDirectoriesInDomains(
directory: NSSearchPathDirectory,
domain_mask: NSSearchPathDomainMask,
expand_tilde: Bool,
) -> *mut NSArray<NSString>;
}
let ret = unsafe {
NSSearchPathForDirectoriesInDomains(directory, domain_mask, Bool::new(expand_tilde))
};
unsafe { Retained::retain_autoreleased(ret) }
.expect("function was marked as returning non-null, but actually returned NULL")
}