forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebserver.h
More file actions
58 lines (45 loc) · 1.22 KB
/
webserver.h
File metadata and controls
58 lines (45 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Aseprite
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef WEBSERVER_WEBSERVER_H_INCLUDED
#define WEBSERVER_WEBSERVER_H_INCLUDED
#pragma once
#include "base/disable_copying.h"
#include <string>
#include <iosfwd>
namespace webserver {
class IRequest {
public:
virtual ~IRequest() { }
virtual const char* getRequestMethod() = 0;
virtual const char* getUri() = 0;
virtual const char* getHttpVersion() = 0;
virtual const char* getQueryString() = 0;
};
class IResponse {
public:
virtual ~IResponse() { }
virtual void setStatusCode(int code) = 0;
virtual void setContentType(const char* contentType) = 0;
virtual std::ostream& getStream() = 0;
virtual void sendFile(const char* path) = 0;
};
class IDelegate {
public:
virtual ~IDelegate() { }
virtual void onProcessRequest(IRequest* request, IResponse* response) = 0;
};
class WebServer {
public:
class WebServerImpl;
WebServer(IDelegate* delegate);
~WebServer();
std::string getName() const;
private:
WebServerImpl* m_impl;
DISABLE_COPYING(WebServer);
};
} // namespace webserver
#endif