foobar2000 SDK
2015-01-14
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
foobar2000
SDK
completion_notify.cpp
Go to the documentation of this file.
1
#include "
foobar2000.h
"
2
3
namespace
{
4
class
main_thread_callback_myimpl :
public
main_thread_callback
{
5
public
:
6
void
callback_run
() {
7
m_notify->on_completion(m_code);
8
}
9
10
main_thread_callback_myimpl(
completion_notify_ptr
p_notify,
unsigned
p_code) : m_notify(p_notify), m_code(p_code) {}
11
private
:
12
completion_notify_ptr
m_notify;
13
unsigned
m_code;
14
};
15
}
16
17
void
completion_notify::g_signal_completion_async
(
completion_notify_ptr
p_notify,
unsigned
p_code) {
18
if
(p_notify.
is_valid
()) {
19
static_api_ptr_t<main_thread_callback_manager>
()->add_callback(
new
service_impl_t<main_thread_callback_myimpl>
(p_notify,p_code));
20
}
21
}
22
23
void
completion_notify::on_completion_async
(
unsigned
p_code) {
24
static_api_ptr_t<main_thread_callback_manager>
()->add_callback(
new
service_impl_t<main_thread_callback_myimpl>
(
this
,p_code));
25
}
service_impl_t
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
Definition:
service_impl.h:4
completion_notify::g_signal_completion_async
static void g_signal_completion_async(service_ptr_t< completion_notify > p_notify, unsigned p_code)
Helper. Checks for null ptr and calls on_completion_async when the ptr is not null.
Definition:
completion_notify.cpp:17
service_ptr_t::is_valid
bool is_valid() const
Definition:
service.h:119
completion_notify::on_completion_async
void on_completion_async(unsigned p_code)
Helper. Queues a notification, using main_thread_callback.
Definition:
completion_notify.cpp:23
foobar2000.h
service_ptr_t< completion_notify >
main_thread_callback::callback_run
virtual void callback_run()=0
Gets called from main app thread. See main_thread_callback_manager description for more info...
static_api_ptr_t
Helper template used to easily access core services. Usage: static_api_ptr_t
api; api->doso...
Definition:
service.h:533
main_thread_callback
Callback object class for main_thread_callback_manager service.
Definition:
main_thread_callback.h:2
Generated by
1.8.9.1