mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 09:28:13 +00:00
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
This commit is contained in:
parent
63814ffebf
commit
04b9dc2d30
328 changed files with 36 additions and 36 deletions
39
Libraries/LibCore/CNetworkJob.h
Normal file
39
Libraries/LibCore/CNetworkJob.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <LibCore/CObject.h>
|
||||
|
||||
class CNetworkResponse;
|
||||
|
||||
class CNetworkJob : public CObject {
|
||||
public:
|
||||
enum class Error {
|
||||
None,
|
||||
ConnectionFailed,
|
||||
TransmissionFailed,
|
||||
ProtocolFailed,
|
||||
};
|
||||
virtual ~CNetworkJob() override;
|
||||
|
||||
Function<void(bool success)> on_finish;
|
||||
|
||||
bool has_error() const { return m_error != Error::None; }
|
||||
Error error() const { return m_error; }
|
||||
CNetworkResponse* response() { return m_response.ptr(); }
|
||||
const CNetworkResponse* response() const { return m_response.ptr(); }
|
||||
|
||||
virtual void start() = 0;
|
||||
|
||||
virtual const char* class_name() const override { return "CNetworkJob"; }
|
||||
|
||||
protected:
|
||||
CNetworkJob();
|
||||
void did_finish(NonnullRefPtr<CNetworkResponse>&&);
|
||||
void did_fail(Error);
|
||||
|
||||
private:
|
||||
RefPtr<CNetworkResponse> m_response;
|
||||
Error m_error { Error::None };
|
||||
};
|
||||
|
||||
const char* to_string(CNetworkJob::Error);
|
Loading…
Add table
Add a link
Reference in a new issue