Base extension

class extension_base : public service_base

Base class for uie::window and uie::visualisation classes.

Subclassed by uie::visualisation, uie::window

Public Functions

virtual const GUID &get_extension_guid() const = 0

Get unique ID of extension.

This GUID is used to identify a specific extension.

Returns:

extension GUID

virtual void get_name(pfc::string_base &out) const = 0

Get a user-readable name of the extension.

Warning

Do not use the name to identify extensions; use extension GUIDs instead.

Parameters:

out[out] receives the name of the extension, e.g. “Spectrum analyser”

inline virtual void set_config(stream_reader *p_reader, t_size p_size, abort_callback &p_abort)

Set instance configuration data.

Remark

  • Only called before enabling/window creation.

  • Must not be used by single instance extensions.

  • You should also make sure you deal with the case of an empty stream

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_reader[in] Pointer to configuration data stream

  • p_size[in] Size of data in stream

  • p_abort[in] Signals abort of operation

inline virtual void get_config(stream_writer *p_writer, abort_callback &p_abort) const

Get instance configuration data.

Remark

Must not be used by single instance extensions.

Note

Consider compatibility with future versions of you own component when deciding upon a data format. You may wish to change what is written by this function in the future. If you prepare for this in advance, you won’t have to take measures such as changing your extension GUID to avoid incompatibility.

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_writer[out] Pointer to stream receiving configuration data

  • p_abort[in] Signals abort of operation

inline virtual void import_config(stream_reader *p_reader, t_size p_size, abort_callback &p_abort)

Set instance configuration data. This differs from set_config in that the data will be of that returned by export_config.

Remark

  • Only called before enabling/window creation.

Note

The default implementation calls set_config for compatibility only. Be sure that you override if you need to.

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_reader[in] Pointer to configuration data stream

  • p_size[in] Size of data in stream

  • p_abort[in] Signals abort of operation

inline virtual void export_config(stream_writer *p_writer, abort_callback &p_abort) const

Get instance configuration data. This differs from get_config, in that what is written is intended to be transferable between different foobar2000 installations on different computers (i.e. self-contained).

Note

The default implementation calls get_config for compatibility only. Be sure that you override if you need to.

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_writer[out] Pointer to stream receiving configuration data

  • p_abort[in] Signals abort of operation

inline virtual bool have_config_popup() const

Gets whether the extension has a modal configuration window.

The window is exposed through show_config_popup()

Returns:

true iff a configuration window is exposed through show_config_popup

inline virtual bool show_config_popup(HWND wnd_parent)

Displays a modal configuartion dialog.

Parameters:

wnd_parent[in] The window to use as the owner window for your configuration dialog

Returns:

false if the configuration did not change

inline virtual void get_menu_items(menu_hook_t &p_hook)

Retrieve menu items to be displayed in the host menu.

Parameters:

p_hook[in] The interface you use to add your menu items

void set_config_from_ptr(const void *p_data, t_size p_size, abort_callback &p_abort)

Helper function, set instance configuration data from raw pointer.

See also

set_config

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_data[in] Pointer to configuration data

  • p_size[in] Size of data

  • p_abort[in] Signals abort of operation

void import_config_from_ptr(const void *p_data, t_size p_size, abort_callback &p_abort)

Helper function. Import instance configuration data from a raw pointer.

See also

import_config.

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_data[in] Pointer to configuration data

  • p_size[in] Size of data in stream

  • p_abort[in] Signals abort of operation

void get_config_to_array(pfc::array_t<uint8_t> &p_data, abort_callback &p_abort, bool b_reset = false) const

Helper function, writes instance configuration data to an existing array.

See also

get_config

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_data[out] Array receiving configuration data

  • p_abort[in] Signals abort of operation

  • b_reset[in] Indicates whether the contents of the array should first be cleared

pfc::array_t<uint8_t> get_config_as_array(abort_callback &p_abort) const

Helper function, writes instance configuration data to a new array.

See also

get_config

Throws:

Throws – pfc::exception on failure

Parameters:

p_abort[in] Signals abort of operation

void export_config_to_array(pfc::array_t<uint8_t> &p_data, abort_callback &p_abort, bool b_reset = false) const

Helper function, exports instance configuration data to an array.

See also

export_config

Throws:

Throws – pfc::exception on failure

Parameters:
  • p_data[out] Array receiving exported configuration data

  • p_abort[in] Signals abort of operation

  • b_reset[in] Indicates whether the contents of the array should first be cleared