comparison Core/Uuid.h @ 2140:aa4b8895cd23

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 16:12:47 +0100
parents b1291df2f780
children a260a8ad83f1
comparison
equal deleted inserted replaced
2139:764c9157301b 2140:aa4b8895cd23
41 * value. In Microsoft-speak they are called GUIDs, but call them 41 * value. In Microsoft-speak they are called GUIDs, but call them
42 * UUIDs when not using Microsoft-speak. 42 * UUIDs when not using Microsoft-speak.
43 * http://stackoverflow.com/questions/246930/is-there-any-difference-between-a-guid-and-a-uuid 43 * http://stackoverflow.com/questions/246930/is-there-any-difference-between-a-guid-and-a-uuid
44 **/ 44 **/
45 45
46 #if !defined(ORTHANC_SANDBOXED)
47 # define ORTHANC_SANDBOXED 0
48 #endif
49
46 #include "Toolbox.h" 50 #include "Toolbox.h"
47 51
48 namespace Orthanc 52 namespace Orthanc
49 { 53 {
50 namespace Toolbox 54 namespace Toolbox
52 std::string GenerateUuid(); 56 std::string GenerateUuid();
53 57
54 bool IsUuid(const std::string& str); 58 bool IsUuid(const std::string& str);
55 59
56 bool StartsWithUuid(const std::string& str); 60 bool StartsWithUuid(const std::string& str);
61 }
57 62
58 class TemporaryFile 63 #if ORTHANC_SANDBOXED == 0
64 class TemporaryFile
65 {
66 private:
67 std::string path_;
68
69 public:
70 TemporaryFile();
71
72 TemporaryFile(const char* extension);
73
74 ~TemporaryFile();
75
76 const std::string& GetPath() const
59 { 77 {
60 private: 78 return path_;
61 std::string path_; 79 }
62 80
63 public: 81 void Write(const std::string& content)
64 TemporaryFile(); 82 {
83 SystemToolbox::WriteFile(content, path_);
84 }
65 85
66 TemporaryFile(const char* extension); 86 void Read(std::string& content) const
67 87 {
68 ~TemporaryFile(); 88 SystemToolbox::ReadFile(content, path_);
69 89 }
70 const std::string& GetPath() const 90 };
71 { 91 #endif
72 return path_;
73 }
74
75 void Write(const std::string& content)
76 {
77 Toolbox::WriteFile(content, path_);
78 }
79
80 void Read(std::string& content) const
81 {
82 Toolbox::ReadFile(content, path_);
83 }
84 };
85 }
86 } 92 }