ladybird/Userland/Libraries/LibHTTP/HttpResponse.h
Andreas Kling b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00

34 lines
864 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/HashMap.h>
#include <AK/String.h>
#include <LibCore/NetworkResponse.h>
namespace HTTP {
class HttpResponse : public Core::NetworkResponse {
public:
virtual ~HttpResponse() override;
static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers)
{
return adopt_ref(*new HttpResponse(code, move(headers)));
}
int code() const { return m_code; }
const HashMap<String, String, CaseInsensitiveStringTraits>& headers() const { return m_headers; }
private:
HttpResponse(int code, HashMap<String, String, CaseInsensitiveStringTraits>&&);
int m_code { 0 };
HashMap<String, String, CaseInsensitiveStringTraits> m_headers;
};
}