Mercurial > hg > orthanc
comparison Core/RestApi/RestApiHierarchy.cpp @ 1303:bba8a47922d1
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Feb 2015 16:47:24 +0100 |
parents | 6e7e5ed91c2d |
children | f3672356c121 |
comparison
equal
deleted
inserted
replaced
1302:5fe254fb1c93 | 1303:bba8a47922d1 |
---|---|
157 | 157 |
158 | 158 |
159 void RestApiHierarchy::DeleteChildren(Children& children) | 159 void RestApiHierarchy::DeleteChildren(Children& children) |
160 { | 160 { |
161 for (Children::iterator it = children.begin(); | 161 for (Children::iterator it = children.begin(); |
162 it != children.end(); it++) | 162 it != children.end(); ++it) |
163 { | 163 { |
164 delete it->second; | 164 delete it->second; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 // Try and go down in the hierarchy, using wildcard rules for children | 239 // Try and go down in the hierarchy, using wildcard rules for children |
240 for (child = wildcardChildren_.begin(); | 240 for (child = wildcardChildren_.begin(); |
241 child != wildcardChildren_.end(); child++) | 241 child != wildcardChildren_.end(); ++child) |
242 { | 242 { |
243 HttpHandler::Arguments subComponents = components; | 243 HttpHandler::Arguments subComponents = components; |
244 subComponents[child->first] = uri[level]; | 244 subComponents[child->first] = uri[level]; |
245 | 245 |
246 if (child->second->LookupResource(subComponents, uri, visitor, level + 1)) | 246 if (child->second->LookupResource(subComponents, uri, visitor, level + 1)) |
274 | 274 |
275 | 275 |
276 bool RestApiHierarchy::CanGenerateDirectory() const | 276 bool RestApiHierarchy::CanGenerateDirectory() const |
277 { | 277 { |
278 return (universalHandlers_.IsEmpty() && | 278 return (universalHandlers_.IsEmpty() && |
279 wildcardChildren_.size() == 0); | 279 wildcardChildren_.empty()); |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 bool RestApiHierarchy::GetDirectory(Json::Value& result, | 283 bool RestApiHierarchy::GetDirectory(Json::Value& result, |
284 const UriComponents& uri, | 284 const UriComponents& uri, |
289 if (CanGenerateDirectory()) | 289 if (CanGenerateDirectory()) |
290 { | 290 { |
291 result = Json::arrayValue; | 291 result = Json::arrayValue; |
292 | 292 |
293 for (Children::const_iterator it = children_.begin(); | 293 for (Children::const_iterator it = children_.begin(); |
294 it != children_.end(); it++) | 294 it != children_.end(); ++it) |
295 { | 295 { |
296 result.append(it->first); | 296 result.append(it->first); |
297 } | 297 } |
298 | 298 |
299 return true; | 299 return true; |
312 return true; | 312 return true; |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 for (child = wildcardChildren_.begin(); | 316 for (child = wildcardChildren_.begin(); |
317 child != wildcardChildren_.end(); child++) | 317 child != wildcardChildren_.end(); ++child) |
318 { | 318 { |
319 if (child->second->GetDirectory(result, uri, level + 1)) | 319 if (child->second->GetDirectory(result, uri, level + 1)) |
320 { | 320 { |
321 return true; | 321 return true; |
322 } | 322 } |
386 } | 386 } |
387 | 387 |
388 target = s;*/ | 388 target = s;*/ |
389 | 389 |
390 for (Children::const_iterator it = children_.begin(); | 390 for (Children::const_iterator it = children_.begin(); |
391 it != children_.end(); it++) | 391 it != children_.end(); ++it) |
392 { | 392 { |
393 it->second->CreateSiteMap(target[it->first]); | 393 it->second->CreateSiteMap(target[it->first]); |
394 } | 394 } |
395 | 395 |
396 for (Children::const_iterator it = wildcardChildren_.begin(); | 396 for (Children::const_iterator it = wildcardChildren_.begin(); |
397 it != wildcardChildren_.end(); it++) | 397 it != wildcardChildren_.end(); ++it) |
398 { | 398 { |
399 it->second->CreateSiteMap(target["<" + it->first + ">"]); | 399 it->second->CreateSiteMap(target["<" + it->first + ">"]); |
400 } | 400 } |
401 } | 401 } |
402 | 402 |