comparison Core/Toolbox.cpp @ 971:509e146c3cb3 plugins

integration mainline->plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Jun 2014 13:36:01 +0200
parents 743a75b14bef 886652370ff2
children 0bfeeb6d340f
comparison
equal deleted inserted replaced
955:743a75b14bef 971:509e146c3cb3
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 286
287 void Toolbox::TruncateUri(UriComponents& target,
288 const UriComponents& source,
289 size_t fromLevel)
290 {
291 target.clear();
292
293 if (source.size() > fromLevel)
294 {
295 target.resize(source.size() - fromLevel);
296
297 size_t j = 0;
298 for (size_t i = fromLevel; i < source.size(); i++, j++)
299 {
300 target[j] = source[i];
301 }
302
303 assert(j == target.size());
304 }
305 }
306
307
308
287 bool Toolbox::IsChildUri(const UriComponents& baseUri, 309 bool Toolbox::IsChildUri(const UriComponents& baseUri,
288 const UriComponents& testedUri) 310 const UriComponents& testedUri)
289 { 311 {
290 if (testedUri.size() < baseUri.size()) 312 if (testedUri.size() < baseUri.size())
291 { 313 {
503 { 525 {
504 case Encoding_Utf8: 526 case Encoding_Utf8:
505 // Already in UTF-8: No conversion is required 527 // Already in UTF-8: No conversion is required
506 return source; 528 return source;
507 529
530 case Encoding_Ascii:
531 return ConvertToAscii(source);;
532
508 case Encoding_Latin1: 533 case Encoding_Latin1:
509 encoding = "ISO-8859-1"; 534 encoding = "ISO-8859-1";
510 break; 535 break;
511 536
512 default: 537 default:
513 throw OrthancException(ErrorCode_ParameterOutOfRange); 538 throw OrthancException(ErrorCode_NotImplemented);
514 } 539 }
515 540
516 try 541 try
517 { 542 {
518 return boost::locale::conv::to_utf<char>(source, encoding); 543 return boost::locale::conv::to_utf<char>(source, encoding);