Mercurial > hg > orthanc
diff OrthancFramework/Sources/DicomFormat/DicomPath.cpp @ 4690:13efc0967cea
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jun 2021 11:21:22 +0200 |
parents | ead3b81f4541 |
children | e17fdc43ef6c |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomPath.cpp Thu Jun 10 10:54:14 2021 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomPath.cpp Thu Jun 10 11:21:22 2021 +0200 @@ -112,6 +112,12 @@ } + DicomPath::DicomPath(const Orthanc::DicomTag& tag) : + finalTag_(tag) + { + } + + DicomPath::DicomPath(const Orthanc::DicomTag& sequence, size_t index, const Orthanc::DicomTag& tag) : @@ -149,7 +155,7 @@ DicomPath::DicomPath(const std::vector<Orthanc::DicomTag>& parentTags, - const std::vector<size_t> parentIndexes, + const std::vector<size_t>& parentIndexes, const Orthanc::DicomTag& finalTag) : finalTag_(finalTag) { @@ -182,6 +188,36 @@ } + size_t DicomPath::GetPrefixLength() const + { + return prefix_.size(); + } + + + const Orthanc::DicomTag& DicomPath::GetFinalTag() const + { + return finalTag_; + } + + + const Orthanc::DicomTag& DicomPath::GetPrefixTag(size_t level) const + { + return GetLevel(level).GetTag(); + } + + + bool DicomPath::IsPrefixUniversal(size_t level) const + { + return GetLevel(level).IsUniversal(); + } + + + size_t DicomPath::GetPrefixIndex(size_t level) const + { + return GetLevel(level).GetIndex(); + } + + bool DicomPath::HasUniversal() const { for (size_t i = 0; i < prefix_.size(); i++) @@ -273,17 +309,17 @@ try { - std::string s = Toolbox::StripSpaces(right.substr(0, right.size() - 1)); - if (s == "*") + std::string t = Toolbox::StripSpaces(right.substr(0, right.size() - 1)); + if (t == "*") { path.AddUniversalTagToPrefix(tag); } else { - int index = boost::lexical_cast<int>(s); + int index = boost::lexical_cast<int>(t); if (index < 0) { - throw OrthancException(ErrorCode_ParameterOutOfRange, "Negative index in parent path: " + s); + throw OrthancException(ErrorCode_ParameterOutOfRange, "Negative index in parent path: " + t); } else {