Base extension

class extension_base : public service_base

Base class for uie::window.

Subclassed by uie::visualisation, uie::window

Public Functions

virtual const GUID &get_extension_guid() const = 0

Get unique ID representing this extension.

The returned GUID must be unique per registered extension.

Note

Because the return type is a reference, you must return either a static local variable or a global variable.

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

  • This method is only called before window::create_or_transfer_window() (i.e. it will not be called once your window has been created)

  • It must not be used by single instance extensions

  • You should handle the case of an empty stream

Note

Consider both forwards and backwards compatibility deciding upon a data format, when implementing this method and when implementing get_config().

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 both forwards and backwards compatibility deciding upon a data format, when implementing this method and when implementing set_config().

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)

Import previously exported instance configuration data.

The export_config() method is used when exporting the Columns UI configuration and ‘Any foobar2000 installation’ is selected as the target.

The import_config() method is used when importing a configuration previously exported with ‘Any foobar2000 installation’ selected as the target.

You only need to consider overriding both methods if your normal configuration data contains references to external resources specific to the current system.

Remark

Note

The default implementation simply calls set_config().

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

Export instance configuration data.

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

The export_config() method is used when exporting the Columns UI configuration and ‘Any foobar2000 installation’ is selected as the target.

The import_config() method is used when importing a configuration previously exported with ‘Any foobar2000 installation’ selected as the target.

You only need to consider overriding both methods if your normal configuration data contains references to external resources specific to the current system.

Remark

Note

The default implementation simply calls get_config().

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

Get whether the extension has a modal configuration window.

The window is exposed through show_config_popup()

Returns:

true if the extension has a configuration window that can be shown using show_config_popup

inline virtual bool show_config_popup(HWND wnd_parent)

Display a modal configuration 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. Write 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. Write 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. Export 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