Mercurial > hg > orthanc
comparison Core/HttpServer/HttpContentNegociation.cpp @ 3712:2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 02 Mar 2020 15:32:45 +0100 |
parents | 94f4a18a79cc |
children |
comparison
equal
deleted
inserted
replaced
3709:1f4910999fe7 | 3712:2a170a8f1faf |
---|---|
168 | 168 |
169 return 1.0f; // Default quality | 169 return 1.0f; // Default quality |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 void HttpContentNegociation::SelectBestMatch(std::auto_ptr<Reference>& best, | 173 void HttpContentNegociation::SelectBestMatch(std::unique_ptr<Reference>& best, |
174 const Handler& handler, | 174 const Handler& handler, |
175 const std::string& type, | 175 const std::string& type, |
176 const std::string& subtype, | 176 const std::string& subtype, |
177 float quality) | 177 float quality) |
178 { | 178 { |
179 std::auto_ptr<Reference> match(new Reference(handler, type, subtype, quality)); | 179 std::unique_ptr<Reference> match(new Reference(handler, type, subtype, quality)); |
180 | 180 |
181 if (best.get() == NULL || | 181 if (best.get() == NULL || |
182 *best < *match) | 182 *best < *match) |
183 { | 183 { |
184 best = match; | 184 #if __cplusplus < 201103L |
185 best.reset(match.release()); | |
186 #else | |
187 best = std::move(match); | |
188 #endif | |
185 } | 189 } |
186 } | 190 } |
187 | 191 |
188 | 192 |
189 void HttpContentNegociation::Register(const std::string& mime, | 193 void HttpContentNegociation::Register(const std::string& mime, |
225 // http://www.newmediacampaigns.com/blog/browser-rest-http-accept-headers | 229 // http://www.newmediacampaigns.com/blog/browser-rest-http-accept-headers |
226 | 230 |
227 Tokens mediaRanges; | 231 Tokens mediaRanges; |
228 Toolbox::TokenizeString(mediaRanges, accept, ','); | 232 Toolbox::TokenizeString(mediaRanges, accept, ','); |
229 | 233 |
230 std::auto_ptr<Reference> bestMatch; | 234 std::unique_ptr<Reference> bestMatch; |
231 | 235 |
232 for (Tokens::const_iterator it = mediaRanges.begin(); | 236 for (Tokens::const_iterator it = mediaRanges.begin(); |
233 it != mediaRanges.end(); ++it) | 237 it != mediaRanges.end(); ++it) |
234 { | 238 { |
235 Tokens parameters; | 239 Tokens parameters; |