Copy as Markdown
Other Tools
//
// DO NOT EDIT. THIS FILE IS GENERATED FROM $SRCDIR/xpcom/io/nsILocalFileMac.idl
//
/// `interface nsILocalFileMac : nsIFile`
///
// The actual type definition for the interface. This struct has methods
// declared on it which will call through its vtable. You never want to pass
// this type around by value, always pass it behind a reference.
#[repr(C)]
pub struct nsILocalFileMac {
vtable: &'static nsILocalFileMacVTable,
/// This field is a phantomdata to ensure that the VTable type and any
/// struct containing it is not safe to send across threads by default, as
/// XPCOM is generally not threadsafe.
///
/// If this type is marked as [rust_sync], there will be explicit `Send` and
/// `Sync` implementations on this type, which will override the inherited
/// negative impls from `Rc`.
__nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
// Make the rust compiler aware that there might be interior mutability
// in what actually implements the interface. This works around UB
// introduced by https://github.com/llvm/llvm-project/commit/01859da84bad95fd51d6a03b08b60c660e642a4f
// that a rust lint would make blatantly obvious, but doesn't exist.
// This prevents optimizations, but those optimizations weren't available
// before rustc switched to LLVM 16, and they now cause problems because
// of the UB.
// Until there's a lint available to find all our UB, it's simpler to
// avoid the UB in the first place, at the cost of preventing optimizations
// in places that don't cause UB. But again, those optimizations weren't
// available before.
__maybe_interior_mutability: ::std::cell::UnsafeCell<[u8; 0]>,
}
// Implementing XpCom for an interface exposes its IID, which allows for easy
// use of the `.query_interface<T>` helper method. This also defines that
// method for nsILocalFileMac.
unsafe impl XpCom for nsILocalFileMac {
const IID: nsIID = nsID(0x623eca5b, 0xc25d, 0x4e27,
[0xbe, 0x5a, 0x78, 0x9a, 0x66, 0xc4, 0xb2, 0xf7]);
}
// We need to implement the RefCounted trait so we can be used with `RefPtr`.
// This trait teaches `RefPtr` how to manage our memory.
unsafe impl RefCounted for nsILocalFileMac {
#[inline]
unsafe fn addref(&self) {
self.AddRef();
}
#[inline]
unsafe fn release(&self) {
self.Release();
}
}
// This trait is implemented on all types which can be coerced to from nsILocalFileMac.
// It is used in the implementation of `fn coerce<T>`. We hide it from the
// documentation, because it clutters it up a lot.
#[doc(hidden)]
pub trait nsILocalFileMacCoerce {
/// Cheaply cast a value of this type from a `nsILocalFileMac`.
fn coerce_from(v: &nsILocalFileMac) -> &Self;
}
// The trivial implementation: We can obviously coerce ourselves to ourselves.
impl nsILocalFileMacCoerce for nsILocalFileMac {
#[inline]
fn coerce_from(v: &nsILocalFileMac) -> &Self {
v
}
}
impl nsILocalFileMac {
/// Cast this `nsILocalFileMac` to one of its base interfaces.
#[inline]
pub fn coerce<T: nsILocalFileMacCoerce>(&self) -> &T {
T::coerce_from(self)
}
}
// Every interface struct type implements `Deref` to its base interface. This
// causes methods on the base interfaces to be directly avaliable on the
// object. For example, you can call `.AddRef` or `.QueryInterface` directly
// on any interface which inherits from `nsISupports`.
impl ::std::ops::Deref for nsILocalFileMac {
type Target = nsIFile;
#[inline]
fn deref(&self) -> &nsIFile {
unsafe {
::std::mem::transmute(self)
}
}
}
// Ensure we can use .coerce() to cast to our base types as well. Any type which
// our base interface can coerce from should be coercable from us as well.
impl<T: nsIFileCoerce> nsILocalFileMacCoerce for T {
#[inline]
fn coerce_from(v: &nsILocalFileMac) -> &Self {
T::coerce_from(v)
}
}
// This struct represents the interface's VTable. A pointer to a statically
// allocated version of this struct is at the beginning of every nsILocalFileMac
// object. It contains one pointer field for each method in the interface. In
// the case where we can't generate a binding for a method, we include a void
// pointer.
#[doc(hidden)]
#[repr(C)]
pub struct nsILocalFileMacVTable {
/// We need to include the members from the base interface's vtable at the start
/// of the VTable definition.
pub __base: nsIFileVTable,
/* [noscript] void initWithCFURL (in CFURLRef aCFURL); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub InitWithCFURL: *const ::libc::c_void,
/* [noscript] void initWithFSRef ([const] in FSRefPtr aFSRef); */
/// Unable to generate binding because `native type FSRef unsupported`
pub InitWithFSRef: *const ::libc::c_void,
/* [noscript] CFURLRef getCFURL (); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetCFURL: *const ::libc::c_void,
/* [noscript] FSRef getFSRef (); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetFSRef: *const ::libc::c_void,
/* [noscript] FSSpec getFSSpec (); */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetFSSpec: *const ::libc::c_void,
/* readonly attribute int64_t fileSizeWithResFork; */
pub GetFileSizeWithResFork: unsafe extern "system" fn (this: *const nsILocalFileMac, aFileSizeWithResFork: *mut i64) -> ::nserror::nsresult,
/* [noscript] attribute OSType fileType; */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetFileType: *const ::libc::c_void,
/* [noscript] attribute OSType fileType; */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub SetFileType: *const ::libc::c_void,
/* [noscript] attribute OSType fileCreator; */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub GetFileCreator: *const ::libc::c_void,
/* [noscript] attribute OSType fileCreator; */
/// Unable to generate binding because `Rust only supports [ref] / [ptr] native types`
pub SetFileCreator: *const ::libc::c_void,
/* void launchWithDoc (in nsIFile aDocToLoad, in boolean aLaunchInBackground); */
pub LaunchWithDoc: unsafe extern "system" fn (this: *const nsILocalFileMac, aDocToLoad: *const nsIFile, aLaunchInBackground: bool) -> ::nserror::nsresult,
/* void openDocWithApp (in nsIFile aAppToOpenWith, in boolean aLaunchInBackground); */
pub OpenDocWithApp: unsafe extern "system" fn (this: *const nsILocalFileMac, aAppToOpenWith: *const nsIFile, aLaunchInBackground: bool) -> ::nserror::nsresult,
/* boolean isPackage (); */
pub IsPackage: unsafe extern "system" fn (this: *const nsILocalFileMac, _retval: *mut bool) -> ::nserror::nsresult,
/* readonly attribute AString bundleDisplayName; */
pub GetBundleDisplayName: unsafe extern "system" fn (this: *const nsILocalFileMac, aBundleDisplayName: *mut ::nsstring::nsAString) -> ::nserror::nsresult,
/* readonly attribute AUTF8String bundleIdentifier; */
pub GetBundleIdentifier: unsafe extern "system" fn (this: *const nsILocalFileMac, aBundleIdentifier: *mut ::nsstring::nsACString) -> ::nserror::nsresult,
/* readonly attribute int64_t bundleContentsLastModifiedTime; */
pub GetBundleContentsLastModifiedTime: unsafe extern "system" fn (this: *const nsILocalFileMac, aBundleContentsLastModifiedTime: *mut i64) -> ::nserror::nsresult,
/* boolean hasXAttr (in ACString aAttrName); */
pub HasXAttr: unsafe extern "system" fn (this: *const nsILocalFileMac, aAttrName: *const ::nsstring::nsACString, _retval: *mut bool) -> ::nserror::nsresult,
/* Array<uint8_t> getXAttr (in ACString aAttrName); */
pub GetXAttr: unsafe extern "system" fn (this: *const nsILocalFileMac, aAttrName: *const ::nsstring::nsACString, _retval: *mut thin_vec::ThinVec<u8>) -> ::nserror::nsresult,
/* void setXAttr (in ACString aAttrName, in Array<uint8_t> aAttrValue); */
pub SetXAttr: unsafe extern "system" fn (this: *const nsILocalFileMac, aAttrName: *const ::nsstring::nsACString, aAttrValue: *const thin_vec::ThinVec<u8>) -> ::nserror::nsresult,
/* void delXAttr (in ACString aAttrName); */
pub DelXAttr: unsafe extern "system" fn (this: *const nsILocalFileMac, aAttrName: *const ::nsstring::nsACString) -> ::nserror::nsresult,
}
// The implementations of the function wrappers which are exposed to rust code.
// Call these methods rather than manually calling through the VTable struct.
impl nsILocalFileMac {
/// ```text
/// /**
/// * initWithCFURL
/// *
/// * Init this object with a CFURLRef
/// *
/// * NOTE: Supported only for XP_MACOSX
/// * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand.
/// *
/// * @param aCFURL the CoreFoundation URL
/// *
/// */
/// ```
///
/// `[noscript] void initWithCFURL (in CFURLRef aCFURL);`
const _InitWithCFURL: () = ();
/// ```text
/// /**
/// * initWithFSRef
/// *
/// * Init this object with an FSRef
/// *
/// * NOTE: Supported only for XP_MACOSX
/// *
/// * @param aFSRef the native FSRef
/// *
/// */
/// ```
///
/// `[noscript] void initWithFSRef ([const] in FSRefPtr aFSRef);`
const _InitWithFSRef: () = ();
/// ```text
/// /**
/// * getCFURL
/// *
/// * Returns the CFURLRef of the file object. The caller is
/// * responsible for calling CFRelease() on it.
/// *
/// * NOTE: Observes the state of the followLinks attribute.
/// * If the file object is an alias and followLinks is TRUE, returns
/// * the target of the alias. If followLinks is FALSE, returns
/// * the unresolved alias file.
/// *
/// * NOTE: Supported only for XP_MACOSX
/// *
/// * @return
/// *
/// */
/// ```
///
/// `[noscript] CFURLRef getCFURL ();`
const _GetCFURL: () = ();
/// ```text
/// /**
/// * getFSRef
/// *
/// * Returns the FSRef of the file object.
/// *
/// * NOTE: Observes the state of the followLinks attribute.
/// * If the file object is an alias and followLinks is TRUE, returns
/// * the target of the alias. If followLinks is FALSE, returns
/// * the unresolved alias file.
/// *
/// * NOTE: Supported only for XP_MACOSX
/// *
/// * @return
/// *
/// */
/// ```
///
/// `[noscript] FSRef getFSRef ();`
const _GetFSRef: () = ();
/// ```text
/// /**
/// * getFSSpec
/// *
/// * Returns the FSSpec of the file object.
/// *
/// * NOTE: Observes the state of the followLinks attribute.
/// * If the file object is an alias and followLinks is TRUE, returns
/// * the target of the alias. If followLinks is FALSE, returns
/// * the unresolved alias file.
/// *
/// * @return
/// *
/// */
/// ```
///
/// `[noscript] FSSpec getFSSpec ();`
const _GetFSSpec: () = ();
/// ```text
/// /**
/// * fileSizeWithResFork
/// *
/// * Returns the combined size of both the data fork and the resource
/// * fork (if present) rather than just the size of the data fork
/// * as returned by GetFileSize()
/// *
/// */
/// ```
///
/// `readonly attribute int64_t fileSizeWithResFork;`
#[inline]
pub unsafe fn GetFileSizeWithResFork(&self, aFileSizeWithResFork: *mut i64) -> ::nserror::nsresult {
((*self.vtable).GetFileSizeWithResFork)(self, aFileSizeWithResFork)
}
/// ```text
/// /**
/// * fileType, creator
/// *
/// * File type and creator attributes
/// *
/// */
/// ```
///
/// `[noscript] attribute OSType fileType;`
const _GetFileType: () = ();
/// ```text
/// /**
/// * fileType, creator
/// *
/// * File type and creator attributes
/// *
/// */
/// ```
///
/// `[noscript] attribute OSType fileType;`
const _SetFileType: () = ();
/// `[noscript] attribute OSType fileCreator;`
const _GetFileCreator: () = ();
/// `[noscript] attribute OSType fileCreator;`
const _SetFileCreator: () = ();
/// ```text
/// /**
/// * launchWithDoc
/// *
/// * Launch the application that this file points to with a document.
/// *
/// * @param aDocToLoad Must not be NULL. If no document, use nsIFile::launch
/// * @param aLaunchInBackground TRUE if the application should not come to the front.
/// *
/// */
/// ```
///
/// `void launchWithDoc (in nsIFile aDocToLoad, in boolean aLaunchInBackground);`
#[inline]
pub unsafe fn LaunchWithDoc(&self, aDocToLoad: *const nsIFile, aLaunchInBackground: bool) -> ::nserror::nsresult {
((*self.vtable).LaunchWithDoc)(self, aDocToLoad, aLaunchInBackground)
}
/// ```text
/// /**
/// * openDocWithApp
/// *
/// * Open the document that this file points to with the given application.
/// *
/// * @param aAppToOpenWith The application with which to open the document.
/// * If NULL, the creator code of the document is used
/// * to determine the application.
/// * @param aLaunchInBackground TRUE if the application should not come to the front.
/// *
/// */
/// ```
///
/// `void openDocWithApp (in nsIFile aAppToOpenWith, in boolean aLaunchInBackground);`
#[inline]
pub unsafe fn OpenDocWithApp(&self, aAppToOpenWith: *const nsIFile, aLaunchInBackground: bool) -> ::nserror::nsresult {
((*self.vtable).OpenDocWithApp)(self, aAppToOpenWith, aLaunchInBackground)
}
/// ```text
/// /**
/// * isPackage
/// *
/// * returns true if a directory is determined to be a package under Mac OS 9/X
/// *
/// */
/// ```
///
/// `boolean isPackage ();`
#[inline]
pub unsafe fn IsPackage(&self, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).IsPackage)(self, _retval)
}
/// ```text
/// /**
/// * bundleDisplayName
/// *
/// * returns the display name of the application bundle (usually the human
/// * readable name of the application)
/// */
/// ```
///
/// `readonly attribute AString bundleDisplayName;`
#[inline]
pub unsafe fn GetBundleDisplayName(&self, aBundleDisplayName: *mut ::nsstring::nsAString) -> ::nserror::nsresult {
((*self.vtable).GetBundleDisplayName)(self, aBundleDisplayName)
}
/// ```text
/// /**
/// * bundleIdentifier
/// *
/// * returns the identifier of the bundle
/// */
/// ```
///
/// `readonly attribute AUTF8String bundleIdentifier;`
#[inline]
pub unsafe fn GetBundleIdentifier(&self, aBundleIdentifier: *mut ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).GetBundleIdentifier)(self, aBundleIdentifier)
}
/// ```text
/// /**
/// * Last modified time of a bundle's contents (as opposed to its package
/// * directory). Our convention is to make the bundle's Info.plist file
/// * stand in for the rest of its contents -- since this file contains the
/// * bundle's version information and other identifiers. For non-bundles
/// * this is the same as lastModifiedTime.
/// */
/// ```
///
/// `readonly attribute int64_t bundleContentsLastModifiedTime;`
#[inline]
pub unsafe fn GetBundleContentsLastModifiedTime(&self, aBundleContentsLastModifiedTime: *mut i64) -> ::nserror::nsresult {
((*self.vtable).GetBundleContentsLastModifiedTime)(self, aBundleContentsLastModifiedTime)
}
/// ```text
/// /**
/// * Return whether or not the file has an extended attribute.
/// *
/// * @param aAttrName The attribute name to check for.
/// *
/// * @return Whether or not the extended attribute is present.
/// */
/// ```
///
/// `boolean hasXAttr (in ACString aAttrName);`
#[inline]
pub unsafe fn HasXAttr(&self, aAttrName: *const ::nsstring::nsACString, _retval: *mut bool) -> ::nserror::nsresult {
((*self.vtable).HasXAttr)(self, aAttrName, _retval)
}
/// ```text
/// /**
/// * Get the value of the extended attribute.
/// *
/// * @param aAttrName The attribute name to read.
/// *
/// * @return The extended attribute value.
/// */
/// ```
///
/// `Array<uint8_t> getXAttr (in ACString aAttrName);`
#[inline]
pub unsafe fn GetXAttr(&self, aAttrName: *const ::nsstring::nsACString, _retval: *mut thin_vec::ThinVec<u8>) -> ::nserror::nsresult {
((*self.vtable).GetXAttr)(self, aAttrName, _retval)
}
/// ```text
/// /**
/// * Set an extended attribute.
/// *
/// * @param aAttrName The attribute name to set a value for.
/// * @param aAttrValue The value to set for the attribute.
/// */
/// ```
///
/// `void setXAttr (in ACString aAttrName, in Array<uint8_t> aAttrValue);`
#[inline]
pub unsafe fn SetXAttr(&self, aAttrName: *const ::nsstring::nsACString, aAttrValue: *const thin_vec::ThinVec<u8>) -> ::nserror::nsresult {
((*self.vtable).SetXAttr)(self, aAttrName, aAttrValue)
}
/// ```text
/// /**
/// * Delete an extended attribute.
/// *
/// * @param aAttrName The extended attribute to delete.
/// */
/// ```
///
/// `void delXAttr (in ACString aAttrName);`
#[inline]
pub unsafe fn DelXAttr(&self, aAttrName: *const ::nsstring::nsACString) -> ::nserror::nsresult {
((*self.vtable).DelXAttr)(self, aAttrName)
}
}