indexing description: "implementation of IStorage interface" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2006-04-25 12:20:02 -0700 (Tue, 25 Apr 2006) $" revision: "$Revision: 58453 $" class interface ECOM_STORAGE create make_new_doc_file (filename: FILE_NAME; a_mode: INTEGER_32) -- Create new compound file with path `filename' -- and mode `a_mode' in file system. -- See class ECOM_STGM for mode values. require valid_filename: filename /= Void valid_mode: is_valid_stgm (a_mode) ensure compound_file_created: exists make_temporary_doc_file (a_mode: INTEGER_32) -- Create temporary compound file with mode mode -- See class ECOM_STGM for `a_mode' values. require valid_mode: is_valid_stgm (a_mode) ensure compound_file_created: exists make_open_file (filename: FILE_NAME; a_mode: INTEGER_32) -- Open existing root compound file with path `filename' -- and mode mode in file system. -- excluding block pointed by `exclude' (can be default_pointer) -- See class ECOM_STGM for `a_mode' values. require valid_file: filename /= Void and then is_compound_file (filename) valid_mode: is_valid_stgm (a_mode) ensure compound_file_open: exists make_from_other (other: ECOM_INTERFACE) -- Make from other Queriable. -- (from ECOM_QUERIABLE) require -- from ECOM_QUERIABLE non_void_other: other /= Void ensure -- from ECOM_QUERIABLE valid_initializer: initializer /= default_pointer exists: exists make_from_pointer (cpp_obj: POINTER) -- Make from pointer require -- from ECOM_QUERIABLE non_default_pointer: cpp_obj /= default_pointer ensure -- from ECOM_QUERIABLE valid_initializer: initializer /= default_pointer exists: exists feature -- Access access_time: WEL_FILE_TIME -- Access time class_id: POINTER -- Class identifier creation_time: WEL_FILE_TIME -- Creation time element_access_time (a_name: STRING_8): WEL_FILE_TIME -- Access time of element `a_name' require non_void_name: a_name /= Void valid_name: is_valid_name (a_name) ensure non_void_access_time: Result /= Void element_creation_time (a_name: STRING_8): WEL_FILE_TIME -- Creation time of element `a_name' require non_void_name: a_name /= Void valid_name: is_valid_name (a_name) ensure non_void_creation_time: Result /= Void element_modification_time (a_name: STRING_8): WEL_FILE_TIME -- Modification time of element `a_name' require non_void_name: a_name /= Void valid_name: is_valid_name (a_name) ensure non_void_modification_time: Result /= Void elements: ECOM_ENUM_STATSTG -- Substorages and substreams enumerator ensure Result /= Void exists: BOOLEAN -- Is wrapped structure initialized? -- (from ECOM_QUERIABLE) generating_type: STRING_8 -- Name of current object's generating type -- (type of which it is a direct instance) -- (from ANY) generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) is_same_name (a_name: STRING_8): BOOLEAN -- is `a_name' equal to name of Current storage is_valid_name (a_name: STRING_8): BOOLEAN -- is object with name `a_name' -- part of Current storage require valid_name: a_name /= Void is_valid_stat_flag (flag: INTEGER_32): BOOLEAN -- Is `flag' a valid stat flag? -- (from ECOM_STAT_FLAGS) is_valid_stgc (stgc: INTEGER_32): BOOLEAN -- Is `stgc' a valid storage commit mode flag? -- (from ECOM_STGC) is_valid_stgm (stgm: INTEGER_32): BOOLEAN -- Is `stgm' a valid storage mode flag? -- (from ECOM_STGM) is_valid_stgmove (stgmove: INTEGER_32): BOOLEAN -- Is `stgmove' a valid storage move flag? -- (from ECOM_STGMOVE) item: POINTER -- Pointer to COM object wrapper. -- (from ECOM_QUERIABLE) mode: INTEGER_32 -- Access mode modification_time: WEL_FILE_TIME -- Modufication time name: STRING_8 -- Name new_stream (a_name: STRING_8; a_mode: INTEGER_32): ECOM_STREAM -- Newly created stream with name `a_name' -- and mode `a_mode' nested within Current storage -- Opening the same stream more than once from the -- same storage is not supported. -- STGM_SHARE_EXCLUSIVE flag must be specified. require non_void_storage_name: a_name /= Void valid_storage_name: not a_name.is_empty valid_mode: is_valid_stgm (a_mode) ensure non_void_stream: Result /= Void valid_stream: Result.exists new_substorage (a_name: STRING_8; a_mode: INTEGER_32): ECOM_STORAGE -- Newly created storage with name `a_name' -- and mode `a_mode' -- nested within Current storage require non_void_storage_name: a_name /= Void valid_storage_name: not a_name.is_empty valid_mode: is_valid_stgm (a_mode) ensure non_void_storage: Result /= Void valid_storage: Result.exists retrieved_stream (a_name: STRING_8; a_mode: INTEGER_32): ECOM_STREAM -- Retrieved nested stream with name `a_name' -- and mode `a_mode' -- same storage is not supported. -- STGM_SHARE_EXCLUSIVE flag must be specified. require non_void_name: a_name /= Void valid_name: is_valid_name (a_name) valid_mode: is_valid_stgm (a_mode) ensure non_void_stream: Result /= Void valid_stream: Result.exists retrieved_substorage (a_name: STRING_8; a_mode: INTEGER_32): ECOM_STORAGE -- Retrieved storage with name `a_name' and mode `a_mode' -- nested within Current storage -- Opening the same storage object more than once from the same -- parent storage is not supported. -- STGM_SHARE_EXCLUSIVE flag must be specified. require non_void_name: a_name /= Void valid_name: is_valid_name (a_name) valid_mode: is_valid_stgm (a_mode) ensure non_void_storage: Result /= Void valid_storage: Result.exists root_storage: ECOM_ROOT_STORAGE -- IRootStorage interface statflag_default: INTEGER_32 -- Indicate that this is not used for property -- (from ECOM_STAT_FLAGS) statflag_noname: INTEGER_32 -- Indicate that this is not used for property -- (from ECOM_STAT_FLAGS) stgc_dangerouslycommitmerelytodiskcache: INTEGER_32 -- EOLE_STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE commits the changes, -- but does not save them to the disk cache. -- (from ECOM_STGC) stgc_default: INTEGER_32 -- OLE 2 default commit mode -- (from ECOM_STGC) stgc_onlyifcurrent: INTEGER_32 -- EOLE_STGC_ONLYIFCURRENT prevents multiple users of an IStorage -- from overwriting the other's changes. EOLE_STGC_ONLYIFCURRENT -- commits changes only if no one else has made changes since the -- last time this user opened the IStorage or committed. If other -- changes have been made, EOLE_STG_E_NOTCURRENT is returned. -- If the caller chooses to overwrite the changes, IStorage.Commit -- can be called with commit mode set to EOLE_STGC_DEFAULT. -- (from ECOM_STGC) stgc_overwrite: INTEGER_32 -- EOLE_STGC_OVERWRITE allows new data to overwrite the old data, -- reducing space requirements. EOLE_STGC_OVERWRITE is not recommended -- for usual operation, but it could be useful in the following -- situations: -- 1. A commit was tried and EOLE_STG_E_MEDIUMFULL was returned. -- 2. The user has somehow specified a willingness to risk -- overwriting the old data. -- 3. A low-memory save sequence is being used to end up with a -- smaller file. -- The commit operation obtains all the disk space it needs before -- attempting to store the new data, whether or not EOLE_STGC_OVERWRITE -- is specified. If space requirements prohibit the save, the old -- data will be intact, including all uncommitted changes. However, -- if the commit fails due to reasons other than lack of disk space -- and EOLE_STGC_OVERWRITE was specified, it is possible that neither -- the old nor the new version of the data will be intact. -- (from ECOM_STGC) stgm_convert: INTEGER_32 -- This flag is applicable only to the creation of IStorage objects. -- Stgm_convert allows the creation to proceed while preserving -- existing data. The old data is saved to a stream named CONTENTS -- containing the same data that was in the old IStorage or IStream -- instance. In the IStorage case, the data is flattened to a -- stream regardless of whether the existing file currently contains -- a layered storage object. -- (from ECOM_STGM) stgm_create: INTEGER_32 -- Stgm_create indicates an existing IStorage or IStream object -- should be removed before the new one replaces it. A new object -- is created when this flag is specified only if the existing -- IStorage or IStream has been successfully removed. -- (from ECOM_STGM) stgm_deleteonrelease: INTEGER_32 -- The Stgm_deleteonrelease flag indicates that the underlying -- file is to be automatically destroyed when the root IStorage -- object is released. This capability is most useful for -- creating temporary files. -- (from ECOM_STGM) stgm_direct: INTEGER_32 -- Stgm_DIrect is always specified for IStream objects. -- Stgm_transacted is not supported in the compound file -- implementation of IStream. Other implementations can choose -- to support it. -- (from ECOM_STGM) stgm_failifthere: INTEGER_32 -- Stgm_failifthere causes the create operation to fail if an -- existing object with the specified name exists. In this case, -- Stg_e_filealreadyexists is returned. Stgm_failifthere -- applies to both IStorage and IStream objects. -- (from ECOM_STGM) stgm_priority: INTEGER_32 -- The Stgm_priority flag allows an IStorage object to be opened -- so that a subsequent copy operation can be done at reduced cost. -- Stgm_priority allows an application to read certain streams -- from storage before opening the storage object in a mode that would -- require a snapshot copy to be made. Priority mode has exclusive -- access to the committed version of the IStorage object. -- While a compound file is open in priority mode, no other opening -- of the compound file can commit changes even one that was opened -- before the priority mode opening. Therefore, applications should -- keep IStorage objects open in priority mode for as short a time -- as possible. -- (from ECOM_STGM) stgm_read: INTEGER_32 -- When applied to an IStream object, Stgm_READ enables -- applications to successfully call IStream.Read. If Stgm_read -- is omitted, IStream.Read will return an error. When applied to an -- IStorage, Stgm_READ allows the enumeration of the storage -- object's elements and enables applications to open these elements -- in read mode. Parents of storage objects to be opened in read mode -- must also have been opened in read mode otherwise, an error is -- returned. -- (from ECOM_STGM) stgm_readwrite: INTEGER_32 -- Stgm_readwrite is the logical combination of the -- Stgm_read and Stgm_write. However, the defined value -- of Stgm_readwrite is not equal to -- (Stgm_read or Stgm_write). -- (from ECOM_STGM) stgm_share_deny_none: INTEGER_32 -- 0x00000040L -- Stgm_SHARE_DENY_NONE indicates that neither read access nor -- write access should be denied to subsequent openings. This is the -- default sharing mode and if no Stgm_SHARE_* flag is explicitly -- given, Stgm_SHARE_DENY_NONE is implied. -- (from ECOM_STGM) stgm_share_deny_read: INTEGER_32 -- 0x00000030L -- When successfully applied to a root IStorage, the -- Stgm_SHARE_DENY_READ flag prevents others from opening the -- object in read mode. The open call fails and returns an error if -- the object is presently open in deny-read mode. -- Stgm_SHARE_DENY_READ is most useful when opening root storage -- objects. Deny modes on inner elements are still useful if some -- component is coordinating the opening of these inner elements, as -- might happen in a Copy/Paste operation. However, inner elements -- always require Stgm_SHARE_EXCLUSIVE. Opening a parent storage -- object with Stgm_SHARE_DENY_READ applies only to that opening, -- not the network-wide set of openings of the parent. -- (from ECOM_STGM) stgm_share_deny_write: INTEGER_32 -- When successfully applied the Stgm_share_deny_write flag -- prevents subsequent openings of either a storage or a stream from -- specifying write mode. The open call fails and returns an error -- if the storage or stream is presently open in write mode. -- For information about the interaction of this flag with nested -- openings, see the earlier discussion about Stgm_share_deny_read. -- (from ECOM_STGM) stgm_share_exclusive: INTEGER_32 -- The compound files implementation requires that all inner elements -- be opened Stgm_share_exclusive. It is the logical combination -- of the Stgm_share_deny_read and Stgm_share_deny_write. -- All root storage objects, as well as child storage and stream -- objects must be opened with Stgm_share_exclusive. -- (from ECOM_STGM) stgm_transacted: INTEGER_32 -- The transaction for each open object is nested in the transaction -- for its parent storage object. Therefore, committing changes at the -- child level is dependent on committing changes in the parent and -- a commit of the root storage object (top-level parent) is necessary -- before changes to an object are actually written to disk. -- The changes percolate upward: inner objects publish changes to the -- transaction of the next object outwards. Outermost objects publish -- changes permanently into the file system. Transacted mode is not -- required on the parent storage object in order to use transacted -- mode on a contained object.The scope of changes that are buffered -- in transacted mode is very broad. A storage or stream object can -- be opened, have arbitrary changes made to it, and then have the -- changes reverted, preserving the object as it was when it was -- first opened. The creation and destruction of elements within a -- storage object are scoped by its transaction. -- (from ECOM_STGM) stgm_write: INTEGER_32 -- Stgm_write lets an object commit changes to the storage. -- Specifically, unless this flag has been given, IStorage.Commit -- and IStream.Commit will fail. An open object whose changes cannot -- be committed can save its changes by copying the storage or stream -- with IStorage.CopyTo or IStream.CopyTo. In direct mode, -- changes are committed after every change operation. Thus, write -- permissions are needed to call any function that causes a change. -- On streams, this includes IStream.Write and IStream.SetSize. -- If a parent storage is opened in direct mode without write -- permission, any attempt to open a child stream within it in direct -- mode with write permission will fail, because it causes an implicit -- commit to be made on the storage. Similarly, trying to create or -- destroy a contained element in this storage object also causes an -- implicit commit, resulting in an error. -- (from ECOM_STGM) stgmove_copy: INTEGER_32 -- Carry out the first part of the move operation but do -- not remove the original element. -- (from ECOM_STGMOVE) stgmove_move: INTEGER_32 -- Carry out the move operation, as expected. -- (from ECOM_STGMOVE) feature -- Access -- com_api: ECOM_COM is -- once -- create Result -- end guid_routines: ECOM_GUID_ROUTINES -- (from ECOM_ROUTINES) feature -- Comparison frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN -- Are `some' and `other' either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY shallow_implies_deep: standard_equal (some, other) implies Result both_or_none_void: (some = Void) implies (Result = (other = Void)) same_type: (Result and (some /= Void)) implies some.same_type (other) symmetric: Result implies deep_equal (other, some) frozen equal (some: ANY; other: like arg #1): BOOLEAN -- Are `some' and `other' either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other)) is_equal (other: like Current): BOOLEAN -- Is `other' attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other.is_equal (Current) consistent: standard_is_equal (other) implies Result frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN -- Are `some' and `other' either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other)) frozen standard_is_equal (other: like Current): BOOLEAN -- Is `other' attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of `other' (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of `other'? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Duplication copy (other: like Current) -- Update current object using fields of object attached -- to `other', so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: is_equal (other) frozen deep_copy (other: like Current) -- Effect equivalent to that of: -- copy (`other' . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: like Current -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_equal: deep_equal (Current, Result) frozen standard_copy (other: like Current) -- Copy every field of `other' onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: like Current -- New object field-by-field identical to `other'. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: like Current -- New object equal to `Current' -- twin calls copy; to change copying/twining semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result.is_equal (Current) feature -- Basic operations frozen default: like Current -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type `POINTER' -- (Avoid the need to write `p'.default for -- some `p' of type `POINTER'.) -- (from ANY) default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) feature -- Basic Operations commit (a_flags: INTEGER_32) -- Commit any changes. -- Notify parent storage. require valid_flags: is_valid_stgc (a_flags) copy_all_to (dest_storage: ECOM_STORAGE) -- Copy entire contents to `dest_storage'. require non_void_destination: dest_storage /= Void valid_destination: dest_storage.exists destroy_element (a_name: STRING_8) -- Remove element with name `a_name' from storage. require non_void_name: a_name /= Void valid_name: is_valid_name (a_name) ensure element_removed: not is_valid_name (a_name) is_compound_file (a_name: STRING_8): BOOLEAN -- Does file `a_name' contain a storage object? -- (from ECOM_STORAGE_ROUTINES) rename_element (old_name: STRING_8; new_name: STRING_8) -- Rename element `old_name' into `new_name' require non_void_old_name: old_name /= Void valid_old_name: is_valid_name (old_name) non_void_new_name: new_name /= Void valid_new_name: is_valid_name (new_name) ensure not_valid_old_name: not is_valid_name (old_name) valid_new_name: is_valid_name (new_name) revert -- Discard all changes made to storage object -- since the last commit feature -- Element Change move_element_to (a_element_name: STRING_8; dest_storage: ECOM_STORAGE; new_name: STRING_8; a_mode: INTEGER_32) -- Copy or move (depending on mode) element `a_element_name' -- of root storage to `dest_storage'. -- Create new element in `dest_storage' with `new_name'. -- See class ECOM_STGM for `a_mode' values. -- Before calling this method, the element to be moved must -- be closed, and the destination storage must be open. require non_void_element_name: a_element_name /= Void valid_element_name: is_valid_name (a_element_name) non_void_dest_storage: dest_storage /= Void valid_dest_storage: dest_storage.exists non_void_new_name: new_name /= Void valid_new_name: not new_name.is_empty valid_mode: is_valid_stgmove (a_mode) ensure element_moved: dest_storage.is_valid_name (new_name) set_access_time (an_access_time: WEL_FILE_TIME) -- Set access time with `an_access_time'. require non_void_access_time: an_access_time /= Void ensure access_time_set: access_time.is_equal (an_access_time) set_class (a_class_id: POINTER) -- Associate storage with COM component with class id `a_class-id' require valid_clsid: a_class_id /= default_pointer set_creation_time (a_creation_time: WEL_FILE_TIME) -- Set creation time with creation_time. require non_void_creation_time: a_creation_time /= Void ensure creation_time_set: creation_time.is_equal (a_creation_time) set_element_access_time (a_element_name: STRING_8; an_access_time: WEL_FILE_TIME) -- Set access time of element `a_element_name' with `an_access_time'. require non_void_element_name: a_element_name /= Void valid_element_name: is_valid_name (a_element_name) valid_access_time: an_access_time /= Void ensure element_access_time_set: element_access_time (a_element_name).is_equal (an_access_time) set_element_creation_time (a_element_name: STRING_8; a_creation_time: WEL_FILE_TIME) -- Set creation time of element `a_element_name' with `a_creation_time'. require non_void_element_name: a_element_name /= Void valid_element_name: is_valid_name (a_element_name) valid_creation_time: a_creation_time /= Void ensure element_creation_time_set: element_creation_time (a_element_name).is_equal (a_creation_time) set_element_modification_time (a_element_name: STRING_8; a_modification_time: WEL_FILE_TIME) -- Set modification time of element `a_element_name' with `a_modification_time'. require non_void_element_name: a_element_name /= Void valid_element_name: is_valid_name (a_element_name) valid_modification_time: a_modification_time /= Void ensure element_access_time_set: element_modification_time (a_element_name).is_equal (a_modification_time) set_modification_time (a_modification_time: WEL_FILE_TIME) -- Set modification time with `a_modification_time'. require non_void_modification_time: a_modification_time /= Void ensure modification_time_set: modification_time.is_equal (a_modification_time) feature -- Output io: STD_FILES -- Handle to standard file setup -- (from ANY) out: STRING_8 -- New string containing terse printable representation -- of current object -- Was declared in ANY as synonym of tagged_out. -- (from ANY) print (some: ANY) -- Write terse external representation of `some' -- on standard output. -- (from ANY) frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- Was declared in ANY as synonym of out. -- (from ANY) feature -- Platform operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) invariant -- from ECOM_QUERIABLE queriable_invariant: initializer /= default_pointer and then exists -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) indexing copyright: "Copyright (c) 1984-2006, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 356 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class ECOM_STORAGE