1// Aseprite Network Library
2// Copyright (c) 2001-2015 David Capello
3//
4// This file is released under the terms of the MIT license.
5// Read LICENSE.txt for more information.
6
7#ifndef NET_HTTP_RESPONSE_H_INCLUDED
8#define NET_HTTP_RESPONSE_H_INCLUDED
9#pragma once
10
11#include "base/disable_copying.h"
12
13#include <cstddef>
14#include <iosfwd>
15
16namespace net {
17
18class HttpResponse
19{
20public:
21 // Creates a response. The body of the response will be written in
22 // the given "stream".
23 HttpResponse(std::ostream* stream)
24 : m_status(0)
25 , m_stream(stream)
26 { }
27
28 // Returns the HTTP status code.
29 int status() const { return m_status; }
30 void setStatus(int status) { m_status = status; }
31
32 // Writes data in the stream.
33 void write(const char* data, std::size_t length);
34
35private:
36 int m_status;
37 std::ostream* m_stream;
38
39 DISABLE_COPYING(HttpResponse);
40};
41
42} // namespace net
43
44#endif // NET_HTTP_RESPONSE_H_INCLUDED
45