# HIOManager

## Functions

| `HIOManager`
| `~HIOManager`
HInputHandler * | `RegisterInputHandler`
HOutputHandler * | `RegisterOutputHandler`
HIOConnector * | `RegisterConnector`
HInputHandler * | `GetInputHandler`
HInputHandler * | `GetInputHandler`
HOutputHandler * | `GetOutputHandler`
HOutputHandler * | `GetOutputHandler`
void | `RegisterHandlers`
const char * | `GetInputHandlerTypes`
const char * | `GetOutputHandlerTypes`
HIOConnector * | `CreateConnector`
void | `FreeConnector`
void | `CleanCallbacks`
HIOManager * | `GetCurrentHIOManager`
void | `GetFileOutputResultString`

## Detailed Description

class HIOManager

  HIOManger manages subclassed instances of HInputHandler and HOutputHandler. It maps handlers to operations based on registered associations and/or requested file extensions. It is created on demand by HDB.

  Public Functions

  HIOManager()
  virtual ~HIOManager()
  virtual HInputHandler *RegisterInputHandler(const char *file_type, HInputHandler *handler)

    This method associates a specified file type with an input handler. If another input handler already exists for the file type, this method replaces it with the given handler.

    Parameters

      - file_type – The file extension this to associate with the given handler.

      - handler – The handler for specified extension file_type. This may be 0 to clear extension handler.

    Returns

      A pointer to old handler for the file extension.

  virtual HOutputHandler *RegisterOutputHandler(const char *file_type, HOutputHandler *handler)

    This method associates a specified file type with an output handler. If another output handler already exists for the file type, this method replaces it with the given handler.

    Parameters

      - file_type – The file extension this to associate with the given handler.

      - handler – The handler for specified extension file_type. This may be 0 to clear extension handler.

    Returns

      A pointer to old handler for the file extension.

  virtual HIOConnector *RegisterConnector(const char *file_type, HIO_CREATE_FREE_FUNCTION Create, HIO_FREE_CONNECTOR_FUNCTION Free)

    This method associates a specified file type with an HIOConnector. If another another connector already exists for the file type, this method replaces it with the given connector.

    Parameters

      - file_type – The file extension this connector is for.

      - Create – A pointer to the desired Create method.

      - Free – A pointer to the desired Free method

    Returns

      A pointer to old connector for the file extension.

  virtual HInputHandler *GetInputHandler(const char *file_type)

    ### Special Cases

    Because DWG files can be imported via both HIO_DWG and HIO_Exchange, two special cases exist for the file_type parameter to tell Visualize which module to use for the import:

    Parameters

      file_type – The extension to lookup handler for example: “jpg”. See information on special cases below.

    Returns

      The HInputHandler registered for specified file type or 0 if none is registered.

  HInputHandler *GetInputHandler(const __wchar_t *file_type)
  virtual HOutputHandler *GetOutputHandler(const char *file_type)
    Parameters

      file_type – The extension to lookup handler for example: “jpg”

    Returns

      The HOutputHandler registered for specified file type or 0 if none is registered.

  virtual HOutputHandler *GetOutputHandler(const __wchar_t *file_type)
  virtual void RegisterHandlers()

    This method registers default file handlers. This called by HDB when it creates a HIOManager. To avoid the default handlers being set, pass your own HIOManager by calling HDB::SetHIOManager().

  virtual const char *GetInputHandlerTypes()
    Returns

      The list of all extensions registered with input handlers. You can part this string to create a file type list for input file dialogs. The string’s format looks like “jpg;gif;tiff”.

  virtual const char *GetOutputHandlerTypes()
    Returns

      The list of all extensions registered with output handlers. You can parse this string to create a file type list for output file dialogs. The string’s format looks like “jpg;gif;tiff”.

  virtual HIOConnector *CreateConnector(const char *file_type)

    This method creates a new connector for the given type and returns a pointer to it.

    Parameters

      file_type – The extension to lookup handler for example: “jpg”.

    Returns

      An HIOConnector registered for specified file type or 0 if none.

  virtual void FreeConnector(HIOConnector *old_connector)

    This method frees a connector for the file type associated with it.

    Parameters

      old_connector – A pointer to the HIOConnector object you wan to free from a given type.

  void CleanCallbacks()

    This method requests that any callbacks registered on handlers be cleaned (when the manager would othewise be deleted)

  Public Static Functions

  static HIOManager *GetCurrentHIOManager()

    This method gets the current HIOManager. It will create on if none exists.

    Returns

      The current manager from HDB.

  static void GetFileOutputResultString(HFileIOResult result, char *result_str)

    This method gets a string representation of the HFileOutputResults.

    Parameters

      - result – The HFileOutputResult that you want to get a string representation of.

      - result_str – Returns the string representation of the result.