Mercurial > hg > orthanc
annotate OrthancFramework/Sources/FileStorage/FileInfo.cpp @ 4519:a3c6678aa7b1
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Feb 2021 16:51:23 +0100 |
parents | 3b4940bca158 |
children | 7053502fbf97 |
rev | line source |
---|---|
4500
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * License along with this program. If not, see |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "../PrecompiledHeaders.h" |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "FileInfo.h" |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include "../OrthancException.h" |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 namespace Orthanc |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 { |
4519 | 30 FileInfo::FileInfo() : |
31 valid_(false), | |
32 contentType_(FileContentType_Unknown), | |
33 uncompressedSize_(0), | |
34 compressionType_(CompressionType_None), | |
35 compressedSize_(0) | |
36 { | |
37 } | |
38 | |
39 | |
4500
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 FileInfo::FileInfo(const std::string& uuid, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 FileContentType contentType, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 uint64_t size, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 const std::string& md5) : |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 valid_(true), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 uuid_(uuid), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 contentType_(contentType), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 uncompressedSize_(size), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 uncompressedMD5_(md5), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 compressionType_(CompressionType_None), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 compressedSize_(size), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 compressedMD5_(md5) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 FileInfo::FileInfo(const std::string& uuid, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 FileContentType contentType, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 uint64_t uncompressedSize, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 const std::string& uncompressedMD5, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 CompressionType compressionType, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 uint64_t compressedSize, |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 const std::string& compressedMD5) : |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 valid_(true), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 uuid_(uuid), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 contentType_(contentType), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 uncompressedSize_(uncompressedSize), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 uncompressedMD5_(uncompressedMD5), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 compressionType_(compressionType), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 compressedSize_(compressedSize), |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 compressedMD5_(compressedMD5) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 bool FileInfo::IsValid() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 return valid_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 const std::string& FileInfo::GetUuid() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 return uuid_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 FileContentType FileInfo::GetContentType() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 return contentType_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 uint64_t FileInfo::GetUncompressedSize() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 return uncompressedSize_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 CompressionType FileInfo::GetCompressionType() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 return compressionType_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 uint64_t FileInfo::GetCompressedSize() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 return compressedSize_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 const std::string& FileInfo::GetCompressedMD5() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 return compressedMD5_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 const std::string& FileInfo::GetUncompressedMD5() const |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 if (valid_) |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 return uncompressedMD5_; |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
164 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
165 else |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 { |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
167 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
168 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
169 } |
3b4940bca158
added safeguards in Orthanc::FileInfo
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 } |