comparison Core/HttpServer/HttpOutput.h @ 1519:8bd0d897763f

refactoring: IHttpStreamAnswer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2015 13:15:16 +0200
parents 4f8c8ef114db
children 3606278d305e
comparison
equal deleted inserted replaced
1518:eb46cc06389a 1519:8bd0d897763f
35 #include <list> 35 #include <list>
36 #include <string> 36 #include <string>
37 #include <stdint.h> 37 #include <stdint.h>
38 #include "../Enumerations.h" 38 #include "../Enumerations.h"
39 #include "IHttpOutputStream.h" 39 #include "IHttpOutputStream.h"
40 #include "IHttpStreamAnswer.h"
40 #include "../Uuid.h" 41 #include "../Uuid.h"
41 42
42 namespace Orthanc 43 namespace Orthanc
43 { 44 {
44 class HttpOutput : public boost::noncopyable 45 class HttpOutput : public boost::noncopyable
100 101
101 void SendMultipartItem(const void* item, size_t length); 102 void SendMultipartItem(const void* item, size_t length);
102 103
103 void CloseMultipart(); 104 void CloseMultipart();
104 105
106 void CloseBody();
107
105 State GetState() const 108 State GetState() const
106 { 109 {
107 return state_; 110 return state_;
108 } 111 }
109 }; 112 };
153 void SetContentFilename(const char* filename) 156 void SetContentFilename(const char* filename)
154 { 157 {
155 stateMachine_.SetContentFilename(filename); 158 stateMachine_.SetContentFilename(filename);
156 } 159 }
157 160
158 void SetContentLength(uint64_t length)
159 {
160 stateMachine_.SetContentLength(length);
161 }
162
163 void SetCookie(const std::string& cookie, 161 void SetCookie(const std::string& cookie,
164 const std::string& value) 162 const std::string& value)
165 { 163 {
166 stateMachine_.SetCookie(cookie, value); 164 stateMachine_.SetCookie(cookie, value);
167 } 165 }
175 void SendBody(const void* buffer, 173 void SendBody(const void* buffer,
176 size_t length); 174 size_t length);
177 175
178 void SendBody(const std::string& str); 176 void SendBody(const std::string& str);
179 177
180 void SendBody(); 178 void SendEmptyBody();
181 179
182 void SendMethodNotAllowed(const std::string& allowed); 180 void SendMethodNotAllowed(const std::string& allowed);
183 181
184 void Redirect(const std::string& path); 182 void Redirect(const std::string& path);
185 183
205 203
206 bool IsWritingMultipart() const 204 bool IsWritingMultipart() const
207 { 205 {
208 return stateMachine_.GetState() == StateMachine::State_WritingMultipart; 206 return stateMachine_.GetState() == StateMachine::State_WritingMultipart;
209 } 207 }
208
209 void Answer(IHttpStreamAnswer& stream);
210 }; 210 };
211 } 211 }