#ifndef LLMR_COMMON_CURL_REQUEST #define LLMR_COMMON_CURL_REQUEST #include #include #include // Forward definition. typedef void CURL; typedef struct uv_work_s uv_work_t; typedef struct uv_check_s uv_check_t; namespace llmr { namespace platform { struct Response; class Request : public std::enable_shared_from_this, private util::noncopyable { public: Request(const std::string &url, std::function background_function, std::function foreground_callback); ~Request(); public: static void work_cb(uv_work_t *work); static void after_work_cb(uv_work_t *work, int status); public: const std::string url; const std::function background_function; const std::function foreground_callback; std::unique_ptr res; CURL *curl = nullptr; bool cancelled = false; uv_check_t *check = nullptr; }; } } #endif