# IRsFileIOGeneric Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | GetFileTypeIIDFromExt ([in] BSTR bstrExt,[out, retval] IID *piidType)
HRESULT | GetFileTypeExtFromIID ([in] IID iidType,[out, retval] BSTR *pbstrExt)
HRESULT | FindFileIOTypeByIID ([in] IID iidType,[out, retval] IRsFileIOType **ppRsFileIOType)
HRESULT | FindFileIOTypeByExt ([in] BSTR bstrExt,[out, retval] IRsFileIOType **ppRsFileIOType)
HRESULT | FindFileIOTypeByFile ([in] IRsFileHandle *pFileHandle,[out, retval] IRsFileIOType **ppRsFileIOType)
HRESULT | EnumFileIOTypes ([out, retval] IRsEnumFileIOTypes **ppEnum)
HRESULT | GetGenericFileTypeTarget ([out, retval] IRsObject **ppTargetObject)
HRESULT | GenericLoad ([in] BSTR bstrFileName,[in] IRsObject *pTarget,[in] DWORD dwFlags,[in] IRsFileIOAsyncNotify *pNotify,[out, retval] IRsObject **ppObject)
HRESULT | GenericSave ([in] BSTR bstrFileName,[in] IRsObject *pTarget,[in] BSTR bstrDescr,[in] IRdBitmap *pThumbnail,[in] DWORD dwFlags,[in] IRsFileIOAsyncNotify *pNotify)

## Detailed Description

Allows generic manipulation with file types such as serialization/deserialization actions and enumeration all registered file types.

## Member Function Documentation

HRESULT IRsFileIOGeneric::GetFileTypeIIDFromExt | ( | [in] BSTR | bstrExt,
|  | [out, retval] IID * | piidType |
| ) |  |  |

Method returns IID for the file type.

Parameters:

  | bstrExt | [in] Specify file type extension.
  | piid | [out, retval] If the string is found, returns IID of the file type. This parameter is optional.

Returns:
  S_OK - if found.
  E_INVALIDARG - if not found.

HRESULT IRsFileIOGeneric::GetFileTypeExtFromIID | ( | [in] IID | iidType,
|  | [out, retval] BSTR * | pbstrExt |
| ) |  |  |

Method returns appropriated file extension.

Parameters:

  | iidType | [in] file type IID.
  | pbstrExt | [out, retval] If the file type IID is found, returns file extension. This parameter is optional so you can use this method just to check whether the type is registered.

Returns:
  S_OK - if found.
  S_FALSE - if not found.

HRESULT IRsFileIOGeneric::FindFileIOTypeByIID | ( | [in] IID | iidType,
|  | [out, retval] IRsFileIOType ** | ppRsFileIOType |
| ) |  |  |

Method enumerate all registered file types and if found, returns IID for the file type.

Parameters:

  | iidType | [in] file type IID.
  | ppRsFileIOType | [out, retval] Returns file type if found.

Returns:
  S_OK - if found.
  E_INVALIDARG - if not found.

HRESULT IRsFileIOGeneric::FindFileIOTypeByExt | ( | [in] BSTR | bstrExt,
|  | [out, retval] IRsFileIOType ** | ppRsFileIOType |
| ) |  |  |

Find registered file type by file extension.

Parameters:

  | bstrExt | [in] Specify file type extension.
  | ppRsFileIOType | [out, retval] Returns file type if found.

Returns:
  S_OK - if found.
  S_FALSE - if not found.

HRESULT IRsFileIOGeneric::FindFileIOTypeByFile | ( | [in] IRsFileHandle * | pFileHandle,
|  | [out, retval] IRsFileIOType ** | ppRsFileIOType |
| ) |  |  |

Find registered file type by file analyze.

Parameters:

  | pFileHandle | [in] Specify file for that you want get the file type. Be sure the file handle is opened for read.
  | ppRsFileIOType | [out, retval] Returns file type if found.

Returns:
  S_OK - if found.
  S_FALSE - if not found. In this case the Rosetta Object file type is returned.

HRESULT IRsFileIOGeneric::EnumFileIOTypes | ( | [out, retval] IRsEnumFileIOTypes ** | ppEnum | ) |

Enumerate all registered file IO types.

Parameters:

  | ppEnum | [out, retval] Returns all registered file IO types.

Returns:
  S_OK - If successfully enumerated.

  S_FALSE - If none of the file types are registered.

  other standard error.

HRESULT IRsFileIOGeneric::GetGenericFileTypeTarget | ( | [out, retval] IRsObject ** | ppTargetObject | ) |

Get target object for generic FileIO operations.

Parameters:

  | ppTargetObject | [out, retval] - Returns the target object.

HRESULT IRsFileIOGeneric::GenericLoad | ( | [in] BSTR | bstrFileName,
|  | [in] IRsObject * | pTarget,
|  | [in] DWORD | dwFlags,
|  | [in] IRsFileIOAsyncNotify * | pNotify,
|  | [out, retval] IRsObject ** | ppObject |
| ) |  |  |

Load and apply given object.

Parameters:

  | bstrFileName | [in] File name of the object that should be loaded.
  | pTarget | [in] If target is: NULL - Just load the object. IRsObjectList - Apply the object to all selected Nodes. If it is not possible, do not load the object. an other object - Apply the loaded object to the target. If it is not possible, don't load the object.
  | dwFlags | [in] - Load flags (type of IRsPackageFileIOReg::RePckFileIOGenLoadFlags) FIO_GEN_LOAD_SYNC (0x00000001) - Allow synchronous load. FIO_GEN_LOAD_ASYNC (0x00000002) - Allow asynchronous load. FIO_GEN_LOAD_PREFER_ASYNC_LOAD (0x00000004) - If set, then asynchronous load will be preferred. This flag has sense only with FIO_GEN_LOAD_ASYNC and FIO_GEN_LOAD_SYNC flags. FIO_GEN_LOAD_FORCE_APPLY (0x00000008) - If set, the object will be applied rather than only loaded.
  | pNotify | [in] - Put here an IRsFileIOAsyncNotify object that will be called when the operation finish.
  | ppObject | [out, retval] - Returns loaded object (if synchronously load was executed).

Returns:
  S_OK - if the object was deserialized successfully.

  S_FALSE - if the object was deserialized successfully, but not applied. In such case you are responsible to call object's destroy method.

  ERROR_IO_PENDING - if the file is loading asynchronously. In this case if you specify pNotify, you will be notified when the operation finish.

  E_INVALIDARG - if the object cannot be deserialized in desired format. In this case check the ppObject as the object could be loaded but not applied. If you don't need the object, release it properly (e.g. IRsNode->Destroy())

  other standard error.

HRESULT IRsFileIOGeneric::GenericSave | ( | [in] BSTR | bstrFileName,
|  | [in] IRsObject * | pTarget,
|  | [in] BSTR | bstrDescr,
|  | [in] IRdBitmap * | pThumbnail,
|  | [in] DWORD | dwFlags,
|  | [in] IRsFileIOAsyncNotify * | pNotify |
| ) |  |  |

Save specified object into specified file.

Parameters:

  | bstrFileName | [in] Object File name. It have to have valid file extension as it is used as for file type detection. Valid mean, the extension is registered in Rs system.
  | pTarget | [in] If target is is not specified, a generic will be used.
  | bstrDescr | [in] Optional, specify object description if you want to.
  | pThumbnail | [in] Specify object file thumbnail. If not specified, the file type is asked.
  | dwFlags | [in] - Save flags (type of IRsPackageFileIOReg::RePckFileIOGenSaveFlags) FIO_GEN_SAVE_SYNC (0x00000001) - Allow synchronous save. FIO_GEN_SAVE_ASYNC (0x00000002) - Allow asynchronous save. FIO_GEN_SAVE_PREFER_ASYNC_LOAD (0x00000004) - If set, then asynchronous save will be preferred. This flag has sense only with FIO_GEN_SAVE_ASYNC and FIO_GEN_SAVE_SYNC flags.
  | pNotify | [in] - Put here an IRsFileIOAsyncNotify object that will be called when the operation finish.

Returns:
  S_OK - if the object was serialized successfully.

  ERROR_IO_PENDING - if the file is save asynchronously. In this case if you specify pNotify, you will be notified when the operation finish.

  E_INVALIDARG - if the object cannot be serialized in desired format.

  other standard error.