etag support will be added later. github supports it and themezer probably does as well. appstore does not sadly...
48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
// simple thread-safe list of events.
|
|
#pragma once
|
|
|
|
#include <optional>
|
|
#include <variant>
|
|
#include <list>
|
|
#include <string>
|
|
#include <switch.h>
|
|
#include <nxlink.h>
|
|
#include <haze.h>
|
|
#include "download.hpp"
|
|
|
|
namespace sphaira::evman {
|
|
|
|
struct LaunchNroEventData {
|
|
std::string path;
|
|
std::string argv;
|
|
};
|
|
|
|
struct ExitEventData {
|
|
bool dummy;
|
|
};
|
|
|
|
using EventData = std::variant<
|
|
LaunchNroEventData,
|
|
ExitEventData,
|
|
HazeCallbackData,
|
|
NxlinkCallbackData,
|
|
curl::DownloadEventData
|
|
>;
|
|
|
|
// returns number of events
|
|
auto count() -> std::size_t;
|
|
|
|
// thread-safe
|
|
auto push(const EventData& e, bool remove_matching = true) -> bool;
|
|
auto push(EventData&& e, bool remove_matching = true) -> bool;
|
|
|
|
// events are returned FIFO style, so if you push event a,b,c
|
|
// then pop() will return a then b then c.
|
|
auto pop() -> std::optional<EventData>;
|
|
|
|
// this pops all events, this is ideal to stop the main thread from
|
|
// hanging if loads of events are pushed and popped at the same time.
|
|
auto popall() -> std::list<EventData>;
|
|
|
|
} // namespace sphaira::evman
|