comparison OrthancServer/Search/IFindConstraint.cpp @ 1792:b769623c806c worklists

safety check
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Nov 2015 11:15:43 +0100
parents 91a5d39ec665
children b1291df2f780
comparison
equal deleted inserted replaced
1791:91a5d39ec665 1792:b769623c806c
31 31
32 32
33 #include "../PrecompiledHeadersServer.h" 33 #include "../PrecompiledHeadersServer.h"
34 #include "IFindConstraint.h" 34 #include "IFindConstraint.h"
35 35
36 #include "../FromDcmtkBridge.h"
37 #include "ListConstraint.h" 36 #include "ListConstraint.h"
38 #include "RangeConstraint.h" 37 #include "RangeConstraint.h"
39 #include "ValueConstraint.h" 38 #include "ValueConstraint.h"
40 #include "WildcardConstraint.h" 39 #include "WildcardConstraint.h"
40
41 #include "../FromDcmtkBridge.h"
42 #include "../../Core/OrthancException.h"
41 43
42 namespace Orthanc 44 namespace Orthanc
43 { 45 {
44 IFindConstraint* IFindConstraint::ParseDicomConstraint(const DicomTag& tag, 46 IFindConstraint* IFindConstraint::ParseDicomConstraint(const DicomTag& tag,
45 const std::string& dicomQuery, 47 const std::string& dicomQuery,
46 bool caseSensitive) 48 bool caseSensitive)
47 { 49 {
48 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag); 50 ValueRepresentation vr = FromDcmtkBridge::GetValueRepresentation(tag);
51
52 if (vr == ValueRepresentation_Sequence)
53 {
54 throw OrthancException(ErrorCode_ParameterOutOfRange);
55 }
49 56
50 if ((vr == ValueRepresentation_Date || 57 if ((vr == ValueRepresentation_Date ||
51 vr == ValueRepresentation_DateTime || 58 vr == ValueRepresentation_DateTime ||
52 vr == ValueRepresentation_Time) && 59 vr == ValueRepresentation_Time) &&
53 dicomQuery.find('-') != std::string::npos) 60 dicomQuery.find('-') != std::string::npos)