use crate::{sys, SBFileSpec, SBStream};
use std::fmt;
pub struct SBModuleSpec {
pub raw: sys::SBModuleSpecRef,
}
impl SBModuleSpec {
#[allow(dead_code)]
pub(crate) fn maybe_wrap(raw: sys::SBModuleSpecRef) -> Option<SBModuleSpec> {
if unsafe { sys::SBModuleSpecIsValid(raw) } {
Some(SBModuleSpec { raw })
} else {
None
}
}
pub fn is_valid(&self) -> bool {
unsafe { sys::SBModuleSpecIsValid(self.raw) }
}
pub fn filespec(&self) -> SBFileSpec {
SBFileSpec::wrap(unsafe { sys::SBModuleSpecGetFileSpec(self.raw) })
}
pub fn set_filespec(&self, filespec: &SBFileSpec) {
unsafe { sys::SBModuleSpecSetFileSpec(self.raw, filespec.raw) }
}
pub fn platform_filespec(&self) -> SBFileSpec {
SBFileSpec::wrap(unsafe { sys::SBModuleSpecGetPlatformFileSpec(self.raw) })
}
pub fn set_platform_filespec(&self, filespec: &SBFileSpec) {
unsafe { sys::SBModuleSpecSetPlatformFileSpec(self.raw, filespec.raw) }
}
#[allow(missing_docs)]
pub fn symbol_filespec(&self) -> Option<SBFileSpec> {
SBFileSpec::maybe_wrap(unsafe { sys::SBModuleSpecGetSymbolFileSpec(self.raw) })
}
#[allow(missing_docs)]
pub fn set_symbol_filespec(&self, filespec: &SBFileSpec) {
unsafe { sys::SBModuleSpecSetSymbolFileSpec(self.raw, filespec.raw) }
}
#[allow(missing_docs)]
pub fn object_name(&self) -> &str {
unimplemented!();
}
#[allow(missing_docs)]
pub fn set_object_name(&self, _object_name: &str) {
unimplemented!();
}
#[allow(missing_docs)]
pub fn triple(&self) -> &str {
unimplemented!();
}
#[allow(missing_docs)]
pub fn set_triple(&self, _object_name: &str) {
unimplemented!();
}
#[allow(missing_docs)]
pub fn uuid_bytes(&self) -> &str {
unimplemented!();
}
#[allow(missing_docs)]
pub fn set_uuid_bytes(&self, _object_name: &str) {
unimplemented!();
}
}
impl Clone for SBModuleSpec {
fn clone(&self) -> SBModuleSpec {
SBModuleSpec {
raw: unsafe { sys::CloneSBModuleSpec(self.raw) },
}
}
}
impl fmt::Debug for SBModuleSpec {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
let stream = SBStream::new();
unsafe { sys::SBModuleSpecGetDescription(self.raw, stream.raw) };
write!(fmt, "SBModuleSpec {{ {} }}", stream.data())
}
}
impl Drop for SBModuleSpec {
fn drop(&mut self) {
unsafe { sys::DisposeSBModuleSpec(self.raw) };
}
}
unsafe impl Send for SBModuleSpec {}
unsafe impl Sync for SBModuleSpec {}