/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/common/notifications/BackgroundActivator/handler_functions.cpp
27 строк
705 B
Andrey Nekrasov
common: refactor common library pt2 (#8588)
15 дек 2020, 15:16
Не верифицирован
15 дек 2020, 15:16
212ea2d
Код
Авторство
О чём код?
#include "pch.h" #include "handler_functions.h" #include <winrt/Windows.System.h> using handler_function_t = void (*)(const size_t button_id); namespace { const std::unordered_map<std::wstring_view, handler_function_t> handlers_map; } void dispatch_to_background_handler(std::wstring_view argument) { winrt::Windows::Foundation::WwwFormUrlDecoder decoder{ argument }; const size_t button_id = std::stoi(decoder.GetFirstValueByName(L"button_id").c_str()); auto handler = decoder.GetFirstValueByName(L"handler"); const auto found_handler = handlers_map.find(handler); if (found_handler == end(handlers_map)) { return; } found_handler->second(button_id); }