29 #include YFM_YSLib_Core_YApplication
35 : Shell(), qMain(), hShell()
51 const auto hShl(GetShellHandle());
53 YAssert(
bool(hShl),
"Null handle found.");
56 hShl->OnGotMessage(msg);
85 PostMessage<SM_Set>(prior, shared_ptr<Shell>());
86 PostMessage<SM_Quit>(prior, nExitCode);
YF_API Application & FetchAppInstance() ynothrow
取应用程序实例。
YF_API void PostMessage(const Message &, Messaging::Priority) ynothrow
全局默认队列消息发送函数。
YF_API void PostQuitMessage(int nExitCode, Messaging::Priority p=0xF0)
以优先级 p 发起 Shell 终止请求,返回 nExitCode。
std::function< void()> ApplicationExit
资源释放函数。
shared_ptr< Shell > hShell
当前 Shell 句柄:指示当前线程空间中运行的 Shell 。
void swap(any &x, any &y)
交换对象。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
virtual ~Application()
析构:释放 Shell 所有权和其它资源。
void OnGotMessage(const Message &) override
处理消息:分发消息。
#define YAssert(_expr, _msg)
bool Switch(shared_ptr< Shell > &) ynothrow
线程切换:若参数非空,和线程空间中当前运行的 Shell 的句柄交换。