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>
impl<T: Read + Seek> OFormsFile<T>
sourcepub fn open(buf: T) -> Result<Self>
pub fn open(buf: T) -> Result<Self>
Create a new instance by opening the underlying [cfb::CompoundFile
]
sourcepub fn open_in(buf: T, prefix: PathBuf) -> Result<Self>
pub fn open_in(buf: T, prefix: PathBuf) -> Result<Self>
Create a new instance by opening the underlying [cfb::CompoundFile
]
pub fn open_stream<P: AsRef<Path>>(&mut self, path: P) -> Result<Stream<T>>
sourcepub fn root_form_stream(&mut self) -> Result<Stream<T>>
pub fn root_form_stream(&mut self) -> Result<Stream<T>>
Get the form stream (f
)
sourcepub fn root_object_stream(&mut self) -> Result<Stream<T>>
pub fn root_object_stream(&mut self) -> Result<Stream<T>>
Get the object stream (o
)
sourcepub fn root_comp_obj_stream(&mut self) -> Result<Stream<T>>
pub fn root_comp_obj_stream(&mut self) -> Result<Stream<T>>
Get the CompObj stream (\001CompObj
)
pub fn root_comp_obj(&mut self) -> Result<CompObj>
pub fn root_form_control(&mut self) -> Result<FormControl>
pub fn root_form(&mut self) -> Result<Form<T>>
Methods from Deref<Target = CompoundFile<T>>§
pub fn version(&self) -> Version
pub fn version(&self) -> Version
Returns the CFB format version used for this compound file.
pub fn root_entry(&self) -> Entry
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>,
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>
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>,
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>
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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>,
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()
.)