Struct ms_oforms::OFormsFile

source ·
pub struct OFormsFile<F> { /* private fields */ }
Expand description

An OForms file is a [cfb::CompoundFile].

Implementations§

source§

impl<T: Read + Seek> OFormsFile<T>

source

pub fn open(buf: T) -> Result<Self>

Create a new instance by opening the underlying [cfb::CompoundFile]

source

pub fn open_in(buf: T, prefix: PathBuf) -> Result<Self>

Create a new instance by opening the underlying [cfb::CompoundFile]

source

pub fn open_stream<P: AsRef<Path>>(&mut self, path: P) -> Result<Stream<T>>

source

pub fn root_form_stream(&mut self) -> Result<Stream<T>>

source

pub fn root_object_stream(&mut self) -> Result<Stream<T>>

source

pub fn root_comp_obj_stream(&mut self) -> Result<Stream<T>>

source

pub fn root_comp_obj(&mut self) -> Result<CompObj>

source

pub fn root_form_control(&mut self) -> Result<FormControl>

source

pub fn root_form(&mut self) -> Result<Form<T>>

Methods from Deref<Target = CompoundFile<T>>§

pub fn version(&self) -> Version

Returns the CFB format version used for this compound file.

pub fn root_entry(&self) -> Entry

Returns information about the root storage object. This is equivalent to self.entry("/").unwrap() (but always succeeds).

pub fn entry<P>(&self, path: P) -> Result<Entry, Error>where P: AsRef<Path>,

Given a path within the compound file, get information about that stream or storage object.

pub fn read_root_storage(&self) -> Entries<'_, F>

Returns an iterator over the entries within the root storage object. This is equivalent to self.read_storage("/").unwrap() (but always succeeds).

pub fn read_storage<P>(&self, path: P) -> Result<Entries<'_, F>, Error>where P: AsRef<Path>,

Returns an iterator over the entries within a storage object.

pub fn walk(&self) -> Entries<'_, F>

Returns an iterator over all entries within the compound file, starting from and including the root entry. The iterator walks the storage tree in a preorder traversal. This is equivalent to self.walk_storage("/").unwrap() (but always succeeds).

pub fn walk_storage<P>(&self, path: P) -> Result<Entries<'_, F>, Error>where P: AsRef<Path>,

Returns an iterator over all entries under a storage subtree, including the given path itself. The iterator walks the storage tree in a preorder traversal.

pub fn exists<P>(&self, path: P) -> boolwhere P: AsRef<Path>,

Returns true if there is an existing stream or storage at the given path, or false if there is nothing at that path.

pub fn is_stream<P>(&self, path: P) -> boolwhere P: AsRef<Path>,

Returns true if there is an existing stream at the given path, or false if there is a storage or nothing at that path.

pub fn is_storage<P>(&self, path: P) -> boolwhere P: AsRef<Path>,

Returns true if there is an existing storage at the given path, or false if there is a stream or nothing at that path.

pub fn open_stream<P>(&mut self, path: P) -> Result<Stream<F>, Error>where P: AsRef<Path>,

Opens an existing stream in the compound file for reading and/or writing (depending on what the underlying file supports).

pub fn create_storage<P>(&mut self, path: P) -> Result<(), Error>where P: AsRef<Path>,

Creates a new, empty storage object (i.e. “directory”) at the provided path. The parent storage object must already exist.

pub fn create_storage_all<P>(&mut self, path: P) -> Result<(), Error>where P: AsRef<Path>,

Recursively creates a storage and all of its parent storages if they are missing.

pub fn remove_storage<P>(&mut self, path: P) -> Result<(), Error>where P: AsRef<Path>,

Removes the storage object at the provided path. The storage object must exist and have no children.

pub fn remove_storage_all<P>(&mut self, path: P) -> Result<(), Error>where P: AsRef<Path>,

Recursively removes a storage and all of its children. If called on the root storage, recursively removes all of its children but not the root storage itself (which cannot be removed).

pub fn set_storage_clsid<P>( &mut self, path: P, clsid: Uuid ) -> Result<(), Error>where P: AsRef<Path>,

Sets the CLSID for the storage object at the provided path. (To get the current CLSID for a storage object, use self.entry(path)?.clsid().)

pub fn create_stream<P>(&mut self, path: P) -> Result<Stream<F>, Error>where P: AsRef<Path>,

Creates and returns a new, empty stream object at the provided path. If a stream already exists at that path, it will be replaced by the new stream. The parent storage object must already exist.

pub fn create_new_stream<P>(&mut self, path: P) -> Result<Stream<F>, Error>where P: AsRef<Path>,

Creates and returns a new, empty stream object at the provided path. Returns an error if a stream already exists at that path. The parent storage object must already exist.

pub fn remove_stream<P>(&mut self, path: P) -> Result<(), Error>where P: AsRef<Path>,

Removes the stream object at the provided path.

pub fn set_state_bits<P>(&mut self, path: P, bits: u32) -> Result<(), Error>where P: AsRef<Path>,

Sets the user-defined bitflags for the object at the provided path. (To get the current state bits for an object, use self.entry(path)?.state_bits().)

pub fn touch<P>(&mut self, path: P) -> Result<(), Error>where P: AsRef<Path>,

Sets the modified time for the object at the given path to now. Has no effect when called on the root storage.

pub fn flush(&mut self) -> Result<(), Error>

Flushes all changes to the underlying file.

Trait Implementations§

source§

impl<T> Deref for OFormsFile<T>

§

type Target = CompoundFile<T>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> DerefMut for OFormsFile<T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<F> !RefUnwindSafe for OFormsFile<F>

§

impl<F> !Send for OFormsFile<F>

§

impl<F> !Sync for OFormsFile<F>

§

impl<F> Unpin for OFormsFile<F>

§

impl<F> !UnwindSafe for OFormsFile<F>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.