Class TStorage (unit CompDoc)

Inherits from

TObject

encapsulates the compound document storage object

Constructors


constructor Create(Name : string; ParentStorage : TStorage; AccessMode : TAccessMode; TransactMode : TTransactMode; CreateNew : boolean);

Creates (CreateNew = true) or opens (CreateNew = false) } { a storage within another storage.


Functions

procedure Commit;

If the storage was opened in transacted mode Commit } { publishes changes at its own level to the next } { higher level.

procedure CopyElement(const srcname, dstname : string; Dst : TStorage);

Copies an element of the storage (i.

procedure CopyTo(Dst : TStorage);

Copies all the contents of the storage to another } { storage.

procedure DeleteElement(const Name : string);

Removes a substorage or stream from the storage.

destructor Destroy;

Closes the storage.

procedure ListStorages(StorageList : TStrings);

Fills StorageList with the names of all the storage's ] { substorages.

procedure ListStreams(StreamList : TStrings);

Fills StreamList with the names of all the storage's ] { streams.

procedure MoveElement(const srcname, dstname : string; Dst : TStorage);

Like CopyElement followed by delete.

procedure RenameElement(const OldName, NewName : string);

Renames one of the storage's substorages or streams.

procedure Revert;

In transacted mode undoes any changes made since the } { Commit.

procedure CheckError(msg : string);

checks hr and raises exception with msg (msg ignored in D1)

procedure CopyMoveElement(const srcname, dstname : string; Dst : TStorage; flag : longint);


function GetCLSID : TCLSID;


function GetName : string;


function GetTimes : TStorageTimes;


procedure SetCLSID(Value : TCLSID);


Properties

property ClassID : TCLSID

The CLSID associated with this storage.

property LastError : HResult

The last error code.

property Name : string

The Name of the storage.

property ParentStorage : TStorage

The storage whgich contains this storage.

property Times : TStorageTimes

The date/times of the storage's creation, last access, } { and last modification.

Events

Variables

FName : string;


FParent : TStorage;


FThis : IStorage;


hr : HResult;



Constructors


constructor Create(Name : string; ParentStorage : TStorage; AccessMode : TAccessMode; TransactMode : TTransactMode; CreateNew : boolean);

Creates (CreateNew = true) or opens (CreateNew = false) } { a storage within another storage. Fails if } { ParentStorage is nil. } { If creating a new storage, Name is null (''), a self- } { deleting temporary storage is created. } { If a storage is in transacted mode any methods that } { make changes to the storage only take effect when } { Commit is called. } { Note that all storages other than root storages can } { only be opened for exclusive access.


Functions


procedure Commit;

If the storage was opened in transacted mode Commit } { publishes changes at its own level to the next } { higher level. If the storage is a root storage the } { changes are committed to the underlying file system .


procedure CopyElement(const srcname, dstname : string; Dst : TStorage);

Copies an element of the storage (i.e., a substorage } { or stream) to another storage, optionally changing } { the element name.


procedure CopyTo(Dst : TStorage);

Copies all the contents of the storage to another } { storage. If the destination storage is not empty } { the new elements will be added to it, possibly } { overwriting elements of the same name.


procedure DeleteElement(const Name : string);

Removes a substorage or stream from the storage.


destructor Destroy;

Closes the storage. If the storage is temporary it is } { also deleted. If in transacted mode any uncommitted } { changes are lost.


procedure ListStorages(StorageList : TStrings);

Fills StorageList with the names of all the storage's ] { substorages.


procedure ListStreams(StreamList : TStrings);

Fills StreamList with the names of all the storage's ] { streams.


procedure MoveElement(const srcname, dstname : string; Dst : TStorage);

Like CopyElement followed by delete.


procedure RenameElement(const OldName, NewName : string);

Renames one of the storage's substorages or streams.


procedure Revert;

In transacted mode undoes any changes made since the } { Commit.


procedure CheckError(msg : string);

checks hr and raises exception with msg (msg ignored in D1)


procedure CopyMoveElement(const srcname, dstname : string; Dst : TStorage; flag : longint);


function GetCLSID : TCLSID;


function GetName : string;


function GetTimes : TStorageTimes;


procedure SetCLSID(Value : TCLSID);


Properties


property ClassID : TCLSID

The CLSID associated with this storage.


property LastError : HResult

The last error code. Read-only.


property Name : string

The Name of the storage. If the storage was created as } { temporary the actual name will be retrieved. Read-only.


property ParentStorage : TStorage

The storage whgich contains this storage. Read-only.


property Times : TStorageTimes

The date/times of the storage's creation, last access, } { and last modification. Read-only.


Events


Variables


FName : string;


FParent : TStorage;


FThis : IStorage;


hr : HResult;