comparison Core/Toolbox.cpp @ 402:d2c69150a979

bulk storescu
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Apr 2013 11:50:51 +0200
parents bdd72233b105
children 30086c1aca30
comparison
equal deleted inserted replaced
401:5962898fb7c8 402:d2c69150a979
563 { 563 {
564 throw OrthancException(ErrorCode_InternalError); 564 throw OrthancException(ErrorCode_InternalError);
565 } 565 }
566 } 566 }
567 567
568 bool Toolbox::IsSHA1(const std::string& str)
569 {
570 if (str.size() != 44)
571 {
572 return false;
573 }
574
575 for (unsigned int i = 0; i < 44; i++)
576 {
577 if (i == 8 ||
578 i == 17 ||
579 i == 26 ||
580 i == 35)
581 {
582 if (str[i] != '-')
583 return false;
584 }
585 else
586 {
587 if (!isalnum(str[i]))
588 return false;
589 }
590 }
591
592 return true;
593 }
594
568 std::string Toolbox::GetNowIsoString() 595 std::string Toolbox::GetNowIsoString()
569 { 596 {
570 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 597 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
571 return boost::posix_time::to_iso_string(now); 598 return boost::posix_time::to_iso_string(now);
572 } 599 }