comparison Core/FileStorage/StorageAccessor.cpp @ 2394:75c779ca948c

fix compilation without Web server
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Aug 2017 16:23:10 +0200
parents a3a65de1840f
children 878b59270859
comparison
equal deleted inserted replaced
2393:807ddffc0eeb 2394:75c779ca948c
34 #include "../PrecompiledHeaders.h" 34 #include "../PrecompiledHeaders.h"
35 #include "StorageAccessor.h" 35 #include "StorageAccessor.h"
36 36
37 #include "../Compression/ZlibCompressor.h" 37 #include "../Compression/ZlibCompressor.h"
38 #include "../OrthancException.h" 38 #include "../OrthancException.h"
39 #include "../HttpServer/HttpStreamTranscoder.h"
40 #include "../Toolbox.h" 39 #include "../Toolbox.h"
41 #include "../SystemToolbox.h" 40 #include "../SystemToolbox.h"
41
42 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
43 # include "../HttpServer/HttpStreamTranscoder.h"
44 #endif
42 45
43 namespace Orthanc 46 namespace Orthanc
44 { 47 {
45 FileInfo StorageAccessor::Write(const void* data, 48 FileInfo StorageAccessor::Write(const void* data,
46 size_t size, 49 size_t size,
141 throw OrthancException(ErrorCode_BadFileFormat); 144 throw OrthancException(ErrorCode_BadFileFormat);
142 } 145 }
143 } 146 }
144 147
145 148
149 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
146 void StorageAccessor::SetupSender(BufferHttpSender& sender, 150 void StorageAccessor::SetupSender(BufferHttpSender& sender,
147 const FileInfo& info, 151 const FileInfo& info,
148 const std::string& mime) 152 const std::string& mime)
149 { 153 {
150 area_.Read(sender.GetBuffer(), info.GetUuid(), info.GetContentType()); 154 area_.Read(sender.GetBuffer(), info.GetUuid(), info.GetContentType());
166 extension = ""; 170 extension = "";
167 } 171 }
168 172
169 sender.SetContentFilename(info.GetUuid() + std::string(extension)); 173 sender.SetContentFilename(info.GetUuid() + std::string(extension));
170 } 174 }
171 175 #endif
172 176
177
178 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
173 void StorageAccessor::AnswerFile(HttpOutput& output, 179 void StorageAccessor::AnswerFile(HttpOutput& output,
174 const FileInfo& info, 180 const FileInfo& info,
175 const std::string& mime) 181 const std::string& mime)
176 { 182 {
177 BufferHttpSender sender; 183 BufferHttpSender sender;
178 SetupSender(sender, info, mime); 184 SetupSender(sender, info, mime);
179 185
180 HttpStreamTranscoder transcoder(sender, info.GetCompressionType()); 186 HttpStreamTranscoder transcoder(sender, info.GetCompressionType());
181 output.Answer(transcoder); 187 output.Answer(transcoder);
182 } 188 }
183 189 #endif
184 190
191
192 #if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
185 void StorageAccessor::AnswerFile(RestApiOutput& output, 193 void StorageAccessor::AnswerFile(RestApiOutput& output,
186 const FileInfo& info, 194 const FileInfo& info,
187 const std::string& mime) 195 const std::string& mime)
188 { 196 {
189 BufferHttpSender sender; 197 BufferHttpSender sender;
190 SetupSender(sender, info, mime); 198 SetupSender(sender, info, mime);
191 199
192 HttpStreamTranscoder transcoder(sender, info.GetCompressionType()); 200 HttpStreamTranscoder transcoder(sender, info.GetCompressionType());
193 output.AnswerStream(transcoder); 201 output.AnswerStream(transcoder);
194 } 202 }
203 #endif
195 } 204 }