Mercurial > hg > orthanc
comparison Core/Images/IImageWriter.h @ 2170:baf8dd89b4e0
improved support for sandboxed environments
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Nov 2016 11:45:02 +0100 |
parents | bfeacb51af20 |
children | a3a65de1840f |
comparison
equal
deleted
inserted
replaced
2169:d15de5685ad8 | 2170:baf8dd89b4e0 |
---|---|
34 | 34 |
35 #include "ImageAccessor.h" | 35 #include "ImageAccessor.h" |
36 | 36 |
37 #include <boost/noncopyable.hpp> | 37 #include <boost/noncopyable.hpp> |
38 | 38 |
39 #if !defined(ORTHANC_SANDBOXED) | |
40 # error The macro ORTHANC_SANDBOXED must be defined | |
41 #endif | |
42 | |
39 namespace Orthanc | 43 namespace Orthanc |
40 { | 44 { |
41 class IImageWriter : public boost::noncopyable | 45 class IImageWriter : public boost::noncopyable |
42 { | 46 { |
43 protected: | 47 protected: |
46 unsigned int height, | 50 unsigned int height, |
47 unsigned int pitch, | 51 unsigned int pitch, |
48 PixelFormat format, | 52 PixelFormat format, |
49 const void* buffer) = 0; | 53 const void* buffer) = 0; |
50 | 54 |
55 #if ORTHANC_SANDBOXED == 0 | |
51 virtual void WriteToFileInternal(const std::string& path, | 56 virtual void WriteToFileInternal(const std::string& path, |
52 unsigned int width, | 57 unsigned int width, |
53 unsigned int height, | 58 unsigned int height, |
54 unsigned int pitch, | 59 unsigned int pitch, |
55 PixelFormat format, | 60 PixelFormat format, |
56 const void* buffer); | 61 const void* buffer); |
62 #endif | |
57 | 63 |
58 public: | 64 public: |
59 virtual ~IImageWriter() | 65 virtual ~IImageWriter() |
60 { | 66 { |
61 } | 67 } |
65 { | 71 { |
66 WriteToMemoryInternal(compressed, accessor.GetWidth(), accessor.GetHeight(), | 72 WriteToMemoryInternal(compressed, accessor.GetWidth(), accessor.GetHeight(), |
67 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); | 73 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); |
68 } | 74 } |
69 | 75 |
76 #if ORTHANC_SANDBOXED == 0 | |
70 virtual void WriteToFile(const std::string& path, | 77 virtual void WriteToFile(const std::string& path, |
71 const ImageAccessor& accessor) | 78 const ImageAccessor& accessor) |
72 { | 79 { |
73 WriteToFileInternal(path, accessor.GetWidth(), accessor.GetHeight(), | 80 WriteToFileInternal(path, accessor.GetWidth(), accessor.GetHeight(), |
74 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); | 81 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); |
75 } | 82 } |
83 #endif | |
76 }; | 84 }; |
77 } | 85 } |