foobar2000 SDK  2015-01-14
Functions
core_api Namespace Reference

Functions

bool are_services_available ()
 
bool assert_main_thread ()
 
void ensure_main_thread ()
 
HWND get_main_window ()
 
const char * get_my_file_name ()
 
const char * get_my_full_path ()
 
HINSTANCE get_my_instance ()
 
const char * get_profile_path ()
 
bool is_initializing ()
 
bool is_main_thread ()
 
bool is_portable_mode_enabled ()
 
bool is_quiet_mode_enabled ()
 
bool is_shutting_down ()
 
pfc::string8 pathInProfile (const char *fileName)
 

Function Documentation

bool core_api::are_services_available ( )

Tests whether services are available at this time. They are not available only during DLL startup or shutdown (e.g. inside static object constructors or destructors).

Definition at line 35 of file component_client.cpp.

36  {
37  return g_services_available;
38  }
static bool g_services_available
bool core_api::assert_main_thread ( )

Tests whether calling thread is main app thread, and shows diagnostic message in debugger output if it's not.

Definition at line 39 of file component_client.cpp.

40  {
41  return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->assert_main_thread() : true;
42  }
static bool g_services_available
g_foobar2000_api
void core_api::ensure_main_thread ( )

Triggers a bug check if the calling thread is not the main app thread.

Definition at line 44 of file component_client.cpp.

44  {
45  if (!is_main_thread()) uBugCheck();
46  }
bool is_main_thread()
Returns true if calling thread is main app thread, false otherwise.
PFC_NORETURN void SHARED_EXPORT uBugCheck()
HWND core_api::get_main_window ( )

Retrieves main app window. WARNING: this is provided for parent of dialog windows and such only; using it for anything else (such as hooking windowproc to alter app behaviors) is absolutely illegal.

Definition at line 20 of file component_client.cpp.

21  {
22  PFC_ASSERT( g_foobar2000_api != NULL );
23  return g_foobar2000_api->get_main_window();
24  }
g_foobar2000_api
const char * core_api::get_my_file_name ( )

Retrieves filename of calling dll, excluding extension, e.g. "foo_asdf".

Definition at line 25 of file component_client.cpp.

26  {
27  return g_name;
28  }
static pfc::string_simple g_name
const char * core_api::get_my_full_path ( )

Retrieves full path of calling dll, e.g. file://c:.dll.

Definition at line 30 of file component_client.cpp.

31  {
32  return g_full_path;
33  }
static pfc::string_simple g_full_path
HINSTANCE core_api::get_my_instance ( )

Retrieves HINSTANCE of calling DLL.

Definition at line 15 of file component_client.cpp.

16  {
17  return g_hIns;
18  }
static HINSTANCE g_hIns
const char * core_api::get_profile_path ( )

Returns filesystem path to directory with user settings, e.g. file://c:.

Definition at line 52 of file component_client.cpp.

53  {
54  PFC_ASSERT( g_foobar2000_api != NULL );
55  return g_foobar2000_api->get_profile_path();
56  }
g_foobar2000_api
bool core_api::is_initializing ( )

Returns whether the app is currently initializing.

Definition at line 62 of file component_client.cpp.

63  {
64  return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_initializing() : !g_initialized;
65  }
static bool g_services_available
g_foobar2000_api
static bool g_initialized
bool core_api::is_main_thread ( )

Returns true if calling thread is main app thread, false otherwise.

Definition at line 48 of file component_client.cpp.

49  {
50  return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_main_thread() : true;
51  }
static bool g_services_available
g_foobar2000_api
bool core_api::is_portable_mode_enabled ( )

Returns whether foobar2000 has been installed in "portable" mode.

Definition at line 66 of file component_client.cpp.

66  {
67  PFC_ASSERT( g_foobar2000_api != NULL );
68  return g_foobar2000_api->is_portable_mode_enabled();
69  }
g_foobar2000_api
bool core_api::is_quiet_mode_enabled ( )

Returns whether foobar2000 is currently running in quiet mode.
Quiet mode bypasses all GUI features, disables Media Library and does not save any changes to app configuration.
Your component should not display any forms of user interface when running in quiet mode, as well as avoid saving configuration on its own (no need to worry if you only rely on cfg_vars or config_io_callback, they will simply be ignored on shutdown).

Definition at line 71 of file component_client.cpp.

71  {
72  PFC_ASSERT( g_foobar2000_api != NULL );
73  return g_foobar2000_api->is_quiet_mode_enabled();
74  }
g_foobar2000_api
bool core_api::is_shutting_down ( )

Returns whether the app is currently shutting down.

Definition at line 58 of file component_client.cpp.

59  {
60  return (g_services_available && g_foobar2000_api) ? g_foobar2000_api->is_shutting_down() : g_initialized;
61  }
static bool g_services_available
g_foobar2000_api
static bool g_initialized
pfc::string8 core_api::pathInProfile ( const char *  fileName)
inline

Returns a path to <file name>=""> in fb2k profile folder.

Definition at line 30 of file core_api.h.

30 { pfc::string8 p( core_api::get_profile_path() ); p.add_filename( fileName ); return std::move(p); }
const char * get_profile_path()
Returns filesystem path to directory with user settings, e.g. file://c:.