Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/FindResponse.h @ 5594:a906dc19264c find-refactoring
created FindResponse::Resource::Format()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 04 May 2024 15:25:19 +0200 |
parents | 1e2631b8b9af |
children | a87f2a56257d |
comparison
equal
deleted
inserted
replaced
5593:862b54b4cfe2 | 5594:a906dc19264c |
---|---|
75 std::map<MetadataType, std::string> metadata_; | 75 std::map<MetadataType, std::string> metadata_; |
76 std::map<FileContentType, FileInfo> attachments_; | 76 std::map<FileContentType, FileInfo> attachments_; |
77 | 77 |
78 ChildrenAtLevel& GetChildrenAtLevel(ResourceType level); | 78 ChildrenAtLevel& GetChildrenAtLevel(ResourceType level); |
79 | 79 |
80 const ChildrenAtLevel& GetChildrenAtLevel(ResourceType level) const | |
81 { | |
82 return const_cast<Resource&>(*this).GetChildrenAtLevel(level); | |
83 } | |
84 | |
80 public: | 85 public: |
81 Resource(ResourceType level, | 86 Resource(ResourceType level, |
82 const std::string& identifier) : | 87 const std::string& identifier) : |
83 level_(level), | 88 level_(level), |
84 identifier_(identifier) | 89 identifier_(identifier) |
125 return const_cast<Resource&>(*this).GetChildrenAtLevel(level).GetIdentifiers(); | 130 return const_cast<Resource&>(*this).GetChildrenAtLevel(level).GetIdentifiers(); |
126 } | 131 } |
127 | 132 |
128 void AddLabel(const std::string& label); | 133 void AddLabel(const std::string& label); |
129 | 134 |
135 std::set<std::string>& GetLabels() | |
136 { | |
137 return labels_; | |
138 } | |
139 | |
130 const std::set<std::string>& GetLabels() const | 140 const std::set<std::string>& GetLabels() const |
131 { | 141 { |
132 return labels_; | 142 return labels_; |
133 } | 143 } |
134 | 144 |
135 void AddMetadata(MetadataType metadata, | 145 void AddMetadata(MetadataType metadata, |
136 const std::string& value); | 146 const std::string& value); |
137 | 147 |
148 std::map<MetadataType, std::string>& GetMetadata() | |
149 { | |
150 return metadata_; | |
151 } | |
152 | |
138 const std::map<MetadataType, std::string>& GetMetadata() const | 153 const std::map<MetadataType, std::string>& GetMetadata() const |
139 { | 154 { |
140 return metadata_; | 155 return metadata_; |
141 } | 156 } |
142 | 157 |
152 | 167 |
153 void AddAttachment(const FileInfo& attachment); | 168 void AddAttachment(const FileInfo& attachment); |
154 | 169 |
155 bool LookupAttachment(FileInfo& target, | 170 bool LookupAttachment(FileInfo& target, |
156 FileContentType type) const; | 171 FileContentType type) const; |
172 | |
173 void Format(Json::Value& target, | |
174 const FindRequest& request) const; | |
157 }; | 175 }; |
158 | 176 |
159 private: | 177 private: |
160 typedef std::map<std::string, Resource*> Index; | 178 typedef std::map<std::string, Resource*> Index; |
161 | 179 |