# IRfFileIOHelper Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | SaveAllowed ([out, retval] RtBOOL *pbVal)
HRESULT | LoadNode ([in] BSTR bstrFileName,[out] IRsNode **ppNode)
HRESULT | LoadObject ([in] IRsFileHandle *pRsFileHandle,[out] IRsObject **ppObject)
HRESULT | SaveNode ([in] BSTR bstrFileName,[in] BSTR bstrAuthor,[in] BSTR bstrDescr,[in] IRdBitmap *pThumbnail,[in] IRsNode *pNode)
HRESULT | SaveObject ([in] IRsFileHandle *pRsFileHandle,[in] IRsObject *pObject)
HRESULT | LoadPreobject ([in] BSTR bszFileName,[out] IRsNode **ppNode)
HRESULT | LoadNodeFromResource ([in] HINSTANCE hInstance,[in]RtUlong dwResourceId,[out] IRsNode **ppNode)
HRESULT | SaveHistory ([in] BSTR bstrFileName,[in] BSTR bstrAuthor,[in] BSTR bstrDescr,[in] IRdBitmap *pThumbnail,[in] RtBool fClearDirty)
HRESULT | LoadHistory ([in] BSTR bstrFileName)
HRESULT | SaveSystem ([in] BSTR bstrFileName,[in] BSTR bstrAuthor,[in] BSTR bstrDescr,[in] IRdBitmap *pThumbnail,[in] RtBool fClearDirty)
HRESULT | LoadSystem ([in] BSTR bstrFileName)
HRESULT | CreateHeaderChunk ([in] IID idType,[in] BSTR bstrAuthor,[in] BSTR bstrDescr,[out, retval] IRsFileChunk **ppChunk)
HRESULT | LoadObjListFromStream ([in] IStream *pStream,[out] IRsObjectList **ppObjList)
HRESULT | SaveObjListToStream ([in] IStream *pStream,[in] IRsObjectList *pObjList)
HRESULT | LoadPreobjectShader ([in] BSTR bszFileName,[out] IRsNode **ppNode)
HRESULT | WriteSystemChunk ([in] IRsFileHandle *pRsFileHandle)
HRESULT | ReadSystemChunk ([in] IRsFileHandle *pRsFileHandle,[out, retval] IRdChunkSystem **ppChunkSystem)
HRESULT | GetDefaultProducer ([out, retval] BSTR *pbstrProducer)
HRESULT | GetDefaultAuthor ([out, retval] BSTR *pbstrAuthor)

## Detailed Description

Rosetta file IO helper. The helper provides methods for Rosetta objects and nodes serialization.
Use GetFileIOHelper method of the IRpFileIOPck to create this helper.

## Member Function Documentation

HRESULT IRfFileIOHelper::SaveAllowed | ( | [out, retval] RtBOOL * | pbVal | ) |

Asks runner for RUN_FEATURE_LIM_SAVE. The feature allows you to decide if you enable or disable serialization for your objects.

Parameters:

  | pbVal | [out, retval] Returns if save is allowed.

Returns:
  S_OK if save is allowed, S_FALSE if it isn't.

HRESULT IRfFileIOHelper::LoadNode | ( | [in] BSTR | bstrFileName,
|  | [out] IRsNode ** | ppNode |
| ) |  |  |

Load node from specified file.

Parameters:

  | bstrFileName | [in] - Path or name of the file.
  | ppNode | [out] Returns loaded node.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadObject | ( | [in] IRsFileHandle * | pRsFileHandle,
|  | [out] IRsObject ** | ppObject |
| ) |  |  |

Load object from specified file handle. The object is loaded from first RsObj chunk.

Parameters:

  | pRsFileHandle | [in] File handle.
  | ppObject | [out] Returns loaded object.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::SaveNode | ( | [in] BSTR | bstrFileName,
|  | [in] BSTR | bstrAuthor,
|  | [in] BSTR | bstrDescr,
|  | [in] IRdBitmap * | pThumbnail,
|  | [in] IRsNode * | pNode |
| ) |  |  |

Save node to specified file.

Parameters:

  | bstrFileName | [in] - desired filename.
  | bstrAuthor | [in] - author of the file.
  | bstrDescr | [in] - file description.
  | pThumbnail | [in] - thumbnail.
  | pNode | [in] - Node to save.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::SaveObject | ( | [in] IRsFileHandle * | pRsFileHandle,
|  | [in] IRsObject * | pObject |
| ) |  |  |

Save object to specified file handle as RsObj Chunk. If such chunk already exist, replace the first one.

Parameters:

  | pRsFileHandle | [in] - File handle of the file where the object will be serialized. Use CreateRsFileHandle method of the IRpFileIOPck to create the file handle.
  | pObject | [in] - Object to save.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadPreobject | ( | [in] BSTR | bszFileName,
|  | [out] IRsNode ** | ppNode |
| ) |  |  |

Load node from application pre-object directory.

Parameters:

  | bstrFileName | [in] - File name.
  | ppNode | [out] Returns loaded node.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadNodeFromResource | ( | [in] HINSTANCE | hInstance,
|  | [in] RtUlong | dwResourceId,
|  | [out] IRsNode ** | ppNode |
| ) |  |  |

Load node from a resource.

Parameters:

  | hInstance | [in] Module handle instance containing resource.
  | dwResourceId | [in] Integer resource ID.
  | ppNode | [out] Returns loaded node.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::SaveHistory | ( | [in] BSTR | bstrFileName,
|  | [in] BSTR | bstrAuthor,
|  | [in] BSTR | bstrDescr,
|  | [in] IRdBitmap * | pThumbnail,
|  | [in] RtBool | fClearDirty |
| ) |  |  |

Save history stack.

Parameters:

  | bstrFileName | [in] - desired filename.
  | bstrAuthor | [in] - author of the file.
  | bstrDescr | [in] - file description.
  | pThumbnail | [in] - thumbnail.
  | fClearDirty | [in] - set to TRUE if the dirty flag should be cleared.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadHistory | ( | [in] BSTR | bstrFileName | ) |

Load and apply history stack.

Parameters:

  | bstrFileName | [in] - desired filename.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::SaveSystem | ( | [in] BSTR | bstrFileName,
|  | [in] BSTR | bstrAuthor,
|  | [in] BSTR | bstrDescr,
|  | [in] IRdBitmap * | pThumbnail,
|  | [in] RtBool | fClearDirty |
| ) |  |  |

Save current system.

Parameters:

  | bstrFileName | [in] - desired filename.
  | bstrAuthor | [in] - author of the file.
  | bstrDescr | [in] - file description.
  | pThumbnail | [in] - thumbnail.
  | fClearDirty | [in] - set to TRUE if the dirty flag should be cleared.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadSystem | ( | [in] BSTR | bstrFileName | ) |

Load and apply system settings.

Parameters:

  | bstrFileName | [in] - desired filename.

Returns:
  Standard HRESULT processing can be applied to the result.

Remarks:
  If the load or application fail, the original system will be automatically restored.

HRESULT IRfFileIOHelper::CreateHeaderChunk | ( | [in] IID | idType,
|  | [in] BSTR | bstrAuthor,
|  | [in] BSTR | bstrDescr,
|  | [out, retval] IRsFileChunk ** | ppChunk |
| ) |  |  |

Create standard header chunk.

Parameters:

  | idType | [in] - Type GUID of the stream/file (object, scene, ctx, ...
  | bstrAuthor | [in] - Specify author.
  | bstrDescr | [in] - Specify short text description.
  | ppChunk | [out, retval] - Returns created header chunk.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadObjListFromStream | ( | [in] IStream * | pStream,
|  | [out] IRsObjectList ** | ppObjList |
| ) |  |  |

Load nodes list from a stream.

Parameters:

  | pStream | [in] Specify stream from which you want to read.
  | ppObjList | [out] Returns loaded objects list.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::SaveObjListToStream | ( | [in] IStream * | pStream,
|  | [in] IRsObjectList * | pObjList |
| ) |  |  |

Save list of nodes into stream in one node session.

Parameters:

  | pStream | [in] Specify stream to which the object list 'll be saved.
  | pObjList | [in] The list of objects that will be saved into the stream. Allowed are nodes, commands and data objects.

Returns:
  E_INVALIDARG - If the object list contains other than node and data object objects.

  other - Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::LoadPreobjectShader | ( | [in] BSTR | bszFileName,
|  | [out] IRsNode ** | ppNode |
| ) |  |  |

Load shader node from application pre-object/shaders directory.

Parameters:

  | bstrFileName | [in] - File name.
  | ppNode | [out] Returns loaded node.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::WriteSystemChunk | ( | [in] IRsFileHandle * | pRsFileHandle | ) |

Save system chunk to given file handle. The system itself will be serialized when the file will be closed.

Parameters:

  | pRsFileHandle | [in] - File handle.

Returns:
  Standard HRESULT processing can be applied to the result.

Remarks:
  If the chunk already exist, it will be replaced by the new one.

HRESULT IRfFileIOHelper::ReadSystemChunk | ( | [in] IRsFileHandle * | pRsFileHandle,
|  | [out, retval] IRdChunkSystem ** | ppChunkSystem |
| ) |  |  |

Load system chunk.

Parameters:

  | pRsFileHandle | [in] - File handle.
  | ppChunkSystem | [out, retval] - Returns interface to system chunk.

Returns:
  S_OK If the chunk was loaded properly.

  S_FALSE If the chunk was not found.

  or other standard error.

HRESULT IRfFileIOHelper::GetDefaultProducer | ( | [out, retval] BSTR * | pbstrProducer | ) |

Get default file producer name. The author is read from application registration.

Parameters:

  | pbstrProducer | [out, retval] - Returns default producer name.

Returns:
  Standard HRESULT processing can be applied to the result.

HRESULT IRfFileIOHelper::GetDefaultAuthor | ( | [out, retval] BSTR * | pbstrAuthor | ) |

Get default file author name. The author is read from application registration.

Parameters:

  | pbstrAuthor | [out, retval] - Returns default author name.

Returns:
  Standard HRESULT processing can be applied to the result.